The LS1021A NAND driver provided in the QorIQ Linux SDK does nor report bit flips when bits are flipped in a sector of page. This applies both to U-Boot and Linux driver.
E.g. the following u-boot command returns OK while page 3fe000 contains an uncorrectable number of bit flips:
=> nand read 81000000 3fe000 1000
NAND read: device 0 offset 0x3fe000, size 0x1000
4096 bytes read: OK
The root cause of this problem is that the "struct fsl_ifc_nand" does not match the register map defined in the LS1021A Rev 1 reference manual. A boot that include a patch for this issue reports an error for a page with an uncorrectable number of bit flips, see:
=> nand read 81000000 3fe000 1000
NAND read: device 0 offset 0x3fe000, size 0x1000
NAND read from offset 3fe000 failed -74
0 bytes read: ERROR
The U-Boot patch file:
From 5d30cbefe1204be348af860591e2f3e97dc67286 Mon Sep 17 00:00:00 2001
From: Kees Trommel <ctrommel@linvm302.aimsys.nl>
Date: Tue, 15 Nov 2016 16:16:00 +0100
Subject: [PATCH] fsl_ifc_nand-u-boot
Signed-off-by: Kees Trommel <ctrommel@linvm302.aimsys.nl>
---
include/fsl_ifc.h | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/include/fsl_ifc.h b/include/fsl_ifc.h
index a86f216..6d1dc23 100644
--- a/include/fsl_ifc.h
+++ b/include/fsl_ifc.h
@@ -883,15 +883,14 @@ struct fsl_ifc_nand {
u32 nand_evter_en;
u32 res17[0x2];
u32 nand_evter_intr_en;
- u32 nand_vol_addr_stat;
- u32 res18;
+ u32 res18[0x2];
u32 nand_erattr0;
u32 nand_erattr1;
u32 res19[0x10];
u32 nand_fsr;
- u32 res20[0x3];
- u32 nand_eccstat[6];
- u32 res21[0x1c];
+ u32 res20;
+ u32 nand_eccstat[4];
+ u32 res21[0x20];
u32 nanndcr;
u32 res22[0x2];
u32 nand_autoboot_trgr;
--
2.5.5
The Linux patch file:
From c3ec47854734293594b11b8e88bb2179804935e4 Mon Sep 17 00:00:00 2001
From: Kees Trommel <ctrommel@linvm302.aimsys.nl>
Date: Tue, 15 Nov 2016 16:19:09 +0100
Subject: [PATCH] fsl_ifc_nand-linux
Signed-off-by: Kees Trommel <ctrommel@linvm302.aimsys.nl>
---
include/linux/fsl_ifc.h | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/include/linux/fsl_ifc.h b/include/linux/fsl_ifc.h
index 1770224..d48b886 100644
--- a/include/linux/fsl_ifc.h
+++ b/include/linux/fsl_ifc.h
@@ -729,15 +729,14 @@ struct fsl_ifc_nand {
__be32 nand_evter_en;
u32 res17[0x2];
__be32 nand_evter_intr_en;
- __be32 nand_vol_addr_stat;
- u32 res18;
+ u32 res18[0x2];
__be32 nand_erattr0;
__be32 nand_erattr1;
u32 res19[0x10];
__be32 nand_fsr;
- u32 res20[0x3];
- __be32 nand_eccstat[6];
- u32 res21[0x1c];
+ u32 res20;
+ __be32 nand_eccstat[4];
+ u32 res21[0x20];
__be32 nanndcr;
u32 res22[0x2];
__be32 nand_autoboot_trgr;
--
2.5.5