This patch add people that use ubi and BBT in the kernel. Up to now
the mxs driver has no managment for BBT in nand itself. We can
have this problem:

ubi0: attaching mtd1
ubi0 error: scan_peb: bad image sequence number -999266176 in PEB 1844, 
expected 344810451
Erase counter header dump:
        magic          0x55424923
        version        1
        ec             2
        vid_hdr_offset 2048
        data_offset    4096
        image_seq      -999266176
        hdr_crc        0x4247f853
erase counter header hexdump:
ubi0 error: ubi_attach_mtd_dev: failed to attach mtd1, error -22
UBI error: cannot attach mtd1
UBI error: cannot initialize UBI, error -22
UBI init error 22

and even we can have this problem for every reboot in kernel log

[    1.635636] Bad block table not found for chip 0
[    1.642350] Bad block table not found for chip 0
[    1.647066] Scanning device for bad blocks
[    2.392740] Bad block table written to 0x00000ffe0000, version 0x01
[    2.401091] Bad block table written to 0x00000ffc0000, version 0x01

Correct log should be

[    3.117226] nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB 
size: 64
[    3.128981] Bad block table found at page 131008, version 0x01
[    3.136624] Bad block table found at page 130944, version 0x01

Signed-off-by: Michael Trimarchi <mich...@amarulasolutions.com>
---
 drivers/mtd/nand/mxs_nand.c     | 5 ++++-
 include/configs/imx6ull-isiot.h | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/mxs_nand.c b/drivers/mtd/nand/mxs_nand.c
index b9ffa7cbae..a1e0705b65 100644
--- a/drivers/mtd/nand/mxs_nand.c
+++ b/drivers/mtd/nand/mxs_nand.c
@@ -1182,7 +1182,10 @@ int board_nand_init(struct nand_chip *nand)
 
        nand_set_controller_data(nand, nand_info);
        nand->options |= NAND_NO_SUBPAGE_WRITE;
-
+#if defined CONFIG_SYS_NAND_USE_FLASH_BBT
+       nand->bbt_options |= NAND_BBT_NO_OOB;
+       nand->bbt_options |= NAND_BBT_USE_FLASH;
+#endif
        nand->cmd_ctrl          = mxs_nand_cmd_ctrl;
 
        nand->dev_ready         = mxs_nand_device_ready;
diff --git a/include/configs/imx6ull-isiot.h b/include/configs/imx6ull-isiot.h
index 766839c123..f2c97bb964 100644
--- a/include/configs/imx6ull-isiot.h
+++ b/include/configs/imx6ull-isiot.h
@@ -146,6 +146,7 @@
 
 /* NAND */
 #ifdef CONFIG_NAND_MXS
+# define CONFIG_SYS_NAND_USE_FLASH_BBT
 # define CONFIG_SYS_MAX_NAND_DEVICE            1
 # define CONFIG_SYS_NAND_BASE                  0x40000000
 # define CONFIG_SYS_NAND_5_ADDR_CYCLE
-- 
2.17.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to