ramips: fix subtarget kernel version assignment (only mt7621 is ready for now)
[openwrt.git] / target / linux / ramips / patches-4.3 / 0901-spansion_nand_id_fix.patch
1 From 8b61a1a33e41456ebeafa0ebe7ec0fccf859861e Mon Sep 17 00:00:00 2001
2 From: Nikolay Martynov <mar.kolya@gmail.com>
3 Date: Wed, 25 Nov 2015 20:43:46 -0500
4 Subject: [PATCH] mtd: nand: Fix Spansion sparearea size detection
5
6 According to datasheet S34ML02G2 and S34ML04G2 have
7 larger sparea area size than was detected.
8
9 Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>
10 ---
11  drivers/mtd/nand/nand_base.c | 9 +++++++++
12  1 file changed, 9 insertions(+)
13
14 --- a/drivers/mtd/nand/nand_base.c
15 +++ b/drivers/mtd/nand/nand_base.c
16 @@ -3422,6 +3422,7 @@ static void nand_decode_ext_id(struct mt
17         /*
18          * Field definitions are in the following datasheets:
19          * Old style (4,5 byte ID): Samsung K9GAG08U0M (p.32)
20 +        *                          Spansion S34ML02G2 (p.33)
21          * New Samsung (6 byte ID): Samsung K9GAG08U0F (p.44)
22          * Hynix MLC   (6 byte ID): Hynix H27UBG8T2B (p.22)
23          *
24 @@ -3519,6 +3520,19 @@ static void nand_decode_ext_id(struct mt
25                 *busw = (extid & 0x01) ? NAND_BUSWIDTH_16 : 0;
26  
27                 /*
28 +                * Spansion S34ML0[24]G2 have oobsize twice as large
29 +                * as S34ML01G2 encoded in the same bit. We
30 +                * differinciate them by their ID length
31 +                */
32 +               if (id_data[0] == NAND_MFR_AMD
33 +                               && (id_data[1] == 0xda
34 +                                || id_data[1] == 0xdc
35 +                                || id_data[1] == 0xca
36 +                                || id_data[1] == 0xcc)) {
37 +                       mtd->oobsize *= 2;
38 +               }
39 +
40 +               /*
41                  * Toshiba 24nm raw SLC (i.e., not BENAND) have 32B OOB per
42                  * 512B page. For Toshiba SLC, we decode the 5th/6th byte as
43                  * follows: