]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[MTD] assume mtd->writesize is 1 for NOR flashes
authorArtem B. Bityutskiy <dedekind@sauron.oktetlabs.ru>
Wed, 14 Jun 2006 15:53:44 +0000 (19:53 +0400)
committerArtem B. Bityutskiy <dedekind@sauron.oktetlabs.ru>
Wed, 14 Jun 2006 15:53:44 +0000 (19:53 +0400)
Signed-off-by: Artem B. Bityitskiy
drivers/mtd/chips/amd_flash.c
drivers/mtd/chips/cfi_cmdset_0002.c
drivers/mtd/chips/sharp.c
drivers/mtd/devices/lart.c
drivers/mtd/devices/m25p80.c
drivers/mtd/devices/mtdram.c
drivers/mtd/mtdcore.c
include/linux/mtd/mtd.h

index 9e466509a23df0f7aad2f4b6949f397196daa187..16eaca69fb5aff52137560149b4409217463f47b 100644 (file)
@@ -730,6 +730,7 @@ static struct mtd_info *amd_flash_probe(struct map_info *map)
                offset += dev_size;
        }
        mtd->type = MTD_NORFLASH;
+       mtd->writesize = 1;
        mtd->flags = MTD_CAP_NORFLASH;
        mtd->name = map->name;
        mtd->erase = amd_flash_erase;
index 3aeb0c79e714fe454ae6006a13b9625c67b24c19..1e01ad38b26e91d0f17c60e74d6987c6833afba1 100644 (file)
@@ -236,6 +236,7 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
        mtd->resume  = cfi_amdstd_resume;
        mtd->flags   = MTD_CAP_NORFLASH;
        mtd->name    = map->name;
+       mtd->writesize = 1;
 
        if (cfi->cfi_mode==CFI_MODE_CFI){
                unsigned char bootloc;
index 3cc0b23c5865cd3cd3fb1ffe5ad4496e7b5aeb59..967abbecdff9bb450aab9852e28c5ee84d39dcc7 100644 (file)
@@ -140,6 +140,7 @@ static struct mtd_info *sharp_probe(struct map_info *map)
        mtd->suspend = sharp_suspend;
        mtd->resume = sharp_resume;
        mtd->flags = MTD_CAP_NORFLASH;
+       mtd->writesize = 1;
        mtd->name = map->name;
 
        memset(sharp, 0, sizeof(*sharp));
index 29b0ddaa324e417abf153460d7d94fb67823a6ef..4ea50a1dda8570a1606abbbd623c93f011df2bb7 100644 (file)
@@ -635,6 +635,7 @@ int __init lart_flash_init (void)
    printk ("%s: This looks like a LART board to me.\n",module_name);
    mtd.name = module_name;
    mtd.type = MTD_NORFLASH;
+   mtd.writesize = 1;
    mtd.flags = MTD_CAP_NORFLASH;
    mtd.size = FLASH_BLOCKSIZE_PARAM * FLASH_NUMBLOCKS_16m_PARAM + FLASH_BLOCKSIZE_MAIN * FLASH_NUMBLOCKS_16m_MAIN;
    mtd.erasesize = FLASH_BLOCKSIZE_MAIN;
index 04e65d5dae000f9b3d4f0c94c114da26169d2548..a8466141e914d3f5f94c0adec075b4a4f0099cef 100644 (file)
@@ -465,6 +465,7 @@ static int __devinit m25p_probe(struct spi_device *spi)
                flash->mtd.name = spi->dev.bus_id;
 
        flash->mtd.type = MTD_NORFLASH;
+       flash->mtd.writesize = 1;
        flash->mtd.flags = MTD_CAP_NORFLASH;
        flash->mtd.size = info->sector_size * info->n_sectors;
        flash->mtd.erasesize = info->sector_size;
index f284c9670be854d8f55ba878bbe83b0f4382a601..8ab4b931215ffba1947cf18b092397e9e4a41284 100644 (file)
@@ -106,6 +106,7 @@ int mtdram_init_device(struct mtd_info *mtd, void *mapped_address,
        mtd->type = MTD_GENERIC_TYPE;
        mtd->flags = MTD_CAP_RAM;
        mtd->size = size;
+       mtd->writesize = 1;
        mtd->erasesize = MTDRAM_ERASE_SIZE;
        mtd->priv = mapped_address;
 
index 49bc9fdcb88b1ccf8225c4023fd76aabf84c3617..16a952dd486a90277580d0eb30493a7bb5fda458 100644 (file)
@@ -47,6 +47,7 @@ int add_mtd_device(struct mtd_info *mtd)
 {
        int i;
 
+       BUG_ON(mtd->writesize == 0);
        mutex_lock(&mtd_table_mutex);
 
        for (i=0; i < MAX_MTD_DEVICES; i++)
index 9536567d041bd6b58b95a3aaa0bb02163b6eaceb..e1d2a3d56546341925a1ebb5993a3f28b8554ffa 100644 (file)
@@ -110,9 +110,12 @@ struct mtd_info {
         * information below if they desire
         */
        u_int32_t erasesize;
-       /* Smallest availlable size for writing to the device.  For NAND,
-        * this is the page size, for some NOR chips, the size of ECC
-        * covered blocks.
+       /* Minimal writable flash unit size. In case of NOR flash it is 1 (even
+        * though individual bits can be cleared), in case of NAND flash it is
+        * one NAND page (or half, or one-fourths of it), in case of ECC-ed NOR
+        * it is of ECC block size, etc. It is illegal to have writesize = 0.
+        * Any driver registering a struct mtd_info must ensure a writesize of
+        * 1 or larger.
         */
        u_int32_t writesize;