Loading drivers/mtd/devices/pmc551.c +596 −567 Original line number Diff line number Diff line Loading @@ -115,7 +115,8 @@ static int pmc551_erase (struct mtd_info *mtd, struct erase_info *instr) size_t retlen; #ifdef CONFIG_MTD_PMC551_DEBUG printk(KERN_DEBUG "pmc551_erase(pos:%ld, len:%ld)\n", (long)instr->addr, (long)instr->len); printk(KERN_DEBUG "pmc551_erase(pos:%ld, len:%ld)\n", (long)instr->addr, (long)instr->len); #endif end = instr->addr + instr->len - 1; Loading @@ -123,7 +124,8 @@ static int pmc551_erase (struct mtd_info *mtd, struct erase_info *instr) /* Is it past the end? */ if (end > mtd->size) { #ifdef CONFIG_MTD_PMC551_DEBUG printk(KERN_DEBUG "pmc551_erase() out of bounds (%ld > %ld)\n", (long)end, (long)mtd->size); printk(KERN_DEBUG "pmc551_erase() out of bounds (%ld > %ld)\n", (long)end, (long)mtd->size); #endif return -EINVAL; } Loading @@ -144,7 +146,8 @@ static int pmc551_erase (struct mtd_info *mtd, struct erase_info *instr) written. */ while (soff_hi != eoff_hi) { #ifdef CONFIG_MTD_PMC551_DEBUG printk( KERN_DEBUG "pmc551_erase() soff_hi: %ld, eoff_hi: %ld\n", (long)soff_hi, (long)eoff_hi); printk(KERN_DEBUG "pmc551_erase() soff_hi: %ld, " "eoff_hi: %ld\n", (long)soff_hi, (long)eoff_hi); #endif memset(ptr, 0xff, priv->asize); if (soff_hi + priv->asize >= mtd->size) { Loading @@ -167,8 +170,8 @@ static int pmc551_erase (struct mtd_info *mtd, struct erase_info *instr) return 0; } static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf) static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, size_t * retlen, u_char ** mtdbuf) { struct mypriv *priv = mtd->priv; u32 soff_hi; Loading @@ -180,7 +183,8 @@ static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t len, size_t * if (from + len > mtd->size) { #ifdef CONFIG_MTD_PMC551_DEBUG printk(KERN_DEBUG "pmc551_point() out of bounds (%ld > %ld)\n", (long)from+len, (long)mtd->size); printk(KERN_DEBUG "pmc551_point() out of bounds (%ld > %ld)\n", (long)from + len, (long)mtd->size); #endif return -EINVAL; } Loading @@ -200,16 +204,16 @@ static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t len, size_t * return 0; } static void pmc551_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, size_t len) static void pmc551_unpoint(struct mtd_info *mtd, u_char * addr, loff_t from, size_t len) { #ifdef CONFIG_MTD_PMC551_DEBUG printk(KERN_DEBUG "pmc551_unpoint()\n"); #endif } static int pmc551_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) static int pmc551_read(struct mtd_info *mtd, loff_t from, size_t len, size_t * retlen, u_char * buf) { struct mypriv *priv = mtd->priv; u32 soff_hi, soff_lo; /* start address offset hi/lo */ Loading @@ -219,7 +223,8 @@ static int pmc551_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *r u_char *copyto = buf; #ifdef CONFIG_MTD_PMC551_DEBUG printk(KERN_DEBUG "pmc551_read(pos:%ld, len:%ld) asize: %ld\n", (long)from, (long)len, (long)priv->asize); printk(KERN_DEBUG "pmc551_read(pos:%ld, len:%ld) asize: %ld\n", (long)from, (long)len, (long)priv->asize); #endif end = from + len - 1; Loading @@ -227,7 +232,8 @@ static int pmc551_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *r /* Is it past the end? */ if (end > mtd->size) { #ifdef CONFIG_MTD_PMC551_DEBUG printk(KERN_DEBUG "pmc551_read() out of bounds (%ld > %ld)\n", (long) end, (long)mtd->size); printk(KERN_DEBUG "pmc551_read() out of bounds (%ld > %ld)\n", (long)end, (long)mtd->size); #endif return -EINVAL; } Loading @@ -249,7 +255,8 @@ static int pmc551_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *r written. */ while (soff_hi != eoff_hi) { #ifdef CONFIG_MTD_PMC551_DEBUG printk( KERN_DEBUG "pmc551_read() soff_hi: %ld, eoff_hi: %ld\n", (long)soff_hi, (long)eoff_hi); printk(KERN_DEBUG "pmc551_read() soff_hi: %ld, " "eoff_hi: %ld\n", (long)soff_hi, (long)eoff_hi); #endif memcpy(copyto, ptr, priv->asize); copyto += priv->asize; Loading @@ -271,7 +278,8 @@ static int pmc551_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *r return 0; } static int pmc551_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf) static int pmc551_write(struct mtd_info *mtd, loff_t to, size_t len, size_t * retlen, const u_char * buf) { struct mypriv *priv = mtd->priv; u32 soff_hi, soff_lo; /* start address offset hi/lo */ Loading @@ -280,16 +288,18 @@ static int pmc551_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *re u_char *ptr; const u_char *copyfrom = buf; #ifdef CONFIG_MTD_PMC551_DEBUG printk(KERN_DEBUG "pmc551_write(pos:%ld, len:%ld) asize:%ld\n", (long)to, (long)len, (long)priv->asize); printk(KERN_DEBUG "pmc551_write(pos:%ld, len:%ld) asize:%ld\n", (long)to, (long)len, (long)priv->asize); #endif end = to + len - 1; /* Is it past the end? or did the u32 wrap? */ if (end > mtd->size) { #ifdef CONFIG_MTD_PMC551_DEBUG printk(KERN_DEBUG "pmc551_write() out of bounds (end: %ld, size: %ld, to: %ld)\n", (long) end, (long)mtd->size, (long)to); printk(KERN_DEBUG "pmc551_write() out of bounds (end: %ld, " "size: %ld, to: %ld)\n", (long)end, (long)mtd->size, (long)to); #endif return -EINVAL; } Loading @@ -311,7 +321,8 @@ static int pmc551_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *re written. */ while (soff_hi != eoff_hi) { #ifdef CONFIG_MTD_PMC551_DEBUG printk( KERN_DEBUG "pmc551_write() soff_hi: %ld, eoff_hi: %ld\n", (long)soff_hi, (long)eoff_hi); printk(KERN_DEBUG "pmc551_write() soff_hi: %ld, " "eoff_hi: %ld\n", (long)soff_hi, (long)eoff_hi); #endif memcpy(ptr, copyfrom, priv->asize); copyfrom += priv->asize; Loading Loading @@ -469,8 +480,10 @@ static u32 fixup_pmc551 (struct pci_dev *dev) * Wait until command has gone through * FIXME: register spinning issue */ do { pci_read_config_word( dev, PMC551_SDRAM_CMD, &cmd ); if(counter++ > 100)break; do { pci_read_config_word(dev, PMC551_SDRAM_CMD, &cmd); if (counter++ > 100) break; } while ((PCI_COMMAND_IO) & cmd); /* Loading @@ -487,8 +500,10 @@ static u32 fixup_pmc551 (struct pci_dev *dev) * FIXME: register spinning issue */ counter = 0; do { pci_read_config_word(dev, PMC551_SDRAM_CMD, &cmd); if(counter++ > 100)break; do { pci_read_config_word(dev, PMC551_SDRAM_CMD, &cmd); if (counter++ > 100) break; } while ((PCI_COMMAND_IO) & cmd); } Loading @@ -500,8 +515,10 @@ static u32 fixup_pmc551 (struct pci_dev *dev) * FIXME: register spinning issue */ counter = 0; do { pci_read_config_word ( dev, PMC551_SDRAM_CMD, &cmd); if(counter++ > 100)break; do { pci_read_config_word(dev, PMC551_SDRAM_CMD, &cmd); if (counter++ > 100) break; } while ((PCI_COMMAND_IO) & cmd); pci_read_config_dword(dev, PMC551_DRAM_CFG, &dcmd); Loading Loading @@ -546,11 +563,13 @@ static u32 fixup_pmc551 (struct pci_dev *dev) /* * Some screen fun */ printk(KERN_DEBUG "pmc551: %d%c (0x%x) of %sprefetchable memory at 0x%llx\n", (size<1024)?size:(size<1048576)?size>>10:size>>20, (size<1024)?'B':(size<1048576)?'K':'M', size, ((dcmd&(0x1<<3)) == 0)?"non-":"", (unsigned long long)((dev->resource[0].start)&PCI_BASE_ADDRESS_MEM_MASK)); printk(KERN_DEBUG "pmc551: %d%c (0x%x) of %sprefetchable memory at " "0x%llx\n", (size < 1024) ? size : (size < 1048576) ? size >> 10 : size >> 20, (size < 1024) ? 'B' : (size < 1048576) ? 'K' : 'M', size, ((dcmd & (0x1 << 3)) == 0) ? "non-" : "", (unsigned long long)((dev->resource[0].start) & PCI_BASE_ADDRESS_MEM_MASK)); /* * Check to see the state of the memory Loading @@ -562,7 +581,8 @@ static u32 fixup_pmc551 (struct pci_dev *dev) (((0x1 << 1) & dcmd) == 0) ? "RW" : "RO", (((0x1 << 0) & dcmd) == 0) ? "Off" : "On", PMC551_DRAM_BLK_GET_SIZE(dcmd), ((dcmd>>20)&0x7FF), ((dcmd>>13)&0x7), ((dcmd>>9)&0xF) ); ((dcmd >> 20) & 0x7FF), ((dcmd >> 13) & 0x7), ((dcmd >> 9) & 0xF)); pci_read_config_dword(dev, PMC551_DRAM_BLK1, &dcmd); printk(KERN_DEBUG "pmc551: DRAM_BLK1 Flags: %s,%s\n" Loading @@ -571,7 +591,8 @@ static u32 fixup_pmc551 (struct pci_dev *dev) (((0x1 << 1) & dcmd) == 0) ? "RW" : "RO", (((0x1 << 0) & dcmd) == 0) ? "Off" : "On", PMC551_DRAM_BLK_GET_SIZE(dcmd), ((dcmd>>20)&0x7FF), ((dcmd>>13)&0x7), ((dcmd>>9)&0xF) ); ((dcmd >> 20) & 0x7FF), ((dcmd >> 13) & 0x7), ((dcmd >> 9) & 0xF)); pci_read_config_dword(dev, PMC551_DRAM_BLK2, &dcmd); printk(KERN_DEBUG "pmc551: DRAM_BLK2 Flags: %s,%s\n" Loading @@ -580,7 +601,8 @@ static u32 fixup_pmc551 (struct pci_dev *dev) (((0x1 << 1) & dcmd) == 0) ? "RW" : "RO", (((0x1 << 0) & dcmd) == 0) ? "Off" : "On", PMC551_DRAM_BLK_GET_SIZE(dcmd), ((dcmd>>20)&0x7FF), ((dcmd>>13)&0x7), ((dcmd>>9)&0xF) ); ((dcmd >> 20) & 0x7FF), ((dcmd >> 13) & 0x7), ((dcmd >> 9) & 0xF)); pci_read_config_dword(dev, PMC551_DRAM_BLK3, &dcmd); printk(KERN_DEBUG "pmc551: DRAM_BLK3 Flags: %s,%s\n" Loading @@ -589,7 +611,8 @@ static u32 fixup_pmc551 (struct pci_dev *dev) (((0x1 << 1) & dcmd) == 0) ? "RW" : "RO", (((0x1 << 0) & dcmd) == 0) ? "Off" : "On", PMC551_DRAM_BLK_GET_SIZE(dcmd), ((dcmd>>20)&0x7FF), ((dcmd>>13)&0x7), ((dcmd>>9)&0xF) ); ((dcmd >> 20) & 0x7FF), ((dcmd >> 13) & 0x7), ((dcmd >> 9) & 0xF)); pci_read_config_word(dev, PCI_COMMAND, &cmd); printk(KERN_DEBUG "pmc551: Memory Access %s\n", Loading Loading @@ -620,7 +643,6 @@ static u32 fixup_pmc551 (struct pci_dev *dev) * Kernel version specific module stuffages */ MODULE_LICENSE("GPL"); MODULE_AUTHOR("Mark Ferrell <mferrell@mvista.com>"); MODULE_DESCRIPTION(PMC551_VERSION); Loading Loading @@ -654,7 +676,8 @@ static int __init init_pmc551(void) if (msize) { msize = (1 << (ffs(msize) - 1)) << 20; if (msize > (1 << 30)) { printk(KERN_NOTICE "pmc551: Invalid memory size [%d]\n", msize); printk(KERN_NOTICE "pmc551: Invalid memory size [%d]\n", msize); return -EINVAL; } } Loading @@ -662,7 +685,8 @@ static int __init init_pmc551(void) if (asize) { asize = (1 << (ffs(asize) - 1)) << 20; if (asize > (1 << 30)) { printk(KERN_NOTICE "pmc551: Invalid aperture size [%d]\n", asize); printk(KERN_NOTICE "pmc551: Invalid aperture size " "[%d]\n", asize); return -EINVAL; } } Loading Loading @@ -702,14 +726,16 @@ static int __init init_pmc551(void) */ if (msize) { length = msize; printk(KERN_NOTICE "pmc551: Using specified memory size 0x%x\n", length); printk(KERN_NOTICE "pmc551: Using specified memory " "size 0x%x\n", length); } else { msize = length; } mtd = kmalloc(sizeof(struct mtd_info), GFP_KERNEL); if (!mtd) { printk(KERN_NOTICE "pmc551: Cannot allocate new MTD device.\n"); printk(KERN_NOTICE "pmc551: Cannot allocate new MTD " "device.\n"); break; } Loading @@ -717,7 +743,8 @@ static int __init init_pmc551(void) priv = kmalloc(sizeof(struct mypriv), GFP_KERNEL); if (!priv) { printk(KERN_NOTICE "pmc551: Cannot allocate new MTD device.\n"); printk(KERN_NOTICE "pmc551: Cannot allocate new MTD " "device.\n"); kfree(mtd); break; } Loading @@ -726,13 +753,16 @@ static int __init init_pmc551(void) priv->dev = PCI_Device; if (asize > length) { printk(KERN_NOTICE "pmc551: reducing aperture size to fit %dM\n",length>>20); printk(KERN_NOTICE "pmc551: reducing aperture size to " "fit %dM\n", length >> 20); priv->asize = asize = length; } else if (asize == 0 || asize == length) { printk(KERN_NOTICE "pmc551: Using existing aperture size %dM\n", length>>20); printk(KERN_NOTICE "pmc551: Using existing aperture " "size %dM\n", length >> 20); priv->asize = asize = length; } else { printk(KERN_NOTICE "pmc551: Using specified aperture size %dM\n", asize>>20); printk(KERN_NOTICE "pmc551: Using specified aperture " "size %dM\n", asize >> 20); priv->asize = asize; } priv->start = ioremap(((PCI_Device->resource[0].start) Loading @@ -745,7 +775,6 @@ static int __init init_pmc551(void) kfree(mtd); break; } #ifdef CONFIG_MTD_PMC551_DEBUG printk(KERN_DEBUG "pmc551: setting aperture to %d\n", ffs(priv->asize >> 20) - 1); Loading Loading @@ -777,7 +806,8 @@ static int __init init_pmc551(void) mtd->owner = THIS_MODULE; if (add_mtd_device(mtd)) { printk(KERN_NOTICE "pmc551: Failed to register new device\n"); printk(KERN_NOTICE "pmc551: Failed to register new " "device\n"); iounmap(priv->start); kfree(mtd->priv); kfree(mtd); Loading @@ -790,8 +820,7 @@ static int __init init_pmc551(void) printk(KERN_NOTICE "Registered pmc551 memory device.\n"); printk(KERN_NOTICE "Mapped %dM of memory from 0x%p to 0x%p\n", priv->asize >> 20, priv->start, priv->start + priv->asize); priv->start, priv->start + priv->asize); printk(KERN_NOTICE "Total memory is %d%c\n", (length < 1024) ? length : (length < 1048576) ? length >> 10 : length >> 20, Loading Loading @@ -828,8 +857,8 @@ static void __exit cleanup_pmc551(void) pmc551list = priv->nextpmc551; if (priv->start) { printk (KERN_DEBUG "pmc551: unmapping %dM starting at 0x%p\n", priv->asize>>20, priv->start); printk(KERN_DEBUG "pmc551: unmapping %dM starting at " "0x%p\n", priv->asize >> 20, priv->start); iounmap(priv->start); } pci_dev_put(priv->dev); Loading Loading
drivers/mtd/devices/pmc551.c +596 −567 Original line number Diff line number Diff line Loading @@ -115,7 +115,8 @@ static int pmc551_erase (struct mtd_info *mtd, struct erase_info *instr) size_t retlen; #ifdef CONFIG_MTD_PMC551_DEBUG printk(KERN_DEBUG "pmc551_erase(pos:%ld, len:%ld)\n", (long)instr->addr, (long)instr->len); printk(KERN_DEBUG "pmc551_erase(pos:%ld, len:%ld)\n", (long)instr->addr, (long)instr->len); #endif end = instr->addr + instr->len - 1; Loading @@ -123,7 +124,8 @@ static int pmc551_erase (struct mtd_info *mtd, struct erase_info *instr) /* Is it past the end? */ if (end > mtd->size) { #ifdef CONFIG_MTD_PMC551_DEBUG printk(KERN_DEBUG "pmc551_erase() out of bounds (%ld > %ld)\n", (long)end, (long)mtd->size); printk(KERN_DEBUG "pmc551_erase() out of bounds (%ld > %ld)\n", (long)end, (long)mtd->size); #endif return -EINVAL; } Loading @@ -144,7 +146,8 @@ static int pmc551_erase (struct mtd_info *mtd, struct erase_info *instr) written. */ while (soff_hi != eoff_hi) { #ifdef CONFIG_MTD_PMC551_DEBUG printk( KERN_DEBUG "pmc551_erase() soff_hi: %ld, eoff_hi: %ld\n", (long)soff_hi, (long)eoff_hi); printk(KERN_DEBUG "pmc551_erase() soff_hi: %ld, " "eoff_hi: %ld\n", (long)soff_hi, (long)eoff_hi); #endif memset(ptr, 0xff, priv->asize); if (soff_hi + priv->asize >= mtd->size) { Loading @@ -167,8 +170,8 @@ static int pmc551_erase (struct mtd_info *mtd, struct erase_info *instr) return 0; } static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf) static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, size_t * retlen, u_char ** mtdbuf) { struct mypriv *priv = mtd->priv; u32 soff_hi; Loading @@ -180,7 +183,8 @@ static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t len, size_t * if (from + len > mtd->size) { #ifdef CONFIG_MTD_PMC551_DEBUG printk(KERN_DEBUG "pmc551_point() out of bounds (%ld > %ld)\n", (long)from+len, (long)mtd->size); printk(KERN_DEBUG "pmc551_point() out of bounds (%ld > %ld)\n", (long)from + len, (long)mtd->size); #endif return -EINVAL; } Loading @@ -200,16 +204,16 @@ static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t len, size_t * return 0; } static void pmc551_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, size_t len) static void pmc551_unpoint(struct mtd_info *mtd, u_char * addr, loff_t from, size_t len) { #ifdef CONFIG_MTD_PMC551_DEBUG printk(KERN_DEBUG "pmc551_unpoint()\n"); #endif } static int pmc551_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) static int pmc551_read(struct mtd_info *mtd, loff_t from, size_t len, size_t * retlen, u_char * buf) { struct mypriv *priv = mtd->priv; u32 soff_hi, soff_lo; /* start address offset hi/lo */ Loading @@ -219,7 +223,8 @@ static int pmc551_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *r u_char *copyto = buf; #ifdef CONFIG_MTD_PMC551_DEBUG printk(KERN_DEBUG "pmc551_read(pos:%ld, len:%ld) asize: %ld\n", (long)from, (long)len, (long)priv->asize); printk(KERN_DEBUG "pmc551_read(pos:%ld, len:%ld) asize: %ld\n", (long)from, (long)len, (long)priv->asize); #endif end = from + len - 1; Loading @@ -227,7 +232,8 @@ static int pmc551_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *r /* Is it past the end? */ if (end > mtd->size) { #ifdef CONFIG_MTD_PMC551_DEBUG printk(KERN_DEBUG "pmc551_read() out of bounds (%ld > %ld)\n", (long) end, (long)mtd->size); printk(KERN_DEBUG "pmc551_read() out of bounds (%ld > %ld)\n", (long)end, (long)mtd->size); #endif return -EINVAL; } Loading @@ -249,7 +255,8 @@ static int pmc551_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *r written. */ while (soff_hi != eoff_hi) { #ifdef CONFIG_MTD_PMC551_DEBUG printk( KERN_DEBUG "pmc551_read() soff_hi: %ld, eoff_hi: %ld\n", (long)soff_hi, (long)eoff_hi); printk(KERN_DEBUG "pmc551_read() soff_hi: %ld, " "eoff_hi: %ld\n", (long)soff_hi, (long)eoff_hi); #endif memcpy(copyto, ptr, priv->asize); copyto += priv->asize; Loading @@ -271,7 +278,8 @@ static int pmc551_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *r return 0; } static int pmc551_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf) static int pmc551_write(struct mtd_info *mtd, loff_t to, size_t len, size_t * retlen, const u_char * buf) { struct mypriv *priv = mtd->priv; u32 soff_hi, soff_lo; /* start address offset hi/lo */ Loading @@ -280,16 +288,18 @@ static int pmc551_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *re u_char *ptr; const u_char *copyfrom = buf; #ifdef CONFIG_MTD_PMC551_DEBUG printk(KERN_DEBUG "pmc551_write(pos:%ld, len:%ld) asize:%ld\n", (long)to, (long)len, (long)priv->asize); printk(KERN_DEBUG "pmc551_write(pos:%ld, len:%ld) asize:%ld\n", (long)to, (long)len, (long)priv->asize); #endif end = to + len - 1; /* Is it past the end? or did the u32 wrap? */ if (end > mtd->size) { #ifdef CONFIG_MTD_PMC551_DEBUG printk(KERN_DEBUG "pmc551_write() out of bounds (end: %ld, size: %ld, to: %ld)\n", (long) end, (long)mtd->size, (long)to); printk(KERN_DEBUG "pmc551_write() out of bounds (end: %ld, " "size: %ld, to: %ld)\n", (long)end, (long)mtd->size, (long)to); #endif return -EINVAL; } Loading @@ -311,7 +321,8 @@ static int pmc551_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *re written. */ while (soff_hi != eoff_hi) { #ifdef CONFIG_MTD_PMC551_DEBUG printk( KERN_DEBUG "pmc551_write() soff_hi: %ld, eoff_hi: %ld\n", (long)soff_hi, (long)eoff_hi); printk(KERN_DEBUG "pmc551_write() soff_hi: %ld, " "eoff_hi: %ld\n", (long)soff_hi, (long)eoff_hi); #endif memcpy(ptr, copyfrom, priv->asize); copyfrom += priv->asize; Loading Loading @@ -469,8 +480,10 @@ static u32 fixup_pmc551 (struct pci_dev *dev) * Wait until command has gone through * FIXME: register spinning issue */ do { pci_read_config_word( dev, PMC551_SDRAM_CMD, &cmd ); if(counter++ > 100)break; do { pci_read_config_word(dev, PMC551_SDRAM_CMD, &cmd); if (counter++ > 100) break; } while ((PCI_COMMAND_IO) & cmd); /* Loading @@ -487,8 +500,10 @@ static u32 fixup_pmc551 (struct pci_dev *dev) * FIXME: register spinning issue */ counter = 0; do { pci_read_config_word(dev, PMC551_SDRAM_CMD, &cmd); if(counter++ > 100)break; do { pci_read_config_word(dev, PMC551_SDRAM_CMD, &cmd); if (counter++ > 100) break; } while ((PCI_COMMAND_IO) & cmd); } Loading @@ -500,8 +515,10 @@ static u32 fixup_pmc551 (struct pci_dev *dev) * FIXME: register spinning issue */ counter = 0; do { pci_read_config_word ( dev, PMC551_SDRAM_CMD, &cmd); if(counter++ > 100)break; do { pci_read_config_word(dev, PMC551_SDRAM_CMD, &cmd); if (counter++ > 100) break; } while ((PCI_COMMAND_IO) & cmd); pci_read_config_dword(dev, PMC551_DRAM_CFG, &dcmd); Loading Loading @@ -546,11 +563,13 @@ static u32 fixup_pmc551 (struct pci_dev *dev) /* * Some screen fun */ printk(KERN_DEBUG "pmc551: %d%c (0x%x) of %sprefetchable memory at 0x%llx\n", (size<1024)?size:(size<1048576)?size>>10:size>>20, (size<1024)?'B':(size<1048576)?'K':'M', size, ((dcmd&(0x1<<3)) == 0)?"non-":"", (unsigned long long)((dev->resource[0].start)&PCI_BASE_ADDRESS_MEM_MASK)); printk(KERN_DEBUG "pmc551: %d%c (0x%x) of %sprefetchable memory at " "0x%llx\n", (size < 1024) ? size : (size < 1048576) ? size >> 10 : size >> 20, (size < 1024) ? 'B' : (size < 1048576) ? 'K' : 'M', size, ((dcmd & (0x1 << 3)) == 0) ? "non-" : "", (unsigned long long)((dev->resource[0].start) & PCI_BASE_ADDRESS_MEM_MASK)); /* * Check to see the state of the memory Loading @@ -562,7 +581,8 @@ static u32 fixup_pmc551 (struct pci_dev *dev) (((0x1 << 1) & dcmd) == 0) ? "RW" : "RO", (((0x1 << 0) & dcmd) == 0) ? "Off" : "On", PMC551_DRAM_BLK_GET_SIZE(dcmd), ((dcmd>>20)&0x7FF), ((dcmd>>13)&0x7), ((dcmd>>9)&0xF) ); ((dcmd >> 20) & 0x7FF), ((dcmd >> 13) & 0x7), ((dcmd >> 9) & 0xF)); pci_read_config_dword(dev, PMC551_DRAM_BLK1, &dcmd); printk(KERN_DEBUG "pmc551: DRAM_BLK1 Flags: %s,%s\n" Loading @@ -571,7 +591,8 @@ static u32 fixup_pmc551 (struct pci_dev *dev) (((0x1 << 1) & dcmd) == 0) ? "RW" : "RO", (((0x1 << 0) & dcmd) == 0) ? "Off" : "On", PMC551_DRAM_BLK_GET_SIZE(dcmd), ((dcmd>>20)&0x7FF), ((dcmd>>13)&0x7), ((dcmd>>9)&0xF) ); ((dcmd >> 20) & 0x7FF), ((dcmd >> 13) & 0x7), ((dcmd >> 9) & 0xF)); pci_read_config_dword(dev, PMC551_DRAM_BLK2, &dcmd); printk(KERN_DEBUG "pmc551: DRAM_BLK2 Flags: %s,%s\n" Loading @@ -580,7 +601,8 @@ static u32 fixup_pmc551 (struct pci_dev *dev) (((0x1 << 1) & dcmd) == 0) ? "RW" : "RO", (((0x1 << 0) & dcmd) == 0) ? "Off" : "On", PMC551_DRAM_BLK_GET_SIZE(dcmd), ((dcmd>>20)&0x7FF), ((dcmd>>13)&0x7), ((dcmd>>9)&0xF) ); ((dcmd >> 20) & 0x7FF), ((dcmd >> 13) & 0x7), ((dcmd >> 9) & 0xF)); pci_read_config_dword(dev, PMC551_DRAM_BLK3, &dcmd); printk(KERN_DEBUG "pmc551: DRAM_BLK3 Flags: %s,%s\n" Loading @@ -589,7 +611,8 @@ static u32 fixup_pmc551 (struct pci_dev *dev) (((0x1 << 1) & dcmd) == 0) ? "RW" : "RO", (((0x1 << 0) & dcmd) == 0) ? "Off" : "On", PMC551_DRAM_BLK_GET_SIZE(dcmd), ((dcmd>>20)&0x7FF), ((dcmd>>13)&0x7), ((dcmd>>9)&0xF) ); ((dcmd >> 20) & 0x7FF), ((dcmd >> 13) & 0x7), ((dcmd >> 9) & 0xF)); pci_read_config_word(dev, PCI_COMMAND, &cmd); printk(KERN_DEBUG "pmc551: Memory Access %s\n", Loading Loading @@ -620,7 +643,6 @@ static u32 fixup_pmc551 (struct pci_dev *dev) * Kernel version specific module stuffages */ MODULE_LICENSE("GPL"); MODULE_AUTHOR("Mark Ferrell <mferrell@mvista.com>"); MODULE_DESCRIPTION(PMC551_VERSION); Loading Loading @@ -654,7 +676,8 @@ static int __init init_pmc551(void) if (msize) { msize = (1 << (ffs(msize) - 1)) << 20; if (msize > (1 << 30)) { printk(KERN_NOTICE "pmc551: Invalid memory size [%d]\n", msize); printk(KERN_NOTICE "pmc551: Invalid memory size [%d]\n", msize); return -EINVAL; } } Loading @@ -662,7 +685,8 @@ static int __init init_pmc551(void) if (asize) { asize = (1 << (ffs(asize) - 1)) << 20; if (asize > (1 << 30)) { printk(KERN_NOTICE "pmc551: Invalid aperture size [%d]\n", asize); printk(KERN_NOTICE "pmc551: Invalid aperture size " "[%d]\n", asize); return -EINVAL; } } Loading Loading @@ -702,14 +726,16 @@ static int __init init_pmc551(void) */ if (msize) { length = msize; printk(KERN_NOTICE "pmc551: Using specified memory size 0x%x\n", length); printk(KERN_NOTICE "pmc551: Using specified memory " "size 0x%x\n", length); } else { msize = length; } mtd = kmalloc(sizeof(struct mtd_info), GFP_KERNEL); if (!mtd) { printk(KERN_NOTICE "pmc551: Cannot allocate new MTD device.\n"); printk(KERN_NOTICE "pmc551: Cannot allocate new MTD " "device.\n"); break; } Loading @@ -717,7 +743,8 @@ static int __init init_pmc551(void) priv = kmalloc(sizeof(struct mypriv), GFP_KERNEL); if (!priv) { printk(KERN_NOTICE "pmc551: Cannot allocate new MTD device.\n"); printk(KERN_NOTICE "pmc551: Cannot allocate new MTD " "device.\n"); kfree(mtd); break; } Loading @@ -726,13 +753,16 @@ static int __init init_pmc551(void) priv->dev = PCI_Device; if (asize > length) { printk(KERN_NOTICE "pmc551: reducing aperture size to fit %dM\n",length>>20); printk(KERN_NOTICE "pmc551: reducing aperture size to " "fit %dM\n", length >> 20); priv->asize = asize = length; } else if (asize == 0 || asize == length) { printk(KERN_NOTICE "pmc551: Using existing aperture size %dM\n", length>>20); printk(KERN_NOTICE "pmc551: Using existing aperture " "size %dM\n", length >> 20); priv->asize = asize = length; } else { printk(KERN_NOTICE "pmc551: Using specified aperture size %dM\n", asize>>20); printk(KERN_NOTICE "pmc551: Using specified aperture " "size %dM\n", asize >> 20); priv->asize = asize; } priv->start = ioremap(((PCI_Device->resource[0].start) Loading @@ -745,7 +775,6 @@ static int __init init_pmc551(void) kfree(mtd); break; } #ifdef CONFIG_MTD_PMC551_DEBUG printk(KERN_DEBUG "pmc551: setting aperture to %d\n", ffs(priv->asize >> 20) - 1); Loading Loading @@ -777,7 +806,8 @@ static int __init init_pmc551(void) mtd->owner = THIS_MODULE; if (add_mtd_device(mtd)) { printk(KERN_NOTICE "pmc551: Failed to register new device\n"); printk(KERN_NOTICE "pmc551: Failed to register new " "device\n"); iounmap(priv->start); kfree(mtd->priv); kfree(mtd); Loading @@ -790,8 +820,7 @@ static int __init init_pmc551(void) printk(KERN_NOTICE "Registered pmc551 memory device.\n"); printk(KERN_NOTICE "Mapped %dM of memory from 0x%p to 0x%p\n", priv->asize >> 20, priv->start, priv->start + priv->asize); priv->start, priv->start + priv->asize); printk(KERN_NOTICE "Total memory is %d%c\n", (length < 1024) ? length : (length < 1048576) ? length >> 10 : length >> 20, Loading Loading @@ -828,8 +857,8 @@ static void __exit cleanup_pmc551(void) pmc551list = priv->nextpmc551; if (priv->start) { printk (KERN_DEBUG "pmc551: unmapping %dM starting at 0x%p\n", priv->asize>>20, priv->start); printk(KERN_DEBUG "pmc551: unmapping %dM starting at " "0x%p\n", priv->asize >> 20, priv->start); iounmap(priv->start); } pci_dev_put(priv->dev); Loading