diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-12-09 11:28:36 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-12-09 11:28:36 -0500 |
commit | 4d9c6a21befe6c73c35f2799c7e25a9eda82a95d (patch) | |
tree | d77a05b369b40bd48ce663f5206f3630fc942bbc /drivers/mtd | |
parent | b749e3f8d7879c9c87e237d75b2256b4d1d04df2 (diff) | |
parent | e93f1be503efd0e44e46fc1fd4c13dbee72a6561 (diff) |
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6:
[MTD] [NAND] fix OOPS accessing flash operations over STM flash on PXA
[MTD] [NAND] drivers/mtd/nand/pasemi_nand.c: Add missing pci_dev_put
[MTD] [NAND] fsl_upm: fix build problem with 2.6.28-rc2
[MTD] physmap: fix memory leak on physmap_flash_remove by using devres
[MTD] m25p80: chip erase != block erase != sector erase
[MTD] m25p80: fix detection of m25p16 flashes
[MTD] m25p80: fix detection of SPI parts
[MTD] [NAND] OMAP: OneNAND: header file relocation (part 2)
[MTD] [NAND] OMAP: OneNAND: header file relocation
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/devices/m25p80.c | 28 | ||||
-rw-r--r-- | drivers/mtd/maps/physmap.c | 26 | ||||
-rw-r--r-- | drivers/mtd/nand/fsl_upm.c | 8 | ||||
-rw-r--r-- | drivers/mtd/nand/pasemi_nand.c | 1 | ||||
-rw-r--r-- | drivers/mtd/nand/pxa3xx_nand.c | 1 | ||||
-rw-r--r-- | drivers/mtd/onenand/omap2.c | 17 |
6 files changed, 40 insertions, 41 deletions
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index 76a76751da36..6659b2275c0c 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c | |||
@@ -37,9 +37,9 @@ | |||
37 | #define OPCODE_NORM_READ 0x03 /* Read data bytes (low frequency) */ | 37 | #define OPCODE_NORM_READ 0x03 /* Read data bytes (low frequency) */ |
38 | #define OPCODE_FAST_READ 0x0b /* Read data bytes (high frequency) */ | 38 | #define OPCODE_FAST_READ 0x0b /* Read data bytes (high frequency) */ |
39 | #define OPCODE_PP 0x02 /* Page program (up to 256 bytes) */ | 39 | #define OPCODE_PP 0x02 /* Page program (up to 256 bytes) */ |
40 | #define OPCODE_BE_4K 0x20 /* Erase 4KiB block */ | 40 | #define OPCODE_BE_4K 0x20 /* Erase 4KiB block */ |
41 | #define OPCODE_BE_32K 0x52 /* Erase 32KiB block */ | 41 | #define OPCODE_BE_32K 0x52 /* Erase 32KiB block */ |
42 | #define OPCODE_BE 0xc7 /* Erase whole flash block */ | 42 | #define OPCODE_CHIP_ERASE 0xc7 /* Erase whole flash chip */ |
43 | #define OPCODE_SE 0xd8 /* Sector erase (usually 64KiB) */ | 43 | #define OPCODE_SE 0xd8 /* Sector erase (usually 64KiB) */ |
44 | #define OPCODE_RDID 0x9f /* Read JEDEC ID */ | 44 | #define OPCODE_RDID 0x9f /* Read JEDEC ID */ |
45 | 45 | ||
@@ -167,7 +167,7 @@ static int wait_till_ready(struct m25p *flash) | |||
167 | * | 167 | * |
168 | * Returns 0 if successful, non-zero otherwise. | 168 | * Returns 0 if successful, non-zero otherwise. |
169 | */ | 169 | */ |
170 | static int erase_block(struct m25p *flash) | 170 | static int erase_chip(struct m25p *flash) |
171 | { | 171 | { |
172 | DEBUG(MTD_DEBUG_LEVEL3, "%s: %s %dKiB\n", | 172 | DEBUG(MTD_DEBUG_LEVEL3, "%s: %s %dKiB\n", |
173 | flash->spi->dev.bus_id, __func__, | 173 | flash->spi->dev.bus_id, __func__, |
@@ -181,7 +181,7 @@ static int erase_block(struct m25p *flash) | |||
181 | write_enable(flash); | 181 | write_enable(flash); |
182 | 182 | ||
183 | /* Set up command buffer. */ | 183 | /* Set up command buffer. */ |
184 | flash->command[0] = OPCODE_BE; | 184 | flash->command[0] = OPCODE_CHIP_ERASE; |
185 | 185 | ||
186 | spi_write(flash->spi, flash->command, 1); | 186 | spi_write(flash->spi, flash->command, 1); |
187 | 187 | ||
@@ -250,15 +250,18 @@ static int m25p80_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
250 | 250 | ||
251 | mutex_lock(&flash->lock); | 251 | mutex_lock(&flash->lock); |
252 | 252 | ||
253 | /* REVISIT in some cases we could speed up erasing large regions | 253 | /* whole-chip erase? */ |
254 | * by using OPCODE_SE instead of OPCODE_BE_4K | 254 | if (len == flash->mtd.size && erase_chip(flash)) { |
255 | */ | ||
256 | |||
257 | /* now erase those sectors */ | ||
258 | if (len == flash->mtd.size && erase_block(flash)) { | ||
259 | instr->state = MTD_ERASE_FAILED; | 255 | instr->state = MTD_ERASE_FAILED; |
260 | mutex_unlock(&flash->lock); | 256 | mutex_unlock(&flash->lock); |
261 | return -EIO; | 257 | return -EIO; |
258 | |||
259 | /* REVISIT in some cases we could speed up erasing large regions | ||
260 | * by using OPCODE_SE instead of OPCODE_BE_4K. We may have set up | ||
261 | * to use "small sector erase", but that's not always optimal. | ||
262 | */ | ||
263 | |||
264 | /* "sector"-at-a-time erase */ | ||
262 | } else { | 265 | } else { |
263 | while (len) { | 266 | while (len) { |
264 | if (erase_sector(flash, addr)) { | 267 | if (erase_sector(flash, addr)) { |
@@ -574,10 +577,11 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi) | |||
574 | for (tmp = 0, info = m25p_data; | 577 | for (tmp = 0, info = m25p_data; |
575 | tmp < ARRAY_SIZE(m25p_data); | 578 | tmp < ARRAY_SIZE(m25p_data); |
576 | tmp++, info++) { | 579 | tmp++, info++) { |
577 | if (info->jedec_id == jedec) | 580 | if (info->jedec_id == jedec) { |
578 | if (ext_jedec != 0 && info->ext_id != ext_jedec) | 581 | if (info->ext_id != 0 && info->ext_id != ext_jedec) |
579 | continue; | 582 | continue; |
580 | return info; | 583 | return info; |
584 | } | ||
581 | } | 585 | } |
582 | dev_err(&spi->dev, "unrecognized JEDEC id %06x\n", jedec); | 586 | dev_err(&spi->dev, "unrecognized JEDEC id %06x\n", jedec); |
583 | return NULL; | 587 | return NULL; |
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index 42d844f8f6bf..dfbf3f270cea 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/mtd/partitions.h> | 19 | #include <linux/mtd/partitions.h> |
20 | #include <linux/mtd/physmap.h> | 20 | #include <linux/mtd/physmap.h> |
21 | #include <linux/mtd/concat.h> | 21 | #include <linux/mtd/concat.h> |
22 | #include <asm/io.h> | 22 | #include <linux/io.h> |
23 | 23 | ||
24 | #define MAX_RESOURCES 4 | 24 | #define MAX_RESOURCES 4 |
25 | 25 | ||
@@ -27,7 +27,6 @@ struct physmap_flash_info { | |||
27 | struct mtd_info *mtd[MAX_RESOURCES]; | 27 | struct mtd_info *mtd[MAX_RESOURCES]; |
28 | struct mtd_info *cmtd; | 28 | struct mtd_info *cmtd; |
29 | struct map_info map[MAX_RESOURCES]; | 29 | struct map_info map[MAX_RESOURCES]; |
30 | struct resource *res; | ||
31 | #ifdef CONFIG_MTD_PARTITIONS | 30 | #ifdef CONFIG_MTD_PARTITIONS |
32 | int nr_parts; | 31 | int nr_parts; |
33 | struct mtd_partition *parts; | 32 | struct mtd_partition *parts; |
@@ -70,16 +69,7 @@ static int physmap_flash_remove(struct platform_device *dev) | |||
70 | #endif | 69 | #endif |
71 | map_destroy(info->mtd[i]); | 70 | map_destroy(info->mtd[i]); |
72 | } | 71 | } |
73 | |||
74 | if (info->map[i].virt != NULL) | ||
75 | iounmap(info->map[i].virt); | ||
76 | } | ||
77 | |||
78 | if (info->res != NULL) { | ||
79 | release_resource(info->res); | ||
80 | kfree(info->res); | ||
81 | } | 72 | } |
82 | |||
83 | return 0; | 73 | return 0; |
84 | } | 74 | } |
85 | 75 | ||
@@ -101,7 +91,8 @@ static int physmap_flash_probe(struct platform_device *dev) | |||
101 | if (physmap_data == NULL) | 91 | if (physmap_data == NULL) |
102 | return -ENODEV; | 92 | return -ENODEV; |
103 | 93 | ||
104 | info = kzalloc(sizeof(struct physmap_flash_info), GFP_KERNEL); | 94 | info = devm_kzalloc(&dev->dev, sizeof(struct physmap_flash_info), |
95 | GFP_KERNEL); | ||
105 | if (info == NULL) { | 96 | if (info == NULL) { |
106 | err = -ENOMEM; | 97 | err = -ENOMEM; |
107 | goto err_out; | 98 | goto err_out; |
@@ -114,10 +105,10 @@ static int physmap_flash_probe(struct platform_device *dev) | |||
114 | (unsigned long long)(dev->resource[i].end - dev->resource[i].start + 1), | 105 | (unsigned long long)(dev->resource[i].end - dev->resource[i].start + 1), |
115 | (unsigned long long)dev->resource[i].start); | 106 | (unsigned long long)dev->resource[i].start); |
116 | 107 | ||
117 | info->res = request_mem_region(dev->resource[i].start, | 108 | if (!devm_request_mem_region(&dev->dev, |
118 | dev->resource[i].end - dev->resource[i].start + 1, | 109 | dev->resource[i].start, |
119 | dev->dev.bus_id); | 110 | dev->resource[i].end - dev->resource[i].start + 1, |
120 | if (info->res == NULL) { | 111 | dev->dev.bus_id)) { |
121 | dev_err(&dev->dev, "Could not reserve memory region\n"); | 112 | dev_err(&dev->dev, "Could not reserve memory region\n"); |
122 | err = -ENOMEM; | 113 | err = -ENOMEM; |
123 | goto err_out; | 114 | goto err_out; |
@@ -129,7 +120,8 @@ static int physmap_flash_probe(struct platform_device *dev) | |||
129 | info->map[i].bankwidth = physmap_data->width; | 120 | info->map[i].bankwidth = physmap_data->width; |
130 | info->map[i].set_vpp = physmap_data->set_vpp; | 121 | info->map[i].set_vpp = physmap_data->set_vpp; |
131 | 122 | ||
132 | info->map[i].virt = ioremap(info->map[i].phys, info->map[i].size); | 123 | info->map[i].virt = devm_ioremap(&dev->dev, info->map[i].phys, |
124 | info->map[i].size); | ||
133 | if (info->map[i].virt == NULL) { | 125 | if (info->map[i].virt == NULL) { |
134 | dev_err(&dev->dev, "Failed to ioremap flash region\n"); | 126 | dev_err(&dev->dev, "Failed to ioremap flash region\n"); |
135 | err = EIO; | 127 | err = EIO; |
diff --git a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c index 024e3fffd4bb..a83192f80eba 100644 --- a/drivers/mtd/nand/fsl_upm.c +++ b/drivers/mtd/nand/fsl_upm.c | |||
@@ -163,9 +163,11 @@ static int __devinit fun_chip_init(struct fsl_upm_nand *fun, | |||
163 | ret = parse_mtd_partitions(&fun->mtd, part_types, &fun->parts, 0); | 163 | ret = parse_mtd_partitions(&fun->mtd, part_types, &fun->parts, 0); |
164 | 164 | ||
165 | #ifdef CONFIG_MTD_OF_PARTS | 165 | #ifdef CONFIG_MTD_OF_PARTS |
166 | if (ret == 0) | 166 | if (ret == 0) { |
167 | ret = of_mtd_parse_partitions(fun->dev, &fun->mtd, | 167 | ret = of_mtd_parse_partitions(fun->dev, flash_np, &fun->parts); |
168 | flash_np, &fun->parts); | 168 | if (ret < 0) |
169 | goto err; | ||
170 | } | ||
169 | #endif | 171 | #endif |
170 | if (ret > 0) | 172 | if (ret > 0) |
171 | ret = add_mtd_partitions(&fun->mtd, fun->parts, ret); | 173 | ret = add_mtd_partitions(&fun->mtd, fun->parts, ret); |
diff --git a/drivers/mtd/nand/pasemi_nand.c b/drivers/mtd/nand/pasemi_nand.c index 75c899039023..9bd6c9ac8443 100644 --- a/drivers/mtd/nand/pasemi_nand.c +++ b/drivers/mtd/nand/pasemi_nand.c | |||
@@ -141,6 +141,7 @@ static int __devinit pasemi_nand_probe(struct of_device *ofdev, | |||
141 | } | 141 | } |
142 | 142 | ||
143 | lpcctl = pci_resource_start(pdev, 0); | 143 | lpcctl = pci_resource_start(pdev, 0); |
144 | pci_dev_put(pdev); | ||
144 | 145 | ||
145 | if (!request_region(lpcctl, 4, driver_name)) { | 146 | if (!request_region(lpcctl, 4, driver_name)) { |
146 | err = -EBUSY; | 147 | err = -EBUSY; |
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c index c0fa9c9edf08..15f0a26730ae 100644 --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c | |||
@@ -269,6 +269,7 @@ static struct pxa3xx_nand_timing stm2GbX16_timing = { | |||
269 | 269 | ||
270 | static struct pxa3xx_nand_flash stm2GbX16 = { | 270 | static struct pxa3xx_nand_flash stm2GbX16 = { |
271 | .timing = &stm2GbX16_timing, | 271 | .timing = &stm2GbX16_timing, |
272 | .cmdset = &largepage_cmdset, | ||
272 | .page_per_block = 64, | 273 | .page_per_block = 64, |
273 | .page_size = 2048, | 274 | .page_size = 2048, |
274 | .flash_width = 16, | 275 | .flash_width = 16, |
diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c index e39b21d3e168..a7e4d985f5ef 100644 --- a/drivers/mtd/onenand/omap2.c +++ b/drivers/mtd/onenand/omap2.c | |||
@@ -32,19 +32,18 @@ | |||
32 | #include <linux/platform_device.h> | 32 | #include <linux/platform_device.h> |
33 | #include <linux/interrupt.h> | 33 | #include <linux/interrupt.h> |
34 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
35 | #include <linux/dma-mapping.h> | ||
36 | #include <linux/io.h> | ||
35 | 37 | ||
36 | #include <asm/io.h> | ||
37 | #include <asm/mach/flash.h> | 38 | #include <asm/mach/flash.h> |
38 | #include <asm/arch/gpmc.h> | 39 | #include <mach/gpmc.h> |
39 | #include <asm/arch/onenand.h> | 40 | #include <mach/onenand.h> |
40 | #include <asm/arch/gpio.h> | 41 | #include <mach/gpio.h> |
41 | #include <asm/arch/pm.h> | 42 | #include <mach/pm.h> |
42 | 43 | ||
43 | #include <linux/dma-mapping.h> | 44 | #include <mach/dma.h> |
44 | #include <asm/dma-mapping.h> | ||
45 | #include <asm/arch/dma.h> | ||
46 | 45 | ||
47 | #include <asm/arch/board.h> | 46 | #include <mach/board.h> |
48 | 47 | ||
49 | #define DRIVER_NAME "omap2-onenand" | 48 | #define DRIVER_NAME "omap2-onenand" |
50 | 49 | ||