mtd: cfi: add writebufsize initialization
authorAnatolij Gustschin <agust@denx.de>
Thu, 16 Dec 2010 22:42:15 +0000 (23:42 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Thu, 6 Jan 2011 15:35:53 +0000 (15:35 +0000)
Initialize mtd->writebufsize to the value obtained
by CFI query command at probe time.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
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 44cbfc093ecc03f75a51b77fc37e295610dc82e6..a8c3e1c9b02a78a64a79f5701abac9d1ba29a3e4 100644 (file)
@@ -455,6 +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->reboot_notifier.notifier_call = cfi_intelext_reboot;
 
index a43ab45bdb180625293e8c6e6c7d018d7bd607b5..f072fcfde04ee86fd5133b83c720b73cac2071d7 100644 (file)
@@ -440,6 +440,10 @@ 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;
+
+       DEBUG(MTD_DEBUG_LEVEL3, "MTD %s(): write buffer size %d\n",
+               __func__, mtd->writebufsize);
 
        mtd->reboot_notifier.notifier_call = cfi_amdstd_reboot;
 
index 314af1f5a370ec9d522820842f0054536dea0111..c04b7658abe90c39c6942e2d9d1b18a0ce7219f5 100644 (file)
@@ -238,6 +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;
        map->fldrv = &cfi_staa_chipdrv;
        __module_get(THIS_MODULE);
        mtd->name = map->name;