Skip to content

Commit 8c64038

Browse files
David BrownellDavid Woodhouse
authored andcommitted
[MTD] make dataflash write-verify be optional
This adds a WRITE_VERIFY Kconfig option to the DataFlash driver, closely mirroring the similar NAND and ONENAND options, giving an option to disable some code that's currently always enabled. Removing this step probably saves a millisecond or so per page when writing data, which will add up quickly since these pages are small (the largest is 1 KiB). It doesn't seem to add a lot in terms of reliability, and wouldn't detect errors which crop up when transferring data to the on-chip SRAM buffer. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com> Acked-by: Andrew Victor <linux@maxim.org.za> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
1 parent cf93ae0 commit 8c64038

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

drivers/mtd/devices/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ config MTD_DATAFLASH
5959
Sometimes DataFlash chips are packaged inside MMC-format
6060
cards; at this writing, the MMC stack won't handle those.
6161

62+
config MTD_DATAFLASH_WRITE_VERIFY
63+
bool "Verify DataFlash page writes"
64+
depends on MTD_DATAFLASH
65+
help
66+
This adds an extra check when data is written to the flash.
67+
It may help if you are verifying chip setup (timings etc) on
68+
your board. There is a rare possibility that even though the
69+
device thinks the write was successful, a bit could have been
70+
flipped accidentally due to device wear or something else.
71+
6272
config MTD_DATAFLASH_OTP
6373
bool "DataFlash OTP support (Security Register)"
6474
depends on MTD_DATAFLASH

drivers/mtd/devices/mtd_dataflash.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,10 @@
3030
* doesn't (yet) use these for any kind of i/o overlap or prefetching.
3131
*
3232
* Sometimes DataFlash is packaged in MMC-format cards, although the
33-
* MMC stack can't use SPI (yet), or distinguish between MMC and DataFlash
33+
* MMC stack can't (yet?) distinguish between MMC and DataFlash
3434
* protocols during enumeration.
3535
*/
3636

37-
#define CONFIG_DATAFLASH_WRITE_VERIFY
38-
3937
/* reads can bypass the buffers */
4038
#define OP_READ_CONTINUOUS 0xE8
4139
#define OP_READ_PAGE 0xD2
@@ -403,7 +401,7 @@ static int dataflash_write(struct mtd_info *mtd, loff_t to, size_t len,
403401
(void) dataflash_waitready(priv->spi);
404402

405403

406-
#ifdef CONFIG_DATAFLASH_WRITE_VERIFY
404+
#ifdef CONFIG_MTD_DATAFLASH_VERIFY_WRITE
407405

408406
/* (3) Compare to Buffer1 */
409407
addr = pageaddr << priv->page_offset;
@@ -432,7 +430,7 @@ static int dataflash_write(struct mtd_info *mtd, loff_t to, size_t len,
432430
} else
433431
status = 0;
434432

435-
#endif /* CONFIG_DATAFLASH_WRITE_VERIFY */
433+
#endif /* CONFIG_MTD_DATAFLASH_VERIFY_WRITE */
436434

437435
remaining = remaining - writelen;
438436
pageaddr++;

0 commit comments

Comments
 (0)