diff options
| author | Brian Norris <computersforpeace@gmail.com> | 2014-01-03 18:13:33 -0500 |
|---|---|---|
| committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:57:21 -0400 |
| commit | c8abcf2e2e0ecec88d2fc91fcfcaa0ced83cf55d (patch) | |
| tree | 3c4e10d922d0cffe0583656e0f7815fffdc975e0 /include/linux/mtd | |
| parent | 2c7c827e2f6ba24d0c26d3540cca8b10d2094e17 (diff) | |
mtd: nand: add generic READ RETRY support
Modern MLC (and even SLC?) NAND can experience a large number of
bitflips (beyond the recommended correctability capacity) due to drifts
in the voltage threshold (Vt). These bitflips can cause ECC errors to
occur well within the expected lifetime of the flash. To account for
this, some manufacturers provide a mechanism for shifting the Vt
threshold after a corrupted read.
The generic pattern seems to be that a particular flash has N read retry
modes (where N = 0, traditionally), and after an ECC failure, the host
should reconfigure the flash to use the next available mode, then retry
the read operation. This process repeats until all bitfips can be
corrected or until the host has tried all available retry modes.
This patch adds the infrastructure support for a
vendor-specific/flash-specific callback, used for setting the read-retry
mode (i.e., voltage threshold).
For now, this patch always returns the flash to mode 0 (the default
mode) after a successful read-retry, according to the flowchart found in
Micron's datasheets. This may need to change in the future if it is
determined that eventually, mode 0 is insufficient for the majority of
the flash cells (and so for performance reasons, we should leave the
flash in mode 1, 2, etc.).
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
Diffstat (limited to 'include/linux/mtd')
| -rw-r--r-- | include/linux/mtd/nand.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 309009b7764b..7fd717010ee2 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
| @@ -472,6 +472,8 @@ struct nand_buffers { | |||
| 472 | * commands to the chip. | 472 | * commands to the chip. |
| 473 | * @waitfunc: [REPLACEABLE] hardwarespecific function for wait on | 473 | * @waitfunc: [REPLACEABLE] hardwarespecific function for wait on |
| 474 | * ready. | 474 | * ready. |
| 475 | * @setup_read_retry: [FLASHSPECIFIC] flash (vendor) specific function for | ||
| 476 | * setting the read-retry mode. Mostly needed for MLC NAND. | ||
| 475 | * @ecc: [BOARDSPECIFIC] ECC control structure | 477 | * @ecc: [BOARDSPECIFIC] ECC control structure |
| 476 | * @buffers: buffer structure for read/write | 478 | * @buffers: buffer structure for read/write |
| 477 | * @hwcontrol: platform-specific hardware control structure | 479 | * @hwcontrol: platform-specific hardware control structure |
| @@ -518,6 +520,7 @@ struct nand_buffers { | |||
| 518 | * non 0 if ONFI supported. | 520 | * non 0 if ONFI supported. |
| 519 | * @onfi_params: [INTERN] holds the ONFI page parameter when ONFI is | 521 | * @onfi_params: [INTERN] holds the ONFI page parameter when ONFI is |
| 520 | * supported, 0 otherwise. | 522 | * supported, 0 otherwise. |
| 523 | * @read_retries: [INTERN] the number of read retry modes supported | ||
| 521 | * @onfi_set_features: [REPLACEABLE] set the features for ONFI nand | 524 | * @onfi_set_features: [REPLACEABLE] set the features for ONFI nand |
| 522 | * @onfi_get_features: [REPLACEABLE] get the features for ONFI nand | 525 | * @onfi_get_features: [REPLACEABLE] get the features for ONFI nand |
| 523 | * @bbt: [INTERN] bad block table pointer | 526 | * @bbt: [INTERN] bad block table pointer |
| @@ -565,6 +568,7 @@ struct nand_chip { | |||
| 565 | int feature_addr, uint8_t *subfeature_para); | 568 | int feature_addr, uint8_t *subfeature_para); |
| 566 | int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip, | 569 | int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip, |
| 567 | int feature_addr, uint8_t *subfeature_para); | 570 | int feature_addr, uint8_t *subfeature_para); |
| 571 | int (*setup_read_retry)(struct mtd_info *mtd, int retry_mode); | ||
| 568 | 572 | ||
| 569 | int chip_delay; | 573 | int chip_delay; |
| 570 | unsigned int options; | 574 | unsigned int options; |
| @@ -589,6 +593,8 @@ struct nand_chip { | |||
| 589 | int onfi_version; | 593 | int onfi_version; |
| 590 | struct nand_onfi_params onfi_params; | 594 | struct nand_onfi_params onfi_params; |
| 591 | 595 | ||
| 596 | int read_retries; | ||
| 597 | |||
| 592 | flstate_t state; | 598 | flstate_t state; |
| 593 | 599 | ||
| 594 | uint8_t *oob_poi; | 600 | uint8_t *oob_poi; |
