]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge git://git.infradead.org/mtd-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 9 Dec 2008 16:28:36 +0000 (08:28 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 9 Dec 2008 16:28:36 +0000 (08:28 -0800)
* 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

drivers/mtd/devices/m25p80.c
drivers/mtd/maps/physmap.c
drivers/mtd/nand/fsl_upm.c
drivers/mtd/nand/pasemi_nand.c
drivers/mtd/nand/pxa3xx_nand.c
drivers/mtd/onenand/omap2.c

index 76a76751da3660ce63123844d97eca891d2cbab2..6659b2275c0c6a5ce150906c25ac1d106700065a 100644 (file)
@@ -37,9 +37,9 @@
 #define        OPCODE_NORM_READ        0x03    /* Read data bytes (low frequency) */
 #define        OPCODE_FAST_READ        0x0b    /* Read data bytes (high frequency) */
 #define        OPCODE_PP               0x02    /* Page program (up to 256 bytes) */
-#define        OPCODE_BE_4K            0x20    /* Erase 4KiB block */
+#define        OPCODE_BE_4K            0x20    /* Erase 4KiB block */
 #define        OPCODE_BE_32K           0x52    /* Erase 32KiB block */
-#define        OPCODE_BE               0xc7    /* Erase whole flash block */
+#define        OPCODE_CHIP_ERASE       0xc7    /* Erase whole flash chip */
 #define        OPCODE_SE               0xd8    /* Sector erase (usually 64KiB) */
 #define        OPCODE_RDID             0x9f    /* Read JEDEC ID */
 
@@ -167,7 +167,7 @@ static int wait_till_ready(struct m25p *flash)
  *
  * Returns 0 if successful, non-zero otherwise.
  */
-static int erase_block(struct m25p *flash)
+static int erase_chip(struct m25p *flash)
 {
        DEBUG(MTD_DEBUG_LEVEL3, "%s: %s %dKiB\n",
                        flash->spi->dev.bus_id, __func__,
@@ -181,7 +181,7 @@ static int erase_block(struct m25p *flash)
        write_enable(flash);
 
        /* Set up command buffer. */
-       flash->command[0] = OPCODE_BE;
+       flash->command[0] = OPCODE_CHIP_ERASE;
 
        spi_write(flash->spi, flash->command, 1);
 
@@ -250,15 +250,18 @@ static int m25p80_erase(struct mtd_info *mtd, struct erase_info *instr)
 
        mutex_lock(&flash->lock);
 
-       /* REVISIT in some cases we could speed up erasing large regions
-        * by using OPCODE_SE instead of OPCODE_BE_4K
-        */
-
-       /* now erase those sectors */
-       if (len == flash->mtd.size && erase_block(flash)) {
+       /* whole-chip erase? */
+       if (len == flash->mtd.size && erase_chip(flash)) {
                instr->state = MTD_ERASE_FAILED;
                mutex_unlock(&flash->lock);
                return -EIO;
+
+       /* REVISIT in some cases we could speed up erasing large regions
+        * by using OPCODE_SE instead of OPCODE_BE_4K.  We may have set up
+        * to use "small sector erase", but that's not always optimal.
+        */
+
+       /* "sector"-at-a-time erase */
        } else {
                while (len) {
                        if (erase_sector(flash, addr)) {
@@ -574,10 +577,11 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
        for (tmp = 0, info = m25p_data;
                        tmp < ARRAY_SIZE(m25p_data);
                        tmp++, info++) {
-               if (info->jedec_id == jedec)
-                       if (ext_jedec != 0 && info->ext_id != ext_jedec)
+               if (info->jedec_id == jedec) {
+                       if (info->ext_id != 0 && info->ext_id != ext_jedec)
                                continue;
                        return info;
+               }
        }
        dev_err(&spi->dev, "unrecognized JEDEC id %06x\n", jedec);
        return NULL;
index 42d844f8f6bfef79bdfef42ed48b33368ac4ecd0..dfbf3f270cea9441a7261b69ca3c9f8aa9c87770 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/physmap.h>
 #include <linux/mtd/concat.h>
-#include <asm/io.h>
+#include <linux/io.h>
 
 #define MAX_RESOURCES          4
 
@@ -27,7 +27,6 @@ struct physmap_flash_info {
        struct mtd_info         *mtd[MAX_RESOURCES];
        struct mtd_info         *cmtd;
        struct map_info         map[MAX_RESOURCES];
-       struct resource         *res;
 #ifdef CONFIG_MTD_PARTITIONS
        int                     nr_parts;
        struct mtd_partition    *parts;
@@ -70,16 +69,7 @@ static int physmap_flash_remove(struct platform_device *dev)
 #endif
                        map_destroy(info->mtd[i]);
                }
-
-               if (info->map[i].virt != NULL)
-                       iounmap(info->map[i].virt);
-       }
-
-       if (info->res != NULL) {
-               release_resource(info->res);
-               kfree(info->res);
        }
-
        return 0;
 }
 
@@ -101,7 +91,8 @@ static int physmap_flash_probe(struct platform_device *dev)
        if (physmap_data == NULL)
                return -ENODEV;
 
-       info = kzalloc(sizeof(struct physmap_flash_info), GFP_KERNEL);
+       info = devm_kzalloc(&dev->dev, sizeof(struct physmap_flash_info),
+                           GFP_KERNEL);
        if (info == NULL) {
                err = -ENOMEM;
                goto err_out;
@@ -114,10 +105,10 @@ static int physmap_flash_probe(struct platform_device *dev)
                       (unsigned long long)(dev->resource[i].end - dev->resource[i].start + 1),
                       (unsigned long long)dev->resource[i].start);
 
-               info->res = request_mem_region(dev->resource[i].start,
-                                              dev->resource[i].end - dev->resource[i].start + 1,
-                                              dev->dev.bus_id);
-               if (info->res == NULL) {
+               if (!devm_request_mem_region(&dev->dev,
+                       dev->resource[i].start,
+                       dev->resource[i].end - dev->resource[i].start + 1,
+                       dev->dev.bus_id)) {
                        dev_err(&dev->dev, "Could not reserve memory region\n");
                        err = -ENOMEM;
                        goto err_out;
@@ -129,7 +120,8 @@ static int physmap_flash_probe(struct platform_device *dev)
                info->map[i].bankwidth = physmap_data->width;
                info->map[i].set_vpp = physmap_data->set_vpp;
 
-               info->map[i].virt = ioremap(info->map[i].phys, info->map[i].size);
+               info->map[i].virt = devm_ioremap(&dev->dev, info->map[i].phys,
+                                                info->map[i].size);
                if (info->map[i].virt == NULL) {
                        dev_err(&dev->dev, "Failed to ioremap flash region\n");
                        err = EIO;
index 024e3fffd4bb49b6176af4701c07e344120a3fc2..a83192f80eba5176b6bbad4649bd5996159b086a 100644 (file)
@@ -163,9 +163,11 @@ static int __devinit fun_chip_init(struct fsl_upm_nand *fun,
        ret = parse_mtd_partitions(&fun->mtd, part_types, &fun->parts, 0);
 
 #ifdef CONFIG_MTD_OF_PARTS
-       if (ret == 0)
-               ret = of_mtd_parse_partitions(fun->dev, &fun->mtd,
-                                             flash_np, &fun->parts);
+       if (ret == 0) {
+               ret = of_mtd_parse_partitions(fun->dev, flash_np, &fun->parts);
+               if (ret < 0)
+                       goto err;
+       }
 #endif
        if (ret > 0)
                ret = add_mtd_partitions(&fun->mtd, fun->parts, ret);
index 75c899039023051e9b0f8dda595d734ff9aebdc0..9bd6c9ac844396553cbbfcf026860ff4420bce25 100644 (file)
@@ -141,6 +141,7 @@ static int __devinit pasemi_nand_probe(struct of_device *ofdev,
        }
 
        lpcctl = pci_resource_start(pdev, 0);
+       pci_dev_put(pdev);
 
        if (!request_region(lpcctl, 4, driver_name)) {
                err = -EBUSY;
index c0fa9c9edf089c1a039ded475fb13740cfa52d1f..15f0a26730aea38e4c65708aac43473a8da02122 100644 (file)
@@ -269,6 +269,7 @@ static struct pxa3xx_nand_timing stm2GbX16_timing = {
 
 static struct pxa3xx_nand_flash stm2GbX16 = {
        .timing = &stm2GbX16_timing,
+       .cmdset = &largepage_cmdset,
        .page_per_block = 64,
        .page_size = 2048,
        .flash_width = 16,
index e39b21d3e168e5bb3cabf1a076193bca3f33bcab..a7e4d985f5ef553892a4fba5890647324f1c156c 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
+#include <linux/dma-mapping.h>
+#include <linux/io.h>
 
-#include <asm/io.h>
 #include <asm/mach/flash.h>
-#include <asm/arch/gpmc.h>
-#include <asm/arch/onenand.h>
-#include <asm/arch/gpio.h>
-#include <asm/arch/pm.h>
+#include <mach/gpmc.h>
+#include <mach/onenand.h>
+#include <mach/gpio.h>
+#include <mach/pm.h>
 
-#include <linux/dma-mapping.h>
-#include <asm/dma-mapping.h>
-#include <asm/arch/dma.h>
+#include <mach/dma.h>
 
-#include <asm/arch/board.h>
+#include <mach/board.h>
 
 #define DRIVER_NAME "omap2-onenand"