mtd: cfi: fix writebufsize initialization
authorAnatolij Gustschin <agust@denx.de>
Thu, 10 Feb 2011 15:01:46 +0000 (16:01 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Fri, 11 Mar 2011 14:22:46 +0000 (14:22 +0000)
When initializing mtd->writebufsize, we must take into account
possible flash chip interleaving. Wrong writebufsize initialization
caused UBIFS recovery issues resulting in unmountable UBIFS file
system on NOR flash partitions.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Acked-by: Guillaume LECERF <glecerf@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/chips/cfi_cmdset_0001.c
drivers/mtd/chips/cfi_cmdset_0002.c
drivers/mtd/chips/cfi_cmdset_0020.c

index 4aaa88f8ab5f0323f015dd34c46c4d0f98703ada..092aef11120cb70f13129a29788eb95a1eabbe8c 100644 (file)
@@ -455,7 +455,7 @@ struct mtd_info *cfi_cmdset_0001(struct map_info *map, int primary)
        mtd->flags   = MTD_CAP_NORFLASH;
        mtd->name    = map->name;
        mtd->writesize = 1;
-       mtd->writebufsize = 1 << cfi->cfiq->MaxBufWriteSize;
+       mtd->writebufsize = cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize;
 
        mtd->reboot_notifier.notifier_call = cfi_intelext_reboot;
 
index f072fcfde04ee86fd5133b83c720b73cac2071d7..7e9c4e9c274a46b4bbabf74c4722e4eaa9dc34ce 100644 (file)
@@ -440,7 +440,7 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
        mtd->flags   = MTD_CAP_NORFLASH;
        mtd->name    = map->name;
        mtd->writesize = 1;
-       mtd->writebufsize = 1 << cfi->cfiq->MaxBufWriteSize;
+       mtd->writebufsize = cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize;
 
        DEBUG(MTD_DEBUG_LEVEL3, "MTD %s(): write buffer size %d\n",
                __func__, mtd->writebufsize);
index c04b7658abe90c39c6942e2d9d1b18a0ce7219f5..ed56ad3884fbc5d88ef97c46e046da4d7afab3a8 100644 (file)
@@ -238,7 +238,7 @@ static struct mtd_info *cfi_staa_setup(struct map_info *map)
        mtd->resume = cfi_staa_resume;
        mtd->flags = MTD_CAP_NORFLASH & ~MTD_BIT_WRITEABLE;
        mtd->writesize = 8; /* FIXME: Should be 0 for STMicro flashes w/out ECC */
-       mtd->writebufsize = 1 << cfi->cfiq->MaxBufWriteSize;
+       mtd->writebufsize = cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize;
        map->fldrv = &cfi_staa_chipdrv;
        __module_get(THIS_MODULE);
        mtd->name = map->name;