1 diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
2 index c2e1232..f561c68 100644
3 --- a/drivers/mtd/nand/nand_base.c
4 +++ b/drivers/mtd/nand/nand_base.c
5 @@ -3611,6 +3611,8 @@ static inline bool is_full_id_nand(struct nand_flash_dev *type)
6 static bool find_full_id_nand(struct mtd_info *mtd, struct nand_chip *chip,
7 struct nand_flash_dev *type, u8 *id_data, int *busw)
11 if (!strncmp(type->id, id_data, type->id_len)) {
12 mtd->writesize = type->pagesize;
13 mtd->erasesize = type->erasesize;
14 @@ -3621,8 +3623,9 @@ static bool find_full_id_nand(struct mtd_info *mtd, struct nand_chip *chip,
15 chip->options |= type->options;
16 chip->ecc_strength_ds = NAND_ECC_STRENGTH(type);
17 chip->ecc_step_ds = NAND_ECC_STEP(type);
18 - chip->onfi_timing_mode_default =
19 - type->onfi_timing_mode_default;
21 + mode = type->onfi_timing_mode_default;
22 + chip->sdr_timings = onfi_async_timing_mode_to_sdr_timings(mode);
24 *busw = type->options & NAND_BUSWIDTH_16;
26 diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
27 index 5095a32..72e4135 100644
28 --- a/drivers/mtd/nand/sunxi_nand.c
29 +++ b/drivers/mtd/nand/sunxi_nand.c
30 @@ -1083,7 +1083,7 @@ static int sunxi_nand_chip_init_timings(struct sunxi_nand_chip *chip,
32 mode = onfi_get_async_timing_mode(&chip->nand);
33 if (mode == ONFI_TIMING_MODE_UNKNOWN) {
34 - mode = chip->nand.onfi_timing_mode_default;
35 + timings = chip->nand.sdr_timings;
37 uint8_t feature[ONFI_SUBFEATURE_PARAM_LEN] = {};
39 @@ -1097,9 +1097,10 @@ static int sunxi_nand_chip_init_timings(struct sunxi_nand_chip *chip,
44 + timings = onfi_async_timing_mode_to_sdr_timings(mode);
47 - timings = onfi_async_timing_mode_to_sdr_timings(mode);
49 return PTR_ERR(timings);
51 diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
52 index 3d4ea7e..2eb92a3 100644
53 --- a/include/linux/mtd/nand.h
54 +++ b/include/linux/mtd/nand.h
55 @@ -536,6 +536,55 @@ struct nand_buffers {
60 + * struct nand_sdr_timings - SDR NAND chip timings
62 + * This struct defines the timing requirements of a SDR NAND chip.
63 + * These informations can be found in every NAND datasheets and the timings
64 + * meaning are described in the ONFI specifications:
65 + * www.onfi.org/~/media/ONFI/specs/onfi_3_1_spec.pdf (chapter 4.15 Timing
68 + * All these timings are expressed in picoseconds.
71 +struct nand_sdr_timings {
109 * struct nand_chip - NAND Private Flash Chip Data
110 * @IO_ADDR_R: [BOARDSPECIFIC] address to read the 8 I/O lines of the
111 @@ -600,11 +649,7 @@ struct nand_buffers {
112 * @ecc_step_ds: [INTERN] ECC step required by the @ecc_strength_ds,
113 * also from the datasheet. It is the recommended ECC step
114 * size, if known; if unknown, set to zero.
115 - * @onfi_timing_mode_default: [INTERN] default ONFI timing mode. This field is
116 - * either deduced from the datasheet if the NAND
117 - * chip is not ONFI compliant or set to 0 if it is
118 - * (an ONFI chip is always configured in mode 0
119 - * after a NAND reset)
120 + * @sdr_timings [INTERN] Pointer to default timings for SDR NAND.
121 * @numchips: [INTERN] number of physical chips
122 * @chipsize: [INTERN] the size of one chip for multichip arrays
123 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1
124 @@ -689,7 +734,7 @@ struct nand_chip {
125 uint8_t bits_per_cell;
126 uint16_t ecc_strength_ds;
127 uint16_t ecc_step_ds;
128 - int onfi_timing_mode_default;
129 + const struct nand_sdr_timings *sdr_timings;
133 @@ -975,55 +1020,6 @@ static inline int jedec_feature(struct nand_chip *chip)
138 - * struct nand_sdr_timings - SDR NAND chip timings
140 - * This struct defines the timing requirements of a SDR NAND chip.
141 - * These informations can be found in every NAND datasheets and the timings
142 - * meaning are described in the ONFI specifications:
143 - * www.onfi.org/~/media/ONFI/specs/onfi_3_1_spec.pdf (chapter 4.15 Timing
146 - * All these timings are expressed in picoseconds.
149 -struct nand_sdr_timings {
186 /* get timing characteristics from ONFI timing mode. */
187 const struct nand_sdr_timings *onfi_async_timing_mode_to_sdr_timings(int mode);
188 #endif /* __LINUX_MTD_NAND_H */