MTD: mxs_nand: Fix BCH read timeout error on boards requiring ECC
authorAdam Ford <aford173@gmail.com>
Thu, 3 Jan 2019 02:36:52 +0000 (20:36 -0600)
committerStefano Babic <sbabic@denx.de>
Fri, 15 Feb 2019 11:36:08 +0000 (12:36 +0100)
The LogicPD board uses a Micron Flash with ECC.  To boot this from
SPL, the ECC needs to be correctly configured or the BCH engine
times out.

Signed-off-by: Adam Ford <aford173@gmail.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Tested-by: Jörg Krause <joerg.krause@embedded.rocks>
Acked-by: Tim Harvey <tharvey@gateworks.com>
Tested-by: Tim Harvey <tharvey@gateworks.com>
drivers/mtd/nand/raw/mxs_nand.c
drivers/mtd/nand/raw/mxs_nand_spl.c

index e3341812a203a3984fdbdbebea6207eab20c0709..2d84bfffe2ed462740b30d9c5d886399206fb0f6 100644 (file)
@@ -1163,6 +1163,12 @@ int mxs_nand_init_spl(struct nand_chip *nand)
 
        nand_info->gpmi_regs = (struct mxs_gpmi_regs *)MXS_GPMI_BASE;
        nand_info->bch_regs = (struct mxs_bch_regs *)MXS_BCH_BASE;
+
+       if (is_mx6sx() || is_mx7())
+               nand_info->max_ecc_strength_supported = 62;
+       else
+               nand_info->max_ecc_strength_supported = 40;
+
        err = mxs_nand_alloc_buffers(nand_info);
        if (err)
                return err;
index c628f3adec0fbe7cd620d74685fe361ddd253317..ba85baac6030af575662629dc6343704a494444f 100644 (file)
@@ -201,6 +201,7 @@ static int mxs_nand_init(void)
        /* setup flash layout (does not scan as we override that) */
        mtd->size = nand_chip.chipsize;
        nand_chip.scan_bbt(mtd);
+       mxs_nand_setup_ecc(mtd);
 
        return 0;
 }