Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a48178a2 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* git://git.infradead.org/mtd-2.6:
  Remove accidentally-added include/linux/utsrelease.h
  Revert "[MTD] blkdev helper code: fix printk format warning"
  [MTD] Add SSFDC (SmartMedia) read-only translation layer
  [MTD] pmc551 pci cleanup
  [MTD] pmc551 use kzalloc
  [MTD] pmc551 whitespace cleanup
  [MTD] Remove iq80310 map driver
  [MTD NAND] Fix in typo ndfc.c causing wrong ECC layout
  [MTD] physmap: add power management support
  ioremap balanced with iounmap for drivers/mtd subsystem
  [MTD] Switch to pci_get_device and do ref counting
  [MTD] blkdev helper code: fix printk format warning
  [MTD] Fix ixp4xx partition parsing.
  [JFFS2] Remove unneeded ifdefs from jffs2_fs_i.h
  [MTD NAND] Remove old code in au1550nd.c
  [MTD] Unlock NOR flash automatically where necessary
parents 14d1adfc 734a5628
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -263,6 +263,14 @@ config RFD_FTL


		http://www.gensw.com/pages/prod/bios/rfd.htm
		http://www.gensw.com/pages/prod/bios/rfd.htm


config SSFDC
	bool "NAND SSFDC (SmartMedia) read only translation layer"
	depends on MTD
	default n
	help
	  This enables read only access to SmartMedia formatted NAND
	  flash. You can mount it with FAT file system.

source "drivers/mtd/chips/Kconfig"
source "drivers/mtd/chips/Kconfig"


source "drivers/mtd/maps/Kconfig"
source "drivers/mtd/maps/Kconfig"
+1 −0
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@ obj-$(CONFIG_FTL) += ftl.o mtd_blkdevs.o
obj-$(CONFIG_NFTL)		+= nftl.o mtd_blkdevs.o
obj-$(CONFIG_NFTL)		+= nftl.o mtd_blkdevs.o
obj-$(CONFIG_INFTL)		+= inftl.o mtd_blkdevs.o
obj-$(CONFIG_INFTL)		+= inftl.o mtd_blkdevs.o
obj-$(CONFIG_RFD_FTL)		+= rfd_ftl.o mtd_blkdevs.o
obj-$(CONFIG_RFD_FTL)		+= rfd_ftl.o mtd_blkdevs.o
obj-$(CONFIG_SSFDC)		+= ssfdc.o mtd_blkdevs.o


nftl-objs		:= nftlcore.o nftlmount.o
nftl-objs		:= nftlcore.o nftlmount.o
inftl-objs		:= inftlcore.o inftlmount.o
inftl-objs		:= inftlcore.o inftlmount.o
+1 −0
Original line number Original line Diff line number Diff line
@@ -212,6 +212,7 @@ static void fixup_use_atmel_lock(struct mtd_info *mtd, void *param)
{
{
	mtd->lock = cfi_atmel_lock;
	mtd->lock = cfi_atmel_lock;
	mtd->unlock = cfi_atmel_unlock;
	mtd->unlock = cfi_atmel_unlock;
	mtd->flags |= MTD_STUPID_LOCK;
}
}


static struct cfi_fixup cfi_fixup_table[] = {
static struct cfi_fixup cfi_fixup_table[] = {
+593 −561
Original line number Original line Diff line number Diff line
@@ -115,7 +115,8 @@ static int pmc551_erase (struct mtd_info *mtd, struct erase_info *instr)
	size_t retlen;
	size_t retlen;


#ifdef CONFIG_MTD_PMC551_DEBUG
#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
#endif


	end = instr->addr + instr->len - 1;
	end = instr->addr + instr->len - 1;
@@ -123,7 +124,8 @@ static int pmc551_erase (struct mtd_info *mtd, struct erase_info *instr)
	/* Is it past the end? */
	/* Is it past the end? */
	if (end > mtd->size) {
	if (end > mtd->size) {
#ifdef CONFIG_MTD_PMC551_DEBUG
#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
#endif
		return -EINVAL;
		return -EINVAL;
	}
	}
@@ -144,7 +146,8 @@ static int pmc551_erase (struct mtd_info *mtd, struct erase_info *instr)
		   written. */
		   written. */
		while (soff_hi != eoff_hi) {
		while (soff_hi != eoff_hi) {
#ifdef CONFIG_MTD_PMC551_DEBUG
#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
#endif
			memset(ptr, 0xff, priv->asize);
			memset(ptr, 0xff, priv->asize);
			if (soff_hi + priv->asize >= mtd->size) {
			if (soff_hi + priv->asize >= mtd->size) {
@@ -167,8 +170,8 @@ static int pmc551_erase (struct mtd_info *mtd, struct erase_info *instr)
	return 0;
	return 0;
}
}



static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len,
static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf)
			size_t * retlen, u_char ** mtdbuf)
{
{
	struct mypriv *priv = mtd->priv;
	struct mypriv *priv = mtd->priv;
	u32 soff_hi;
	u32 soff_hi;
@@ -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) {
	if (from + len > mtd->size) {
#ifdef CONFIG_MTD_PMC551_DEBUG
#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
#endif
		return -EINVAL;
		return -EINVAL;
	}
	}
@@ -200,16 +204,16 @@ static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *
	return 0;
	return 0;
}
}



static void pmc551_unpoint(struct mtd_info *mtd, u_char * addr, loff_t from,
static void pmc551_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, size_t len)
			   size_t len)
{
{
#ifdef CONFIG_MTD_PMC551_DEBUG
#ifdef CONFIG_MTD_PMC551_DEBUG
	printk(KERN_DEBUG "pmc551_unpoint()\n");
	printk(KERN_DEBUG "pmc551_unpoint()\n");
#endif
#endif
}
}



static int pmc551_read(struct mtd_info *mtd, loff_t from, size_t len,
static int pmc551_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf)
			size_t * retlen, u_char * buf)
{
{
	struct mypriv *priv = mtd->priv;
	struct mypriv *priv = mtd->priv;
	u32 soff_hi, soff_lo;	/* start address offset hi/lo */
	u32 soff_hi, soff_lo;	/* start address offset hi/lo */
@@ -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;
	u_char *copyto = buf;


#ifdef CONFIG_MTD_PMC551_DEBUG
#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
#endif


	end = from + len - 1;
	end = from + len - 1;
@@ -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? */
	/* Is it past the end? */
	if (end > mtd->size) {
	if (end > mtd->size) {
#ifdef CONFIG_MTD_PMC551_DEBUG
#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
#endif
		return -EINVAL;
		return -EINVAL;
	}
	}
@@ -249,7 +255,8 @@ static int pmc551_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *r
		   written. */
		   written. */
		while (soff_hi != eoff_hi) {
		while (soff_hi != eoff_hi) {
#ifdef CONFIG_MTD_PMC551_DEBUG
#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
#endif
			memcpy(copyto, ptr, priv->asize);
			memcpy(copyto, ptr, priv->asize);
			copyto += priv->asize;
			copyto += priv->asize;
@@ -271,7 +278,8 @@ static int pmc551_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *r
	return 0;
	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;
	struct mypriv *priv = mtd->priv;
	u32 soff_hi, soff_lo;	/* start address offset hi/lo */
	u32 soff_hi, soff_lo;	/* start address offset hi/lo */
@@ -280,16 +288,18 @@ static int pmc551_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *re
	u_char *ptr;
	u_char *ptr;
	const u_char *copyfrom = buf;
	const u_char *copyfrom = buf;



#ifdef CONFIG_MTD_PMC551_DEBUG
#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
#endif


	end = to + len - 1;
	end = to + len - 1;
	/* Is it past the end?  or did the u32 wrap? */
	/* Is it past the end?  or did the u32 wrap? */
	if (end > mtd->size) {
	if (end > mtd->size) {
#ifdef CONFIG_MTD_PMC551_DEBUG
#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
#endif
		return -EINVAL;
		return -EINVAL;
	}
	}
@@ -311,7 +321,8 @@ static int pmc551_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *re
		   written. */
		   written. */
		while (soff_hi != eoff_hi) {
		while (soff_hi != eoff_hi) {
#ifdef CONFIG_MTD_PMC551_DEBUG
#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
#endif
			memcpy(ptr, copyfrom, priv->asize);
			memcpy(ptr, copyfrom, priv->asize);
			copyfrom += priv->asize;
			copyfrom += priv->asize;
@@ -469,8 +480,10 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
	 * Wait until command has gone through
	 * Wait until command has gone through
	 * FIXME: register spinning issue
	 * FIXME: register spinning issue
	 */
	 */
        do {	pci_read_config_word( dev, PMC551_SDRAM_CMD, &cmd );
	do {
		if(counter++ > 100)break;
		pci_read_config_word(dev, PMC551_SDRAM_CMD, &cmd);
		if (counter++ > 100)
			break;
	} while ((PCI_COMMAND_IO) & cmd);
	} while ((PCI_COMMAND_IO) & cmd);


	/*
	/*
@@ -487,8 +500,10 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
		 * FIXME: register spinning issue
		 * FIXME: register spinning issue
		 */
		 */
		counter = 0;
		counter = 0;
                do {	pci_read_config_word(dev, PMC551_SDRAM_CMD, &cmd);
		do {
			if(counter++ > 100)break;
			pci_read_config_word(dev, PMC551_SDRAM_CMD, &cmd);
			if (counter++ > 100)
				break;
		} while ((PCI_COMMAND_IO) & cmd);
		} while ((PCI_COMMAND_IO) & cmd);
	}
	}


@@ -500,8 +515,10 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
	 * FIXME: register spinning issue
	 * FIXME: register spinning issue
	 */
	 */
	counter = 0;
	counter = 0;
        do {	pci_read_config_word ( dev, PMC551_SDRAM_CMD, &cmd);
	do {
		if(counter++ > 100)break;
		pci_read_config_word(dev, PMC551_SDRAM_CMD, &cmd);
		if (counter++ > 100)
			break;
	} while ((PCI_COMMAND_IO) & cmd);
	} while ((PCI_COMMAND_IO) & cmd);


	pci_read_config_dword(dev, PMC551_DRAM_CFG, &dcmd);
	pci_read_config_dword(dev, PMC551_DRAM_CFG, &dcmd);
@@ -546,11 +563,12 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
	/*
	/*
	 * Some screen fun
	 * Some screen fun
	 */
	 */
        printk(KERN_DEBUG "pmc551: %d%c (0x%x) of %sprefetchable memory at 0x%llx\n",
	printk(KERN_DEBUG "pmc551: %d%c (0x%x) of %sprefetchable memory at "
	       (size<1024)?size:(size<1048576)?size>>10:size>>20,
		"0x%llx\n", (size < 1024) ? size : (size < 1048576) ?
               (size<1024)?'B':(size<1048576)?'K':'M',
		size >> 10 : size >> 20,
	       size, ((dcmd&(0x1<<3)) == 0)?"non-":"",
		(size < 1024) ? 'B' : (size < 1048576) ? 'K' : 'M', size,
               (unsigned long long)((dev->resource[0].start)&PCI_BASE_ADDRESS_MEM_MASK));
		((dcmd & (0x1 << 3)) == 0) ? "non-" : "",
		(unsigned long long)pci_resource_start(dev, 0));


	/*
	/*
	 * Check to see the state of the memory
	 * Check to see the state of the memory
@@ -562,7 +580,8 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
		(((0x1 << 1) & dcmd) == 0) ? "RW" : "RO",
		(((0x1 << 1) & dcmd) == 0) ? "RW" : "RO",
		(((0x1 << 0) & dcmd) == 0) ? "Off" : "On",
		(((0x1 << 0) & dcmd) == 0) ? "Off" : "On",
		PMC551_DRAM_BLK_GET_SIZE(dcmd),
		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);
	pci_read_config_dword(dev, PMC551_DRAM_BLK1, &dcmd);
	printk(KERN_DEBUG "pmc551: DRAM_BLK1 Flags: %s,%s\n"
	printk(KERN_DEBUG "pmc551: DRAM_BLK1 Flags: %s,%s\n"
@@ -571,7 +590,8 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
		(((0x1 << 1) & dcmd) == 0) ? "RW" : "RO",
		(((0x1 << 1) & dcmd) == 0) ? "RW" : "RO",
		(((0x1 << 0) & dcmd) == 0) ? "Off" : "On",
		(((0x1 << 0) & dcmd) == 0) ? "Off" : "On",
		PMC551_DRAM_BLK_GET_SIZE(dcmd),
		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);
	pci_read_config_dword(dev, PMC551_DRAM_BLK2, &dcmd);
	printk(KERN_DEBUG "pmc551: DRAM_BLK2 Flags: %s,%s\n"
	printk(KERN_DEBUG "pmc551: DRAM_BLK2 Flags: %s,%s\n"
@@ -580,7 +600,8 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
		(((0x1 << 1) & dcmd) == 0) ? "RW" : "RO",
		(((0x1 << 1) & dcmd) == 0) ? "RW" : "RO",
		(((0x1 << 0) & dcmd) == 0) ? "Off" : "On",
		(((0x1 << 0) & dcmd) == 0) ? "Off" : "On",
		PMC551_DRAM_BLK_GET_SIZE(dcmd),
		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);
	pci_read_config_dword(dev, PMC551_DRAM_BLK3, &dcmd);
	printk(KERN_DEBUG "pmc551: DRAM_BLK3 Flags: %s,%s\n"
	printk(KERN_DEBUG "pmc551: DRAM_BLK3 Flags: %s,%s\n"
@@ -589,7 +610,8 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
		(((0x1 << 1) & dcmd) == 0) ? "RW" : "RO",
		(((0x1 << 1) & dcmd) == 0) ? "RW" : "RO",
		(((0x1 << 0) & dcmd) == 0) ? "Off" : "On",
		(((0x1 << 0) & dcmd) == 0) ? "Off" : "On",
		PMC551_DRAM_BLK_GET_SIZE(dcmd),
		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);
	pci_read_config_word(dev, PCI_COMMAND, &cmd);
	printk(KERN_DEBUG "pmc551: Memory Access %s\n",
	printk(KERN_DEBUG "pmc551: Memory Access %s\n",
@@ -620,7 +642,6 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
 * Kernel version specific module stuffages
 * Kernel version specific module stuffages
 */
 */



MODULE_LICENSE("GPL");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Mark Ferrell <mferrell@mvista.com>");
MODULE_AUTHOR("Mark Ferrell <mferrell@mvista.com>");
MODULE_DESCRIPTION(PMC551_VERSION);
MODULE_DESCRIPTION(PMC551_VERSION);
@@ -654,7 +675,8 @@ static int __init init_pmc551(void)
	if (msize) {
	if (msize) {
		msize = (1 << (ffs(msize) - 1)) << 20;
		msize = (1 << (ffs(msize) - 1)) << 20;
		if (msize > (1 << 30)) {
		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;
			return -EINVAL;
		}
		}
	}
	}
@@ -662,7 +684,8 @@ static int __init init_pmc551(void)
	if (asize) {
	if (asize) {
		asize = (1 << (ffs(asize) - 1)) << 20;
		asize = (1 << (ffs(asize) - 1)) << 20;
		if (asize > (1 << 30)) {
		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;
			return -EINVAL;
		}
		}
	}
	}
@@ -674,14 +697,14 @@ static int __init init_pmc551(void)
	 */
	 */
	for (count = 0; count < MAX_MTD_DEVICES; count++) {
	for (count = 0; count < MAX_MTD_DEVICES; count++) {


                if ((PCI_Device = pci_find_device(PCI_VENDOR_ID_V3_SEMI,
		if ((PCI_Device = pci_get_device(PCI_VENDOR_ID_V3_SEMI,
						  PCI_DEVICE_ID_V3_SEMI_V370PDC,
						  PCI_DEVICE_ID_V3_SEMI_V370PDC,
						  PCI_Device)) == NULL) {
						  PCI_Device)) == NULL) {
			break;
			break;
		}
		}


		printk(KERN_NOTICE "pmc551: Found PCI V370PDC at 0x%llx\n",
		printk(KERN_NOTICE "pmc551: Found PCI V370PDC at 0x%llx\n",
				    (unsigned long long)PCI_Device->resource[0].start);
			(unsigned long long)pci_resource_start(PCI_Device, 0));


		/*
		/*
		 * The PMC551 device acts VERY weird if you don't init it
		 * The PMC551 device acts VERY weird if you don't init it
@@ -702,42 +725,43 @@ static int __init init_pmc551(void)
		 */
		 */
		if (msize) {
		if (msize) {
			length = 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 {
		} else {
			msize = length;
			msize = length;
		}
		}


                mtd = kmalloc(sizeof(struct mtd_info), GFP_KERNEL);
		mtd = kzalloc(sizeof(struct mtd_info), GFP_KERNEL);
		if (!mtd) {
		if (!mtd) {
                        printk(KERN_NOTICE "pmc551: Cannot allocate new MTD device.\n");
			printk(KERN_NOTICE "pmc551: Cannot allocate new MTD "
				"device.\n");
			break;
			break;
		}
		}


                memset(mtd, 0, sizeof(struct mtd_info));
		priv = kzalloc(sizeof(struct mypriv), GFP_KERNEL);

                priv = kmalloc (sizeof(struct mypriv), GFP_KERNEL);
		if (!priv) {
		if (!priv) {
                        printk(KERN_NOTICE "pmc551: Cannot allocate new MTD device.\n");
			printk(KERN_NOTICE "pmc551: Cannot allocate new MTD "
				"device.\n");
			kfree(mtd);
			kfree(mtd);
			break;
			break;
		}
		}
                memset(priv, 0, sizeof(*priv));
		mtd->priv = priv;
		mtd->priv = priv;
		priv->dev = PCI_Device;
		priv->dev = PCI_Device;


		if (asize > length) {
		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;
			priv->asize = asize = length;
		} else if (asize == 0 || 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;
			priv->asize = asize = length;
		} else {
		} 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->asize = asize;
		}
		}
                priv->start = ioremap(((PCI_Device->resource[0].start)
		priv->start = pci_iomap(PCI_Device, 0, priv->asize);
                                       & PCI_BASE_ADDRESS_MEM_MASK),
                                      priv->asize);


		if (!priv->start) {
		if (!priv->start) {
			printk(KERN_NOTICE "pmc551: Unable to map IO space\n");
			printk(KERN_NOTICE "pmc551: Unable to map IO space\n");
@@ -745,7 +769,6 @@ static int __init init_pmc551(void)
			kfree(mtd);
			kfree(mtd);
			break;
			break;
		}
		}

#ifdef CONFIG_MTD_PMC551_DEBUG
#ifdef CONFIG_MTD_PMC551_DEBUG
		printk(KERN_DEBUG "pmc551: setting aperture to %d\n",
		printk(KERN_DEBUG "pmc551: setting aperture to %d\n",
			ffs(priv->asize >> 20) - 1);
			ffs(priv->asize >> 20) - 1);
@@ -777,17 +800,21 @@ static int __init init_pmc551(void)
		mtd->owner = THIS_MODULE;
		mtd->owner = THIS_MODULE;


		if (add_mtd_device(mtd)) {
		if (add_mtd_device(mtd)) {
                        printk(KERN_NOTICE "pmc551: Failed to register new device\n");
			printk(KERN_NOTICE "pmc551: Failed to register new "
			iounmap(priv->start);
				"device\n");
			pci_iounmap(PCI_Device, priv->start);
			kfree(mtd->priv);
			kfree(mtd->priv);
			kfree(mtd);
			kfree(mtd);
			break;
			break;
		}
		}

		/* Keep a reference as the add_mtd_device worked */
		pci_dev_get(PCI_Device);

		printk(KERN_NOTICE "Registered pmc551 memory device.\n");
		printk(KERN_NOTICE "Registered pmc551 memory device.\n");
		printk(KERN_NOTICE "Mapped %dM of memory from 0x%p to 0x%p\n",
		printk(KERN_NOTICE "Mapped %dM of memory from 0x%p to 0x%p\n",
			priv->asize >> 20,
			priv->asize >> 20,
                       priv->start,
			priv->start, priv->start + priv->asize);
                       priv->start + priv->asize);
		printk(KERN_NOTICE "Total memory is %d%c\n",
		printk(KERN_NOTICE "Total memory is %d%c\n",
			(length < 1024) ? length :
			(length < 1024) ? length :
			(length < 1048576) ? length >> 10 : length >> 20,
			(length < 1048576) ? length >> 10 : length >> 20,
@@ -797,6 +824,10 @@ static int __init init_pmc551(void)
		found++;
		found++;
	}
	}


	/* Exited early, reference left over */
	if (PCI_Device)
		pci_dev_put(PCI_Device);

	if (!pmc551list) {
	if (!pmc551list) {
		printk(KERN_NOTICE "pmc551: not detected\n");
		printk(KERN_NOTICE "pmc551: not detected\n");
		return -ENODEV;
		return -ENODEV;
@@ -820,10 +851,11 @@ static void __exit cleanup_pmc551(void)
		pmc551list = priv->nextpmc551;
		pmc551list = priv->nextpmc551;


		if (priv->start) {
		if (priv->start) {
			printk (KERN_DEBUG "pmc551: unmapping %dM starting at 0x%p\n",
			printk(KERN_DEBUG "pmc551: unmapping %dM starting at "
				priv->asize>>20, priv->start);
				"0x%p\n", priv->asize >> 20, priv->start);
			iounmap (priv->start);
			pci_iounmap(priv->dev, priv->start);
		}
		}
		pci_dev_put(priv->dev);


		kfree(mtd->priv);
		kfree(mtd->priv);
		del_mtd_device(mtd);
		del_mtd_device(mtd);
+0 −8
Original line number Original line Diff line number Diff line
@@ -447,14 +447,6 @@ config MTD_DC21285
	  21285 bridge used with Intel's StrongARM processors. More info at
	  21285 bridge used with Intel's StrongARM processors. More info at
	  <http://www.intel.com/design/bridge/docs/21285_documentation.htm>.
	  <http://www.intel.com/design/bridge/docs/21285_documentation.htm>.


config MTD_IQ80310
	tristate "CFI Flash device mapped on the XScale IQ80310 board"
	depends on MTD_CFI && ARCH_IQ80310
	help
	  This enables access routines for the flash chips on the Intel XScale
	  IQ80310 evaluation board. If you have one of these boards and would
	  like to use the flash chips on it, say 'Y'.

config MTD_IXP4XX
config MTD_IXP4XX
	tristate "CFI Flash device mapped on Intel IXP4xx based systems"
	tristate "CFI Flash device mapped on Intel IXP4xx based systems"
	depends on MTD_CFI && MTD_COMPLEX_MAPPINGS && ARCH_IXP4XX
	depends on MTD_CFI && MTD_COMPLEX_MAPPINGS && ARCH_IXP4XX
Loading