linux-dreambox-3.2: add support for other nand flash type (fixed prev commit)
[opendreambox.git] / meta-bsp / dm500hdv2 / recipes / linux / linux-dreambox-3.2 / 0001-add-support-for-toshiba-1GB-nand-flash.patch
1 From 32c2b7fe1afb0c1756bbb60e43b90178395fcaae Mon Sep 17 00:00:00 2001
2 From: Andreas Monzner <andreas.monzner@dream-property.net>
3 Date: Tue, 3 Mar 2015 12:58:15 +0100
4 Subject: [PATCH] add support for toshiba 1GB nand flash
5
6 ---
7  drivers/mtd/brcmnand/brcmnand_base.c |   19 +++++++++++++++++--
8  1 file changed, 17 insertions(+), 2 deletions(-)
9
10 diff --git a/drivers/mtd/brcmnand/brcmnand_base.c b/drivers/mtd/brcmnand/brcmnand_base.c
11 index dff454a..d25d525 100644
12 --- a/drivers/mtd/brcmnand/brcmnand_base.c
13 +++ b/drivers/mtd/brcmnand/brcmnand_base.c
14 @@ -743,7 +743,7 @@ static brcmnand_chip_Id brcmnand_chips[] = {
15                 .timing1 = 0, 
16                 .timing2 = 0,
17                 .nop=4,
18 -               .eccLevel=4,
19 +//             .eccLevel=4,
20                 .nbrBlocks = 4096,
21                 .ctrlVersion = CONFIG_MTD_BRCMNAND_VERS_3_0, 
22         },
23 @@ -9485,6 +9485,21 @@ printk("%s: Ecc level set to %d, sectorSize=%d from ID table\n", __FUNCTION__, c
24          * else ID not in database, but CONFIG reg was passed at command line, already handled
25          */
26  
27 +       if (foundInIdTable && brcmnand_dev_id == TOSHIBA_TC58NVG3S0ETA00 && brcmnand_maf_id == FLASHTYPE_TOSHIBA) {
28 +               nand_config &= ~(BCHP_NAND_CONFIG_BLOCK_SIZE_MASK);
29 +               nand_config |= (BCHP_NAND_CONFIG_BLOCK_SIZE_BK_SIZE_128KB << BCHP_NAND_CONFIG_BLOCK_SIZE_SHIFT); 
30 +
31 +               nand_config &= ~(BCHP_NAND_CONFIG_PAGE_SIZE_MASK);
32 +               nand_config |= (BCHP_NAND_CONFIG_PAGE_SIZE_PG_SIZE_2KB << BCHP_NAND_CONFIG_PAGE_SIZE_SHIFT); 
33 +
34 +               nand_config &= ~(BCHP_NAND_CONFIG_DEVICE_SIZE_MASK);
35 +               nand_config |= (BCHP_NAND_CONFIG_DEVICE_SIZE_DVC_SIZE_512MB << BCHP_NAND_CONFIG_DEVICE_SIZE_SHIFT); 
36 +
37 +               chip->ctrl_write(bchp_nand_config(chip->ctrl->CS[chip->csi]), nand_config);
38 +
39 +               chip->ecclevel = BRCMNAND_ECC_HAMMING;
40 +       }
41 +
42         /* 
43          * For some ID case, the ID decode does not yield all informations,
44          * so we read it back, making sure that NAND CONFIG register and chip-> struct
45 @@ -10699,7 +10714,7 @@ printk("ECC layout=brcmnand_oob_bch8_16_2k\n");
46                                 }
47                         }
48                         else if (chip->ecclevel == BRCMNAND_ECC_HAMMING) {
49 -printk("ECC layout=brcmnand_oob_bch4_4k\n");
50 +printk("ECC layout=brcmnand_oob_64\n");
51                                 chip->ecclayout = &brcmnand_oob_64;
52                         }
53                         else {
54 -- 
55 1.7.10.4
56