diff options
author | Boris BREZILLON <boris.brezillon@free-electrons.com> | 2014-09-22 14:11:50 -0400 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2014-09-22 14:29:57 -0400 |
commit | 57a94e24bc927f642f7f48ca1bf5476aa5be269d (patch) | |
tree | 15c21381e30271c677de35583c0032ad4b8bbc05 | |
parent | e5bffb59cfbb3371ff00a165a5a48c1f3fdf125a (diff) |
mtd: nand: support ONFI timing mode retrieval for non-ONFI NANDs
Add an onfi_timing_mode_default field to nand_chip and nand_flash_dev in
order to support NAND timings definition for non-ONFI NAND.
NAND that support better timings mode than the default one have to define
a new entry in the nand_ids table.
The default timing mode should be deduced from timings description from
the datasheet and the ONFI specification
(www.onfi.org/~/media/ONFI/specs/onfi_3_1_spec.pdf, chapter 4.15
"Timing Parameters").
You should choose the closest mode that fit the timings requirements of
your NAND chip.
Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 2 | ||||
-rw-r--r-- | include/linux/mtd/nand.h | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 801cad1de9eb..5b5c62712814 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -3594,6 +3594,8 @@ static bool find_full_id_nand(struct mtd_info *mtd, struct nand_chip *chip, | |||
3594 | chip->options |= type->options; | 3594 | chip->options |= type->options; |
3595 | chip->ecc_strength_ds = NAND_ECC_STRENGTH(type); | 3595 | chip->ecc_strength_ds = NAND_ECC_STRENGTH(type); |
3596 | chip->ecc_step_ds = NAND_ECC_STEP(type); | 3596 | chip->ecc_step_ds = NAND_ECC_STEP(type); |
3597 | chip->onfi_timing_mode_default = | ||
3598 | type->onfi_timing_mode_default; | ||
3597 | 3599 | ||
3598 | *busw = type->options & NAND_BUSWIDTH_16; | 3600 | *busw = type->options & NAND_BUSWIDTH_16; |
3599 | 3601 | ||
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 8acb307b6fde..e4d451e4600b 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -587,6 +587,11 @@ struct nand_buffers { | |||
587 | * @ecc_step_ds: [INTERN] ECC step required by the @ecc_strength_ds, | 587 | * @ecc_step_ds: [INTERN] ECC step required by the @ecc_strength_ds, |
588 | * also from the datasheet. It is the recommended ECC step | 588 | * also from the datasheet. It is the recommended ECC step |
589 | * size, if known; if unknown, set to zero. | 589 | * size, if known; if unknown, set to zero. |
590 | * @onfi_timing_mode_default: [INTERN] default ONFI timing mode. This field is | ||
591 | * either deduced from the datasheet if the NAND | ||
592 | * chip is not ONFI compliant or set to 0 if it is | ||
593 | * (an ONFI chip is always configured in mode 0 | ||
594 | * after a NAND reset) | ||
590 | * @numchips: [INTERN] number of physical chips | 595 | * @numchips: [INTERN] number of physical chips |
591 | * @chipsize: [INTERN] the size of one chip for multichip arrays | 596 | * @chipsize: [INTERN] the size of one chip for multichip arrays |
592 | * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1 | 597 | * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1 |
@@ -671,6 +676,7 @@ struct nand_chip { | |||
671 | uint8_t bits_per_cell; | 676 | uint8_t bits_per_cell; |
672 | uint16_t ecc_strength_ds; | 677 | uint16_t ecc_strength_ds; |
673 | uint16_t ecc_step_ds; | 678 | uint16_t ecc_step_ds; |
679 | int onfi_timing_mode_default; | ||
674 | int badblockpos; | 680 | int badblockpos; |
675 | int badblockbits; | 681 | int badblockbits; |
676 | 682 | ||
@@ -773,6 +779,10 @@ struct nand_chip { | |||
773 | * @ecc_step_ds in nand_chip{}, also from the datasheet. | 779 | * @ecc_step_ds in nand_chip{}, also from the datasheet. |
774 | * For example, the "4bit ECC for each 512Byte" can be set with | 780 | * For example, the "4bit ECC for each 512Byte" can be set with |
775 | * NAND_ECC_INFO(4, 512). | 781 | * NAND_ECC_INFO(4, 512). |
782 | * @onfi_timing_mode_default: the default ONFI timing mode entered after a NAND | ||
783 | * reset. Should be deduced from timings described | ||
784 | * in the datasheet. | ||
785 | * | ||
776 | */ | 786 | */ |
777 | struct nand_flash_dev { | 787 | struct nand_flash_dev { |
778 | char *name; | 788 | char *name; |
@@ -793,6 +803,7 @@ struct nand_flash_dev { | |||
793 | uint16_t strength_ds; | 803 | uint16_t strength_ds; |
794 | uint16_t step_ds; | 804 | uint16_t step_ds; |
795 | } ecc; | 805 | } ecc; |
806 | int onfi_timing_mode_default; | ||
796 | }; | 807 | }; |
797 | 808 | ||
798 | /** | 809 | /** |