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

+42 -43
+16 -12
drivers/mtd/devices/m25p80.c
··· 37 37 #define OPCODE_NORM_READ 0x03 /* Read data bytes (low frequency) */ 38 38 #define OPCODE_FAST_READ 0x0b /* Read data bytes (high frequency) */ 39 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 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 43 #define OPCODE_SE 0xd8 /* Sector erase (usually 64KiB) */ 44 44 #define OPCODE_RDID 0x9f /* Read JEDEC ID */ 45 45 ··· 167 167 * 168 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 172 DEBUG(MTD_DEBUG_LEVEL3, "%s: %s %dKiB\n", 173 173 flash->spi->dev.bus_id, __func__, ··· 181 181 write_enable(flash); 182 182 183 183 /* Set up command buffer. */ 184 - flash->command[0] = OPCODE_BE; 184 + flash->command[0] = OPCODE_CHIP_ERASE; 185 185 186 186 spi_write(flash->spi, flash->command, 1); 187 187 ··· 250 250 251 251 mutex_lock(&flash->lock); 252 252 253 - /* REVISIT in some cases we could speed up erasing large regions 254 - * by using OPCODE_SE instead of OPCODE_BE_4K 255 - */ 256 - 257 - /* now erase those sectors */ 258 - if (len == flash->mtd.size && erase_block(flash)) { 253 + /* whole-chip erase? */ 254 + if (len == flash->mtd.size && erase_chip(flash)) { 259 255 instr->state = MTD_ERASE_FAILED; 260 256 mutex_unlock(&flash->lock); 261 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 265 } else { 263 266 while (len) { 264 267 if (erase_sector(flash, addr)) { ··· 577 574 for (tmp = 0, info = m25p_data; 578 575 tmp < ARRAY_SIZE(m25p_data); 579 576 tmp++, info++) { 580 - if (info->jedec_id == jedec) 581 - if (ext_jedec != 0 && info->ext_id != ext_jedec) 577 + if (info->jedec_id == jedec) { 578 + if (info->ext_id != 0 && info->ext_id != ext_jedec) 582 579 continue; 583 580 return info; 581 + } 584 582 } 585 583 dev_err(&spi->dev, "unrecognized JEDEC id %06x\n", jedec); 586 584 return NULL;
+9 -17
drivers/mtd/maps/physmap.c
··· 19 19 #include <linux/mtd/partitions.h> 20 20 #include <linux/mtd/physmap.h> 21 21 #include <linux/mtd/concat.h> 22 - #include <asm/io.h> 22 + #include <linux/io.h> 23 23 24 24 #define MAX_RESOURCES 4 25 25 ··· 27 27 struct mtd_info *mtd[MAX_RESOURCES]; 28 28 struct mtd_info *cmtd; 29 29 struct map_info map[MAX_RESOURCES]; 30 - struct resource *res; 31 30 #ifdef CONFIG_MTD_PARTITIONS 32 31 int nr_parts; 33 32 struct mtd_partition *parts; ··· 69 70 #endif 70 71 map_destroy(info->mtd[i]); 71 72 } 72 - 73 - if (info->map[i].virt != NULL) 74 - iounmap(info->map[i].virt); 75 73 } 76 - 77 - if (info->res != NULL) { 78 - release_resource(info->res); 79 - kfree(info->res); 80 - } 81 - 82 74 return 0; 83 75 } 84 76 ··· 91 101 if (physmap_data == NULL) 92 102 return -ENODEV; 93 103 94 - info = kzalloc(sizeof(struct physmap_flash_info), GFP_KERNEL); 104 + info = devm_kzalloc(&dev->dev, sizeof(struct physmap_flash_info), 105 + GFP_KERNEL); 95 106 if (info == NULL) { 96 107 err = -ENOMEM; 97 108 goto err_out; ··· 105 114 (unsigned long long)(dev->resource[i].end - dev->resource[i].start + 1), 106 115 (unsigned long long)dev->resource[i].start); 107 116 108 - info->res = request_mem_region(dev->resource[i].start, 109 - dev->resource[i].end - dev->resource[i].start + 1, 110 - dev->dev.bus_id); 111 - if (info->res == NULL) { 117 + if (!devm_request_mem_region(&dev->dev, 118 + dev->resource[i].start, 119 + dev->resource[i].end - dev->resource[i].start + 1, 120 + dev->dev.bus_id)) { 112 121 dev_err(&dev->dev, "Could not reserve memory region\n"); 113 122 err = -ENOMEM; 114 123 goto err_out; ··· 120 129 info->map[i].bankwidth = physmap_data->width; 121 130 info->map[i].set_vpp = physmap_data->set_vpp; 122 131 123 - info->map[i].virt = ioremap(info->map[i].phys, info->map[i].size); 132 + info->map[i].virt = devm_ioremap(&dev->dev, info->map[i].phys, 133 + info->map[i].size); 124 134 if (info->map[i].virt == NULL) { 125 135 dev_err(&dev->dev, "Failed to ioremap flash region\n"); 126 136 err = EIO;
+5 -3
drivers/mtd/nand/fsl_upm.c
··· 163 163 ret = parse_mtd_partitions(&fun->mtd, part_types, &fun->parts, 0); 164 164 165 165 #ifdef CONFIG_MTD_OF_PARTS 166 - if (ret == 0) 167 - ret = of_mtd_parse_partitions(fun->dev, &fun->mtd, 168 - flash_np, &fun->parts); 166 + if (ret == 0) { 167 + ret = of_mtd_parse_partitions(fun->dev, flash_np, &fun->parts); 168 + if (ret < 0) 169 + goto err; 170 + } 169 171 #endif 170 172 if (ret > 0) 171 173 ret = add_mtd_partitions(&fun->mtd, fun->parts, ret);
+1
drivers/mtd/nand/pasemi_nand.c
··· 141 141 } 142 142 143 143 lpcctl = pci_resource_start(pdev, 0); 144 + pci_dev_put(pdev); 144 145 145 146 if (!request_region(lpcctl, 4, driver_name)) { 146 147 err = -EBUSY;
+1
drivers/mtd/nand/pxa3xx_nand.c
··· 269 269 270 270 static struct pxa3xx_nand_flash stm2GbX16 = { 271 271 .timing = &stm2GbX16_timing, 272 + .cmdset = &largepage_cmdset, 272 273 .page_per_block = 64, 273 274 .page_size = 2048, 274 275 .flash_width = 16,
+10 -11
drivers/mtd/onenand/omap2.c
··· 32 32 #include <linux/platform_device.h> 33 33 #include <linux/interrupt.h> 34 34 #include <linux/delay.h> 35 - 36 - #include <asm/io.h> 37 - #include <asm/mach/flash.h> 38 - #include <asm/arch/gpmc.h> 39 - #include <asm/arch/onenand.h> 40 - #include <asm/arch/gpio.h> 41 - #include <asm/arch/pm.h> 42 - 43 35 #include <linux/dma-mapping.h> 44 - #include <asm/dma-mapping.h> 45 - #include <asm/arch/dma.h> 36 + #include <linux/io.h> 46 37 47 - #include <asm/arch/board.h> 38 + #include <asm/mach/flash.h> 39 + #include <mach/gpmc.h> 40 + #include <mach/onenand.h> 41 + #include <mach/gpio.h> 42 + #include <mach/pm.h> 43 + 44 + #include <mach/dma.h> 45 + 46 + #include <mach/board.h> 48 47 49 48 #define DRIVER_NAME "omap2-onenand" 50 49