sunxi: add support for 4.1
[openwrt.git] / target / linux / sunxi / patches-4.1 / 128-2-mtd-nand-support-non-ONFI-timings.patch
1 diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
2 index f561c68..8e636df 100644
3 --- a/drivers/mtd/nand/nand_base.c
4 +++ b/drivers/mtd/nand/nand_base.c
5 @@ -3624,8 +3624,13 @@ static bool find_full_id_nand(struct mtd_info *mtd, struct nand_chip *chip,
6                 chip->ecc_strength_ds = NAND_ECC_STRENGTH(type);
7                 chip->ecc_step_ds = NAND_ECC_STEP(type);
8  
9 -               mode = type->onfi_timing_mode_default;
10 -               chip->sdr_timings = onfi_async_timing_mode_to_sdr_timings(mode);
11 +               if (type->custom_sdr_timing) {
12 +                       chip->sdr_timings = type->custom_sdr_timing;
13 +               } else {
14 +                       mode = type->onfi_timing_mode_default;
15 +                       chip->sdr_timings =
16 +                               onfi_async_timing_mode_to_sdr_timings(mode);
17 +               }
18  
19                 *busw = type->options & NAND_BUSWIDTH_16;
20  
21 diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
22 index 2eb92a3..7d9e599 100644
23 --- a/include/linux/mtd/nand.h
24 +++ b/include/linux/mtd/nand.h
25 @@ -863,6 +863,7 @@ struct nand_flash_dev {
26                 uint16_t step_ds;
27         } ecc;
28         int onfi_timing_mode_default;
29 +       const struct nand_sdr_timings *custom_sdr_timing;
30  };
31  
32  /**