aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mtd
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@free-electrons.com>2016-09-15 04:32:50 -0400
committerBoris Brezillon <boris.brezillon@free-electrons.com>2016-09-23 03:35:16 -0400
commitd8e725dd831186a3595036b2b1df9f68cbc6efa3 (patch)
treeb6632089aafbf8b55a65c8abbf57e486da6e5afa /include/linux/mtd
parent6e1f9708dbf3c50a8da93c1952a01a7a2acb5e66 (diff)
mtd: nand: automate NAND timings selection
The NAND framework provides several helpers to query timing modes supported by a NAND chip, but this implies that all NAND controller drivers have to implement the same timings selection dance. Also currently NAND devices can be resetted at arbitrary places which also resets the timing for ONFI chips to timing mode 0. Provide a common logic to select the best timings based on ONFI or ->onfi_timing_mode_default information. Hook this into nand_reset() to make sure the new timing is applied each time during a reset. NAND controller willing to support timings adjustment should just implement the ->setup_data_interface() method. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/linux/mtd')
-rw-r--r--include/linux/mtd/nand.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 0c9412c2d80b..d3e3f8d03336 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -751,10 +751,9 @@ nand_get_sdr_timings(const struct nand_data_interface *conf)
751 * also from the datasheet. It is the recommended ECC step 751 * also from the datasheet. It is the recommended ECC step
752 * size, if known; if unknown, set to zero. 752 * size, if known; if unknown, set to zero.
753 * @onfi_timing_mode_default: [INTERN] default ONFI timing mode. This field is 753 * @onfi_timing_mode_default: [INTERN] default ONFI timing mode. This field is
754 * either deduced from the datasheet if the NAND 754 * set to the actually used ONFI mode if the chip is
755 * chip is not ONFI compliant or set to 0 if it is 755 * ONFI compliant or deduced from the datasheet if
756 * (an ONFI chip is always configured in mode 0 756 * the NAND chip is not ONFI compliant.
757 * after a NAND reset)
758 * @numchips: [INTERN] number of physical chips 757 * @numchips: [INTERN] number of physical chips
759 * @chipsize: [INTERN] the size of one chip for multichip arrays 758 * @chipsize: [INTERN] the size of one chip for multichip arrays
760 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1 759 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1
@@ -774,6 +773,7 @@ nand_get_sdr_timings(const struct nand_data_interface *conf)
774 * @read_retries: [INTERN] the number of read retry modes supported 773 * @read_retries: [INTERN] the number of read retry modes supported
775 * @onfi_set_features: [REPLACEABLE] set the features for ONFI nand 774 * @onfi_set_features: [REPLACEABLE] set the features for ONFI nand
776 * @onfi_get_features: [REPLACEABLE] get the features for ONFI nand 775 * @onfi_get_features: [REPLACEABLE] get the features for ONFI nand
776 * @setup_data_interface: [OPTIONAL] setup the data interface and timing
777 * @bbt: [INTERN] bad block table pointer 777 * @bbt: [INTERN] bad block table pointer
778 * @bbt_td: [REPLACEABLE] bad block table descriptor for flash 778 * @bbt_td: [REPLACEABLE] bad block table descriptor for flash
779 * lookup. 779 * lookup.
@@ -820,6 +820,10 @@ struct nand_chip {
820 int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip, 820 int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip,
821 int feature_addr, uint8_t *subfeature_para); 821 int feature_addr, uint8_t *subfeature_para);
822 int (*setup_read_retry)(struct mtd_info *mtd, int retry_mode); 822 int (*setup_read_retry)(struct mtd_info *mtd, int retry_mode);
823 int (*setup_data_interface)(struct mtd_info *mtd,
824 const struct nand_data_interface *conf,
825 bool check_only);
826
823 827
824 int chip_delay; 828 int chip_delay;
825 unsigned int options; 829 unsigned int options;
@@ -849,6 +853,8 @@ struct nand_chip {
849 struct nand_jedec_params jedec_params; 853 struct nand_jedec_params jedec_params;
850 }; 854 };
851 855
856 struct nand_data_interface *data_interface;
857
852 int read_retries; 858 int read_retries;
853 859
854 flstate_t state; 860 flstate_t state;