* [PATCH next 0/2] spi: spi-qpic-snand: enable 8 bits ECC strength support
@ 2025-05-02 19:31 Gabor Juhos
2025-05-02 19:31 ` [PATCH next 1/2] mtd: nand: qpic-common: add defines for ECC_MODE values Gabor Juhos
2025-05-02 19:31 ` [PATCH next 2/2] spi: spi-qpic-snand: add support for 8 bits ECC strength Gabor Juhos
0 siblings, 2 replies; 15+ messages in thread
From: Gabor Juhos @ 2025-05-02 19:31 UTC (permalink / raw)
To: Mark Brown, Manivannan Sadhasivam, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra
Cc: Varadarajan Narayanan, Md Sadre Alam, Sricharan Ramabadhran,
linux-spi, linux-mtd, linux-arm-msm, linux-kernel, Gabor Juhos
This small patch set adds support for 8 bits ECC strength, which widens
the range of the usable SPI NAND chips with the driver.
The series should be integrated via the SPI tree, as that contains
prerequisite changes.
Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
---
Gabor Juhos (2):
mtd: nand: qpic-common: add defines for ECC_MODE values
spi: spi-qpic-snand: add support for 8 bits ECC strength
drivers/mtd/nand/raw/qcom_nandc.c | 6 +++---
drivers/spi/spi-qpic-snand.c | 21 ++++++++++++++++-----
include/linux/mtd/nand-qpic-common.h | 2 ++
3 files changed, 21 insertions(+), 8 deletions(-)
---
base-commit: 39d6783f6488786301f36b0e7c619f220c3e8d2c
change-id: 20250208-qpic-snand-8bit-ecc-dc804fd08592
prerequisite-change-id: 20250320-qpic-snand-kmalloc-3f6c1fb6c873:v1
prerequisite-patch-id: ec9e9786ca59fcddf9502d0ba5b0f4e6593aab62
prerequisite-change-id: 20250501-qpic-snand-validate-ecc-383b3e33e238:v1
prerequisite-patch-id: 7a549e08b3075d20c5014bb3d2151643aa956f5c
Best regards,
--
Gabor Juhos <j4g8y7@gmail.com>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH next 1/2] mtd: nand: qpic-common: add defines for ECC_MODE values
2025-05-02 19:31 [PATCH next 0/2] spi: spi-qpic-snand: enable 8 bits ECC strength support Gabor Juhos
@ 2025-05-02 19:31 ` Gabor Juhos
2025-05-05 11:08 ` Md Sadre Alam
2025-05-02 19:31 ` [PATCH next 2/2] spi: spi-qpic-snand: add support for 8 bits ECC strength Gabor Juhos
1 sibling, 1 reply; 15+ messages in thread
From: Gabor Juhos @ 2025-05-02 19:31 UTC (permalink / raw)
To: Mark Brown, Manivannan Sadhasivam, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra
Cc: Varadarajan Narayanan, Md Sadre Alam, Sricharan Ramabadhran,
linux-spi, linux-mtd, linux-arm-msm, linux-kernel, Gabor Juhos
Add defines for the values of the ECC_MODE field of the NAND_DEV0_ECC_CFG
register and change both the 'qcom-nandc' and 'spi-qpic-snand' drivers to
use those instead of magic numbers.
No functional changes. This is in preparation for adding 8 bit ECC strength
support for the 'spi-qpic-snand' driver.
Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
---
drivers/mtd/nand/raw/qcom_nandc.c | 6 +++---
drivers/spi/spi-qpic-snand.c | 2 +-
include/linux/mtd/nand-qpic-common.h | 2 ++
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c
index 5eaa0be367cdb847d48dbed6f8326a75a5922347..67641ce28bd6435fffda3ffe5e38c777f4708cf8 100644
--- a/drivers/mtd/nand/raw/qcom_nandc.c
+++ b/drivers/mtd/nand/raw/qcom_nandc.c
@@ -1379,7 +1379,7 @@ static int qcom_nand_attach_chip(struct nand_chip *chip)
struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
int cwperpage, bad_block_byte, ret;
bool wide_bus;
- int ecc_mode = 1;
+ int ecc_mode = ECC_MODE_8BIT;
/* controller only supports 512 bytes data steps */
ecc->size = NANDC_STEP_SIZE;
@@ -1400,7 +1400,7 @@ static int qcom_nand_attach_chip(struct nand_chip *chip)
if (ecc->strength >= 8) {
/* 8 bit ECC defaults to BCH ECC on all platforms */
host->bch_enabled = true;
- ecc_mode = 1;
+ ecc_mode = ECC_MODE_8BIT;
if (wide_bus) {
host->ecc_bytes_hw = 14;
@@ -1420,7 +1420,7 @@ static int qcom_nand_attach_chip(struct nand_chip *chip)
if (nandc->props->ecc_modes & ECC_BCH_4BIT) {
/* BCH */
host->bch_enabled = true;
- ecc_mode = 0;
+ ecc_mode = ECC_MODE_4BIT;
if (wide_bus) {
host->ecc_bytes_hw = 8;
diff --git a/drivers/spi/spi-qpic-snand.c b/drivers/spi/spi-qpic-snand.c
index 88f8fa98687fa292861d46648872135aa7fad80f..dfc8cc5d97624fe741121228b97d2b3562cc5cc4 100644
--- a/drivers/spi/spi-qpic-snand.c
+++ b/drivers/spi/spi-qpic-snand.c
@@ -349,7 +349,7 @@ static int qcom_spi_ecc_init_ctx_pipelined(struct nand_device *nand)
FIELD_PREP(ECC_SW_RESET, 0) |
FIELD_PREP(ECC_NUM_DATA_BYTES_MASK, ecc_cfg->cw_data) |
FIELD_PREP(ECC_FORCE_CLK_OPEN, 1) |
- FIELD_PREP(ECC_MODE_MASK, 0) |
+ FIELD_PREP(ECC_MODE_MASK, ECC_MODE_4BIT) |
FIELD_PREP(ECC_PARITY_SIZE_BYTES_BCH_MASK, ecc_cfg->ecc_bytes_hw);
ecc_cfg->ecc_buf_cfg = 0x203 << NUM_STEPS;
diff --git a/include/linux/mtd/nand-qpic-common.h b/include/linux/mtd/nand-qpic-common.h
index cd7172e6c1bbffeee0363a14044980a72ea17723..a070af4593754384d9df4f6206a24665e2040aad 100644
--- a/include/linux/mtd/nand-qpic-common.h
+++ b/include/linux/mtd/nand-qpic-common.h
@@ -101,6 +101,8 @@
#define ECC_SW_RESET BIT(1)
#define ECC_MODE 4
#define ECC_MODE_MASK GENMASK(5, 4)
+#define ECC_MODE_4BIT 0
+#define ECC_MODE_8BIT 1
#define ECC_PARITY_SIZE_BYTES_BCH 8
#define ECC_PARITY_SIZE_BYTES_BCH_MASK GENMASK(12, 8)
#define ECC_NUM_DATA_BYTES 16
--
2.49.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH next 2/2] spi: spi-qpic-snand: add support for 8 bits ECC strength
2025-05-02 19:31 [PATCH next 0/2] spi: spi-qpic-snand: enable 8 bits ECC strength support Gabor Juhos
2025-05-02 19:31 ` [PATCH next 1/2] mtd: nand: qpic-common: add defines for ECC_MODE values Gabor Juhos
@ 2025-05-02 19:31 ` Gabor Juhos
2025-05-05 11:17 ` Md Sadre Alam
1 sibling, 1 reply; 15+ messages in thread
From: Gabor Juhos @ 2025-05-02 19:31 UTC (permalink / raw)
To: Mark Brown, Manivannan Sadhasivam, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra
Cc: Varadarajan Narayanan, Md Sadre Alam, Sricharan Ramabadhran,
linux-spi, linux-mtd, linux-arm-msm, linux-kernel, Gabor Juhos
Even though the hardware supports 8 bits ECC strength, but that is not
handled in the driver yet. This change adds the missing bits in order
to allow using the driver with chips which require 8 bits ECC strength.
No functional changes intended with regard to the existing 4 bits ECC
strength support.
Tested on an IPQ9574 platform using a GigaDevice GD5F2GM7REYIG chip.
Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
---
mtdtest results:
# dmesg | grep nand
[ 0.678143] spi-nand spi0.0: GigaDevice SPI NAND was found.
[ 0.687393] spi-nand spi0.0: 256 MiB, block size: 128 KiB, page size: 2048, OOB size: 128
# cat /proc/mtd
dev: size erasesize name
mtd0: 10000000 00020000 "spi0.0"
# insmod mtd_test
# insmod mtd_speedtest dev=0
[ 63.128425]
[ 63.128452] =================================================
[ 63.128979] mtd_speedtest: MTD device: 0
[ 63.134622] mtd_speedtest: MTD device size 268435456, eraseblock size 131072, page size 2048, count of eraseblocks 2048, pages per eraseblock 64, OOB size 128
[ 63.139561] mtd_test: scanning for bad eraseblocks
[ 63.756447] mtd_test: scanned 2048 eraseblocks, 0 are bad
[ 71.085514] mtd_speedtest: testing eraseblock write speed
[ 202.745977] mtd_speedtest: eraseblock write speed is 1991 KiB/s
[ 202.746022] mtd_speedtest: testing eraseblock read speed
[ 284.104591] mtd_speedtest: eraseblock read speed is 3222 KiB/s
[ 291.405533] mtd_speedtest: testing page write speed
[ 422.516341] mtd_speedtest: page write speed is 1999 KiB/s
[ 422.516384] mtd_speedtest: testing page read speed
[ 504.144630] mtd_speedtest: page read speed is 3211 KiB/s
[ 511.476726] mtd_speedtest: testing 2 page write speed
[ 643.114443] mtd_speedtest: 2 page write speed is 1991 KiB/s
[ 643.114485] mtd_speedtest: testing 2 page read speed
[ 724.434752] mtd_speedtest: 2 page read speed is 3223 KiB/s
[ 724.434796] mtd_speedtest: Testing erase speed
[ 731.792729] mtd_speedtest: erase speed is 35648 KiB/s
[ 731.792772] mtd_speedtest: Testing 2x multi-block erase speed
[ 739.162513] mtd_speedtest: 2x multi-block erase speed is 35589 KiB/s
[ 739.162558] mtd_speedtest: Testing 4x multi-block erase speed
[ 746.486241] mtd_speedtest: 4x multi-block erase speed is 35820 KiB/s
[ 746.486287] mtd_speedtest: Testing 8x multi-block erase speed
[ 753.789683] mtd_speedtest: 8x multi-block erase speed is 35919 KiB/s
[ 753.789728] mtd_speedtest: Testing 16x multi-block erase speed
[ 761.093075] mtd_speedtest: 16x multi-block erase speed is 35920 KiB/s
[ 761.093120] mtd_speedtest: Testing 32x multi-block erase speed
[ 768.396145] mtd_speedtest: 32x multi-block erase speed is 35922 KiB/s
[ 768.396222] mtd_speedtest: Testing 64x multi-block erase speed
[ 775.699819] mtd_speedtest: 64x multi-block erase speed is 35918 KiB/s
[ 775.699863] mtd_speedtest: finished
[ 775.705259] =================================================
# insmod mtd_readtest dev=0
[ 919.060671]
[ 919.060699] =================================================
[ 919.061226] mtd_readtest: MTD device: 0
[ 919.066957] mtd_readtest: MTD device size 268435456, eraseblock size 131072, page size 2048, count of eraseblocks 2048, pages per eraseblock 64, OOB size 128
[ 919.070556] mtd_test: scanning for bad eraseblocks
[ 919.086016] mtd_test: scanned 2048 eraseblocks, 0 are bad
[ 919.089465] mtd_readtest: testing page read
[ 1090.778227] mtd_readtest: finished
[ 1090.778286] =================================================
# insmod mtd_pagetest dev=0
[ 1216.297313]
[ 1216.297341] =================================================
[ 1216.297867] mtd_pagetest: MTD device: 0
[ 1216.303509] mtd_pagetest: MTD device size 268435456, eraseblock size 131072, page size 2048, count of eraseblocks 2048, pages per eraseblock 64, OOB size 128
[ 1216.307213] mtd_test: scanning for bad eraseblocks
[ 1216.322680] mtd_test: scanned 2048 eraseblocks, 0 are bad
[ 1216.326077] mtd_pagetest: erasing whole device
[ 1223.694968] mtd_pagetest: erased 2048 eraseblocks
[ 1223.695009] mtd_pagetest: writing whole device
[ 1223.763930] mtd_pagetest: written up to eraseblock 0
[ 1240.268942] mtd_pagetest: written up to eraseblock 256
[ 1256.641498] mtd_pagetest: written up to eraseblock 512
[ 1273.139048] mtd_pagetest: written up to eraseblock 768
[ 1289.718929] mtd_pagetest: written up to eraseblock 1024
[ 1306.244553] mtd_pagetest: written up to eraseblock 1280
[ 1322.939723] mtd_pagetest: written up to eraseblock 1536
[ 1339.246937] mtd_pagetest: written up to eraseblock 1792
[ 1355.613729] mtd_pagetest: written 2048 eraseblocks
[ 1355.613770] mtd_pagetest: verifying all eraseblocks
[ 1355.854290] mtd_pagetest: verified up to eraseblock 0
[ 1416.657733] mtd_pagetest: verified up to eraseblock 256
[ 1477.384593] mtd_pagetest: verified up to eraseblock 512
[ 1538.008142] mtd_pagetest: verified up to eraseblock 768
[ 1599.080797] mtd_pagetest: verified up to eraseblock 1024
[ 1660.775431] mtd_pagetest: verified up to eraseblock 1280
[ 1722.177149] mtd_pagetest: verified up to eraseblock 1536
[ 1783.090166] mtd_pagetest: verified up to eraseblock 1792
[ 1844.450757] mtd_pagetest: verified 2048 eraseblocks
[ 1844.450798] mtd_pagetest: crosstest
[ 1844.455676] mtd_pagetest: reading page at 0x0
[ 1844.458603] mtd_pagetest: reading page at 0xffff800
[ 1844.463047] mtd_pagetest: reading page at 0x0
[ 1844.467790] mtd_pagetest: verifying pages read at 0x0 match
[ 1844.471636] mtd_pagetest: crosstest ok
[ 1844.477062] mtd_pagetest: erasecrosstest
[ 1844.480833] mtd_pagetest: erasing block 0
[ 1844.488498] mtd_pagetest: writing 1st page of block 0
[ 1844.489821] mtd_pagetest: reading 1st page of block 0
[ 1844.494475] mtd_pagetest: verifying 1st page of block 0
[ 1844.498942] mtd_pagetest: erasing block 0
[ 1844.507505] mtd_pagetest: writing 1st page of block 0
[ 1844.509042] mtd_pagetest: erasing block 2047
[ 1844.516725] mtd_pagetest: reading 1st page of block 0
[ 1844.518087] mtd_pagetest: verifying 1st page of block 0
[ 1844.522415] mtd_pagetest: erasecrosstest ok
[ 1844.527495] mtd_pagetest: erasetest
[ 1844.531613] mtd_pagetest: erasing block 0
[ 1844.538671] mtd_pagetest: writing 1st page of block 0
[ 1844.540249] mtd_pagetest: erasing block 0
[ 1844.547869] mtd_pagetest: reading 1st page of block 0
[ 1844.548927] mtd_pagetest: verifying 1st page of block 0 is all 0xff
[ 1844.553326] mtd_pagetest: erasetest ok
[ 1844.559440] mtd_pagetest: finished with 0 errors
[ 1844.563233] =================================================
# insmod mtd_subpagetest dev=0
[ 1942.429708]
[ 1942.429736] =================================================
[ 1942.430262] mtd_subpagetest: MTD device: 0
[ 1942.435905] mtd_subpagetest: MTD device size 268435456, eraseblock size 131072, page size 2048, subpage size 2048, count of eraseblocks 2048, pages per eraseblock 64, OOB size 128
[ 1942.439994] mtd_test: scanning for bad eraseblocks
[ 1942.457111] mtd_test: scanned 2048 eraseblocks, 0 are bad
[ 1949.824564] mtd_subpagetest: writing whole device
[ 1949.826670] mtd_subpagetest: written up to eraseblock 0
[ 1950.351816] mtd_subpagetest: written up to eraseblock 256
[ 1950.875797] mtd_subpagetest: written up to eraseblock 512
[ 1951.399912] mtd_subpagetest: written up to eraseblock 768
[ 1951.923618] mtd_subpagetest: written up to eraseblock 1024
[ 1952.447361] mtd_subpagetest: written up to eraseblock 1280
[ 1952.970834] mtd_subpagetest: written up to eraseblock 1536
[ 1953.494635] mtd_subpagetest: written up to eraseblock 1792
[ 1954.016265] mtd_subpagetest: written 2048 eraseblocks
[ 1954.016294] mtd_subpagetest: verifying all eraseblocks
[ 1954.021617] mtd_subpagetest: verified up to eraseblock 0
[ 1954.347458] mtd_subpagetest: verified up to eraseblock 256
[ 1954.667446] mtd_subpagetest: verified up to eraseblock 512
[ 1954.987343] mtd_subpagetest: verified up to eraseblock 768
[ 1955.307385] mtd_subpagetest: verified up to eraseblock 1024
[ 1955.627462] mtd_subpagetest: verified up to eraseblock 1280
[ 1955.947277] mtd_subpagetest: verified up to eraseblock 1536
[ 1956.266834] mtd_subpagetest: verified up to eraseblock 1792
[ 1956.585581] mtd_subpagetest: verified 2048 eraseblocks
[ 1963.889308] mtd_subpagetest: verifying all eraseblocks for 0xff
[ 1963.930487] mtd_subpagetest: verified up to eraseblock 0
[ 1974.592567] mtd_subpagetest: verified up to eraseblock 256
[ 1985.180953] mtd_subpagetest: verified up to eraseblock 512
[ 1995.805397] mtd_subpagetest: verified up to eraseblock 768
[ 2006.348859] mtd_subpagetest: verified up to eraseblock 1024
[ 2016.900530] mtd_subpagetest: verified up to eraseblock 1280
[ 2027.447587] mtd_subpagetest: verified up to eraseblock 1536
[ 2037.962383] mtd_subpagetest: verified up to eraseblock 1792
[ 2048.587863] mtd_subpagetest: verified 2048 eraseblocks
[ 2048.587906] mtd_subpagetest: writing whole device
[ 2048.648174] mtd_subpagetest: written up to eraseblock 0
[ 2062.643145] mtd_subpagetest: written up to eraseblock 256
[ 2076.699015] mtd_subpagetest: written up to eraseblock 512
[ 2091.004910] mtd_subpagetest: written up to eraseblock 768
[ 2105.149879] mtd_subpagetest: written up to eraseblock 1024
[ 2119.470691] mtd_subpagetest: written up to eraseblock 1280
[ 2133.746861] mtd_subpagetest: written up to eraseblock 1536
[ 2147.776477] mtd_subpagetest: written up to eraseblock 1792
[ 2161.947734] mtd_subpagetest: written 2048 eraseblocks
[ 2161.947776] mtd_subpagetest: verifying all eraseblocks
[ 2161.986109] mtd_subpagetest: verified up to eraseblock 0
[ 2170.818316] mtd_subpagetest: verified up to eraseblock 256
[ 2179.596875] mtd_subpagetest: verified up to eraseblock 512
[ 2188.405116] mtd_subpagetest: verified up to eraseblock 768
[ 2197.188588] mtd_subpagetest: verified up to eraseblock 1024
[ 2206.002204] mtd_subpagetest: verified up to eraseblock 1280
[ 2214.784815] mtd_subpagetest: verified up to eraseblock 1536
[ 2223.557141] mtd_subpagetest: verified up to eraseblock 1792
[ 2232.472832] mtd_subpagetest: verified 2048 eraseblocks
[ 2239.818213] mtd_subpagetest: verifying all eraseblocks for 0xff
[ 2239.861404] mtd_subpagetest: verified up to eraseblock 0
[ 2250.439035] mtd_subpagetest: verified up to eraseblock 256
[ 2261.176485] mtd_subpagetest: verified up to eraseblock 512
[ 2271.713183] mtd_subpagetest: verified up to eraseblock 768
[ 2282.356892] mtd_subpagetest: verified up to eraseblock 1024
[ 2292.891424] mtd_subpagetest: verified up to eraseblock 1280
[ 2303.543110] mtd_subpagetest: verified up to eraseblock 1536
[ 2314.116690] mtd_subpagetest: verified up to eraseblock 1792
[ 2324.607804] mtd_subpagetest: verified 2048 eraseblocks
[ 2324.607846] mtd_subpagetest: finished with 0 errors
[ 2324.611859] =================================================
# insmod mtd_oobtest dev=0
[ 2336.159109]
[ 2336.159138] =================================================
[ 2336.159664] mtd_oobtest: MTD device: 0
[ 2336.165308] mtd_oobtest: MTD device size 268435456, eraseblock size 131072, page size 2048, count of eraseblocks 2048, pages per eraseblock 64, OOB size 128
[ 2336.169043] mtd_test: scanning for bad eraseblocks
[ 2336.184354] mtd_test: scanned 2048 eraseblocks, 0 are bad
[ 2336.187716] mtd_oobtest: test 1 of 5
[ 2343.495966] mtd_oobtest: writing OOBs of whole device
[ 2343.496073] mtd_oobtest: written up to eraseblock 0
[ 2343.516803] mtd_oobtest: written up to eraseblock 256
[ 2343.533527] mtd_oobtest: written up to eraseblock 512
[ 2343.549945] mtd_oobtest: written up to eraseblock 768
[ 2343.563666] mtd_oobtest: written up to eraseblock 1024
[ 2343.575186] mtd_oobtest: written up to eraseblock 1280
[ 2343.584310] mtd_oobtest: written up to eraseblock 1536
[ 2343.593011] mtd_oobtest: written up to eraseblock 1792
[ 2343.600847] mtd_oobtest: written 2048 eraseblocks
[ 2343.600861] mtd_oobtest: verifying all eraseblocks
[ 2343.604542] mtd_oobtest: verified up to eraseblock 0
[ 2343.616606] mtd_oobtest: verified up to eraseblock 256
[ 2343.623992] mtd_oobtest: verified up to eraseblock 512
[ 2343.631390] mtd_oobtest: verified up to eraseblock 768
[ 2343.638788] mtd_oobtest: verified up to eraseblock 1024
[ 2343.646184] mtd_oobtest: verified up to eraseblock 1280
[ 2343.653570] mtd_oobtest: verified up to eraseblock 1536
[ 2343.660970] mtd_oobtest: verified up to eraseblock 1792
[ 2343.668356] mtd_oobtest: verified 2048 eraseblocks
[ 2343.668369] mtd_oobtest: test 2 of 5
[ 2350.985635] mtd_oobtest: writing OOBs of whole device
[ 2350.985743] mtd_oobtest: written up to eraseblock 0
[ 2351.006445] mtd_oobtest: written up to eraseblock 256
[ 2351.023170] mtd_oobtest: written up to eraseblock 512
[ 2351.039645] mtd_oobtest: written up to eraseblock 768
[ 2351.053395] mtd_oobtest: written up to eraseblock 1024
[ 2351.064954] mtd_oobtest: written up to eraseblock 1280
[ 2351.074144] mtd_oobtest: written up to eraseblock 1536
[ 2351.082848] mtd_oobtest: written up to eraseblock 1792
[ 2351.090707] mtd_oobtest: written 2048 eraseblocks
[ 2351.090721] mtd_oobtest: verifying all eraseblocks
[ 2351.094373] mtd_oobtest: verified up to eraseblock 0
[ 2351.099353] mtd_oobtest: verified up to eraseblock 256
[ 2351.104460] mtd_oobtest: verified up to eraseblock 512
[ 2351.109437] mtd_oobtest: verified up to eraseblock 768
[ 2351.114528] mtd_oobtest: verified up to eraseblock 1024
[ 2351.119683] mtd_oobtest: verified up to eraseblock 1280
[ 2351.124772] mtd_oobtest: verified up to eraseblock 1536
[ 2351.129996] mtd_oobtest: verified up to eraseblock 1792
[ 2351.135187] mtd_oobtest: verified 2048 eraseblocks
[ 2351.140130] mtd_oobtest: test 3 of 5
[ 2358.448438] mtd_oobtest: writing OOBs of whole device
[ 2358.448546] mtd_oobtest: written up to eraseblock 0
[ 2358.469297] mtd_oobtest: written up to eraseblock 256
[ 2358.486095] mtd_oobtest: written up to eraseblock 512
[ 2358.501993] mtd_oobtest: written up to eraseblock 768
[ 2358.515473] mtd_oobtest: written up to eraseblock 1024
[ 2358.526708] mtd_oobtest: written up to eraseblock 1280
[ 2358.535426] mtd_oobtest: written up to eraseblock 1536
[ 2358.544152] mtd_oobtest: written up to eraseblock 1792
[ 2358.551732] mtd_oobtest: written 2048 eraseblocks
[ 2358.551744] mtd_oobtest: verifying all eraseblocks
[ 2358.555424] mtd_oobtest: verified up to eraseblock 0
[ 2358.567572] mtd_oobtest: verified up to eraseblock 256
[ 2358.575045] mtd_oobtest: verified up to eraseblock 512
[ 2358.582537] mtd_oobtest: verified up to eraseblock 768
[ 2358.590024] mtd_oobtest: verified up to eraseblock 1024
[ 2358.597511] mtd_oobtest: verified up to eraseblock 1280
[ 2358.604984] mtd_oobtest: verified up to eraseblock 1536
[ 2358.612468] mtd_oobtest: verified up to eraseblock 1792
[ 2358.619923] mtd_oobtest: verified 2048 eraseblocks
[ 2358.619936] mtd_oobtest: test 4 of 5
[ 2365.924669] mtd_oobtest: attempting to start write past end of OOB
[ 2365.924711] mtd_oobtest: an error is expected...
[ 2365.929795] mtd_oobtest: error occurred as expected
[ 2365.934520] mtd_oobtest: attempting to start read past end of OOB
[ 2365.939150] mtd_oobtest: an error is expected...
[ 2365.945371] mtd_oobtest: error occurred as expected
[ 2365.950087] mtd_oobtest: attempting to write past end of device
[ 2365.954660] mtd_oobtest: an error is expected...
[ 2365.960623] mtd_oobtest: error occurred as expected
[ 2365.965422] mtd_oobtest: attempting to read past end of device
[ 2365.970064] mtd_oobtest: an error is expected...
[ 2365.975925] mtd_oobtest: error occurred as expected
[ 2365.984256] mtd_oobtest: attempting to write past end of device
[ 2365.985300] mtd_oobtest: an error is expected...
[ 2365.991242] mtd_oobtest: error: wrote past end of device
[ 2365.996064] mtd_oobtest: attempting to read past end of device
[ 2366.001389] mtd_oobtest: an error is expected...
[ 2366.007028] mtd_oobtest: error: read past end of device
[ 2366.011776] mtd_oobtest: test 5 of 5
[ 2373.317991] mtd_oobtest: writing OOBs of whole device
[ 2373.318034] mtd_oobtest: written up to eraseblock 0
[ 2373.322028] mtd_oobtest: written up to eraseblock 0
[ 2373.327465] mtd_oobtest: written up to eraseblock 256
[ 2373.331576] mtd_oobtest: written up to eraseblock 256
[ 2373.337501] mtd_oobtest: written up to eraseblock 512
[ 2373.341820] mtd_oobtest: written up to eraseblock 512
[ 2373.347566] mtd_oobtest: written up to eraseblock 768
[ 2373.351888] mtd_oobtest: written up to eraseblock 768
[ 2373.357634] mtd_oobtest: written up to eraseblock 1024
[ 2373.361957] mtd_oobtest: written up to eraseblock 1024
[ 2373.367710] mtd_oobtest: written up to eraseblock 1280
[ 2373.372113] mtd_oobtest: written up to eraseblock 1280
[ 2373.377841] mtd_oobtest: written up to eraseblock 1536
[ 2373.382355] mtd_oobtest: written up to eraseblock 1536
[ 2373.387962] mtd_oobtest: written up to eraseblock 1792
[ 2373.392597] mtd_oobtest: written up to eraseblock 1792
[ 2373.398190] mtd_oobtest: written 2047 eraseblocks
[ 2373.402838] mtd_oobtest: verifying all eraseblocks
[ 2373.407629] mtd_oobtest: verified up to eraseblock 0
[ 2373.412483] mtd_oobtest: verified up to eraseblock 256
[ 2373.417625] mtd_oobtest: verified up to eraseblock 512
[ 2373.422518] mtd_oobtest: verified up to eraseblock 768
[ 2373.427650] mtd_oobtest: verified up to eraseblock 1024
[ 2373.432760] mtd_oobtest: verified up to eraseblock 1280
[ 2373.437912] mtd_oobtest: verified up to eraseblock 1536
[ 2373.443091] mtd_oobtest: verified up to eraseblock 1792
[ 2373.448337] mtd_oobtest: verified 2047 eraseblocks
[ 2373.453358] mtd_oobtest: finished with 2 errors
[ 2373.458250] =================================================
Note: the two errors are present even even without this patch when testing
the driver with a flash chip requiring 4 bits ECC strength.
# insmod mtd_stresstest dev=0
[ 2383.256453]
[ 2383.256482] =================================================
[ 2383.257008] mtd_stresstest: MTD device: 0
[ 2383.262650] mtd_stresstest: MTD device size 268435456, eraseblock size 131072, page size 2048, count of eraseblocks 2048, pages per eraseblock 64, OOB size 128
[ 2383.268254] mtd_test: scanning for bad eraseblocks
[ 2383.281992] mtd_test: scanned 2048 eraseblocks, 0 are bad
[ 2383.285565] mtd_stresstest: doing operations
[ 2383.291047] mtd_stresstest: 0 operations done
[ 2427.841267] mtd_stresstest: 1024 operations done
[ 2471.142229] mtd_stresstest: 2048 operations done
[ 2514.405277] mtd_stresstest: 3072 operations done
[ 2555.451926] mtd_stresstest: 4096 operations done
[ 2598.107133] mtd_stresstest: 5120 operations done
[ 2639.936952] mtd_stresstest: 6144 operations done
[ 2680.724751] mtd_stresstest: 7168 operations done
[ 2720.344163] mtd_stresstest: 8192 operations done
[ 2761.645640] mtd_stresstest: 9216 operations done
[ 2791.760534] mtd_stresstest: finished, 10000 operations done
[ 2791.760817] =================================================
#
---
drivers/spi/spi-qpic-snand.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/drivers/spi/spi-qpic-snand.c b/drivers/spi/spi-qpic-snand.c
index dfc8cc5d97624fe741121228b97d2b3562cc5cc4..5e2eacb83b08016ab85a4b676a06f5dfb8cf5808 100644
--- a/drivers/spi/spi-qpic-snand.c
+++ b/drivers/spi/spi-qpic-snand.c
@@ -283,9 +283,22 @@ static int qcom_spi_ecc_init_ctx_pipelined(struct nand_device *nand)
goto err_free_ecc_cfg;
}
- if (ecc_cfg->strength != 4) {
+ switch (ecc_cfg->strength) {
+ case 4:
+ ecc_cfg->ecc_mode = ECC_MODE_4BIT;
+ ecc_cfg->ecc_bytes_hw = 7;
+ ecc_cfg->spare_bytes = 4;
+ break;
+
+ case 8:
+ ecc_cfg->ecc_mode = ECC_MODE_8BIT;
+ ecc_cfg->ecc_bytes_hw = 13;
+ ecc_cfg->spare_bytes = 2;
+ break;
+
+ default:
dev_err(snandc->dev,
- "only 4 bits ECC strength is supported\n");
+ "only 4 or 8 bits ECC strength is supported\n");
ret = -EOPNOTSUPP;
goto err_free_ecc_cfg;
}
@@ -302,8 +315,6 @@ static int qcom_spi_ecc_init_ctx_pipelined(struct nand_device *nand)
nand->ecc.ctx.priv = ecc_cfg;
snandc->qspi->mtd = mtd;
- ecc_cfg->ecc_bytes_hw = 7;
- ecc_cfg->spare_bytes = 4;
ecc_cfg->bbm_size = 1;
ecc_cfg->bch_enabled = true;
ecc_cfg->bytes = ecc_cfg->ecc_bytes_hw + ecc_cfg->spare_bytes + ecc_cfg->bbm_size;
@@ -349,7 +360,7 @@ static int qcom_spi_ecc_init_ctx_pipelined(struct nand_device *nand)
FIELD_PREP(ECC_SW_RESET, 0) |
FIELD_PREP(ECC_NUM_DATA_BYTES_MASK, ecc_cfg->cw_data) |
FIELD_PREP(ECC_FORCE_CLK_OPEN, 1) |
- FIELD_PREP(ECC_MODE_MASK, ECC_MODE_4BIT) |
+ FIELD_PREP(ECC_MODE_MASK, ecc_cfg->ecc_mode) |
FIELD_PREP(ECC_PARITY_SIZE_BYTES_BCH_MASK, ecc_cfg->ecc_bytes_hw);
ecc_cfg->ecc_buf_cfg = 0x203 << NUM_STEPS;
--
2.49.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH next 1/2] mtd: nand: qpic-common: add defines for ECC_MODE values
2025-05-02 19:31 ` [PATCH next 1/2] mtd: nand: qpic-common: add defines for ECC_MODE values Gabor Juhos
@ 2025-05-05 11:08 ` Md Sadre Alam
0 siblings, 0 replies; 15+ messages in thread
From: Md Sadre Alam @ 2025-05-05 11:08 UTC (permalink / raw)
To: Gabor Juhos, Mark Brown, Manivannan Sadhasivam, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra
Cc: Varadarajan Narayanan, Sricharan Ramabadhran, linux-spi,
linux-mtd, linux-arm-msm, linux-kernel
On 5/3/2025 1:01 AM, Gabor Juhos wrote:
> Add defines for the values of the ECC_MODE field of the NAND_DEV0_ECC_CFG
> register and change both the 'qcom-nandc' and 'spi-qpic-snand' drivers to
> use those instead of magic numbers.
>
> No functional changes. This is in preparation for adding 8 bit ECC strength
> support for the 'spi-qpic-snand' driver.
>
> Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
> ---
> drivers/mtd/nand/raw/qcom_nandc.c | 6 +++---
> drivers/spi/spi-qpic-snand.c | 2 +-
> include/linux/mtd/nand-qpic-common.h | 2 ++
> 3 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c
> index 5eaa0be367cdb847d48dbed6f8326a75a5922347..67641ce28bd6435fffda3ffe5e38c777f4708cf8 100644
> --- a/drivers/mtd/nand/raw/qcom_nandc.c
> +++ b/drivers/mtd/nand/raw/qcom_nandc.c
> @@ -1379,7 +1379,7 @@ static int qcom_nand_attach_chip(struct nand_chip *chip)
> struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
> int cwperpage, bad_block_byte, ret;
> bool wide_bus;
> - int ecc_mode = 1;
> + int ecc_mode = ECC_MODE_8BIT;
>
> /* controller only supports 512 bytes data steps */
> ecc->size = NANDC_STEP_SIZE;
> @@ -1400,7 +1400,7 @@ static int qcom_nand_attach_chip(struct nand_chip *chip)
> if (ecc->strength >= 8) {
> /* 8 bit ECC defaults to BCH ECC on all platforms */
> host->bch_enabled = true;
> - ecc_mode = 1;
> + ecc_mode = ECC_MODE_8BIT;
>
> if (wide_bus) {
> host->ecc_bytes_hw = 14;
> @@ -1420,7 +1420,7 @@ static int qcom_nand_attach_chip(struct nand_chip *chip)
> if (nandc->props->ecc_modes & ECC_BCH_4BIT) {
> /* BCH */
> host->bch_enabled = true;
> - ecc_mode = 0;
> + ecc_mode = ECC_MODE_4BIT;
>
> if (wide_bus) {
> host->ecc_bytes_hw = 8;
> diff --git a/drivers/spi/spi-qpic-snand.c b/drivers/spi/spi-qpic-snand.c
> index 88f8fa98687fa292861d46648872135aa7fad80f..dfc8cc5d97624fe741121228b97d2b3562cc5cc4 100644
> --- a/drivers/spi/spi-qpic-snand.c
> +++ b/drivers/spi/spi-qpic-snand.c
> @@ -349,7 +349,7 @@ static int qcom_spi_ecc_init_ctx_pipelined(struct nand_device *nand)
> FIELD_PREP(ECC_SW_RESET, 0) |
> FIELD_PREP(ECC_NUM_DATA_BYTES_MASK, ecc_cfg->cw_data) |
> FIELD_PREP(ECC_FORCE_CLK_OPEN, 1) |
> - FIELD_PREP(ECC_MODE_MASK, 0) |
> + FIELD_PREP(ECC_MODE_MASK, ECC_MODE_4BIT) |
> FIELD_PREP(ECC_PARITY_SIZE_BYTES_BCH_MASK, ecc_cfg->ecc_bytes_hw);
>
> ecc_cfg->ecc_buf_cfg = 0x203 << NUM_STEPS;
> diff --git a/include/linux/mtd/nand-qpic-common.h b/include/linux/mtd/nand-qpic-common.h
> index cd7172e6c1bbffeee0363a14044980a72ea17723..a070af4593754384d9df4f6206a24665e2040aad 100644
> --- a/include/linux/mtd/nand-qpic-common.h
> +++ b/include/linux/mtd/nand-qpic-common.h
> @@ -101,6 +101,8 @@
> #define ECC_SW_RESET BIT(1)
> #define ECC_MODE 4
> #define ECC_MODE_MASK GENMASK(5, 4)
> +#define ECC_MODE_4BIT 0
> +#define ECC_MODE_8BIT 1
> #define ECC_PARITY_SIZE_BYTES_BCH 8
> #define ECC_PARITY_SIZE_BYTES_BCH_MASK GENMASK(12, 8)
> #define ECC_NUM_DATA_BYTES 16
>
Reviewed-by: Md Sadre Alam <quic_mdalam@quicinc.com>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH next 2/2] spi: spi-qpic-snand: add support for 8 bits ECC strength
2025-05-02 19:31 ` [PATCH next 2/2] spi: spi-qpic-snand: add support for 8 bits ECC strength Gabor Juhos
@ 2025-05-05 11:17 ` Md Sadre Alam
2025-05-05 13:21 ` Gabor Juhos
0 siblings, 1 reply; 15+ messages in thread
From: Md Sadre Alam @ 2025-05-05 11:17 UTC (permalink / raw)
To: Gabor Juhos, Mark Brown, Manivannan Sadhasivam, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra
Cc: Varadarajan Narayanan, Sricharan Ramabadhran, linux-spi,
linux-mtd, linux-arm-msm, linux-kernel
On 5/3/2025 1:01 AM, Gabor Juhos wrote:
> Even though the hardware supports 8 bits ECC strength, but that is not
> handled in the driver yet. This change adds the missing bits in order
> to allow using the driver with chips which require 8 bits ECC strength.
>
> No functional changes intended with regard to the existing 4 bits ECC
> strength support.
>
> Tested on an IPQ9574 platform using a GigaDevice GD5F2GM7REYIG chip.
>
> Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
> ---
> mtdtest results:
>
> # dmesg | grep nand
> [ 0.678143] spi-nand spi0.0: GigaDevice SPI NAND was found.
> [ 0.687393] spi-nand spi0.0: 256 MiB, block size: 128 KiB, page size: 2048, OOB size: 128
> # cat /proc/mtd
> dev: size erasesize name
> mtd0: 10000000 00020000 "spi0.0"
> # insmod mtd_test
> # insmod mtd_speedtest dev=0
> [ 63.128425]
> [ 63.128452] =================================================
> [ 63.128979] mtd_speedtest: MTD device: 0
> [ 63.134622] mtd_speedtest: MTD device size 268435456, eraseblock size 131072, page size 2048, count of eraseblocks 2048, pages per eraseblock 64, OOB size 128
> [ 63.139561] mtd_test: scanning for bad eraseblocks
> [ 63.756447] mtd_test: scanned 2048 eraseblocks, 0 are bad
> [ 71.085514] mtd_speedtest: testing eraseblock write speed
> [ 202.745977] mtd_speedtest: eraseblock write speed is 1991 KiB/s
> [ 202.746022] mtd_speedtest: testing eraseblock read speed
> [ 284.104591] mtd_speedtest: eraseblock read speed is 3222 KiB/s
> [ 291.405533] mtd_speedtest: testing page write speed
> [ 422.516341] mtd_speedtest: page write speed is 1999 KiB/s
> [ 422.516384] mtd_speedtest: testing page read speed
> [ 504.144630] mtd_speedtest: page read speed is 3211 KiB/s
> [ 511.476726] mtd_speedtest: testing 2 page write speed
> [ 643.114443] mtd_speedtest: 2 page write speed is 1991 KiB/s
> [ 643.114485] mtd_speedtest: testing 2 page read speed
> [ 724.434752] mtd_speedtest: 2 page read speed is 3223 KiB/s
> [ 724.434796] mtd_speedtest: Testing erase speed
> [ 731.792729] mtd_speedtest: erase speed is 35648 KiB/s
> [ 731.792772] mtd_speedtest: Testing 2x multi-block erase speed
> [ 739.162513] mtd_speedtest: 2x multi-block erase speed is 35589 KiB/s
> [ 739.162558] mtd_speedtest: Testing 4x multi-block erase speed
> [ 746.486241] mtd_speedtest: 4x multi-block erase speed is 35820 KiB/s
> [ 746.486287] mtd_speedtest: Testing 8x multi-block erase speed
> [ 753.789683] mtd_speedtest: 8x multi-block erase speed is 35919 KiB/s
> [ 753.789728] mtd_speedtest: Testing 16x multi-block erase speed
> [ 761.093075] mtd_speedtest: 16x multi-block erase speed is 35920 KiB/s
> [ 761.093120] mtd_speedtest: Testing 32x multi-block erase speed
> [ 768.396145] mtd_speedtest: 32x multi-block erase speed is 35922 KiB/s
> [ 768.396222] mtd_speedtest: Testing 64x multi-block erase speed
> [ 775.699819] mtd_speedtest: 64x multi-block erase speed is 35918 KiB/s
> [ 775.699863] mtd_speedtest: finished
> [ 775.705259] =================================================
> # insmod mtd_readtest dev=0
> [ 919.060671]
> [ 919.060699] =================================================
> [ 919.061226] mtd_readtest: MTD device: 0
> [ 919.066957] mtd_readtest: MTD device size 268435456, eraseblock size 131072, page size 2048, count of eraseblocks 2048, pages per eraseblock 64, OOB size 128
> [ 919.070556] mtd_test: scanning for bad eraseblocks
> [ 919.086016] mtd_test: scanned 2048 eraseblocks, 0 are bad
> [ 919.089465] mtd_readtest: testing page read
> [ 1090.778227] mtd_readtest: finished
> [ 1090.778286] =================================================
> # insmod mtd_pagetest dev=0
> [ 1216.297313]
> [ 1216.297341] =================================================
> [ 1216.297867] mtd_pagetest: MTD device: 0
> [ 1216.303509] mtd_pagetest: MTD device size 268435456, eraseblock size 131072, page size 2048, count of eraseblocks 2048, pages per eraseblock 64, OOB size 128
> [ 1216.307213] mtd_test: scanning for bad eraseblocks
> [ 1216.322680] mtd_test: scanned 2048 eraseblocks, 0 are bad
> [ 1216.326077] mtd_pagetest: erasing whole device
> [ 1223.694968] mtd_pagetest: erased 2048 eraseblocks
> [ 1223.695009] mtd_pagetest: writing whole device
> [ 1223.763930] mtd_pagetest: written up to eraseblock 0
> [ 1240.268942] mtd_pagetest: written up to eraseblock 256
> [ 1256.641498] mtd_pagetest: written up to eraseblock 512
> [ 1273.139048] mtd_pagetest: written up to eraseblock 768
> [ 1289.718929] mtd_pagetest: written up to eraseblock 1024
> [ 1306.244553] mtd_pagetest: written up to eraseblock 1280
> [ 1322.939723] mtd_pagetest: written up to eraseblock 1536
> [ 1339.246937] mtd_pagetest: written up to eraseblock 1792
> [ 1355.613729] mtd_pagetest: written 2048 eraseblocks
> [ 1355.613770] mtd_pagetest: verifying all eraseblocks
> [ 1355.854290] mtd_pagetest: verified up to eraseblock 0
> [ 1416.657733] mtd_pagetest: verified up to eraseblock 256
> [ 1477.384593] mtd_pagetest: verified up to eraseblock 512
> [ 1538.008142] mtd_pagetest: verified up to eraseblock 768
> [ 1599.080797] mtd_pagetest: verified up to eraseblock 1024
> [ 1660.775431] mtd_pagetest: verified up to eraseblock 1280
> [ 1722.177149] mtd_pagetest: verified up to eraseblock 1536
> [ 1783.090166] mtd_pagetest: verified up to eraseblock 1792
> [ 1844.450757] mtd_pagetest: verified 2048 eraseblocks
> [ 1844.450798] mtd_pagetest: crosstest
> [ 1844.455676] mtd_pagetest: reading page at 0x0
> [ 1844.458603] mtd_pagetest: reading page at 0xffff800
> [ 1844.463047] mtd_pagetest: reading page at 0x0
> [ 1844.467790] mtd_pagetest: verifying pages read at 0x0 match
> [ 1844.471636] mtd_pagetest: crosstest ok
> [ 1844.477062] mtd_pagetest: erasecrosstest
> [ 1844.480833] mtd_pagetest: erasing block 0
> [ 1844.488498] mtd_pagetest: writing 1st page of block 0
> [ 1844.489821] mtd_pagetest: reading 1st page of block 0
> [ 1844.494475] mtd_pagetest: verifying 1st page of block 0
> [ 1844.498942] mtd_pagetest: erasing block 0
> [ 1844.507505] mtd_pagetest: writing 1st page of block 0
> [ 1844.509042] mtd_pagetest: erasing block 2047
> [ 1844.516725] mtd_pagetest: reading 1st page of block 0
> [ 1844.518087] mtd_pagetest: verifying 1st page of block 0
> [ 1844.522415] mtd_pagetest: erasecrosstest ok
> [ 1844.527495] mtd_pagetest: erasetest
> [ 1844.531613] mtd_pagetest: erasing block 0
> [ 1844.538671] mtd_pagetest: writing 1st page of block 0
> [ 1844.540249] mtd_pagetest: erasing block 0
> [ 1844.547869] mtd_pagetest: reading 1st page of block 0
> [ 1844.548927] mtd_pagetest: verifying 1st page of block 0 is all 0xff
> [ 1844.553326] mtd_pagetest: erasetest ok
> [ 1844.559440] mtd_pagetest: finished with 0 errors
> [ 1844.563233] =================================================
> # insmod mtd_subpagetest dev=0
> [ 1942.429708]
> [ 1942.429736] =================================================
> [ 1942.430262] mtd_subpagetest: MTD device: 0
> [ 1942.435905] mtd_subpagetest: MTD device size 268435456, eraseblock size 131072, page size 2048, subpage size 2048, count of eraseblocks 2048, pages per eraseblock 64, OOB size 128
> [ 1942.439994] mtd_test: scanning for bad eraseblocks
> [ 1942.457111] mtd_test: scanned 2048 eraseblocks, 0 are bad
> [ 1949.824564] mtd_subpagetest: writing whole device
> [ 1949.826670] mtd_subpagetest: written up to eraseblock 0
> [ 1950.351816] mtd_subpagetest: written up to eraseblock 256
> [ 1950.875797] mtd_subpagetest: written up to eraseblock 512
> [ 1951.399912] mtd_subpagetest: written up to eraseblock 768
> [ 1951.923618] mtd_subpagetest: written up to eraseblock 1024
> [ 1952.447361] mtd_subpagetest: written up to eraseblock 1280
> [ 1952.970834] mtd_subpagetest: written up to eraseblock 1536
> [ 1953.494635] mtd_subpagetest: written up to eraseblock 1792
> [ 1954.016265] mtd_subpagetest: written 2048 eraseblocks
> [ 1954.016294] mtd_subpagetest: verifying all eraseblocks
> [ 1954.021617] mtd_subpagetest: verified up to eraseblock 0
> [ 1954.347458] mtd_subpagetest: verified up to eraseblock 256
> [ 1954.667446] mtd_subpagetest: verified up to eraseblock 512
> [ 1954.987343] mtd_subpagetest: verified up to eraseblock 768
> [ 1955.307385] mtd_subpagetest: verified up to eraseblock 1024
> [ 1955.627462] mtd_subpagetest: verified up to eraseblock 1280
> [ 1955.947277] mtd_subpagetest: verified up to eraseblock 1536
> [ 1956.266834] mtd_subpagetest: verified up to eraseblock 1792
> [ 1956.585581] mtd_subpagetest: verified 2048 eraseblocks
> [ 1963.889308] mtd_subpagetest: verifying all eraseblocks for 0xff
> [ 1963.930487] mtd_subpagetest: verified up to eraseblock 0
> [ 1974.592567] mtd_subpagetest: verified up to eraseblock 256
> [ 1985.180953] mtd_subpagetest: verified up to eraseblock 512
> [ 1995.805397] mtd_subpagetest: verified up to eraseblock 768
> [ 2006.348859] mtd_subpagetest: verified up to eraseblock 1024
> [ 2016.900530] mtd_subpagetest: verified up to eraseblock 1280
> [ 2027.447587] mtd_subpagetest: verified up to eraseblock 1536
> [ 2037.962383] mtd_subpagetest: verified up to eraseblock 1792
> [ 2048.587863] mtd_subpagetest: verified 2048 eraseblocks
> [ 2048.587906] mtd_subpagetest: writing whole device
> [ 2048.648174] mtd_subpagetest: written up to eraseblock 0
> [ 2062.643145] mtd_subpagetest: written up to eraseblock 256
> [ 2076.699015] mtd_subpagetest: written up to eraseblock 512
> [ 2091.004910] mtd_subpagetest: written up to eraseblock 768
> [ 2105.149879] mtd_subpagetest: written up to eraseblock 1024
> [ 2119.470691] mtd_subpagetest: written up to eraseblock 1280
> [ 2133.746861] mtd_subpagetest: written up to eraseblock 1536
> [ 2147.776477] mtd_subpagetest: written up to eraseblock 1792
> [ 2161.947734] mtd_subpagetest: written 2048 eraseblocks
> [ 2161.947776] mtd_subpagetest: verifying all eraseblocks
> [ 2161.986109] mtd_subpagetest: verified up to eraseblock 0
> [ 2170.818316] mtd_subpagetest: verified up to eraseblock 256
> [ 2179.596875] mtd_subpagetest: verified up to eraseblock 512
> [ 2188.405116] mtd_subpagetest: verified up to eraseblock 768
> [ 2197.188588] mtd_subpagetest: verified up to eraseblock 1024
> [ 2206.002204] mtd_subpagetest: verified up to eraseblock 1280
> [ 2214.784815] mtd_subpagetest: verified up to eraseblock 1536
> [ 2223.557141] mtd_subpagetest: verified up to eraseblock 1792
> [ 2232.472832] mtd_subpagetest: verified 2048 eraseblocks
> [ 2239.818213] mtd_subpagetest: verifying all eraseblocks for 0xff
> [ 2239.861404] mtd_subpagetest: verified up to eraseblock 0
> [ 2250.439035] mtd_subpagetest: verified up to eraseblock 256
> [ 2261.176485] mtd_subpagetest: verified up to eraseblock 512
> [ 2271.713183] mtd_subpagetest: verified up to eraseblock 768
> [ 2282.356892] mtd_subpagetest: verified up to eraseblock 1024
> [ 2292.891424] mtd_subpagetest: verified up to eraseblock 1280
> [ 2303.543110] mtd_subpagetest: verified up to eraseblock 1536
> [ 2314.116690] mtd_subpagetest: verified up to eraseblock 1792
> [ 2324.607804] mtd_subpagetest: verified 2048 eraseblocks
> [ 2324.607846] mtd_subpagetest: finished with 0 errors
> [ 2324.611859] =================================================
> # insmod mtd_oobtest dev=0
> [ 2336.159109]
> [ 2336.159138] =================================================
> [ 2336.159664] mtd_oobtest: MTD device: 0
> [ 2336.165308] mtd_oobtest: MTD device size 268435456, eraseblock size 131072, page size 2048, count of eraseblocks 2048, pages per eraseblock 64, OOB size 128
> [ 2336.169043] mtd_test: scanning for bad eraseblocks
> [ 2336.184354] mtd_test: scanned 2048 eraseblocks, 0 are bad
> [ 2336.187716] mtd_oobtest: test 1 of 5
> [ 2343.495966] mtd_oobtest: writing OOBs of whole device
> [ 2343.496073] mtd_oobtest: written up to eraseblock 0
> [ 2343.516803] mtd_oobtest: written up to eraseblock 256
> [ 2343.533527] mtd_oobtest: written up to eraseblock 512
> [ 2343.549945] mtd_oobtest: written up to eraseblock 768
> [ 2343.563666] mtd_oobtest: written up to eraseblock 1024
> [ 2343.575186] mtd_oobtest: written up to eraseblock 1280
> [ 2343.584310] mtd_oobtest: written up to eraseblock 1536
> [ 2343.593011] mtd_oobtest: written up to eraseblock 1792
> [ 2343.600847] mtd_oobtest: written 2048 eraseblocks
> [ 2343.600861] mtd_oobtest: verifying all eraseblocks
> [ 2343.604542] mtd_oobtest: verified up to eraseblock 0
> [ 2343.616606] mtd_oobtest: verified up to eraseblock 256
> [ 2343.623992] mtd_oobtest: verified up to eraseblock 512
> [ 2343.631390] mtd_oobtest: verified up to eraseblock 768
> [ 2343.638788] mtd_oobtest: verified up to eraseblock 1024
> [ 2343.646184] mtd_oobtest: verified up to eraseblock 1280
> [ 2343.653570] mtd_oobtest: verified up to eraseblock 1536
> [ 2343.660970] mtd_oobtest: verified up to eraseblock 1792
> [ 2343.668356] mtd_oobtest: verified 2048 eraseblocks
> [ 2343.668369] mtd_oobtest: test 2 of 5
> [ 2350.985635] mtd_oobtest: writing OOBs of whole device
> [ 2350.985743] mtd_oobtest: written up to eraseblock 0
> [ 2351.006445] mtd_oobtest: written up to eraseblock 256
> [ 2351.023170] mtd_oobtest: written up to eraseblock 512
> [ 2351.039645] mtd_oobtest: written up to eraseblock 768
> [ 2351.053395] mtd_oobtest: written up to eraseblock 1024
> [ 2351.064954] mtd_oobtest: written up to eraseblock 1280
> [ 2351.074144] mtd_oobtest: written up to eraseblock 1536
> [ 2351.082848] mtd_oobtest: written up to eraseblock 1792
> [ 2351.090707] mtd_oobtest: written 2048 eraseblocks
> [ 2351.090721] mtd_oobtest: verifying all eraseblocks
> [ 2351.094373] mtd_oobtest: verified up to eraseblock 0
> [ 2351.099353] mtd_oobtest: verified up to eraseblock 256
> [ 2351.104460] mtd_oobtest: verified up to eraseblock 512
> [ 2351.109437] mtd_oobtest: verified up to eraseblock 768
> [ 2351.114528] mtd_oobtest: verified up to eraseblock 1024
> [ 2351.119683] mtd_oobtest: verified up to eraseblock 1280
> [ 2351.124772] mtd_oobtest: verified up to eraseblock 1536
> [ 2351.129996] mtd_oobtest: verified up to eraseblock 1792
> [ 2351.135187] mtd_oobtest: verified 2048 eraseblocks
> [ 2351.140130] mtd_oobtest: test 3 of 5
> [ 2358.448438] mtd_oobtest: writing OOBs of whole device
> [ 2358.448546] mtd_oobtest: written up to eraseblock 0
> [ 2358.469297] mtd_oobtest: written up to eraseblock 256
> [ 2358.486095] mtd_oobtest: written up to eraseblock 512
> [ 2358.501993] mtd_oobtest: written up to eraseblock 768
> [ 2358.515473] mtd_oobtest: written up to eraseblock 1024
> [ 2358.526708] mtd_oobtest: written up to eraseblock 1280
> [ 2358.535426] mtd_oobtest: written up to eraseblock 1536
> [ 2358.544152] mtd_oobtest: written up to eraseblock 1792
> [ 2358.551732] mtd_oobtest: written 2048 eraseblocks
> [ 2358.551744] mtd_oobtest: verifying all eraseblocks
> [ 2358.555424] mtd_oobtest: verified up to eraseblock 0
> [ 2358.567572] mtd_oobtest: verified up to eraseblock 256
> [ 2358.575045] mtd_oobtest: verified up to eraseblock 512
> [ 2358.582537] mtd_oobtest: verified up to eraseblock 768
> [ 2358.590024] mtd_oobtest: verified up to eraseblock 1024
> [ 2358.597511] mtd_oobtest: verified up to eraseblock 1280
> [ 2358.604984] mtd_oobtest: verified up to eraseblock 1536
> [ 2358.612468] mtd_oobtest: verified up to eraseblock 1792
> [ 2358.619923] mtd_oobtest: verified 2048 eraseblocks
> [ 2358.619936] mtd_oobtest: test 4 of 5
> [ 2365.924669] mtd_oobtest: attempting to start write past end of OOB
> [ 2365.924711] mtd_oobtest: an error is expected...
> [ 2365.929795] mtd_oobtest: error occurred as expected
> [ 2365.934520] mtd_oobtest: attempting to start read past end of OOB
> [ 2365.939150] mtd_oobtest: an error is expected...
> [ 2365.945371] mtd_oobtest: error occurred as expected
> [ 2365.950087] mtd_oobtest: attempting to write past end of device
> [ 2365.954660] mtd_oobtest: an error is expected...
> [ 2365.960623] mtd_oobtest: error occurred as expected
> [ 2365.965422] mtd_oobtest: attempting to read past end of device
> [ 2365.970064] mtd_oobtest: an error is expected...
> [ 2365.975925] mtd_oobtest: error occurred as expected
> [ 2365.984256] mtd_oobtest: attempting to write past end of device
> [ 2365.985300] mtd_oobtest: an error is expected...
> [ 2365.991242] mtd_oobtest: error: wrote past end of device
> [ 2365.996064] mtd_oobtest: attempting to read past end of device
> [ 2366.001389] mtd_oobtest: an error is expected...
> [ 2366.007028] mtd_oobtest: error: read past end of device
> [ 2366.011776] mtd_oobtest: test 5 of 5
> [ 2373.317991] mtd_oobtest: writing OOBs of whole device
> [ 2373.318034] mtd_oobtest: written up to eraseblock 0
> [ 2373.322028] mtd_oobtest: written up to eraseblock 0
> [ 2373.327465] mtd_oobtest: written up to eraseblock 256
> [ 2373.331576] mtd_oobtest: written up to eraseblock 256
> [ 2373.337501] mtd_oobtest: written up to eraseblock 512
> [ 2373.341820] mtd_oobtest: written up to eraseblock 512
> [ 2373.347566] mtd_oobtest: written up to eraseblock 768
> [ 2373.351888] mtd_oobtest: written up to eraseblock 768
> [ 2373.357634] mtd_oobtest: written up to eraseblock 1024
> [ 2373.361957] mtd_oobtest: written up to eraseblock 1024
> [ 2373.367710] mtd_oobtest: written up to eraseblock 1280
> [ 2373.372113] mtd_oobtest: written up to eraseblock 1280
> [ 2373.377841] mtd_oobtest: written up to eraseblock 1536
> [ 2373.382355] mtd_oobtest: written up to eraseblock 1536
> [ 2373.387962] mtd_oobtest: written up to eraseblock 1792
> [ 2373.392597] mtd_oobtest: written up to eraseblock 1792
> [ 2373.398190] mtd_oobtest: written 2047 eraseblocks
> [ 2373.402838] mtd_oobtest: verifying all eraseblocks
> [ 2373.407629] mtd_oobtest: verified up to eraseblock 0
> [ 2373.412483] mtd_oobtest: verified up to eraseblock 256
> [ 2373.417625] mtd_oobtest: verified up to eraseblock 512
> [ 2373.422518] mtd_oobtest: verified up to eraseblock 768
> [ 2373.427650] mtd_oobtest: verified up to eraseblock 1024
> [ 2373.432760] mtd_oobtest: verified up to eraseblock 1280
> [ 2373.437912] mtd_oobtest: verified up to eraseblock 1536
> [ 2373.443091] mtd_oobtest: verified up to eraseblock 1792
> [ 2373.448337] mtd_oobtest: verified 2047 eraseblocks
> [ 2373.453358] mtd_oobtest: finished with 2 errors
> [ 2373.458250] =================================================
>
> Note: the two errors are present even even without this patch when testing
> the driver with a flash chip requiring 4 bits ECC strength.
>
> # insmod mtd_stresstest dev=0
> [ 2383.256453]
> [ 2383.256482] =================================================
> [ 2383.257008] mtd_stresstest: MTD device: 0
> [ 2383.262650] mtd_stresstest: MTD device size 268435456, eraseblock size 131072, page size 2048, count of eraseblocks 2048, pages per eraseblock 64, OOB size 128
> [ 2383.268254] mtd_test: scanning for bad eraseblocks
> [ 2383.281992] mtd_test: scanned 2048 eraseblocks, 0 are bad
> [ 2383.285565] mtd_stresstest: doing operations
> [ 2383.291047] mtd_stresstest: 0 operations done
> [ 2427.841267] mtd_stresstest: 1024 operations done
> [ 2471.142229] mtd_stresstest: 2048 operations done
> [ 2514.405277] mtd_stresstest: 3072 operations done
> [ 2555.451926] mtd_stresstest: 4096 operations done
> [ 2598.107133] mtd_stresstest: 5120 operations done
> [ 2639.936952] mtd_stresstest: 6144 operations done
> [ 2680.724751] mtd_stresstest: 7168 operations done
> [ 2720.344163] mtd_stresstest: 8192 operations done
> [ 2761.645640] mtd_stresstest: 9216 operations done
> [ 2791.760534] mtd_stresstest: finished, 10000 operations done
> [ 2791.760817] =================================================
> #
Could you please run biterror test "mtd_nandbiterrs" with the same
device, since you are adding 8-bit ECC support.
Regards,
Alam.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH next 2/2] spi: spi-qpic-snand: add support for 8 bits ECC strength
2025-05-05 11:17 ` Md Sadre Alam
@ 2025-05-05 13:21 ` Gabor Juhos
2025-05-12 8:32 ` Miquel Raynal
0 siblings, 1 reply; 15+ messages in thread
From: Gabor Juhos @ 2025-05-05 13:21 UTC (permalink / raw)
To: Md Sadre Alam, Mark Brown, Manivannan Sadhasivam, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra
Cc: Varadarajan Narayanan, Sricharan Ramabadhran, linux-spi,
linux-mtd, linux-arm-msm, linux-kernel
2025. 05. 05. 13:17 keltezéssel, Md Sadre Alam írta:
>
>
[...]
>> [ 2720.344163] mtd_stresstest: 8192 operations done
>> [ 2761.645640] mtd_stresstest: 9216 operations done
>> [ 2791.760534] mtd_stresstest: finished, 10000 operations done
>> [ 2791.760817] =================================================
>> #
> Could you please run biterror test "mtd_nandbiterrs" with the same device, since
> you are adding 8-bit ECC support.
Sure, here is the result:
# insmod mtd_test
# for i in $(seq 0 4); do insmod mtd_nandbiterrs; done
[ 45.405610]
[ 45.405638] ==================================================
[ 45.406164] mtd_nandbiterrs: MTD device: 0
[ 45.411807] mtd_nandbiterrs: MTD device size 268435456, eraseblock=131072,
page=2048, oob=128
[ 45.415990] mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
[ 45.424495] mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
[ 45.434686] mtd_nandbiterrs: incremental biterrors test
[ 45.436653] mtd_nandbiterrs: write_page
[ 45.442634] mtd_nandbiterrs: rewrite page
[ 45.446408] mtd_nandbiterrs: read_page
[ 45.450346] mtd_nandbiterrs: verify_page
[ 45.453320] mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
[ 45.457405] mtd_nandbiterrs: Inserted biterror @ 0/5
[ 45.464431] mtd_nandbiterrs: rewrite page
[ 45.470216] mtd_nandbiterrs: read_page
[ 45.473852] mtd_nandbiterrs: Read reported 1 corrected bit errors
[ 45.476909] mtd_nandbiterrs: verify_page
[ 45.483090] mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
[ 45.487098] mtd_nandbiterrs: Inserted biterror @ 0/2
[ 45.494111] mtd_nandbiterrs: rewrite page
[ 45.499850] mtd_nandbiterrs: read_page
[ 45.503557] mtd_nandbiterrs: Read reported 1 corrected bit errors
[ 45.506597] mtd_nandbiterrs: verify_page
[ 45.512777] mtd_nandbiterrs: Successfully corrected 2 bit errors per subpage
[ 45.516768] mtd_nandbiterrs: Inserted biterror @ 0/0
[ 45.523810] mtd_nandbiterrs: rewrite page
[ 45.529586] mtd_nandbiterrs: read_page
[ 45.533224] mtd_nandbiterrs: Read reported 1 corrected bit errors
[ 45.536305] mtd_nandbiterrs: verify_page
[ 45.542464] mtd_nandbiterrs: Successfully corrected 3 bit errors per subpage
[ 45.546457] mtd_nandbiterrs: Inserted biterror @ 1/7
[ 45.553470] mtd_nandbiterrs: rewrite page
[ 45.559244] mtd_nandbiterrs: read_page
[ 45.562914] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 45.565991] mtd_nandbiterrs: verify_page
[ 45.572153] mtd_nandbiterrs: Successfully corrected 4 bit errors per subpage
[ 45.576142] mtd_nandbiterrs: Inserted biterror @ 1/5
[ 45.583158] mtd_nandbiterrs: rewrite page
[ 45.588927] mtd_nandbiterrs: read_page
[ 45.592599] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 45.595680] mtd_nandbiterrs: verify_page
[ 45.601840] mtd_nandbiterrs: Successfully corrected 5 bit errors per subpage
[ 45.605831] mtd_nandbiterrs: Inserted biterror @ 1/2
[ 45.612846] mtd_nandbiterrs: rewrite page
[ 45.618618] mtd_nandbiterrs: read_page
[ 45.622286] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 45.625434] mtd_nandbiterrs: verify_page
[ 45.631528] mtd_nandbiterrs: Successfully corrected 6 bit errors per subpage
[ 45.635517] mtd_nandbiterrs: Inserted biterror @ 1/0
[ 45.642533] mtd_nandbiterrs: rewrite page
[ 45.648303] mtd_nandbiterrs: read_page
[ 45.651975] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 45.655055] mtd_nandbiterrs: verify_page
[ 45.661215] mtd_nandbiterrs: Successfully corrected 7 bit errors per subpage
[ 45.665207] mtd_nandbiterrs: Inserted biterror @ 2/6
[ 45.672221] mtd_nandbiterrs: rewrite page
[ 45.677987] mtd_nandbiterrs: read_page
[ 45.681663] mtd_nandbiterrs: Read reported 3 corrected bit errors
[ 45.684741] mtd_nandbiterrs: verify_page
[ 45.690902] mtd_nandbiterrs: Successfully corrected 8 bit errors per subpage
[ 45.694892] mtd_nandbiterrs: Inserted biterror @ 2/5
[ 45.701908] mtd_nandbiterrs: rewrite page
[ 45.707678] mtd_nandbiterrs: read_page
[ 45.711351] mtd_nandbiterrs: error: read failed at 0x0
[ 45.714431] mtd_nandbiterrs: After 9 biterrors per subpage, read reported
error -74
[ 45.722975] mtd_nandbiterrs: finished successfully.
[ 45.727101] ==================================================
[ 46.200485]
[ 46.200512] ==================================================
[ 46.201039] mtd_nandbiterrs: MTD device: 0
[ 46.206751] mtd_nandbiterrs: MTD device size 268435456, eraseblock=131072,
page=2048, oob=128
[ 46.210763] mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
[ 46.219377] mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
[ 46.228941] mtd_nandbiterrs: incremental biterrors test
[ 46.231522] mtd_nandbiterrs: write_page
[ 46.237524] mtd_nandbiterrs: rewrite page
[ 46.241199] mtd_nandbiterrs: read_page
[ 46.245175] mtd_nandbiterrs: verify_page
[ 46.248195] mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
[ 46.252254] mtd_nandbiterrs: Inserted biterror @ 0/5
[ 46.259317] mtd_nandbiterrs: rewrite page
[ 46.265230] mtd_nandbiterrs: read_page
[ 46.268955] mtd_nandbiterrs: Read reported 1 corrected bit errors
[ 46.271784] mtd_nandbiterrs: verify_page
[ 46.277987] mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
[ 46.281941] mtd_nandbiterrs: Inserted biterror @ 0/2
[ 46.288985] mtd_nandbiterrs: rewrite page
[ 46.294803] mtd_nandbiterrs: read_page
[ 46.298414] mtd_nandbiterrs: Read reported 1 corrected bit errors
[ 46.301472] mtd_nandbiterrs: verify_page
[ 46.307677] mtd_nandbiterrs: Successfully corrected 2 bit errors per subpage
[ 46.311629] mtd_nandbiterrs: Inserted biterror @ 0/0
[ 46.318686] mtd_nandbiterrs: rewrite page
[ 46.324470] mtd_nandbiterrs: read_page
[ 46.328100] mtd_nandbiterrs: Read reported 1 corrected bit errors
[ 46.331159] mtd_nandbiterrs: verify_page
[ 46.337371] mtd_nandbiterrs: Successfully corrected 3 bit errors per subpage
[ 46.341316] mtd_nandbiterrs: Inserted biterror @ 1/7
[ 46.348365] mtd_nandbiterrs: rewrite page
[ 46.354123] mtd_nandbiterrs: read_page
[ 46.357787] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 46.360846] mtd_nandbiterrs: verify_page
[ 46.367047] mtd_nandbiterrs: Successfully corrected 4 bit errors per subpage
[ 46.371003] mtd_nandbiterrs: Inserted biterror @ 1/5
[ 46.378046] mtd_nandbiterrs: rewrite page
[ 46.383794] mtd_nandbiterrs: read_page
[ 46.387475] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 46.390534] mtd_nandbiterrs: verify_page
[ 46.396747] mtd_nandbiterrs: Successfully corrected 5 bit errors per subpage
[ 46.400691] mtd_nandbiterrs: Inserted biterror @ 1/2
[ 46.407733] mtd_nandbiterrs: rewrite page
[ 46.413483] mtd_nandbiterrs: read_page
[ 46.417190] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 46.420222] mtd_nandbiterrs: verify_page
[ 46.426419] mtd_nandbiterrs: Successfully corrected 6 bit errors per subpage
[ 46.430379] mtd_nandbiterrs: Inserted biterror @ 1/0
[ 46.437423] mtd_nandbiterrs: rewrite page
[ 46.443168] mtd_nandbiterrs: read_page
[ 46.446875] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 46.449908] mtd_nandbiterrs: verify_page
[ 46.456109] mtd_nandbiterrs: Successfully corrected 7 bit errors per subpage
[ 46.460066] mtd_nandbiterrs: Inserted biterror @ 2/6
[ 46.467109] mtd_nandbiterrs: rewrite page
[ 46.472888] mtd_nandbiterrs: read_page
[ 46.476569] mtd_nandbiterrs: Read reported 3 corrected bit errors
[ 46.479597] mtd_nandbiterrs: verify_page
[ 46.485796] mtd_nandbiterrs: Successfully corrected 8 bit errors per subpage
[ 46.489753] mtd_nandbiterrs: Inserted biterror @ 2/5
[ 46.496797] mtd_nandbiterrs: rewrite page
[ 46.502540] mtd_nandbiterrs: read_page
[ 46.506249] mtd_nandbiterrs: error: read failed at 0x0
[ 46.509284] mtd_nandbiterrs: After 9 biterrors per subpage, read reported
error -74
[ 46.517867] mtd_nandbiterrs: finished successfully.
[ 46.521956] ==================================================
[ 47.150313]
[ 47.150341] ==================================================
[ 47.150867] mtd_nandbiterrs: MTD device: 0
[ 47.156564] mtd_nandbiterrs: MTD device size 268435456, eraseblock=131072,
page=2048, oob=128
[ 47.160591] mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
[ 47.169201] mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
[ 47.178778] mtd_nandbiterrs: incremental biterrors test
[ 47.181350] mtd_nandbiterrs: write_page
[ 47.187334] mtd_nandbiterrs: rewrite page
[ 47.191016] mtd_nandbiterrs: read_page
[ 47.194997] mtd_nandbiterrs: verify_page
[ 47.198019] mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
[ 47.202081] mtd_nandbiterrs: Inserted biterror @ 0/5
[ 47.209132] mtd_nandbiterrs: rewrite page
[ 47.214962] mtd_nandbiterrs: read_page
[ 47.218554] mtd_nandbiterrs: Read reported 1 corrected bit errors
[ 47.221612] mtd_nandbiterrs: verify_page
[ 47.227814] mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
[ 47.231769] mtd_nandbiterrs: Inserted biterror @ 0/2
[ 47.238816] mtd_nandbiterrs: rewrite page
[ 47.244574] mtd_nandbiterrs: read_page
[ 47.248242] mtd_nandbiterrs: Read reported 1 corrected bit errors
[ 47.251300] mtd_nandbiterrs: verify_page
[ 47.257499] mtd_nandbiterrs: Successfully corrected 2 bit errors per subpage
[ 47.261457] mtd_nandbiterrs: Inserted biterror @ 0/0
[ 47.268504] mtd_nandbiterrs: rewrite page
[ 47.274301] mtd_nandbiterrs: read_page
[ 47.277930] mtd_nandbiterrs: Read reported 1 corrected bit errors
[ 47.280987] mtd_nandbiterrs: verify_page
[ 47.287187] mtd_nandbiterrs: Successfully corrected 3 bit errors per subpage
[ 47.291145] mtd_nandbiterrs: Inserted biterror @ 1/7
[ 47.298191] mtd_nandbiterrs: rewrite page
[ 47.303951] mtd_nandbiterrs: read_page
[ 47.307619] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 47.310675] mtd_nandbiterrs: verify_page
[ 47.316876] mtd_nandbiterrs: Successfully corrected 4 bit errors per subpage
[ 47.320832] mtd_nandbiterrs: Inserted biterror @ 1/5
[ 47.327875] mtd_nandbiterrs: rewrite page
[ 47.333629] mtd_nandbiterrs: read_page
[ 47.337305] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 47.340362] mtd_nandbiterrs: verify_page
[ 47.346563] mtd_nandbiterrs: Successfully corrected 5 bit errors per subpage
[ 47.350519] mtd_nandbiterrs: Inserted biterror @ 1/2
[ 47.357561] mtd_nandbiterrs: rewrite page
[ 47.363310] mtd_nandbiterrs: read_page
[ 47.367021] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 47.370050] mtd_nandbiterrs: verify_page
[ 47.376248] mtd_nandbiterrs: Successfully corrected 6 bit errors per subpage
[ 47.380207] mtd_nandbiterrs: Inserted biterror @ 1/0
[ 47.387250] mtd_nandbiterrs: rewrite page
[ 47.392996] mtd_nandbiterrs: read_page
[ 47.396703] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 47.399737] mtd_nandbiterrs: verify_page
[ 47.405936] mtd_nandbiterrs: Successfully corrected 7 bit errors per subpage
[ 47.409894] mtd_nandbiterrs: Inserted biterror @ 2/6
[ 47.416938] mtd_nandbiterrs: rewrite page
[ 47.422685] mtd_nandbiterrs: read_page
[ 47.426387] mtd_nandbiterrs: Read reported 3 corrected bit errors
[ 47.429424] mtd_nandbiterrs: verify_page
[ 47.435637] mtd_nandbiterrs: Successfully corrected 8 bit errors per subpage
[ 47.439582] mtd_nandbiterrs: Inserted biterror @ 2/5
[ 47.446624] mtd_nandbiterrs: rewrite page
[ 47.452369] mtd_nandbiterrs: read_page
[ 47.456080] mtd_nandbiterrs: error: read failed at 0x0
[ 47.459111] mtd_nandbiterrs: After 9 biterrors per subpage, read reported
error -74
[ 47.467699] mtd_nandbiterrs: finished successfully.
[ 47.471784] ==================================================
[ 48.080311]
[ 48.080339] ==================================================
[ 48.080866] mtd_nandbiterrs: MTD device: 0
[ 48.086560] mtd_nandbiterrs: MTD device size 268435456, eraseblock=131072,
page=2048, oob=128
[ 48.090590] mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
[ 48.099204] mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
[ 48.108765] mtd_nandbiterrs: incremental biterrors test
[ 48.111353] mtd_nandbiterrs: write_page
[ 48.117325] mtd_nandbiterrs: rewrite page
[ 48.121017] mtd_nandbiterrs: read_page
[ 48.124996] mtd_nandbiterrs: verify_page
[ 48.128017] mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
[ 48.132080] mtd_nandbiterrs: Inserted biterror @ 0/5
[ 48.139131] mtd_nandbiterrs: rewrite page
[ 48.144881] mtd_nandbiterrs: read_page
[ 48.148552] mtd_nandbiterrs: Read reported 1 corrected bit errors
[ 48.151611] mtd_nandbiterrs: verify_page
[ 48.157816] mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
[ 48.161768] mtd_nandbiterrs: Inserted biterror @ 0/2
[ 48.168891] mtd_nandbiterrs: rewrite page
[ 48.174571] mtd_nandbiterrs: read_page
[ 48.178241] mtd_nandbiterrs: Read reported 1 corrected bit errors
[ 48.181299] mtd_nandbiterrs: verify_page
[ 48.187500] mtd_nandbiterrs: Successfully corrected 2 bit errors per subpage
[ 48.191455] mtd_nandbiterrs: Inserted biterror @ 0/0
[ 48.198506] mtd_nandbiterrs: rewrite page
[ 48.204299] mtd_nandbiterrs: read_page
[ 48.207931] mtd_nandbiterrs: Read reported 1 corrected bit errors
[ 48.210985] mtd_nandbiterrs: verify_page
[ 48.217187] mtd_nandbiterrs: Successfully corrected 3 bit errors per subpage
[ 48.221142] mtd_nandbiterrs: Inserted biterror @ 1/7
[ 48.228188] mtd_nandbiterrs: rewrite page
[ 48.233950] mtd_nandbiterrs: read_page
[ 48.237617] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 48.240673] mtd_nandbiterrs: verify_page
[ 48.246872] mtd_nandbiterrs: Successfully corrected 4 bit errors per subpage
[ 48.250831] mtd_nandbiterrs: Inserted biterror @ 1/5
[ 48.257875] mtd_nandbiterrs: rewrite page
[ 48.263631] mtd_nandbiterrs: read_page
[ 48.267303] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 48.270361] mtd_nandbiterrs: verify_page
[ 48.276560] mtd_nandbiterrs: Successfully corrected 5 bit errors per subpage
[ 48.280531] mtd_nandbiterrs: Inserted biterror @ 1/2
[ 48.287592] mtd_nandbiterrs: rewrite page
[ 48.293338] mtd_nandbiterrs: read_page
[ 48.297030] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 48.300049] mtd_nandbiterrs: verify_page
[ 48.306247] mtd_nandbiterrs: Successfully corrected 6 bit errors per subpage
[ 48.310205] mtd_nandbiterrs: Inserted biterror @ 1/0
[ 48.317250] mtd_nandbiterrs: rewrite page
[ 48.322994] mtd_nandbiterrs: read_page
[ 48.326705] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 48.329736] mtd_nandbiterrs: verify_page
[ 48.335935] mtd_nandbiterrs: Successfully corrected 7 bit errors per subpage
[ 48.339892] mtd_nandbiterrs: Inserted biterror @ 2/6
[ 48.346936] mtd_nandbiterrs: rewrite page
[ 48.352633] mtd_nandbiterrs: read_page
[ 48.356391] mtd_nandbiterrs: Read reported 3 corrected bit errors
[ 48.359423] mtd_nandbiterrs: verify_page
[ 48.365626] mtd_nandbiterrs: Successfully corrected 8 bit errors per subpage
[ 48.369581] mtd_nandbiterrs: Inserted biterror @ 2/5
[ 48.376627] mtd_nandbiterrs: rewrite page
[ 48.382322] mtd_nandbiterrs: read_page
[ 48.386077] mtd_nandbiterrs: error: read failed at 0x0
[ 48.389110] mtd_nandbiterrs: After 9 biterrors per subpage, read reported
error -74
[ 48.397695] mtd_nandbiterrs: finished successfully.
[ 48.401783] ==================================================
[ 48.940558]
[ 48.940586] ==================================================
[ 48.941112] mtd_nandbiterrs: MTD device: 0
[ 48.946811] mtd_nandbiterrs: MTD device size 268435456, eraseblock=131072,
page=2048, oob=128
[ 48.950837] mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
[ 48.959448] mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
[ 48.969014] mtd_nandbiterrs: incremental biterrors test
[ 48.971596] mtd_nandbiterrs: write_page
[ 48.977594] mtd_nandbiterrs: rewrite page
[ 48.981277] mtd_nandbiterrs: read_page
[ 48.985247] mtd_nandbiterrs: verify_page
[ 48.988269] mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
[ 48.992327] mtd_nandbiterrs: Inserted biterror @ 0/5
[ 48.999428] mtd_nandbiterrs: rewrite page
[ 49.005508] mtd_nandbiterrs: read_page
[ 49.008836] mtd_nandbiterrs: Read reported 1 corrected bit errors
[ 49.011858] mtd_nandbiterrs: verify_page
[ 49.018061] mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
[ 49.022015] mtd_nandbiterrs: Inserted biterror @ 0/2
[ 49.029058] mtd_nandbiterrs: rewrite page
[ 49.034848] mtd_nandbiterrs: read_page
[ 49.038516] mtd_nandbiterrs: Read reported 1 corrected bit errors
[ 49.041545] mtd_nandbiterrs: verify_page
[ 49.047755] mtd_nandbiterrs: Successfully corrected 2 bit errors per subpage
[ 49.051702] mtd_nandbiterrs: Inserted biterror @ 0/0
[ 49.058760] mtd_nandbiterrs: rewrite page
[ 49.064565] mtd_nandbiterrs: read_page
[ 49.068203] mtd_nandbiterrs: Read reported 1 corrected bit errors
[ 49.071232] mtd_nandbiterrs: verify_page
[ 49.077432] mtd_nandbiterrs: Successfully corrected 3 bit errors per subpage
[ 49.081389] mtd_nandbiterrs: Inserted biterror @ 1/7
[ 49.088432] mtd_nandbiterrs: rewrite page
[ 49.094197] mtd_nandbiterrs: read_page
[ 49.097889] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 49.100919] mtd_nandbiterrs: verify_page
[ 49.107121] mtd_nandbiterrs: Successfully corrected 4 bit errors per subpage
[ 49.111077] mtd_nandbiterrs: Inserted biterror @ 1/5
[ 49.118137] mtd_nandbiterrs: rewrite page
[ 49.123892] mtd_nandbiterrs: read_page
[ 49.127576] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 49.130608] mtd_nandbiterrs: verify_page
[ 49.136808] mtd_nandbiterrs: Successfully corrected 5 bit errors per subpage
[ 49.140764] mtd_nandbiterrs: Inserted biterror @ 1/2
[ 49.147807] mtd_nandbiterrs: rewrite page
[ 49.153607] mtd_nandbiterrs: read_page
[ 49.157268] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 49.160294] mtd_nandbiterrs: verify_page
[ 49.166496] mtd_nandbiterrs: Successfully corrected 6 bit errors per subpage
[ 49.170452] mtd_nandbiterrs: Inserted biterror @ 1/0
[ 49.177498] mtd_nandbiterrs: rewrite page
[ 49.183253] mtd_nandbiterrs: read_page
[ 49.186974] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 49.189983] mtd_nandbiterrs: verify_page
[ 49.196194] mtd_nandbiterrs: Successfully corrected 7 bit errors per subpage
[ 49.200140] mtd_nandbiterrs: Inserted biterror @ 2/6
[ 49.207182] mtd_nandbiterrs: rewrite page
[ 49.212895] mtd_nandbiterrs: read_page
[ 49.216671] mtd_nandbiterrs: Read reported 3 corrected bit errors
[ 49.219670] mtd_nandbiterrs: verify_page
[ 49.225872] mtd_nandbiterrs: Successfully corrected 8 bit errors per subpage
[ 49.229827] mtd_nandbiterrs: Inserted biterror @ 2/5
[ 49.236871] mtd_nandbiterrs: rewrite page
[ 49.242629] mtd_nandbiterrs: read_page
[ 49.246348] mtd_nandbiterrs: error: read failed at 0x0
[ 49.249356] mtd_nandbiterrs: After 9 biterrors per subpage, read reported
error -74
[ 49.257958] mtd_nandbiterrs: finished successfully.
[ 49.262029] ==================================================
#
Regards,
Gabor
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH next 2/2] spi: spi-qpic-snand: add support for 8 bits ECC strength
2025-05-05 13:21 ` Gabor Juhos
@ 2025-05-12 8:32 ` Miquel Raynal
2025-05-12 20:19 ` Gabor Juhos
0 siblings, 1 reply; 15+ messages in thread
From: Miquel Raynal @ 2025-05-12 8:32 UTC (permalink / raw)
To: Gabor Juhos
Cc: Md Sadre Alam, Mark Brown, Manivannan Sadhasivam,
Richard Weinberger, Vignesh Raghavendra, Varadarajan Narayanan,
Sricharan Ramabadhran, linux-spi, linux-mtd, linux-arm-msm,
linux-kernel
On 05/05/2025 at 15:21:52 +02, Gabor Juhos <j4g8y7@gmail.com> wrote:
> 2025. 05. 05. 13:17 keltezéssel, Md Sadre Alam írta:
>>
>>
>
> [...]
>
>>> [ 2720.344163] mtd_stresstest: 8192 operations done
>>> [ 2761.645640] mtd_stresstest: 9216 operations done
>>> [ 2791.760534] mtd_stresstest: finished, 10000 operations done
>>> [ 2791.760817] =================================================
>>> #
>> Could you please run biterror test "mtd_nandbiterrs" with the same device, since
>> you are adding 8-bit ECC support.
>
> Sure, here is the result:
>
> # insmod mtd_test
> # for i in $(seq 0 4); do insmod mtd_nandbiterrs; done
> [ 45.405610]
> [ 45.405638] ==================================================
> [ 45.406164] mtd_nandbiterrs: MTD device: 0
> [ 45.411807] mtd_nandbiterrs: MTD device size 268435456, eraseblock=131072,
> page=2048, oob=128
> [ 45.415990] mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
> [ 45.424495] mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
> [ 45.434686] mtd_nandbiterrs: incremental biterrors test
> [ 45.436653] mtd_nandbiterrs: write_page
> [ 45.442634] mtd_nandbiterrs: rewrite page
> [ 45.446408] mtd_nandbiterrs: read_page
> [ 45.450346] mtd_nandbiterrs: verify_page
> [ 45.453320] mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
> [ 45.457405] mtd_nandbiterrs: Inserted biterror @ 0/5
> [ 45.464431] mtd_nandbiterrs: rewrite page
> [ 45.470216] mtd_nandbiterrs: read_page
> [ 45.473852] mtd_nandbiterrs: Read reported 1 corrected bit errors
> [ 45.476909] mtd_nandbiterrs: verify_page
> [ 45.483090] mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
> [ 45.487098] mtd_nandbiterrs: Inserted biterror @ 0/2
> [ 45.494111] mtd_nandbiterrs: rewrite page
> [ 45.499850] mtd_nandbiterrs: read_page
> [ 45.503557] mtd_nandbiterrs: Read reported 1 corrected bit errors
> [ 45.506597] mtd_nandbiterrs: verify_page
> [ 45.512777] mtd_nandbiterrs: Successfully corrected 2 bit errors per subpage
> [ 45.516768] mtd_nandbiterrs: Inserted biterror @ 0/0
> [ 45.523810] mtd_nandbiterrs: rewrite page
> [ 45.529586] mtd_nandbiterrs: read_page
> [ 45.533224] mtd_nandbiterrs: Read reported 1 corrected bit errors
> [ 45.536305] mtd_nandbiterrs: verify_page
> [ 45.542464] mtd_nandbiterrs: Successfully corrected 3 bit errors per subpage
> [ 45.546457] mtd_nandbiterrs: Inserted biterror @ 1/7
> [ 45.553470] mtd_nandbiterrs: rewrite page
> [ 45.559244] mtd_nandbiterrs: read_page
> [ 45.562914] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 45.565991] mtd_nandbiterrs: verify_page
> [ 45.572153] mtd_nandbiterrs: Successfully corrected 4 bit errors per subpage
> [ 45.576142] mtd_nandbiterrs: Inserted biterror @ 1/5
> [ 45.583158] mtd_nandbiterrs: rewrite page
> [ 45.588927] mtd_nandbiterrs: read_page
> [ 45.592599] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 45.595680] mtd_nandbiterrs: verify_page
> [ 45.601840] mtd_nandbiterrs: Successfully corrected 5 bit errors per subpage
> [ 45.605831] mtd_nandbiterrs: Inserted biterror @ 1/2
> [ 45.612846] mtd_nandbiterrs: rewrite page
> [ 45.618618] mtd_nandbiterrs: read_page
> [ 45.622286] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 45.625434] mtd_nandbiterrs: verify_page
> [ 45.631528] mtd_nandbiterrs: Successfully corrected 6 bit errors per subpage
> [ 45.635517] mtd_nandbiterrs: Inserted biterror @ 1/0
> [ 45.642533] mtd_nandbiterrs: rewrite page
> [ 45.648303] mtd_nandbiterrs: read_page
> [ 45.651975] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 45.655055] mtd_nandbiterrs: verify_page
> [ 45.661215] mtd_nandbiterrs: Successfully corrected 7 bit errors per subpage
> [ 45.665207] mtd_nandbiterrs: Inserted biterror @ 2/6
> [ 45.672221] mtd_nandbiterrs: rewrite page
> [ 45.677987] mtd_nandbiterrs: read_page
> [ 45.681663] mtd_nandbiterrs: Read reported 3 corrected bit errors
> [ 45.684741] mtd_nandbiterrs: verify_page
> [ 45.690902] mtd_nandbiterrs: Successfully corrected 8 bit errors per subpage
> [ 45.694892] mtd_nandbiterrs: Inserted biterror @ 2/5
> [ 45.701908] mtd_nandbiterrs: rewrite page
> [ 45.707678] mtd_nandbiterrs: read_page
> [ 45.711351] mtd_nandbiterrs: error: read failed at 0x0
> [ 45.714431] mtd_nandbiterrs: After 9 biterrors per subpage, read reported
> error -74
> [ 45.722975] mtd_nandbiterrs: finished successfully.
> [ 45.727101] ==================================================
> [ 46.200485]
> [ 46.200512] ==================================================
> [ 46.201039] mtd_nandbiterrs: MTD device: 0
> [ 46.206751] mtd_nandbiterrs: MTD device size 268435456, eraseblock=131072,
> page=2048, oob=128
> [ 46.210763] mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
> [ 46.219377] mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
> [ 46.228941] mtd_nandbiterrs: incremental biterrors test
> [ 46.231522] mtd_nandbiterrs: write_page
> [ 46.237524] mtd_nandbiterrs: rewrite page
> [ 46.241199] mtd_nandbiterrs: read_page
> [ 46.245175] mtd_nandbiterrs: verify_page
> [ 46.248195] mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
> [ 46.252254] mtd_nandbiterrs: Inserted biterror @ 0/5
> [ 46.259317] mtd_nandbiterrs: rewrite page
> [ 46.265230] mtd_nandbiterrs: read_page
> [ 46.268955] mtd_nandbiterrs: Read reported 1 corrected bit errors
> [ 46.271784] mtd_nandbiterrs: verify_page
> [ 46.277987] mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
> [ 46.281941] mtd_nandbiterrs: Inserted biterror @ 0/2
> [ 46.288985] mtd_nandbiterrs: rewrite page
> [ 46.294803] mtd_nandbiterrs: read_page
> [ 46.298414] mtd_nandbiterrs: Read reported 1 corrected bit errors
> [ 46.301472] mtd_nandbiterrs: verify_page
> [ 46.307677] mtd_nandbiterrs: Successfully corrected 2 bit errors per subpage
> [ 46.311629] mtd_nandbiterrs: Inserted biterror @ 0/0
> [ 46.318686] mtd_nandbiterrs: rewrite page
> [ 46.324470] mtd_nandbiterrs: read_page
> [ 46.328100] mtd_nandbiterrs: Read reported 1 corrected bit errors
> [ 46.331159] mtd_nandbiterrs: verify_page
> [ 46.337371] mtd_nandbiterrs: Successfully corrected 3 bit errors per subpage
> [ 46.341316] mtd_nandbiterrs: Inserted biterror @ 1/7
> [ 46.348365] mtd_nandbiterrs: rewrite page
> [ 46.354123] mtd_nandbiterrs: read_page
> [ 46.357787] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 46.360846] mtd_nandbiterrs: verify_page
> [ 46.367047] mtd_nandbiterrs: Successfully corrected 4 bit errors per subpage
> [ 46.371003] mtd_nandbiterrs: Inserted biterror @ 1/5
> [ 46.378046] mtd_nandbiterrs: rewrite page
> [ 46.383794] mtd_nandbiterrs: read_page
> [ 46.387475] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 46.390534] mtd_nandbiterrs: verify_page
> [ 46.396747] mtd_nandbiterrs: Successfully corrected 5 bit errors per subpage
> [ 46.400691] mtd_nandbiterrs: Inserted biterror @ 1/2
> [ 46.407733] mtd_nandbiterrs: rewrite page
> [ 46.413483] mtd_nandbiterrs: read_page
> [ 46.417190] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 46.420222] mtd_nandbiterrs: verify_page
> [ 46.426419] mtd_nandbiterrs: Successfully corrected 6 bit errors per subpage
> [ 46.430379] mtd_nandbiterrs: Inserted biterror @ 1/0
> [ 46.437423] mtd_nandbiterrs: rewrite page
> [ 46.443168] mtd_nandbiterrs: read_page
> [ 46.446875] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 46.449908] mtd_nandbiterrs: verify_page
> [ 46.456109] mtd_nandbiterrs: Successfully corrected 7 bit errors per subpage
> [ 46.460066] mtd_nandbiterrs: Inserted biterror @ 2/6
> [ 46.467109] mtd_nandbiterrs: rewrite page
> [ 46.472888] mtd_nandbiterrs: read_page
> [ 46.476569] mtd_nandbiterrs: Read reported 3 corrected bit errors
> [ 46.479597] mtd_nandbiterrs: verify_page
> [ 46.485796] mtd_nandbiterrs: Successfully corrected 8 bit errors per subpage
> [ 46.489753] mtd_nandbiterrs: Inserted biterror @ 2/5
> [ 46.496797] mtd_nandbiterrs: rewrite page
> [ 46.502540] mtd_nandbiterrs: read_page
> [ 46.506249] mtd_nandbiterrs: error: read failed at 0x0
> [ 46.509284] mtd_nandbiterrs: After 9 biterrors per subpage, read reported
> error -74
> [ 46.517867] mtd_nandbiterrs: finished successfully.
> [ 46.521956] ==================================================
> [ 47.150313]
> [ 47.150341] ==================================================
> [ 47.150867] mtd_nandbiterrs: MTD device: 0
> [ 47.156564] mtd_nandbiterrs: MTD device size 268435456, eraseblock=131072,
> page=2048, oob=128
> [ 47.160591] mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
> [ 47.169201] mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
> [ 47.178778] mtd_nandbiterrs: incremental biterrors test
> [ 47.181350] mtd_nandbiterrs: write_page
> [ 47.187334] mtd_nandbiterrs: rewrite page
> [ 47.191016] mtd_nandbiterrs: read_page
> [ 47.194997] mtd_nandbiterrs: verify_page
> [ 47.198019] mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
> [ 47.202081] mtd_nandbiterrs: Inserted biterror @ 0/5
> [ 47.209132] mtd_nandbiterrs: rewrite page
> [ 47.214962] mtd_nandbiterrs: read_page
> [ 47.218554] mtd_nandbiterrs: Read reported 1 corrected bit errors
> [ 47.221612] mtd_nandbiterrs: verify_page
> [ 47.227814] mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
> [ 47.231769] mtd_nandbiterrs: Inserted biterror @ 0/2
> [ 47.238816] mtd_nandbiterrs: rewrite page
> [ 47.244574] mtd_nandbiterrs: read_page
> [ 47.248242] mtd_nandbiterrs: Read reported 1 corrected bit errors
> [ 47.251300] mtd_nandbiterrs: verify_page
> [ 47.257499] mtd_nandbiterrs: Successfully corrected 2 bit errors per subpage
> [ 47.261457] mtd_nandbiterrs: Inserted biterror @ 0/0
> [ 47.268504] mtd_nandbiterrs: rewrite page
> [ 47.274301] mtd_nandbiterrs: read_page
> [ 47.277930] mtd_nandbiterrs: Read reported 1 corrected bit errors
> [ 47.280987] mtd_nandbiterrs: verify_page
> [ 47.287187] mtd_nandbiterrs: Successfully corrected 3 bit errors per subpage
> [ 47.291145] mtd_nandbiterrs: Inserted biterror @ 1/7
> [ 47.298191] mtd_nandbiterrs: rewrite page
> [ 47.303951] mtd_nandbiterrs: read_page
> [ 47.307619] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 47.310675] mtd_nandbiterrs: verify_page
> [ 47.316876] mtd_nandbiterrs: Successfully corrected 4 bit errors per subpage
> [ 47.320832] mtd_nandbiterrs: Inserted biterror @ 1/5
> [ 47.327875] mtd_nandbiterrs: rewrite page
> [ 47.333629] mtd_nandbiterrs: read_page
> [ 47.337305] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 47.340362] mtd_nandbiterrs: verify_page
> [ 47.346563] mtd_nandbiterrs: Successfully corrected 5 bit errors per subpage
> [ 47.350519] mtd_nandbiterrs: Inserted biterror @ 1/2
> [ 47.357561] mtd_nandbiterrs: rewrite page
> [ 47.363310] mtd_nandbiterrs: read_page
> [ 47.367021] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 47.370050] mtd_nandbiterrs: verify_page
> [ 47.376248] mtd_nandbiterrs: Successfully corrected 6 bit errors per subpage
> [ 47.380207] mtd_nandbiterrs: Inserted biterror @ 1/0
> [ 47.387250] mtd_nandbiterrs: rewrite page
> [ 47.392996] mtd_nandbiterrs: read_page
> [ 47.396703] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 47.399737] mtd_nandbiterrs: verify_page
> [ 47.405936] mtd_nandbiterrs: Successfully corrected 7 bit errors per subpage
> [ 47.409894] mtd_nandbiterrs: Inserted biterror @ 2/6
> [ 47.416938] mtd_nandbiterrs: rewrite page
> [ 47.422685] mtd_nandbiterrs: read_page
> [ 47.426387] mtd_nandbiterrs: Read reported 3 corrected bit errors
> [ 47.429424] mtd_nandbiterrs: verify_page
> [ 47.435637] mtd_nandbiterrs: Successfully corrected 8 bit errors per subpage
> [ 47.439582] mtd_nandbiterrs: Inserted biterror @ 2/5
> [ 47.446624] mtd_nandbiterrs: rewrite page
> [ 47.452369] mtd_nandbiterrs: read_page
> [ 47.456080] mtd_nandbiterrs: error: read failed at 0x0
> [ 47.459111] mtd_nandbiterrs: After 9 biterrors per subpage, read reported
> error -74
> [ 47.467699] mtd_nandbiterrs: finished successfully.
> [ 47.471784] ==================================================
> [ 48.080311]
> [ 48.080339] ==================================================
> [ 48.080866] mtd_nandbiterrs: MTD device: 0
> [ 48.086560] mtd_nandbiterrs: MTD device size 268435456, eraseblock=131072,
> page=2048, oob=128
> [ 48.090590] mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
> [ 48.099204] mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
> [ 48.108765] mtd_nandbiterrs: incremental biterrors test
> [ 48.111353] mtd_nandbiterrs: write_page
> [ 48.117325] mtd_nandbiterrs: rewrite page
> [ 48.121017] mtd_nandbiterrs: read_page
> [ 48.124996] mtd_nandbiterrs: verify_page
> [ 48.128017] mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
> [ 48.132080] mtd_nandbiterrs: Inserted biterror @ 0/5
> [ 48.139131] mtd_nandbiterrs: rewrite page
> [ 48.144881] mtd_nandbiterrs: read_page
> [ 48.148552] mtd_nandbiterrs: Read reported 1 corrected bit errors
> [ 48.151611] mtd_nandbiterrs: verify_page
> [ 48.157816] mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
> [ 48.161768] mtd_nandbiterrs: Inserted biterror @ 0/2
> [ 48.168891] mtd_nandbiterrs: rewrite page
> [ 48.174571] mtd_nandbiterrs: read_page
> [ 48.178241] mtd_nandbiterrs: Read reported 1 corrected bit errors
> [ 48.181299] mtd_nandbiterrs: verify_page
> [ 48.187500] mtd_nandbiterrs: Successfully corrected 2 bit errors per subpage
> [ 48.191455] mtd_nandbiterrs: Inserted biterror @ 0/0
> [ 48.198506] mtd_nandbiterrs: rewrite page
> [ 48.204299] mtd_nandbiterrs: read_page
> [ 48.207931] mtd_nandbiterrs: Read reported 1 corrected bit errors
> [ 48.210985] mtd_nandbiterrs: verify_page
> [ 48.217187] mtd_nandbiterrs: Successfully corrected 3 bit errors per subpage
> [ 48.221142] mtd_nandbiterrs: Inserted biterror @ 1/7
> [ 48.228188] mtd_nandbiterrs: rewrite page
> [ 48.233950] mtd_nandbiterrs: read_page
> [ 48.237617] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 48.240673] mtd_nandbiterrs: verify_page
> [ 48.246872] mtd_nandbiterrs: Successfully corrected 4 bit errors per subpage
> [ 48.250831] mtd_nandbiterrs: Inserted biterror @ 1/5
> [ 48.257875] mtd_nandbiterrs: rewrite page
> [ 48.263631] mtd_nandbiterrs: read_page
> [ 48.267303] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 48.270361] mtd_nandbiterrs: verify_page
> [ 48.276560] mtd_nandbiterrs: Successfully corrected 5 bit errors per subpage
> [ 48.280531] mtd_nandbiterrs: Inserted biterror @ 1/2
> [ 48.287592] mtd_nandbiterrs: rewrite page
> [ 48.293338] mtd_nandbiterrs: read_page
> [ 48.297030] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 48.300049] mtd_nandbiterrs: verify_page
> [ 48.306247] mtd_nandbiterrs: Successfully corrected 6 bit errors per subpage
> [ 48.310205] mtd_nandbiterrs: Inserted biterror @ 1/0
> [ 48.317250] mtd_nandbiterrs: rewrite page
> [ 48.322994] mtd_nandbiterrs: read_page
> [ 48.326705] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 48.329736] mtd_nandbiterrs: verify_page
> [ 48.335935] mtd_nandbiterrs: Successfully corrected 7 bit errors per subpage
> [ 48.339892] mtd_nandbiterrs: Inserted biterror @ 2/6
> [ 48.346936] mtd_nandbiterrs: rewrite page
> [ 48.352633] mtd_nandbiterrs: read_page
> [ 48.356391] mtd_nandbiterrs: Read reported 3 corrected bit errors
> [ 48.359423] mtd_nandbiterrs: verify_page
> [ 48.365626] mtd_nandbiterrs: Successfully corrected 8 bit errors per subpage
> [ 48.369581] mtd_nandbiterrs: Inserted biterror @ 2/5
> [ 48.376627] mtd_nandbiterrs: rewrite page
> [ 48.382322] mtd_nandbiterrs: read_page
> [ 48.386077] mtd_nandbiterrs: error: read failed at 0x0
> [ 48.389110] mtd_nandbiterrs: After 9 biterrors per subpage, read reported
> error -74
> [ 48.397695] mtd_nandbiterrs: finished successfully.
> [ 48.401783] ==================================================
> [ 48.940558]
> [ 48.940586] ==================================================
> [ 48.941112] mtd_nandbiterrs: MTD device: 0
> [ 48.946811] mtd_nandbiterrs: MTD device size 268435456, eraseblock=131072,
> page=2048, oob=128
> [ 48.950837] mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
> [ 48.959448] mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
> [ 48.969014] mtd_nandbiterrs: incremental biterrors test
> [ 48.971596] mtd_nandbiterrs: write_page
> [ 48.977594] mtd_nandbiterrs: rewrite page
> [ 48.981277] mtd_nandbiterrs: read_page
> [ 48.985247] mtd_nandbiterrs: verify_page
> [ 48.988269] mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
> [ 48.992327] mtd_nandbiterrs: Inserted biterror @ 0/5
> [ 48.999428] mtd_nandbiterrs: rewrite page
> [ 49.005508] mtd_nandbiterrs: read_page
> [ 49.008836] mtd_nandbiterrs: Read reported 1 corrected bit errors
> [ 49.011858] mtd_nandbiterrs: verify_page
> [ 49.018061] mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
> [ 49.022015] mtd_nandbiterrs: Inserted biterror @ 0/2
> [ 49.029058] mtd_nandbiterrs: rewrite page
> [ 49.034848] mtd_nandbiterrs: read_page
> [ 49.038516] mtd_nandbiterrs: Read reported 1 corrected bit errors
> [ 49.041545] mtd_nandbiterrs: verify_page
> [ 49.047755] mtd_nandbiterrs: Successfully corrected 2 bit errors per subpage
> [ 49.051702] mtd_nandbiterrs: Inserted biterror @ 0/0
> [ 49.058760] mtd_nandbiterrs: rewrite page
> [ 49.064565] mtd_nandbiterrs: read_page
> [ 49.068203] mtd_nandbiterrs: Read reported 1 corrected bit errors
> [ 49.071232] mtd_nandbiterrs: verify_page
> [ 49.077432] mtd_nandbiterrs: Successfully corrected 3 bit errors per subpage
> [ 49.081389] mtd_nandbiterrs: Inserted biterror @ 1/7
> [ 49.088432] mtd_nandbiterrs: rewrite page
> [ 49.094197] mtd_nandbiterrs: read_page
> [ 49.097889] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 49.100919] mtd_nandbiterrs: verify_page
> [ 49.107121] mtd_nandbiterrs: Successfully corrected 4 bit errors per subpage
> [ 49.111077] mtd_nandbiterrs: Inserted biterror @ 1/5
> [ 49.118137] mtd_nandbiterrs: rewrite page
> [ 49.123892] mtd_nandbiterrs: read_page
> [ 49.127576] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 49.130608] mtd_nandbiterrs: verify_page
> [ 49.136808] mtd_nandbiterrs: Successfully corrected 5 bit errors per subpage
> [ 49.140764] mtd_nandbiterrs: Inserted biterror @ 1/2
> [ 49.147807] mtd_nandbiterrs: rewrite page
> [ 49.153607] mtd_nandbiterrs: read_page
> [ 49.157268] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 49.160294] mtd_nandbiterrs: verify_page
> [ 49.166496] mtd_nandbiterrs: Successfully corrected 6 bit errors per subpage
> [ 49.170452] mtd_nandbiterrs: Inserted biterror @ 1/0
> [ 49.177498] mtd_nandbiterrs: rewrite page
> [ 49.183253] mtd_nandbiterrs: read_page
> [ 49.186974] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 49.189983] mtd_nandbiterrs: verify_page
> [ 49.196194] mtd_nandbiterrs: Successfully corrected 7 bit errors per subpage
> [ 49.200140] mtd_nandbiterrs: Inserted biterror @ 2/6
> [ 49.207182] mtd_nandbiterrs: rewrite page
> [ 49.212895] mtd_nandbiterrs: read_page
> [ 49.216671] mtd_nandbiterrs: Read reported 3 corrected bit errors
> [ 49.219670] mtd_nandbiterrs: verify_page
> [ 49.225872] mtd_nandbiterrs: Successfully corrected 8 bit errors per subpage
> [ 49.229827] mtd_nandbiterrs: Inserted biterror @ 2/5
> [ 49.236871] mtd_nandbiterrs: rewrite page
> [ 49.242629] mtd_nandbiterrs: read_page
> [ 49.246348] mtd_nandbiterrs: error: read failed at 0x0
> [ 49.249356] mtd_nandbiterrs: After 9 biterrors per subpage, read reported
> error -74
> [ 49.257958] mtd_nandbiterrs: finished successfully.
> [ 49.262029] ==================================================
> #
This is not the intended behavior. The reporting is wrong and should
report an increasing number of bitflips instead of 1, 1, 1, 2, 2, 2, 2,
3.
With this behavior, wear levelling will not work correctly.
This is not related to Gabor's changes, but I believe this should be
updated otherwise it does not make much sense to increase the strength.
Gabor, can you look into it? Both patches look fine otherwise, thanks a
lot!
Miquèl
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH next 2/2] spi: spi-qpic-snand: add support for 8 bits ECC strength
2025-05-12 8:32 ` Miquel Raynal
@ 2025-05-12 20:19 ` Gabor Juhos
2025-05-13 7:32 ` Miquel Raynal
0 siblings, 1 reply; 15+ messages in thread
From: Gabor Juhos @ 2025-05-12 20:19 UTC (permalink / raw)
To: Miquel Raynal
Cc: Md Sadre Alam, Mark Brown, Manivannan Sadhasivam,
Richard Weinberger, Vignesh Raghavendra, Varadarajan Narayanan,
Sricharan Ramabadhran, linux-spi, linux-mtd, linux-arm-msm,
linux-kernel
2025. 05. 12. 10:32 keltezéssel, Miquel Raynal írta:
> On 05/05/2025 at 15:21:52 +02, Gabor Juhos <j4g8y7@gmail.com> wrote:
>
>> 2025. 05. 05. 13:17 keltezéssel, Md Sadre Alam írta:
>>>
>>>
>>
[...]
>> [ 48.940586] ==================================================
>> [ 48.941112] mtd_nandbiterrs: MTD device: 0
>> [ 48.946811] mtd_nandbiterrs: MTD device size 268435456, eraseblock=131072,
>> page=2048, oob=128
>> [ 48.950837] mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
>> [ 48.959448] mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
>> [ 48.969014] mtd_nandbiterrs: incremental biterrors test
>> [ 48.971596] mtd_nandbiterrs: write_page
>> [ 48.977594] mtd_nandbiterrs: rewrite page
>> [ 48.981277] mtd_nandbiterrs: read_page
>> [ 48.985247] mtd_nandbiterrs: verify_page
>> [ 48.988269] mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
>> [ 48.992327] mtd_nandbiterrs: Inserted biterror @ 0/5
>> [ 48.999428] mtd_nandbiterrs: rewrite page
>> [ 49.005508] mtd_nandbiterrs: read_page
>> [ 49.008836] mtd_nandbiterrs: Read reported 1 corrected bit errors
>> [ 49.011858] mtd_nandbiterrs: verify_page
>> [ 49.018061] mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
>> [ 49.022015] mtd_nandbiterrs: Inserted biterror @ 0/2
>> [ 49.029058] mtd_nandbiterrs: rewrite page
>> [ 49.034848] mtd_nandbiterrs: read_page
>> [ 49.038516] mtd_nandbiterrs: Read reported 1 corrected bit errors
>> [ 49.041545] mtd_nandbiterrs: verify_page
>> [ 49.047755] mtd_nandbiterrs: Successfully corrected 2 bit errors per subpage
>> [ 49.051702] mtd_nandbiterrs: Inserted biterror @ 0/0
>> [ 49.058760] mtd_nandbiterrs: rewrite page
>> [ 49.064565] mtd_nandbiterrs: read_page
>> [ 49.068203] mtd_nandbiterrs: Read reported 1 corrected bit errors
>> [ 49.071232] mtd_nandbiterrs: verify_page
>> [ 49.077432] mtd_nandbiterrs: Successfully corrected 3 bit errors per subpage
>> [ 49.081389] mtd_nandbiterrs: Inserted biterror @ 1/7
>> [ 49.088432] mtd_nandbiterrs: rewrite page
>> [ 49.094197] mtd_nandbiterrs: read_page
>> [ 49.097889] mtd_nandbiterrs: Read reported 2 corrected bit errors
>> [ 49.100919] mtd_nandbiterrs: verify_page
>> [ 49.107121] mtd_nandbiterrs: Successfully corrected 4 bit errors per subpage
>> [ 49.111077] mtd_nandbiterrs: Inserted biterror @ 1/5
>> [ 49.118137] mtd_nandbiterrs: rewrite page
>> [ 49.123892] mtd_nandbiterrs: read_page
>> [ 49.127576] mtd_nandbiterrs: Read reported 2 corrected bit errors
>> [ 49.130608] mtd_nandbiterrs: verify_page
>> [ 49.136808] mtd_nandbiterrs: Successfully corrected 5 bit errors per subpage
>> [ 49.140764] mtd_nandbiterrs: Inserted biterror @ 1/2
>> [ 49.147807] mtd_nandbiterrs: rewrite page
>> [ 49.153607] mtd_nandbiterrs: read_page
>> [ 49.157268] mtd_nandbiterrs: Read reported 2 corrected bit errors
>> [ 49.160294] mtd_nandbiterrs: verify_page
>> [ 49.166496] mtd_nandbiterrs: Successfully corrected 6 bit errors per subpage
>> [ 49.170452] mtd_nandbiterrs: Inserted biterror @ 1/0
>> [ 49.177498] mtd_nandbiterrs: rewrite page
>> [ 49.183253] mtd_nandbiterrs: read_page
>> [ 49.186974] mtd_nandbiterrs: Read reported 2 corrected bit errors
>> [ 49.189983] mtd_nandbiterrs: verify_page
>> [ 49.196194] mtd_nandbiterrs: Successfully corrected 7 bit errors per subpage
>> [ 49.200140] mtd_nandbiterrs: Inserted biterror @ 2/6
>> [ 49.207182] mtd_nandbiterrs: rewrite page
>> [ 49.212895] mtd_nandbiterrs: read_page
>> [ 49.216671] mtd_nandbiterrs: Read reported 3 corrected bit errors
>> [ 49.219670] mtd_nandbiterrs: verify_page
>> [ 49.225872] mtd_nandbiterrs: Successfully corrected 8 bit errors per subpage
>> [ 49.229827] mtd_nandbiterrs: Inserted biterror @ 2/5
>> [ 49.236871] mtd_nandbiterrs: rewrite page
>> [ 49.242629] mtd_nandbiterrs: read_page
>> [ 49.246348] mtd_nandbiterrs: error: read failed at 0x0
>> [ 49.249356] mtd_nandbiterrs: After 9 biterrors per subpage, read reported
>> error -74
>> [ 49.257958] mtd_nandbiterrs: finished successfully.
>> [ 49.262029] ==================================================
>> #
>
> This is not the intended behavior. The reporting is wrong and should
> report an increasing number of bitflips instead of 1, 1, 1, 2, 2, 2, 2,
> 3.
>
> With this behavior, wear levelling will not work correctly.
>
> This is not related to Gabor's changes, but I believe this should be
> updated otherwise it does not make much sense to increase the strength.
It still makes some sense. For example, the bootloader on my board uses 8 bits
strength when it handles the NAND flash. Without supporting that, the kernel
can't read the data written by the bootloader and vice versa.
> Gabor, can you look into it? Both patches look fine otherwise, thanks a
> lot!
I have checked it. According to the code, the driver reads the reported values
from a hardware register.
Here is the result of another test but i have added some debug code to the
driver so the output contains the hardware register values:
# insmod mtd_nandbiterrs dev=0
[ 64.791395]
[ 64.791423] ==================================================
[ 64.791950] mtd_nandbiterrs: MTD device: 0
[ 64.797592] mtd_nandbiterrs: MTD device size 268435456, eraseblock=131072, page=2048, oob=128
[ 64.801779] mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
[ 64.810313] mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
[ 64.820832] mtd_nandbiterrs: incremental biterrors test
[ 64.822452] mtd_nandbiterrs: write_page
[ 64.828511] mtd_nandbiterrs: rewrite page
[ 64.832270] mtd_nandbiterrs: read_page
[ 64.836184] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0200 erased_cw:00000002
[ 64.839091] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
[ 64.847364] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
[ 64.855694] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
[ 64.864020] qcom_snand 79b0000.spi: corrected:0 failed:0 bitflips:0
[ 64.872349] mtd_nandbiterrs: verify_page
[ 64.878598] mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
[ 64.882760] mtd_nandbiterrs: Inserted biterror @ 0/5
[ 64.889793] mtd_nandbiterrs: rewrite page
[ 64.895541] mtd_nandbiterrs: read_page
[ 64.899228] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0201 erased_cw:00000002
[ 64.902282] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
[ 64.910549] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
[ 64.918860] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
[ 64.927206] qcom_snand 79b0000.spi: corrected:1 failed:0 bitflips:1
[ 64.935552] mtd_nandbiterrs: Read reported 1 corrected bit errors
[ 64.941789] mtd_nandbiterrs: verify_page
[ 64.948043] mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
[ 64.952042] mtd_nandbiterrs: Inserted biterror @ 0/2
[ 64.959048] mtd_nandbiterrs: rewrite page
[ 64.964815] mtd_nandbiterrs: read_page
[ 64.968490] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0201 erased_cw:00000002
[ 64.971586] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
[ 64.979814] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
[ 64.988131] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
[ 64.996481] qcom_snand 79b0000.spi: corrected:1 failed:0 bitflips:1
[ 65.004810] mtd_nandbiterrs: Read reported 1 corrected bit errors
[ 65.011059] mtd_nandbiterrs: verify_page
[ 65.017313] mtd_nandbiterrs: Successfully corrected 2 bit errors per subpage
[ 65.021307] mtd_nandbiterrs: Inserted biterror @ 0/0
[ 65.028319] mtd_nandbiterrs: rewrite page
[ 65.034131] mtd_nandbiterrs: read_page
[ 65.037862] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0201 erased_cw:00000002
[ 65.040844] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
[ 65.049069] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
[ 65.057418] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
[ 65.065763] qcom_snand 79b0000.spi: corrected:1 failed:0 bitflips:1
[ 65.074082] mtd_nandbiterrs: Read reported 1 corrected bit errors
[ 65.080341] mtd_nandbiterrs: verify_page
[ 65.086584] mtd_nandbiterrs: Successfully corrected 3 bit errors per subpage
[ 65.090574] mtd_nandbiterrs: Inserted biterror @ 1/7
[ 65.097589] mtd_nandbiterrs: rewrite page
[ 65.103374] mtd_nandbiterrs: read_page
[ 65.107030] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0202 erased_cw:00000002
[ 65.110120] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
[ 65.118340] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
[ 65.126689] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
[ 65.135032] qcom_snand 79b0000.spi: corrected:2 failed:0 bitflips:2
[ 65.143357] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 65.149611] mtd_nandbiterrs: verify_page
[ 65.155855] mtd_nandbiterrs: Successfully corrected 4 bit errors per subpage
[ 65.159844] mtd_nandbiterrs: Inserted biterror @ 1/5
[ 65.166860] mtd_nandbiterrs: rewrite page
[ 65.172645] mtd_nandbiterrs: read_page
[ 65.176301] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0202 erased_cw:00000002
[ 65.179389] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
[ 65.187611] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
[ 65.195961] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
[ 65.204289] qcom_snand 79b0000.spi: corrected:2 failed:0 bitflips:2
[ 65.212623] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 65.218858] mtd_nandbiterrs: verify_page
[ 65.225139] mtd_nandbiterrs: Successfully corrected 5 bit errors per subpage
[ 65.229102] mtd_nandbiterrs: Inserted biterror @ 1/2
[ 65.236147] mtd_nandbiterrs: rewrite page
[ 65.241899] mtd_nandbiterrs: read_page
[ 65.245572] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0202 erased_cw:00000002
[ 65.248635] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
[ 65.256902] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
[ 65.265234] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
[ 65.273561] qcom_snand 79b0000.spi: corrected:2 failed:0 bitflips:2
[ 65.281895] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 65.288129] mtd_nandbiterrs: verify_page
[ 65.294408] mtd_nandbiterrs: Successfully corrected 6 bit errors per subpage
[ 65.298373] mtd_nandbiterrs: Inserted biterror @ 1/0
[ 65.305413] mtd_nandbiterrs: rewrite page
[ 65.311170] mtd_nandbiterrs: read_page
[ 65.314843] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0202 erased_cw:00000002
[ 65.317906] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
[ 65.326170] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
[ 65.334501] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
[ 65.342833] qcom_snand 79b0000.spi: corrected:2 failed:0 bitflips:2
[ 65.351164] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 65.357399] mtd_nandbiterrs: verify_page
[ 65.363680] mtd_nandbiterrs: Successfully corrected 7 bit errors per subpage
[ 65.367643] mtd_nandbiterrs: Inserted biterror @ 2/6
[ 65.374684] mtd_nandbiterrs: rewrite page
[ 65.380445] mtd_nandbiterrs: read_page
[ 65.384112] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0203 erased_cw:00000002
[ 65.387177] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
[ 65.395445] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
[ 65.403769] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
[ 65.412103] qcom_snand 79b0000.spi: corrected:3 failed:0 bitflips:3
[ 65.420436] mtd_nandbiterrs: Read reported 3 corrected bit errors
[ 65.426671] mtd_nandbiterrs: verify_page
[ 65.432950] mtd_nandbiterrs: Successfully corrected 8 bit errors per subpage
[ 65.436915] mtd_nandbiterrs: Inserted biterror @ 2/5
[ 65.443958] mtd_nandbiterrs: rewrite page
[ 65.449719] mtd_nandbiterrs: read_page
[ 65.453386] qcom_snand 79b0000.spi: cw[0] flash:00003030 buffer:00ff0301 erased_cw:00000002
[ 65.456448] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
[ 65.464715] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
[ 65.473041] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
[ 65.481374] qcom_snand 79b0000.spi: corrected:0 failed:1 bitflips:3
[ 65.489706] mtd_nandbiterrs: error: read failed at 0x0
[ 65.495941] mtd_nandbiterrs: After 9 biterrors per subpage, read reported error -74
[ 65.504609] mtd_nandbiterrs: finished successfully.
[ 65.508700] ==================================================
Basically, the driver reads the page as 4 codewords along with reading the
register values after each. The reported values are coming from the low
5 bits of the 'buffer' values printed above. The layout of the register is
barely documented in the driver, so the exact meaning of the bits is unknown.
Despite that, I had an idea, so I have changed the code in the nandbiterrs
module to insert only single bit error into a given byte. By doing the test
with the modified module results in the following:
# insmod mtd_nandbiterrs dev=0
[ 37.125416]
[ 37.125444] ==================================================
[ 37.125970] mtd_nandbiterrs: MTD device: 0
[ 37.131764] mtd_nandbiterrs: MTD device size 268435456, eraseblock=131072, page=2048, oob=128
[ 37.135695] mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
[ 37.144314] mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
[ 37.155047] mtd_nandbiterrs: incremental biterrors test
[ 37.156481] mtd_nandbiterrs: write_page
[ 37.162518] mtd_nandbiterrs: rewrite page
[ 37.166298] mtd_nandbiterrs: read_page
[ 37.170193] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0200 erased_cw:00000002
[ 37.173111] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
[ 37.181383] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
[ 37.189708] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
[ 37.198020] qcom_snand 79b0000.spi: corrected:0 failed:0 bitflips:0
[ 37.206367] mtd_nandbiterrs: verify_page
[ 37.212631] mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
[ 37.216768] mtd_nandbiterrs: Inserted biterror @ 1/7
[ 37.223809] mtd_nandbiterrs: rewrite page
[ 37.229569] mtd_nandbiterrs: read_page
[ 37.233244] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0201 erased_cw:00000002
[ 37.236301] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
[ 37.244571] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
[ 37.252896] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
[ 37.261227] qcom_snand 79b0000.spi: corrected:1 failed:0 bitflips:1
[ 37.269560] mtd_nandbiterrs: Read reported 1 corrected bit errors
[ 37.275795] mtd_nandbiterrs: verify_page
[ 37.282075] mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
[ 37.286039] mtd_nandbiterrs: Inserted biterror @ 3/7
[ 37.293080] mtd_nandbiterrs: rewrite page
[ 37.298877] mtd_nandbiterrs: read_page
[ 37.302531] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0202 erased_cw:00000002
[ 37.305572] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
[ 37.313839] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
[ 37.322169] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
[ 37.330498] qcom_snand 79b0000.spi: corrected:2 failed:0 bitflips:2
[ 37.338818] mtd_nandbiterrs: Read reported 2 corrected bit errors
[ 37.345078] mtd_nandbiterrs: verify_page
[ 37.351352] mtd_nandbiterrs: Successfully corrected 2 bit errors per subpage
[ 37.355310] mtd_nandbiterrs: Inserted biterror @ 5/7
[ 37.362352] mtd_nandbiterrs: rewrite page
[ 37.368094] mtd_nandbiterrs: read_page
[ 37.371814] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0203 erased_cw:00000002
[ 37.374843] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
[ 37.383111] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
[ 37.391437] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
[ 37.399769] qcom_snand 79b0000.spi: corrected:3 failed:0 bitflips:3
[ 37.408089] mtd_nandbiterrs: Read reported 3 corrected bit errors
[ 37.414351] mtd_nandbiterrs: verify_page
[ 37.420616] mtd_nandbiterrs: Successfully corrected 3 bit errors per subpage
[ 37.424581] mtd_nandbiterrs: Inserted biterror @ 7/7
[ 37.431622] mtd_nandbiterrs: rewrite page
[ 37.437419] mtd_nandbiterrs: read_page
[ 37.441072] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0204 erased_cw:00000002
[ 37.444114] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
[ 37.452380] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
[ 37.460708] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
[ 37.469047] qcom_snand 79b0000.spi: corrected:4 failed:0 bitflips:4
[ 37.477360] mtd_nandbiterrs: Read reported 4 corrected bit errors
[ 37.483621] mtd_nandbiterrs: verify_page
[ 37.489888] mtd_nandbiterrs: Successfully corrected 4 bit errors per subpage
[ 37.493852] mtd_nandbiterrs: Inserted biterror @ 8/7
[ 37.500893] mtd_nandbiterrs: rewrite page
[ 37.506636] mtd_nandbiterrs: read_page
[ 37.510342] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0205 erased_cw:00000002
[ 37.513385] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
[ 37.521652] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
[ 37.529978] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
[ 37.538297] qcom_snand 79b0000.spi: corrected:5 failed:0 bitflips:5
[ 37.546643] mtd_nandbiterrs: Read reported 5 corrected bit errors
[ 37.552896] mtd_nandbiterrs: verify_page
[ 37.559161] mtd_nandbiterrs: Successfully corrected 5 bit errors per subpage
[ 37.563123] mtd_nandbiterrs: Inserted biterror @ 10/7
[ 37.570168] mtd_nandbiterrs: rewrite page
[ 37.575956] mtd_nandbiterrs: read_page
[ 37.579702] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0206 erased_cw:00000002
[ 37.582743] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
[ 37.591010] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
[ 37.599354] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
[ 37.607655] qcom_snand 79b0000.spi: corrected:6 failed:0 bitflips:6
[ 37.616004] mtd_nandbiterrs: Read reported 6 corrected bit errors
[ 37.622249] mtd_nandbiterrs: verify_page
[ 37.628504] mtd_nandbiterrs: Successfully corrected 6 bit errors per subpage
[ 37.632497] mtd_nandbiterrs: Inserted biterror @ 12/7
[ 37.639524] mtd_nandbiterrs: rewrite page
[ 37.645353] mtd_nandbiterrs: read_page
[ 37.649047] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0207 erased_cw:00000002
[ 37.652100] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
[ 37.660367] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
[ 37.668679] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
[ 37.677029] qcom_snand 79b0000.spi: corrected:7 failed:0 bitflips:7
[ 37.685358] mtd_nandbiterrs: Read reported 7 corrected bit errors
[ 37.691607] mtd_nandbiterrs: verify_page
[ 37.697861] mtd_nandbiterrs: Successfully corrected 7 bit errors per subpage
[ 37.701852] mtd_nandbiterrs: Inserted biterror @ 14/7
[ 37.708867] mtd_nandbiterrs: rewrite page
[ 37.714683] mtd_nandbiterrs: read_page
[ 37.718397] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0208 erased_cw:00000002
[ 37.721478] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
[ 37.729718] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
[ 37.738037] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
[ 37.746433] qcom_snand 79b0000.spi: corrected:8 failed:0 bitflips:8
[ 37.754719] mtd_nandbiterrs: Read reported 8 corrected bit errors
[ 37.760972] mtd_nandbiterrs: verify_page
[ 37.767218] mtd_nandbiterrs: Successfully corrected 8 bit errors per subpage
[ 37.771214] mtd_nandbiterrs: Inserted biterror @ 17/7
[ 37.778225] mtd_nandbiterrs: rewrite page
[ 37.784054] mtd_nandbiterrs: read_page
[ 37.787754] qcom_snand 79b0000.spi: cw[0] flash:00003030 buffer:00ff0301 erased_cw:00000002
[ 37.790836] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
[ 37.799076] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
[ 37.807395] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
[ 37.815743] qcom_snand 79b0000.spi: corrected:0 failed:1 bitflips:8
[ 37.824073] mtd_nandbiterrs: error: read failed at 0x0
[ 37.830321] mtd_nandbiterrs: After 9 biterrors per subpage, read reported error -74
[ 37.838993] mtd_nandbiterrs: finished successfully.
[ 37.843068] ==================================================
Interestingly enough, it reports the correct number of bit errors now.
For me it seems, that the hardware reports the number of the corrected
*bytes* instead of the corrected *bits*.
I can't figure out whether this is a configuration problem only, or it
is a hardware limitation.
Nevertheless, it is possible that I'm entirely wrong about this, since
I have no documentation for the hardware.
Maybe Alam has some ideas about what could be wrong.
Regards,
Gabor
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH next 2/2] spi: spi-qpic-snand: add support for 8 bits ECC strength
2025-05-12 20:19 ` Gabor Juhos
@ 2025-05-13 7:32 ` Miquel Raynal
2025-05-13 9:01 ` Md Sadre Alam
2025-05-13 15:35 ` Md Sadre Alam
0 siblings, 2 replies; 15+ messages in thread
From: Miquel Raynal @ 2025-05-13 7:32 UTC (permalink / raw)
To: Gabor Juhos
Cc: Md Sadre Alam, Mark Brown, Manivannan Sadhasivam,
Richard Weinberger, Vignesh Raghavendra, Varadarajan Narayanan,
Sricharan Ramabadhran, linux-spi, linux-mtd, linux-arm-msm,
linux-kernel
On 12/05/2025 at 22:19:05 +02, Gabor Juhos <j4g8y7@gmail.com> wrote:
> 2025. 05. 12. 10:32 keltezéssel, Miquel Raynal írta:
>> On 05/05/2025 at 15:21:52 +02, Gabor Juhos <j4g8y7@gmail.com> wrote:
>>
>>> 2025. 05. 05. 13:17 keltezéssel, Md Sadre Alam írta:
>>>>
>>>>
>>>
>
> [...]
>
>>> [ 48.940586] ==================================================
>>> [ 48.941112] mtd_nandbiterrs: MTD device: 0
>>> [ 48.946811] mtd_nandbiterrs: MTD device size 268435456, eraseblock=131072,
>>> page=2048, oob=128
>>> [ 48.950837] mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
>>> [ 48.959448] mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
>>> [ 48.969014] mtd_nandbiterrs: incremental biterrors test
>>> [ 48.971596] mtd_nandbiterrs: write_page
>>> [ 48.977594] mtd_nandbiterrs: rewrite page
>>> [ 48.981277] mtd_nandbiterrs: read_page
>>> [ 48.985247] mtd_nandbiterrs: verify_page
>>> [ 48.988269] mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
>>> [ 48.992327] mtd_nandbiterrs: Inserted biterror @ 0/5
>>> [ 48.999428] mtd_nandbiterrs: rewrite page
>>> [ 49.005508] mtd_nandbiterrs: read_page
>>> [ 49.008836] mtd_nandbiterrs: Read reported 1 corrected bit errors
>>> [ 49.011858] mtd_nandbiterrs: verify_page
>>> [ 49.018061] mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
>>> [ 49.022015] mtd_nandbiterrs: Inserted biterror @ 0/2
>>> [ 49.029058] mtd_nandbiterrs: rewrite page
>>> [ 49.034848] mtd_nandbiterrs: read_page
>>> [ 49.038516] mtd_nandbiterrs: Read reported 1 corrected bit errors
>>> [ 49.041545] mtd_nandbiterrs: verify_page
>>> [ 49.047755] mtd_nandbiterrs: Successfully corrected 2 bit errors per subpage
>>> [ 49.051702] mtd_nandbiterrs: Inserted biterror @ 0/0
>>> [ 49.058760] mtd_nandbiterrs: rewrite page
>>> [ 49.064565] mtd_nandbiterrs: read_page
>>> [ 49.068203] mtd_nandbiterrs: Read reported 1 corrected bit errors
>>> [ 49.071232] mtd_nandbiterrs: verify_page
>>> [ 49.077432] mtd_nandbiterrs: Successfully corrected 3 bit errors per subpage
>>> [ 49.081389] mtd_nandbiterrs: Inserted biterror @ 1/7
>>> [ 49.088432] mtd_nandbiterrs: rewrite page
>>> [ 49.094197] mtd_nandbiterrs: read_page
>>> [ 49.097889] mtd_nandbiterrs: Read reported 2 corrected bit errors
>>> [ 49.100919] mtd_nandbiterrs: verify_page
>>> [ 49.107121] mtd_nandbiterrs: Successfully corrected 4 bit errors per subpage
>>> [ 49.111077] mtd_nandbiterrs: Inserted biterror @ 1/5
>>> [ 49.118137] mtd_nandbiterrs: rewrite page
>>> [ 49.123892] mtd_nandbiterrs: read_page
>>> [ 49.127576] mtd_nandbiterrs: Read reported 2 corrected bit errors
>>> [ 49.130608] mtd_nandbiterrs: verify_page
>>> [ 49.136808] mtd_nandbiterrs: Successfully corrected 5 bit errors per subpage
>>> [ 49.140764] mtd_nandbiterrs: Inserted biterror @ 1/2
>>> [ 49.147807] mtd_nandbiterrs: rewrite page
>>> [ 49.153607] mtd_nandbiterrs: read_page
>>> [ 49.157268] mtd_nandbiterrs: Read reported 2 corrected bit errors
>>> [ 49.160294] mtd_nandbiterrs: verify_page
>>> [ 49.166496] mtd_nandbiterrs: Successfully corrected 6 bit errors per subpage
>>> [ 49.170452] mtd_nandbiterrs: Inserted biterror @ 1/0
>>> [ 49.177498] mtd_nandbiterrs: rewrite page
>>> [ 49.183253] mtd_nandbiterrs: read_page
>>> [ 49.186974] mtd_nandbiterrs: Read reported 2 corrected bit errors
>>> [ 49.189983] mtd_nandbiterrs: verify_page
>>> [ 49.196194] mtd_nandbiterrs: Successfully corrected 7 bit errors per subpage
>>> [ 49.200140] mtd_nandbiterrs: Inserted biterror @ 2/6
>>> [ 49.207182] mtd_nandbiterrs: rewrite page
>>> [ 49.212895] mtd_nandbiterrs: read_page
>>> [ 49.216671] mtd_nandbiterrs: Read reported 3 corrected bit errors
>>> [ 49.219670] mtd_nandbiterrs: verify_page
>>> [ 49.225872] mtd_nandbiterrs: Successfully corrected 8 bit errors per subpage
>>> [ 49.229827] mtd_nandbiterrs: Inserted biterror @ 2/5
>>> [ 49.236871] mtd_nandbiterrs: rewrite page
>>> [ 49.242629] mtd_nandbiterrs: read_page
>>> [ 49.246348] mtd_nandbiterrs: error: read failed at 0x0
>>> [ 49.249356] mtd_nandbiterrs: After 9 biterrors per subpage, read reported
>>> error -74
>>> [ 49.257958] mtd_nandbiterrs: finished successfully.
>>> [ 49.262029] ==================================================
>>> #
>>
>> This is not the intended behavior. The reporting is wrong and should
>> report an increasing number of bitflips instead of 1, 1, 1, 2, 2, 2, 2,
>> 3.
>>
>> With this behavior, wear levelling will not work correctly.
>>
>> This is not related to Gabor's changes, but I believe this should be
>> updated otherwise it does not make much sense to increase the strength.
>
> It still makes some sense. For example, the bootloader on my board uses 8 bits
> strength when it handles the NAND flash. Without supporting that, the kernel
> can't read the data written by the bootloader and vice versa.
>
>> Gabor, can you look into it? Both patches look fine otherwise, thanks a
>> lot!
>
> I have checked it. According to the code, the driver reads the reported values
> from a hardware register.
>
> Here is the result of another test but i have added some debug code to the
> driver so the output contains the hardware register values:
>
> # insmod mtd_nandbiterrs dev=0
> [ 64.791395]
> [ 64.791423] ==================================================
> [ 64.791950] mtd_nandbiterrs: MTD device: 0
> [ 64.797592] mtd_nandbiterrs: MTD device size 268435456, eraseblock=131072, page=2048, oob=128
> [ 64.801779] mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
> [ 64.810313] mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
> [ 64.820832] mtd_nandbiterrs: incremental biterrors test
> [ 64.822452] mtd_nandbiterrs: write_page
> [ 64.828511] mtd_nandbiterrs: rewrite page
> [ 64.832270] mtd_nandbiterrs: read_page
> [ 64.836184] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0200 erased_cw:00000002
> [ 64.839091] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
> [ 64.847364] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
> [ 64.855694] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
> [ 64.864020] qcom_snand 79b0000.spi: corrected:0 failed:0 bitflips:0
> [ 64.872349] mtd_nandbiterrs: verify_page
> [ 64.878598] mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
> [ 64.882760] mtd_nandbiterrs: Inserted biterror @ 0/5
> [ 64.889793] mtd_nandbiterrs: rewrite page
> [ 64.895541] mtd_nandbiterrs: read_page
> [ 64.899228] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0201 erased_cw:00000002
> [ 64.902282] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
> [ 64.910549] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
> [ 64.918860] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
> [ 64.927206] qcom_snand 79b0000.spi: corrected:1 failed:0 bitflips:1
> [ 64.935552] mtd_nandbiterrs: Read reported 1 corrected bit errors
> [ 64.941789] mtd_nandbiterrs: verify_page
> [ 64.948043] mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
> [ 64.952042] mtd_nandbiterrs: Inserted biterror @ 0/2
> [ 64.959048] mtd_nandbiterrs: rewrite page
> [ 64.964815] mtd_nandbiterrs: read_page
> [ 64.968490] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0201 erased_cw:00000002
> [ 64.971586] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
> [ 64.979814] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
> [ 64.988131] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
> [ 64.996481] qcom_snand 79b0000.spi: corrected:1 failed:0 bitflips:1
> [ 65.004810] mtd_nandbiterrs: Read reported 1 corrected bit errors
> [ 65.011059] mtd_nandbiterrs: verify_page
> [ 65.017313] mtd_nandbiterrs: Successfully corrected 2 bit errors per subpage
> [ 65.021307] mtd_nandbiterrs: Inserted biterror @ 0/0
> [ 65.028319] mtd_nandbiterrs: rewrite page
> [ 65.034131] mtd_nandbiterrs: read_page
> [ 65.037862] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0201 erased_cw:00000002
> [ 65.040844] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
> [ 65.049069] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
> [ 65.057418] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
> [ 65.065763] qcom_snand 79b0000.spi: corrected:1 failed:0 bitflips:1
> [ 65.074082] mtd_nandbiterrs: Read reported 1 corrected bit errors
> [ 65.080341] mtd_nandbiterrs: verify_page
> [ 65.086584] mtd_nandbiterrs: Successfully corrected 3 bit errors per subpage
> [ 65.090574] mtd_nandbiterrs: Inserted biterror @ 1/7
> [ 65.097589] mtd_nandbiterrs: rewrite page
> [ 65.103374] mtd_nandbiterrs: read_page
> [ 65.107030] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0202 erased_cw:00000002
> [ 65.110120] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
> [ 65.118340] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
> [ 65.126689] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
> [ 65.135032] qcom_snand 79b0000.spi: corrected:2 failed:0 bitflips:2
> [ 65.143357] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 65.149611] mtd_nandbiterrs: verify_page
> [ 65.155855] mtd_nandbiterrs: Successfully corrected 4 bit errors per subpage
> [ 65.159844] mtd_nandbiterrs: Inserted biterror @ 1/5
> [ 65.166860] mtd_nandbiterrs: rewrite page
> [ 65.172645] mtd_nandbiterrs: read_page
> [ 65.176301] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0202 erased_cw:00000002
> [ 65.179389] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
> [ 65.187611] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
> [ 65.195961] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
> [ 65.204289] qcom_snand 79b0000.spi: corrected:2 failed:0 bitflips:2
> [ 65.212623] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 65.218858] mtd_nandbiterrs: verify_page
> [ 65.225139] mtd_nandbiterrs: Successfully corrected 5 bit errors per subpage
> [ 65.229102] mtd_nandbiterrs: Inserted biterror @ 1/2
> [ 65.236147] mtd_nandbiterrs: rewrite page
> [ 65.241899] mtd_nandbiterrs: read_page
> [ 65.245572] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0202 erased_cw:00000002
> [ 65.248635] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
> [ 65.256902] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
> [ 65.265234] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
> [ 65.273561] qcom_snand 79b0000.spi: corrected:2 failed:0 bitflips:2
> [ 65.281895] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 65.288129] mtd_nandbiterrs: verify_page
> [ 65.294408] mtd_nandbiterrs: Successfully corrected 6 bit errors per subpage
> [ 65.298373] mtd_nandbiterrs: Inserted biterror @ 1/0
> [ 65.305413] mtd_nandbiterrs: rewrite page
> [ 65.311170] mtd_nandbiterrs: read_page
> [ 65.314843] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0202 erased_cw:00000002
> [ 65.317906] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
> [ 65.326170] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
> [ 65.334501] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
> [ 65.342833] qcom_snand 79b0000.spi: corrected:2 failed:0 bitflips:2
> [ 65.351164] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 65.357399] mtd_nandbiterrs: verify_page
> [ 65.363680] mtd_nandbiterrs: Successfully corrected 7 bit errors per subpage
> [ 65.367643] mtd_nandbiterrs: Inserted biterror @ 2/6
> [ 65.374684] mtd_nandbiterrs: rewrite page
> [ 65.380445] mtd_nandbiterrs: read_page
> [ 65.384112] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0203 erased_cw:00000002
> [ 65.387177] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
> [ 65.395445] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
> [ 65.403769] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
> [ 65.412103] qcom_snand 79b0000.spi: corrected:3 failed:0 bitflips:3
> [ 65.420436] mtd_nandbiterrs: Read reported 3 corrected bit errors
> [ 65.426671] mtd_nandbiterrs: verify_page
> [ 65.432950] mtd_nandbiterrs: Successfully corrected 8 bit errors per subpage
> [ 65.436915] mtd_nandbiterrs: Inserted biterror @ 2/5
> [ 65.443958] mtd_nandbiterrs: rewrite page
> [ 65.449719] mtd_nandbiterrs: read_page
> [ 65.453386] qcom_snand 79b0000.spi: cw[0] flash:00003030 buffer:00ff0301 erased_cw:00000002
> [ 65.456448] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
> [ 65.464715] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
> [ 65.473041] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
> [ 65.481374] qcom_snand 79b0000.spi: corrected:0 failed:1 bitflips:3
> [ 65.489706] mtd_nandbiterrs: error: read failed at 0x0
> [ 65.495941] mtd_nandbiterrs: After 9 biterrors per subpage, read reported error -74
> [ 65.504609] mtd_nandbiterrs: finished successfully.
> [ 65.508700] ==================================================
>
>
> Basically, the driver reads the page as 4 codewords along with reading the
> register values after each. The reported values are coming from the low
> 5 bits of the 'buffer' values printed above. The layout of the register is
> barely documented in the driver, so the exact meaning of the bits is unknown.
>
> Despite that, I had an idea, so I have changed the code in the nandbiterrs
> module to insert only single bit error into a given byte. By doing the test
> with the modified module results in the following:
>
> # insmod mtd_nandbiterrs dev=0
> [ 37.125416]
> [ 37.125444] ==================================================
> [ 37.125970] mtd_nandbiterrs: MTD device: 0
> [ 37.131764] mtd_nandbiterrs: MTD device size 268435456, eraseblock=131072, page=2048, oob=128
> [ 37.135695] mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
> [ 37.144314] mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
> [ 37.155047] mtd_nandbiterrs: incremental biterrors test
> [ 37.156481] mtd_nandbiterrs: write_page
> [ 37.162518] mtd_nandbiterrs: rewrite page
> [ 37.166298] mtd_nandbiterrs: read_page
> [ 37.170193] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0200 erased_cw:00000002
> [ 37.173111] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
> [ 37.181383] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
> [ 37.189708] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
> [ 37.198020] qcom_snand 79b0000.spi: corrected:0 failed:0 bitflips:0
> [ 37.206367] mtd_nandbiterrs: verify_page
> [ 37.212631] mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
> [ 37.216768] mtd_nandbiterrs: Inserted biterror @ 1/7
> [ 37.223809] mtd_nandbiterrs: rewrite page
> [ 37.229569] mtd_nandbiterrs: read_page
> [ 37.233244] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0201 erased_cw:00000002
> [ 37.236301] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
> [ 37.244571] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
> [ 37.252896] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
> [ 37.261227] qcom_snand 79b0000.spi: corrected:1 failed:0 bitflips:1
> [ 37.269560] mtd_nandbiterrs: Read reported 1 corrected bit errors
> [ 37.275795] mtd_nandbiterrs: verify_page
> [ 37.282075] mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
> [ 37.286039] mtd_nandbiterrs: Inserted biterror @ 3/7
> [ 37.293080] mtd_nandbiterrs: rewrite page
> [ 37.298877] mtd_nandbiterrs: read_page
> [ 37.302531] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0202 erased_cw:00000002
> [ 37.305572] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
> [ 37.313839] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
> [ 37.322169] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
> [ 37.330498] qcom_snand 79b0000.spi: corrected:2 failed:0 bitflips:2
> [ 37.338818] mtd_nandbiterrs: Read reported 2 corrected bit errors
> [ 37.345078] mtd_nandbiterrs: verify_page
> [ 37.351352] mtd_nandbiterrs: Successfully corrected 2 bit errors per subpage
> [ 37.355310] mtd_nandbiterrs: Inserted biterror @ 5/7
> [ 37.362352] mtd_nandbiterrs: rewrite page
> [ 37.368094] mtd_nandbiterrs: read_page
> [ 37.371814] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0203 erased_cw:00000002
> [ 37.374843] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
> [ 37.383111] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
> [ 37.391437] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
> [ 37.399769] qcom_snand 79b0000.spi: corrected:3 failed:0 bitflips:3
> [ 37.408089] mtd_nandbiterrs: Read reported 3 corrected bit errors
> [ 37.414351] mtd_nandbiterrs: verify_page
> [ 37.420616] mtd_nandbiterrs: Successfully corrected 3 bit errors per subpage
> [ 37.424581] mtd_nandbiterrs: Inserted biterror @ 7/7
> [ 37.431622] mtd_nandbiterrs: rewrite page
> [ 37.437419] mtd_nandbiterrs: read_page
> [ 37.441072] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0204 erased_cw:00000002
> [ 37.444114] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
> [ 37.452380] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
> [ 37.460708] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
> [ 37.469047] qcom_snand 79b0000.spi: corrected:4 failed:0 bitflips:4
> [ 37.477360] mtd_nandbiterrs: Read reported 4 corrected bit errors
> [ 37.483621] mtd_nandbiterrs: verify_page
> [ 37.489888] mtd_nandbiterrs: Successfully corrected 4 bit errors per subpage
> [ 37.493852] mtd_nandbiterrs: Inserted biterror @ 8/7
> [ 37.500893] mtd_nandbiterrs: rewrite page
> [ 37.506636] mtd_nandbiterrs: read_page
> [ 37.510342] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0205 erased_cw:00000002
> [ 37.513385] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
> [ 37.521652] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
> [ 37.529978] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
> [ 37.538297] qcom_snand 79b0000.spi: corrected:5 failed:0 bitflips:5
> [ 37.546643] mtd_nandbiterrs: Read reported 5 corrected bit errors
> [ 37.552896] mtd_nandbiterrs: verify_page
> [ 37.559161] mtd_nandbiterrs: Successfully corrected 5 bit errors per subpage
> [ 37.563123] mtd_nandbiterrs: Inserted biterror @ 10/7
> [ 37.570168] mtd_nandbiterrs: rewrite page
> [ 37.575956] mtd_nandbiterrs: read_page
> [ 37.579702] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0206 erased_cw:00000002
> [ 37.582743] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
> [ 37.591010] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
> [ 37.599354] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
> [ 37.607655] qcom_snand 79b0000.spi: corrected:6 failed:0 bitflips:6
> [ 37.616004] mtd_nandbiterrs: Read reported 6 corrected bit errors
> [ 37.622249] mtd_nandbiterrs: verify_page
> [ 37.628504] mtd_nandbiterrs: Successfully corrected 6 bit errors per subpage
> [ 37.632497] mtd_nandbiterrs: Inserted biterror @ 12/7
> [ 37.639524] mtd_nandbiterrs: rewrite page
> [ 37.645353] mtd_nandbiterrs: read_page
> [ 37.649047] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0207 erased_cw:00000002
> [ 37.652100] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
> [ 37.660367] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
> [ 37.668679] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
> [ 37.677029] qcom_snand 79b0000.spi: corrected:7 failed:0 bitflips:7
> [ 37.685358] mtd_nandbiterrs: Read reported 7 corrected bit errors
> [ 37.691607] mtd_nandbiterrs: verify_page
> [ 37.697861] mtd_nandbiterrs: Successfully corrected 7 bit errors per subpage
> [ 37.701852] mtd_nandbiterrs: Inserted biterror @ 14/7
> [ 37.708867] mtd_nandbiterrs: rewrite page
> [ 37.714683] mtd_nandbiterrs: read_page
> [ 37.718397] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0208 erased_cw:00000002
> [ 37.721478] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
> [ 37.729718] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
> [ 37.738037] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
> [ 37.746433] qcom_snand 79b0000.spi: corrected:8 failed:0 bitflips:8
> [ 37.754719] mtd_nandbiterrs: Read reported 8 corrected bit errors
> [ 37.760972] mtd_nandbiterrs: verify_page
> [ 37.767218] mtd_nandbiterrs: Successfully corrected 8 bit errors per subpage
> [ 37.771214] mtd_nandbiterrs: Inserted biterror @ 17/7
> [ 37.778225] mtd_nandbiterrs: rewrite page
> [ 37.784054] mtd_nandbiterrs: read_page
> [ 37.787754] qcom_snand 79b0000.spi: cw[0] flash:00003030 buffer:00ff0301 erased_cw:00000002
> [ 37.790836] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
> [ 37.799076] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
> [ 37.807395] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
> [ 37.815743] qcom_snand 79b0000.spi: corrected:0 failed:1 bitflips:8
> [ 37.824073] mtd_nandbiterrs: error: read failed at 0x0
> [ 37.830321] mtd_nandbiterrs: After 9 biterrors per subpage, read reported error -74
> [ 37.838993] mtd_nandbiterrs: finished successfully.
> [ 37.843068] ==================================================
>
> Interestingly enough, it reports the correct number of bit errors now.
> For me it seems, that the hardware reports the number of the corrected
> *bytes* instead of the corrected *bits*.
I doubt that, nobody counts bytes of errors.
You results are surprising. I initially though in favour of a software
bug, but then it looks even weirder than that. Alam?
Thanks,
Miquèl
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH next 2/2] spi: spi-qpic-snand: add support for 8 bits ECC strength
2025-05-13 7:32 ` Miquel Raynal
@ 2025-05-13 9:01 ` Md Sadre Alam
2025-05-13 15:35 ` Md Sadre Alam
1 sibling, 0 replies; 15+ messages in thread
From: Md Sadre Alam @ 2025-05-13 9:01 UTC (permalink / raw)
To: Miquel Raynal, Gabor Juhos
Cc: Mark Brown, Manivannan Sadhasivam, Richard Weinberger,
Vignesh Raghavendra, Varadarajan Narayanan, Sricharan Ramabadhran,
linux-spi, linux-mtd, linux-arm-msm, linux-kernel
On 5/13/2025 1:02 PM, Miquel Raynal wrote:
> On 12/05/2025 at 22:19:05 +02, Gabor Juhos <j4g8y7@gmail.com> wrote:
>
>> 2025. 05. 12. 10:32 keltezéssel, Miquel Raynal írta:
>>> On 05/05/2025 at 15:21:52 +02, Gabor Juhos <j4g8y7@gmail.com> wrote:
>>>
>>>> 2025. 05. 05. 13:17 keltezéssel, Md Sadre Alam írta:
>>>>>
>>>>>
>>>>
>>
>> [...]
>>
>>>> [ 48.940586] ==================================================
>>>> [ 48.941112] mtd_nandbiterrs: MTD device: 0
>>>> [ 48.946811] mtd_nandbiterrs: MTD device size 268435456, eraseblock=131072,
>>>> page=2048, oob=128
>>>> [ 48.950837] mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
>>>> [ 48.959448] mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
>>>> [ 48.969014] mtd_nandbiterrs: incremental biterrors test
>>>> [ 48.971596] mtd_nandbiterrs: write_page
>>>> [ 48.977594] mtd_nandbiterrs: rewrite page
>>>> [ 48.981277] mtd_nandbiterrs: read_page
>>>> [ 48.985247] mtd_nandbiterrs: verify_page
>>>> [ 48.988269] mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
>>>> [ 48.992327] mtd_nandbiterrs: Inserted biterror @ 0/5
>>>> [ 48.999428] mtd_nandbiterrs: rewrite page
>>>> [ 49.005508] mtd_nandbiterrs: read_page
>>>> [ 49.008836] mtd_nandbiterrs: Read reported 1 corrected bit errors
>>>> [ 49.011858] mtd_nandbiterrs: verify_page
>>>> [ 49.018061] mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
>>>> [ 49.022015] mtd_nandbiterrs: Inserted biterror @ 0/2
>>>> [ 49.029058] mtd_nandbiterrs: rewrite page
>>>> [ 49.034848] mtd_nandbiterrs: read_page
>>>> [ 49.038516] mtd_nandbiterrs: Read reported 1 corrected bit errors
>>>> [ 49.041545] mtd_nandbiterrs: verify_page
>>>> [ 49.047755] mtd_nandbiterrs: Successfully corrected 2 bit errors per subpage
>>>> [ 49.051702] mtd_nandbiterrs: Inserted biterror @ 0/0
>>>> [ 49.058760] mtd_nandbiterrs: rewrite page
>>>> [ 49.064565] mtd_nandbiterrs: read_page
>>>> [ 49.068203] mtd_nandbiterrs: Read reported 1 corrected bit errors
>>>> [ 49.071232] mtd_nandbiterrs: verify_page
>>>> [ 49.077432] mtd_nandbiterrs: Successfully corrected 3 bit errors per subpage
>>>> [ 49.081389] mtd_nandbiterrs: Inserted biterror @ 1/7
>>>> [ 49.088432] mtd_nandbiterrs: rewrite page
>>>> [ 49.094197] mtd_nandbiterrs: read_page
>>>> [ 49.097889] mtd_nandbiterrs: Read reported 2 corrected bit errors
>>>> [ 49.100919] mtd_nandbiterrs: verify_page
>>>> [ 49.107121] mtd_nandbiterrs: Successfully corrected 4 bit errors per subpage
>>>> [ 49.111077] mtd_nandbiterrs: Inserted biterror @ 1/5
>>>> [ 49.118137] mtd_nandbiterrs: rewrite page
>>>> [ 49.123892] mtd_nandbiterrs: read_page
>>>> [ 49.127576] mtd_nandbiterrs: Read reported 2 corrected bit errors
>>>> [ 49.130608] mtd_nandbiterrs: verify_page
>>>> [ 49.136808] mtd_nandbiterrs: Successfully corrected 5 bit errors per subpage
>>>> [ 49.140764] mtd_nandbiterrs: Inserted biterror @ 1/2
>>>> [ 49.147807] mtd_nandbiterrs: rewrite page
>>>> [ 49.153607] mtd_nandbiterrs: read_page
>>>> [ 49.157268] mtd_nandbiterrs: Read reported 2 corrected bit errors
>>>> [ 49.160294] mtd_nandbiterrs: verify_page
>>>> [ 49.166496] mtd_nandbiterrs: Successfully corrected 6 bit errors per subpage
>>>> [ 49.170452] mtd_nandbiterrs: Inserted biterror @ 1/0
>>>> [ 49.177498] mtd_nandbiterrs: rewrite page
>>>> [ 49.183253] mtd_nandbiterrs: read_page
>>>> [ 49.186974] mtd_nandbiterrs: Read reported 2 corrected bit errors
>>>> [ 49.189983] mtd_nandbiterrs: verify_page
>>>> [ 49.196194] mtd_nandbiterrs: Successfully corrected 7 bit errors per subpage
>>>> [ 49.200140] mtd_nandbiterrs: Inserted biterror @ 2/6
>>>> [ 49.207182] mtd_nandbiterrs: rewrite page
>>>> [ 49.212895] mtd_nandbiterrs: read_page
>>>> [ 49.216671] mtd_nandbiterrs: Read reported 3 corrected bit errors
>>>> [ 49.219670] mtd_nandbiterrs: verify_page
>>>> [ 49.225872] mtd_nandbiterrs: Successfully corrected 8 bit errors per subpage
>>>> [ 49.229827] mtd_nandbiterrs: Inserted biterror @ 2/5
>>>> [ 49.236871] mtd_nandbiterrs: rewrite page
>>>> [ 49.242629] mtd_nandbiterrs: read_page
>>>> [ 49.246348] mtd_nandbiterrs: error: read failed at 0x0
>>>> [ 49.249356] mtd_nandbiterrs: After 9 biterrors per subpage, read reported
>>>> error -74
>>>> [ 49.257958] mtd_nandbiterrs: finished successfully.
>>>> [ 49.262029] ==================================================
>>>> #
>>>
>>> This is not the intended behavior. The reporting is wrong and should
>>> report an increasing number of bitflips instead of 1, 1, 1, 2, 2, 2, 2,
>>> 3.
>>>
>>> With this behavior, wear levelling will not work correctly.
>>>
>>> This is not related to Gabor's changes, but I believe this should be
>>> updated otherwise it does not make much sense to increase the strength.
>>
>> It still makes some sense. For example, the bootloader on my board uses 8 bits
>> strength when it handles the NAND flash. Without supporting that, the kernel
>> can't read the data written by the bootloader and vice versa.
>>
>>> Gabor, can you look into it? Both patches look fine otherwise, thanks a
>>> lot!
>>
>> I have checked it. According to the code, the driver reads the reported values
>> from a hardware register.
>>
>> Here is the result of another test but i have added some debug code to the
>> driver so the output contains the hardware register values:
>>
>> # insmod mtd_nandbiterrs dev=0
>> [ 64.791395]
>> [ 64.791423] ==================================================
>> [ 64.791950] mtd_nandbiterrs: MTD device: 0
>> [ 64.797592] mtd_nandbiterrs: MTD device size 268435456, eraseblock=131072, page=2048, oob=128
>> [ 64.801779] mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
>> [ 64.810313] mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
>> [ 64.820832] mtd_nandbiterrs: incremental biterrors test
>> [ 64.822452] mtd_nandbiterrs: write_page
>> [ 64.828511] mtd_nandbiterrs: rewrite page
>> [ 64.832270] mtd_nandbiterrs: read_page
>> [ 64.836184] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0200 erased_cw:00000002
>> [ 64.839091] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 64.847364] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 64.855694] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 64.864020] qcom_snand 79b0000.spi: corrected:0 failed:0 bitflips:0
>> [ 64.872349] mtd_nandbiterrs: verify_page
>> [ 64.878598] mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
>> [ 64.882760] mtd_nandbiterrs: Inserted biterror @ 0/5
>> [ 64.889793] mtd_nandbiterrs: rewrite page
>> [ 64.895541] mtd_nandbiterrs: read_page
>> [ 64.899228] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0201 erased_cw:00000002
>> [ 64.902282] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 64.910549] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 64.918860] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 64.927206] qcom_snand 79b0000.spi: corrected:1 failed:0 bitflips:1
>> [ 64.935552] mtd_nandbiterrs: Read reported 1 corrected bit errors
>> [ 64.941789] mtd_nandbiterrs: verify_page
>> [ 64.948043] mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
>> [ 64.952042] mtd_nandbiterrs: Inserted biterror @ 0/2
>> [ 64.959048] mtd_nandbiterrs: rewrite page
>> [ 64.964815] mtd_nandbiterrs: read_page
>> [ 64.968490] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0201 erased_cw:00000002
>> [ 64.971586] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 64.979814] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 64.988131] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 64.996481] qcom_snand 79b0000.spi: corrected:1 failed:0 bitflips:1
>> [ 65.004810] mtd_nandbiterrs: Read reported 1 corrected bit errors
>> [ 65.011059] mtd_nandbiterrs: verify_page
>> [ 65.017313] mtd_nandbiterrs: Successfully corrected 2 bit errors per subpage
>> [ 65.021307] mtd_nandbiterrs: Inserted biterror @ 0/0
>> [ 65.028319] mtd_nandbiterrs: rewrite page
>> [ 65.034131] mtd_nandbiterrs: read_page
>> [ 65.037862] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0201 erased_cw:00000002
>> [ 65.040844] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 65.049069] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 65.057418] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 65.065763] qcom_snand 79b0000.spi: corrected:1 failed:0 bitflips:1
>> [ 65.074082] mtd_nandbiterrs: Read reported 1 corrected bit errors
>> [ 65.080341] mtd_nandbiterrs: verify_page
>> [ 65.086584] mtd_nandbiterrs: Successfully corrected 3 bit errors per subpage
>> [ 65.090574] mtd_nandbiterrs: Inserted biterror @ 1/7
>> [ 65.097589] mtd_nandbiterrs: rewrite page
>> [ 65.103374] mtd_nandbiterrs: read_page
>> [ 65.107030] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0202 erased_cw:00000002
>> [ 65.110120] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 65.118340] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 65.126689] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 65.135032] qcom_snand 79b0000.spi: corrected:2 failed:0 bitflips:2
>> [ 65.143357] mtd_nandbiterrs: Read reported 2 corrected bit errors
>> [ 65.149611] mtd_nandbiterrs: verify_page
>> [ 65.155855] mtd_nandbiterrs: Successfully corrected 4 bit errors per subpage
>> [ 65.159844] mtd_nandbiterrs: Inserted biterror @ 1/5
>> [ 65.166860] mtd_nandbiterrs: rewrite page
>> [ 65.172645] mtd_nandbiterrs: read_page
>> [ 65.176301] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0202 erased_cw:00000002
>> [ 65.179389] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 65.187611] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 65.195961] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 65.204289] qcom_snand 79b0000.spi: corrected:2 failed:0 bitflips:2
>> [ 65.212623] mtd_nandbiterrs: Read reported 2 corrected bit errors
>> [ 65.218858] mtd_nandbiterrs: verify_page
>> [ 65.225139] mtd_nandbiterrs: Successfully corrected 5 bit errors per subpage
>> [ 65.229102] mtd_nandbiterrs: Inserted biterror @ 1/2
>> [ 65.236147] mtd_nandbiterrs: rewrite page
>> [ 65.241899] mtd_nandbiterrs: read_page
>> [ 65.245572] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0202 erased_cw:00000002
>> [ 65.248635] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 65.256902] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 65.265234] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 65.273561] qcom_snand 79b0000.spi: corrected:2 failed:0 bitflips:2
>> [ 65.281895] mtd_nandbiterrs: Read reported 2 corrected bit errors
>> [ 65.288129] mtd_nandbiterrs: verify_page
>> [ 65.294408] mtd_nandbiterrs: Successfully corrected 6 bit errors per subpage
>> [ 65.298373] mtd_nandbiterrs: Inserted biterror @ 1/0
>> [ 65.305413] mtd_nandbiterrs: rewrite page
>> [ 65.311170] mtd_nandbiterrs: read_page
>> [ 65.314843] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0202 erased_cw:00000002
>> [ 65.317906] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 65.326170] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 65.334501] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 65.342833] qcom_snand 79b0000.spi: corrected:2 failed:0 bitflips:2
>> [ 65.351164] mtd_nandbiterrs: Read reported 2 corrected bit errors
>> [ 65.357399] mtd_nandbiterrs: verify_page
>> [ 65.363680] mtd_nandbiterrs: Successfully corrected 7 bit errors per subpage
>> [ 65.367643] mtd_nandbiterrs: Inserted biterror @ 2/6
>> [ 65.374684] mtd_nandbiterrs: rewrite page
>> [ 65.380445] mtd_nandbiterrs: read_page
>> [ 65.384112] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0203 erased_cw:00000002
>> [ 65.387177] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 65.395445] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 65.403769] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 65.412103] qcom_snand 79b0000.spi: corrected:3 failed:0 bitflips:3
>> [ 65.420436] mtd_nandbiterrs: Read reported 3 corrected bit errors
>> [ 65.426671] mtd_nandbiterrs: verify_page
>> [ 65.432950] mtd_nandbiterrs: Successfully corrected 8 bit errors per subpage
>> [ 65.436915] mtd_nandbiterrs: Inserted biterror @ 2/5
>> [ 65.443958] mtd_nandbiterrs: rewrite page
>> [ 65.449719] mtd_nandbiterrs: read_page
>> [ 65.453386] qcom_snand 79b0000.spi: cw[0] flash:00003030 buffer:00ff0301 erased_cw:00000002
>> [ 65.456448] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 65.464715] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 65.473041] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 65.481374] qcom_snand 79b0000.spi: corrected:0 failed:1 bitflips:3
>> [ 65.489706] mtd_nandbiterrs: error: read failed at 0x0
>> [ 65.495941] mtd_nandbiterrs: After 9 biterrors per subpage, read reported error -74
>> [ 65.504609] mtd_nandbiterrs: finished successfully.
>> [ 65.508700] ==================================================
>>
>>
>> Basically, the driver reads the page as 4 codewords along with reading the
>> register values after each. The reported values are coming from the low
>> 5 bits of the 'buffer' values printed above. The layout of the register is
>> barely documented in the driver, so the exact meaning of the bits is unknown.
>>
>> Despite that, I had an idea, so I have changed the code in the nandbiterrs
>> module to insert only single bit error into a given byte. By doing the test
>> with the modified module results in the following:
>>
>> # insmod mtd_nandbiterrs dev=0
>> [ 37.125416]
>> [ 37.125444] ==================================================
>> [ 37.125970] mtd_nandbiterrs: MTD device: 0
>> [ 37.131764] mtd_nandbiterrs: MTD device size 268435456, eraseblock=131072, page=2048, oob=128
>> [ 37.135695] mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
>> [ 37.144314] mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
>> [ 37.155047] mtd_nandbiterrs: incremental biterrors test
>> [ 37.156481] mtd_nandbiterrs: write_page
>> [ 37.162518] mtd_nandbiterrs: rewrite page
>> [ 37.166298] mtd_nandbiterrs: read_page
>> [ 37.170193] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0200 erased_cw:00000002
>> [ 37.173111] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 37.181383] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 37.189708] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 37.198020] qcom_snand 79b0000.spi: corrected:0 failed:0 bitflips:0
>> [ 37.206367] mtd_nandbiterrs: verify_page
>> [ 37.212631] mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
>> [ 37.216768] mtd_nandbiterrs: Inserted biterror @ 1/7
>> [ 37.223809] mtd_nandbiterrs: rewrite page
>> [ 37.229569] mtd_nandbiterrs: read_page
>> [ 37.233244] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0201 erased_cw:00000002
>> [ 37.236301] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 37.244571] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 37.252896] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 37.261227] qcom_snand 79b0000.spi: corrected:1 failed:0 bitflips:1
>> [ 37.269560] mtd_nandbiterrs: Read reported 1 corrected bit errors
>> [ 37.275795] mtd_nandbiterrs: verify_page
>> [ 37.282075] mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
>> [ 37.286039] mtd_nandbiterrs: Inserted biterror @ 3/7
>> [ 37.293080] mtd_nandbiterrs: rewrite page
>> [ 37.298877] mtd_nandbiterrs: read_page
>> [ 37.302531] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0202 erased_cw:00000002
>> [ 37.305572] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 37.313839] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 37.322169] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 37.330498] qcom_snand 79b0000.spi: corrected:2 failed:0 bitflips:2
>> [ 37.338818] mtd_nandbiterrs: Read reported 2 corrected bit errors
>> [ 37.345078] mtd_nandbiterrs: verify_page
>> [ 37.351352] mtd_nandbiterrs: Successfully corrected 2 bit errors per subpage
>> [ 37.355310] mtd_nandbiterrs: Inserted biterror @ 5/7
>> [ 37.362352] mtd_nandbiterrs: rewrite page
>> [ 37.368094] mtd_nandbiterrs: read_page
>> [ 37.371814] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0203 erased_cw:00000002
>> [ 37.374843] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 37.383111] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 37.391437] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 37.399769] qcom_snand 79b0000.spi: corrected:3 failed:0 bitflips:3
>> [ 37.408089] mtd_nandbiterrs: Read reported 3 corrected bit errors
>> [ 37.414351] mtd_nandbiterrs: verify_page
>> [ 37.420616] mtd_nandbiterrs: Successfully corrected 3 bit errors per subpage
>> [ 37.424581] mtd_nandbiterrs: Inserted biterror @ 7/7
>> [ 37.431622] mtd_nandbiterrs: rewrite page
>> [ 37.437419] mtd_nandbiterrs: read_page
>> [ 37.441072] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0204 erased_cw:00000002
>> [ 37.444114] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 37.452380] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 37.460708] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 37.469047] qcom_snand 79b0000.spi: corrected:4 failed:0 bitflips:4
>> [ 37.477360] mtd_nandbiterrs: Read reported 4 corrected bit errors
>> [ 37.483621] mtd_nandbiterrs: verify_page
>> [ 37.489888] mtd_nandbiterrs: Successfully corrected 4 bit errors per subpage
>> [ 37.493852] mtd_nandbiterrs: Inserted biterror @ 8/7
>> [ 37.500893] mtd_nandbiterrs: rewrite page
>> [ 37.506636] mtd_nandbiterrs: read_page
>> [ 37.510342] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0205 erased_cw:00000002
>> [ 37.513385] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 37.521652] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 37.529978] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 37.538297] qcom_snand 79b0000.spi: corrected:5 failed:0 bitflips:5
>> [ 37.546643] mtd_nandbiterrs: Read reported 5 corrected bit errors
>> [ 37.552896] mtd_nandbiterrs: verify_page
>> [ 37.559161] mtd_nandbiterrs: Successfully corrected 5 bit errors per subpage
>> [ 37.563123] mtd_nandbiterrs: Inserted biterror @ 10/7
>> [ 37.570168] mtd_nandbiterrs: rewrite page
>> [ 37.575956] mtd_nandbiterrs: read_page
>> [ 37.579702] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0206 erased_cw:00000002
>> [ 37.582743] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 37.591010] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 37.599354] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 37.607655] qcom_snand 79b0000.spi: corrected:6 failed:0 bitflips:6
>> [ 37.616004] mtd_nandbiterrs: Read reported 6 corrected bit errors
>> [ 37.622249] mtd_nandbiterrs: verify_page
>> [ 37.628504] mtd_nandbiterrs: Successfully corrected 6 bit errors per subpage
>> [ 37.632497] mtd_nandbiterrs: Inserted biterror @ 12/7
>> [ 37.639524] mtd_nandbiterrs: rewrite page
>> [ 37.645353] mtd_nandbiterrs: read_page
>> [ 37.649047] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0207 erased_cw:00000002
>> [ 37.652100] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 37.660367] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 37.668679] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 37.677029] qcom_snand 79b0000.spi: corrected:7 failed:0 bitflips:7
>> [ 37.685358] mtd_nandbiterrs: Read reported 7 corrected bit errors
>> [ 37.691607] mtd_nandbiterrs: verify_page
>> [ 37.697861] mtd_nandbiterrs: Successfully corrected 7 bit errors per subpage
>> [ 37.701852] mtd_nandbiterrs: Inserted biterror @ 14/7
>> [ 37.708867] mtd_nandbiterrs: rewrite page
>> [ 37.714683] mtd_nandbiterrs: read_page
>> [ 37.718397] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0208 erased_cw:00000002
>> [ 37.721478] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 37.729718] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 37.738037] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 37.746433] qcom_snand 79b0000.spi: corrected:8 failed:0 bitflips:8
>> [ 37.754719] mtd_nandbiterrs: Read reported 8 corrected bit errors
>> [ 37.760972] mtd_nandbiterrs: verify_page
>> [ 37.767218] mtd_nandbiterrs: Successfully corrected 8 bit errors per subpage
>> [ 37.771214] mtd_nandbiterrs: Inserted biterror @ 17/7
>> [ 37.778225] mtd_nandbiterrs: rewrite page
>> [ 37.784054] mtd_nandbiterrs: read_page
>> [ 37.787754] qcom_snand 79b0000.spi: cw[0] flash:00003030 buffer:00ff0301 erased_cw:00000002
>> [ 37.790836] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 37.799076] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 37.807395] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 37.815743] qcom_snand 79b0000.spi: corrected:0 failed:1 bitflips:8
>> [ 37.824073] mtd_nandbiterrs: error: read failed at 0x0
>> [ 37.830321] mtd_nandbiterrs: After 9 biterrors per subpage, read reported error -74
>> [ 37.838993] mtd_nandbiterrs: finished successfully.
>> [ 37.843068] ==================================================
>>
>> Interestingly enough, it reports the correct number of bit errors now.
>> For me it seems, that the hardware reports the number of the corrected
>> *bytes* instead of the corrected *bits*.
>
> I doubt that, nobody counts bytes of errors.
>
> You results are surprising. I initially though in favour of a software
> bug, but then it looks even weirder than that. Alam?
I am checking with HW team, will update with details once get the input.
Thanks,
Alam.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH next 2/2] spi: spi-qpic-snand: add support for 8 bits ECC strength
2025-05-13 7:32 ` Miquel Raynal
2025-05-13 9:01 ` Md Sadre Alam
@ 2025-05-13 15:35 ` Md Sadre Alam
2025-05-16 14:14 ` Miquel Raynal
1 sibling, 1 reply; 15+ messages in thread
From: Md Sadre Alam @ 2025-05-13 15:35 UTC (permalink / raw)
To: Miquel Raynal, Gabor Juhos
Cc: Mark Brown, Manivannan Sadhasivam, Richard Weinberger,
Vignesh Raghavendra, Varadarajan Narayanan, Sricharan Ramabadhran,
linux-spi, linux-mtd, linux-arm-msm, linux-kernel
On 5/13/2025 1:02 PM, Miquel Raynal wrote:
> On 12/05/2025 at 22:19:05 +02, Gabor Juhos <j4g8y7@gmail.com> wrote:
>
>> 2025. 05. 12. 10:32 keltezéssel, Miquel Raynal írta:
>>> On 05/05/2025 at 15:21:52 +02, Gabor Juhos <j4g8y7@gmail.com> wrote:
>>>
>>>> 2025. 05. 05. 13:17 keltezéssel, Md Sadre Alam írta:
>>>>>
>>>>>
>>>>
>>
>> [...]
>>
>>>> [ 48.940586] ==================================================
>>>> [ 48.941112] mtd_nandbiterrs: MTD device: 0
>>>> [ 48.946811] mtd_nandbiterrs: MTD device size 268435456, eraseblock=131072,
>>>> page=2048, oob=128
>>>> [ 48.950837] mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
>>>> [ 48.959448] mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
>>>> [ 48.969014] mtd_nandbiterrs: incremental biterrors test
>>>> [ 48.971596] mtd_nandbiterrs: write_page
>>>> [ 48.977594] mtd_nandbiterrs: rewrite page
>>>> [ 48.981277] mtd_nandbiterrs: read_page
>>>> [ 48.985247] mtd_nandbiterrs: verify_page
>>>> [ 48.988269] mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
>>>> [ 48.992327] mtd_nandbiterrs: Inserted biterror @ 0/5
>>>> [ 48.999428] mtd_nandbiterrs: rewrite page
>>>> [ 49.005508] mtd_nandbiterrs: read_page
>>>> [ 49.008836] mtd_nandbiterrs: Read reported 1 corrected bit errors
>>>> [ 49.011858] mtd_nandbiterrs: verify_page
>>>> [ 49.018061] mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
>>>> [ 49.022015] mtd_nandbiterrs: Inserted biterror @ 0/2
>>>> [ 49.029058] mtd_nandbiterrs: rewrite page
>>>> [ 49.034848] mtd_nandbiterrs: read_page
>>>> [ 49.038516] mtd_nandbiterrs: Read reported 1 corrected bit errors
>>>> [ 49.041545] mtd_nandbiterrs: verify_page
>>>> [ 49.047755] mtd_nandbiterrs: Successfully corrected 2 bit errors per subpage
>>>> [ 49.051702] mtd_nandbiterrs: Inserted biterror @ 0/0
>>>> [ 49.058760] mtd_nandbiterrs: rewrite page
>>>> [ 49.064565] mtd_nandbiterrs: read_page
>>>> [ 49.068203] mtd_nandbiterrs: Read reported 1 corrected bit errors
>>>> [ 49.071232] mtd_nandbiterrs: verify_page
>>>> [ 49.077432] mtd_nandbiterrs: Successfully corrected 3 bit errors per subpage
>>>> [ 49.081389] mtd_nandbiterrs: Inserted biterror @ 1/7
>>>> [ 49.088432] mtd_nandbiterrs: rewrite page
>>>> [ 49.094197] mtd_nandbiterrs: read_page
>>>> [ 49.097889] mtd_nandbiterrs: Read reported 2 corrected bit errors
>>>> [ 49.100919] mtd_nandbiterrs: verify_page
>>>> [ 49.107121] mtd_nandbiterrs: Successfully corrected 4 bit errors per subpage
>>>> [ 49.111077] mtd_nandbiterrs: Inserted biterror @ 1/5
>>>> [ 49.118137] mtd_nandbiterrs: rewrite page
>>>> [ 49.123892] mtd_nandbiterrs: read_page
>>>> [ 49.127576] mtd_nandbiterrs: Read reported 2 corrected bit errors
>>>> [ 49.130608] mtd_nandbiterrs: verify_page
>>>> [ 49.136808] mtd_nandbiterrs: Successfully corrected 5 bit errors per subpage
>>>> [ 49.140764] mtd_nandbiterrs: Inserted biterror @ 1/2
>>>> [ 49.147807] mtd_nandbiterrs: rewrite page
>>>> [ 49.153607] mtd_nandbiterrs: read_page
>>>> [ 49.157268] mtd_nandbiterrs: Read reported 2 corrected bit errors
>>>> [ 49.160294] mtd_nandbiterrs: verify_page
>>>> [ 49.166496] mtd_nandbiterrs: Successfully corrected 6 bit errors per subpage
>>>> [ 49.170452] mtd_nandbiterrs: Inserted biterror @ 1/0
>>>> [ 49.177498] mtd_nandbiterrs: rewrite page
>>>> [ 49.183253] mtd_nandbiterrs: read_page
>>>> [ 49.186974] mtd_nandbiterrs: Read reported 2 corrected bit errors
>>>> [ 49.189983] mtd_nandbiterrs: verify_page
>>>> [ 49.196194] mtd_nandbiterrs: Successfully corrected 7 bit errors per subpage
>>>> [ 49.200140] mtd_nandbiterrs: Inserted biterror @ 2/6
>>>> [ 49.207182] mtd_nandbiterrs: rewrite page
>>>> [ 49.212895] mtd_nandbiterrs: read_page
>>>> [ 49.216671] mtd_nandbiterrs: Read reported 3 corrected bit errors
>>>> [ 49.219670] mtd_nandbiterrs: verify_page
>>>> [ 49.225872] mtd_nandbiterrs: Successfully corrected 8 bit errors per subpage
>>>> [ 49.229827] mtd_nandbiterrs: Inserted biterror @ 2/5
>>>> [ 49.236871] mtd_nandbiterrs: rewrite page
>>>> [ 49.242629] mtd_nandbiterrs: read_page
>>>> [ 49.246348] mtd_nandbiterrs: error: read failed at 0x0
>>>> [ 49.249356] mtd_nandbiterrs: After 9 biterrors per subpage, read reported
>>>> error -74
>>>> [ 49.257958] mtd_nandbiterrs: finished successfully.
>>>> [ 49.262029] ==================================================
>>>> #
>>>
>>> This is not the intended behavior. The reporting is wrong and should
>>> report an increasing number of bitflips instead of 1, 1, 1, 2, 2, 2, 2,
>>> 3.
>>>
>>> With this behavior, wear levelling will not work correctly.
>>>
>>> This is not related to Gabor's changes, but I believe this should be
>>> updated otherwise it does not make much sense to increase the strength.
>>
>> It still makes some sense. For example, the bootloader on my board uses 8 bits
>> strength when it handles the NAND flash. Without supporting that, the kernel
>> can't read the data written by the bootloader and vice versa.
>>
>>> Gabor, can you look into it? Both patches look fine otherwise, thanks a
>>> lot!
>>
>> I have checked it. According to the code, the driver reads the reported values
>> from a hardware register.
>>
>> Here is the result of another test but i have added some debug code to the
>> driver so the output contains the hardware register values:
>>
>> # insmod mtd_nandbiterrs dev=0
>> [ 64.791395]
>> [ 64.791423] ==================================================
>> [ 64.791950] mtd_nandbiterrs: MTD device: 0
>> [ 64.797592] mtd_nandbiterrs: MTD device size 268435456, eraseblock=131072, page=2048, oob=128
>> [ 64.801779] mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
>> [ 64.810313] mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
>> [ 64.820832] mtd_nandbiterrs: incremental biterrors test
>> [ 64.822452] mtd_nandbiterrs: write_page
>> [ 64.828511] mtd_nandbiterrs: rewrite page
>> [ 64.832270] mtd_nandbiterrs: read_page
>> [ 64.836184] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0200 erased_cw:00000002
>> [ 64.839091] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 64.847364] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 64.855694] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 64.864020] qcom_snand 79b0000.spi: corrected:0 failed:0 bitflips:0
>> [ 64.872349] mtd_nandbiterrs: verify_page
>> [ 64.878598] mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
>> [ 64.882760] mtd_nandbiterrs: Inserted biterror @ 0/5
>> [ 64.889793] mtd_nandbiterrs: rewrite page
>> [ 64.895541] mtd_nandbiterrs: read_page
>> [ 64.899228] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0201 erased_cw:00000002
>> [ 64.902282] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 64.910549] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 64.918860] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 64.927206] qcom_snand 79b0000.spi: corrected:1 failed:0 bitflips:1
>> [ 64.935552] mtd_nandbiterrs: Read reported 1 corrected bit errors
>> [ 64.941789] mtd_nandbiterrs: verify_page
>> [ 64.948043] mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
>> [ 64.952042] mtd_nandbiterrs: Inserted biterror @ 0/2
>> [ 64.959048] mtd_nandbiterrs: rewrite page
>> [ 64.964815] mtd_nandbiterrs: read_page
>> [ 64.968490] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0201 erased_cw:00000002
>> [ 64.971586] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 64.979814] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 64.988131] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 64.996481] qcom_snand 79b0000.spi: corrected:1 failed:0 bitflips:1
>> [ 65.004810] mtd_nandbiterrs: Read reported 1 corrected bit errors
>> [ 65.011059] mtd_nandbiterrs: verify_page
>> [ 65.017313] mtd_nandbiterrs: Successfully corrected 2 bit errors per subpage
>> [ 65.021307] mtd_nandbiterrs: Inserted biterror @ 0/0
>> [ 65.028319] mtd_nandbiterrs: rewrite page
>> [ 65.034131] mtd_nandbiterrs: read_page
>> [ 65.037862] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0201 erased_cw:00000002
>> [ 65.040844] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 65.049069] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 65.057418] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 65.065763] qcom_snand 79b0000.spi: corrected:1 failed:0 bitflips:1
>> [ 65.074082] mtd_nandbiterrs: Read reported 1 corrected bit errors
>> [ 65.080341] mtd_nandbiterrs: verify_page
>> [ 65.086584] mtd_nandbiterrs: Successfully corrected 3 bit errors per subpage
>> [ 65.090574] mtd_nandbiterrs: Inserted biterror @ 1/7
>> [ 65.097589] mtd_nandbiterrs: rewrite page
>> [ 65.103374] mtd_nandbiterrs: read_page
>> [ 65.107030] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0202 erased_cw:00000002
>> [ 65.110120] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 65.118340] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 65.126689] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 65.135032] qcom_snand 79b0000.spi: corrected:2 failed:0 bitflips:2
>> [ 65.143357] mtd_nandbiterrs: Read reported 2 corrected bit errors
>> [ 65.149611] mtd_nandbiterrs: verify_page
>> [ 65.155855] mtd_nandbiterrs: Successfully corrected 4 bit errors per subpage
>> [ 65.159844] mtd_nandbiterrs: Inserted biterror @ 1/5
>> [ 65.166860] mtd_nandbiterrs: rewrite page
>> [ 65.172645] mtd_nandbiterrs: read_page
>> [ 65.176301] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0202 erased_cw:00000002
>> [ 65.179389] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 65.187611] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 65.195961] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 65.204289] qcom_snand 79b0000.spi: corrected:2 failed:0 bitflips:2
>> [ 65.212623] mtd_nandbiterrs: Read reported 2 corrected bit errors
>> [ 65.218858] mtd_nandbiterrs: verify_page
>> [ 65.225139] mtd_nandbiterrs: Successfully corrected 5 bit errors per subpage
>> [ 65.229102] mtd_nandbiterrs: Inserted biterror @ 1/2
>> [ 65.236147] mtd_nandbiterrs: rewrite page
>> [ 65.241899] mtd_nandbiterrs: read_page
>> [ 65.245572] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0202 erased_cw:00000002
>> [ 65.248635] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 65.256902] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 65.265234] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 65.273561] qcom_snand 79b0000.spi: corrected:2 failed:0 bitflips:2
>> [ 65.281895] mtd_nandbiterrs: Read reported 2 corrected bit errors
>> [ 65.288129] mtd_nandbiterrs: verify_page
>> [ 65.294408] mtd_nandbiterrs: Successfully corrected 6 bit errors per subpage
>> [ 65.298373] mtd_nandbiterrs: Inserted biterror @ 1/0
>> [ 65.305413] mtd_nandbiterrs: rewrite page
>> [ 65.311170] mtd_nandbiterrs: read_page
>> [ 65.314843] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0202 erased_cw:00000002
>> [ 65.317906] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 65.326170] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 65.334501] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 65.342833] qcom_snand 79b0000.spi: corrected:2 failed:0 bitflips:2
>> [ 65.351164] mtd_nandbiterrs: Read reported 2 corrected bit errors
>> [ 65.357399] mtd_nandbiterrs: verify_page
>> [ 65.363680] mtd_nandbiterrs: Successfully corrected 7 bit errors per subpage
>> [ 65.367643] mtd_nandbiterrs: Inserted biterror @ 2/6
>> [ 65.374684] mtd_nandbiterrs: rewrite page
>> [ 65.380445] mtd_nandbiterrs: read_page
>> [ 65.384112] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0203 erased_cw:00000002
>> [ 65.387177] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 65.395445] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 65.403769] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 65.412103] qcom_snand 79b0000.spi: corrected:3 failed:0 bitflips:3
>> [ 65.420436] mtd_nandbiterrs: Read reported 3 corrected bit errors
>> [ 65.426671] mtd_nandbiterrs: verify_page
>> [ 65.432950] mtd_nandbiterrs: Successfully corrected 8 bit errors per subpage
>> [ 65.436915] mtd_nandbiterrs: Inserted biterror @ 2/5
>> [ 65.443958] mtd_nandbiterrs: rewrite page
>> [ 65.449719] mtd_nandbiterrs: read_page
>> [ 65.453386] qcom_snand 79b0000.spi: cw[0] flash:00003030 buffer:00ff0301 erased_cw:00000002
>> [ 65.456448] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 65.464715] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 65.473041] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 65.481374] qcom_snand 79b0000.spi: corrected:0 failed:1 bitflips:3
>> [ 65.489706] mtd_nandbiterrs: error: read failed at 0x0
>> [ 65.495941] mtd_nandbiterrs: After 9 biterrors per subpage, read reported error -74
>> [ 65.504609] mtd_nandbiterrs: finished successfully.
>> [ 65.508700] ==================================================
>>
>>
>> Basically, the driver reads the page as 4 codewords along with reading the
>> register values after each. The reported values are coming from the low
>> 5 bits of the 'buffer' values printed above. The layout of the register is
>> barely documented in the driver, so the exact meaning of the bits is unknown.
>>
>> Despite that, I had an idea, so I have changed the code in the nandbiterrs
>> module to insert only single bit error into a given byte. By doing the test
>> with the modified module results in the following:
>>
>> # insmod mtd_nandbiterrs dev=0
>> [ 37.125416]
>> [ 37.125444] ==================================================
>> [ 37.125970] mtd_nandbiterrs: MTD device: 0
>> [ 37.131764] mtd_nandbiterrs: MTD device size 268435456, eraseblock=131072, page=2048, oob=128
>> [ 37.135695] mtd_nandbiterrs: Device uses 1 subpages of 2048 bytes
>> [ 37.144314] mtd_nandbiterrs: Using page=0, offset=0, eraseblock=0
>> [ 37.155047] mtd_nandbiterrs: incremental biterrors test
>> [ 37.156481] mtd_nandbiterrs: write_page
>> [ 37.162518] mtd_nandbiterrs: rewrite page
>> [ 37.166298] mtd_nandbiterrs: read_page
>> [ 37.170193] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0200 erased_cw:00000002
>> [ 37.173111] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 37.181383] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 37.189708] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 37.198020] qcom_snand 79b0000.spi: corrected:0 failed:0 bitflips:0
>> [ 37.206367] mtd_nandbiterrs: verify_page
>> [ 37.212631] mtd_nandbiterrs: Successfully corrected 0 bit errors per subpage
>> [ 37.216768] mtd_nandbiterrs: Inserted biterror @ 1/7
>> [ 37.223809] mtd_nandbiterrs: rewrite page
>> [ 37.229569] mtd_nandbiterrs: read_page
>> [ 37.233244] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0201 erased_cw:00000002
>> [ 37.236301] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 37.244571] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 37.252896] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 37.261227] qcom_snand 79b0000.spi: corrected:1 failed:0 bitflips:1
>> [ 37.269560] mtd_nandbiterrs: Read reported 1 corrected bit errors
>> [ 37.275795] mtd_nandbiterrs: verify_page
>> [ 37.282075] mtd_nandbiterrs: Successfully corrected 1 bit errors per subpage
>> [ 37.286039] mtd_nandbiterrs: Inserted biterror @ 3/7
>> [ 37.293080] mtd_nandbiterrs: rewrite page
>> [ 37.298877] mtd_nandbiterrs: read_page
>> [ 37.302531] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0202 erased_cw:00000002
>> [ 37.305572] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 37.313839] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 37.322169] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 37.330498] qcom_snand 79b0000.spi: corrected:2 failed:0 bitflips:2
>> [ 37.338818] mtd_nandbiterrs: Read reported 2 corrected bit errors
>> [ 37.345078] mtd_nandbiterrs: verify_page
>> [ 37.351352] mtd_nandbiterrs: Successfully corrected 2 bit errors per subpage
>> [ 37.355310] mtd_nandbiterrs: Inserted biterror @ 5/7
>> [ 37.362352] mtd_nandbiterrs: rewrite page
>> [ 37.368094] mtd_nandbiterrs: read_page
>> [ 37.371814] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0203 erased_cw:00000002
>> [ 37.374843] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 37.383111] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 37.391437] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 37.399769] qcom_snand 79b0000.spi: corrected:3 failed:0 bitflips:3
>> [ 37.408089] mtd_nandbiterrs: Read reported 3 corrected bit errors
>> [ 37.414351] mtd_nandbiterrs: verify_page
>> [ 37.420616] mtd_nandbiterrs: Successfully corrected 3 bit errors per subpage
>> [ 37.424581] mtd_nandbiterrs: Inserted biterror @ 7/7
>> [ 37.431622] mtd_nandbiterrs: rewrite page
>> [ 37.437419] mtd_nandbiterrs: read_page
>> [ 37.441072] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0204 erased_cw:00000002
>> [ 37.444114] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 37.452380] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 37.460708] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 37.469047] qcom_snand 79b0000.spi: corrected:4 failed:0 bitflips:4
>> [ 37.477360] mtd_nandbiterrs: Read reported 4 corrected bit errors
>> [ 37.483621] mtd_nandbiterrs: verify_page
>> [ 37.489888] mtd_nandbiterrs: Successfully corrected 4 bit errors per subpage
>> [ 37.493852] mtd_nandbiterrs: Inserted biterror @ 8/7
>> [ 37.500893] mtd_nandbiterrs: rewrite page
>> [ 37.506636] mtd_nandbiterrs: read_page
>> [ 37.510342] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0205 erased_cw:00000002
>> [ 37.513385] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 37.521652] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 37.529978] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 37.538297] qcom_snand 79b0000.spi: corrected:5 failed:0 bitflips:5
>> [ 37.546643] mtd_nandbiterrs: Read reported 5 corrected bit errors
>> [ 37.552896] mtd_nandbiterrs: verify_page
>> [ 37.559161] mtd_nandbiterrs: Successfully corrected 5 bit errors per subpage
>> [ 37.563123] mtd_nandbiterrs: Inserted biterror @ 10/7
>> [ 37.570168] mtd_nandbiterrs: rewrite page
>> [ 37.575956] mtd_nandbiterrs: read_page
>> [ 37.579702] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0206 erased_cw:00000002
>> [ 37.582743] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 37.591010] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 37.599354] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 37.607655] qcom_snand 79b0000.spi: corrected:6 failed:0 bitflips:6
>> [ 37.616004] mtd_nandbiterrs: Read reported 6 corrected bit errors
>> [ 37.622249] mtd_nandbiterrs: verify_page
>> [ 37.628504] mtd_nandbiterrs: Successfully corrected 6 bit errors per subpage
>> [ 37.632497] mtd_nandbiterrs: Inserted biterror @ 12/7
>> [ 37.639524] mtd_nandbiterrs: rewrite page
>> [ 37.645353] mtd_nandbiterrs: read_page
>> [ 37.649047] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0207 erased_cw:00000002
>> [ 37.652100] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 37.660367] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 37.668679] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 37.677029] qcom_snand 79b0000.spi: corrected:7 failed:0 bitflips:7
>> [ 37.685358] mtd_nandbiterrs: Read reported 7 corrected bit errors
>> [ 37.691607] mtd_nandbiterrs: verify_page
>> [ 37.697861] mtd_nandbiterrs: Successfully corrected 7 bit errors per subpage
>> [ 37.701852] mtd_nandbiterrs: Inserted biterror @ 14/7
>> [ 37.708867] mtd_nandbiterrs: rewrite page
>> [ 37.714683] mtd_nandbiterrs: read_page
>> [ 37.718397] qcom_snand 79b0000.spi: cw[0] flash:00003020 buffer:00ff0208 erased_cw:00000002
>> [ 37.721478] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 37.729718] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 37.738037] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 37.746433] qcom_snand 79b0000.spi: corrected:8 failed:0 bitflips:8
>> [ 37.754719] mtd_nandbiterrs: Read reported 8 corrected bit errors
>> [ 37.760972] mtd_nandbiterrs: verify_page
>> [ 37.767218] mtd_nandbiterrs: Successfully corrected 8 bit errors per subpage
>> [ 37.771214] mtd_nandbiterrs: Inserted biterror @ 17/7
>> [ 37.778225] mtd_nandbiterrs: rewrite page
>> [ 37.784054] mtd_nandbiterrs: read_page
>> [ 37.787754] qcom_snand 79b0000.spi: cw[0] flash:00003030 buffer:00ff0301 erased_cw:00000002
>> [ 37.790836] qcom_snand 79b0000.spi: cw[1] flash:00002020 buffer:00ff0200 erased_cw:00000002
>> [ 37.799076] qcom_snand 79b0000.spi: cw[2] flash:00001020 buffer:00ff0200 erased_cw:00000002
>> [ 37.807395] qcom_snand 79b0000.spi: cw[3] flash:00000020 buffer:00ff0200 erased_cw:00000002
>> [ 37.815743] qcom_snand 79b0000.spi: corrected:0 failed:1 bitflips:8
>> [ 37.824073] mtd_nandbiterrs: error: read failed at 0x0
>> [ 37.830321] mtd_nandbiterrs: After 9 biterrors per subpage, read reported error -74
>> [ 37.838993] mtd_nandbiterrs: finished successfully.
>> [ 37.843068] ==================================================
>>
>> Interestingly enough, it reports the correct number of bit errors now.
>> For me it seems, that the hardware reports the number of the corrected
>> *bytes* instead of the corrected *bits*.
>
> I doubt that, nobody counts bytes of errors.
>
> You results are surprising. I initially though in favour of a software
> bug, but then it looks even weirder than that. Alam?
I have checked with HW team , the QPIC ECC HW engine reports the bit
error byte wise not bit wise.
e.g
Byte0 --> 2-bitflips --> QPIC ECC counts 1 only
Byte1 --> 3-bitflips --> QPIC ECC counts 1 only
Byte2 --> 1-bitflips --> QPIC ECC counts 1 only
Byte3 --> 4-bitflips --> QPIC ECC counts 1 only (in 8-bit ecc)
Byte4 --> 6-bitflips --> QPIC ECC counts 1 only (in 8-bit ecc)
Hope this can clearify the things now.
Thanks,
Alam.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH next 2/2] spi: spi-qpic-snand: add support for 8 bits ECC strength
2025-05-13 15:35 ` Md Sadre Alam
@ 2025-05-16 14:14 ` Miquel Raynal
2025-05-21 5:38 ` Md Sadre Alam
0 siblings, 1 reply; 15+ messages in thread
From: Miquel Raynal @ 2025-05-16 14:14 UTC (permalink / raw)
To: Md Sadre Alam
Cc: Gabor Juhos, Mark Brown, Manivannan Sadhasivam,
Richard Weinberger, Vignesh Raghavendra, Varadarajan Narayanan,
Sricharan Ramabadhran, linux-spi, linux-mtd, linux-arm-msm,
linux-kernel
>>> Interestingly enough, it reports the correct number of bit errors now.
>>> For me it seems, that the hardware reports the number of the corrected
>>> *bytes* instead of the corrected *bits*.
>> I doubt that, nobody counts bytes of errors.
>> You results are surprising. I initially though in favour of a software
>> bug, but then it looks even weirder than that. Alam?
> I have checked with HW team , the QPIC ECC HW engine reports the bit
> error byte wise not bit wise.
>
> e.g
> Byte0 --> 2-bitflips --> QPIC ECC counts 1 only
> Byte1 --> 3-bitflips --> QPIC ECC counts 1 only
> Byte2 --> 1-bitflips --> QPIC ECC counts 1 only
> Byte3 --> 4-bitflips --> QPIC ECC counts 1 only (in 8-bit ecc)
> Byte4 --> 6-bitflips --> QPIC ECC counts 1 only (in 8-bit ecc)
>
> Hope this can clearify the things now.
o_O ????
How is that even useful? This basically means UBI will never refresh the
data because we will constantly underestimate the number of bitflips! We
need to know the actual number, this averaging does not make any sense
for Linux. Is there another way to get the raw number of bitflips?
Thanks,
Miquèl
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH next 2/2] spi: spi-qpic-snand: add support for 8 bits ECC strength
2025-05-16 14:14 ` Miquel Raynal
@ 2025-05-21 5:38 ` Md Sadre Alam
2025-05-21 7:52 ` Miquel Raynal
0 siblings, 1 reply; 15+ messages in thread
From: Md Sadre Alam @ 2025-05-21 5:38 UTC (permalink / raw)
To: Miquel Raynal
Cc: Gabor Juhos, Mark Brown, Manivannan Sadhasivam,
Richard Weinberger, Vignesh Raghavendra, Varadarajan Narayanan,
Sricharan Ramabadhran, linux-spi, linux-mtd, linux-arm-msm,
linux-kernel
Hi,
On 5/16/2025 7:44 PM, Miquel Raynal wrote:
>
>>>> Interestingly enough, it reports the correct number of bit errors now.
>>>> For me it seems, that the hardware reports the number of the corrected
>>>> *bytes* instead of the corrected *bits*.
>>> I doubt that, nobody counts bytes of errors.
>>> You results are surprising. I initially though in favour of a software
>>> bug, but then it looks even weirder than that. Alam?
>> I have checked with HW team , the QPIC ECC HW engine reports the bit
>> error byte wise not bit wise.
>>
>> e.g
>> Byte0 --> 2-bitflips --> QPIC ECC counts 1 only
>> Byte1 --> 3-bitflips --> QPIC ECC counts 1 only
>> Byte2 --> 1-bitflips --> QPIC ECC counts 1 only
>> Byte3 --> 4-bitflips --> QPIC ECC counts 1 only (in 8-bit ecc)
>> Byte4 --> 6-bitflips --> QPIC ECC counts 1 only (in 8-bit ecc)
>>
>> Hope this can clearify the things now.
>
> o_O ????
>
> How is that even useful? This basically means UBI will never refresh the
> data because we will constantly underestimate the number of bitflips! We
> need to know the actual number, this averaging does not make any sense
> for Linux. Is there another way to get the raw number of bitflips?
I have re-checked with HW team, unfortunately currently there is no
register fields available to get the raw number of bit flips. But
for newer chipset they have fixed this issue. But currently the QPIC
QPIC_NANDC_BUFFER_STATUS | 0x79B0018 register bit-8 will get set if
there is uncorrectable bitflips happened.
For 4-bit ECC if 5-bit raw bit flips happened then bit-8 will get set in
QPIC_NANDC_BUFFER_STATUS.
similar for 8-bit ECC if 9-bit raw bit flips happened then bit-8 will
get set in QPIC_NANDC_BUFFER_STATUS.
Thanks,
Alam.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH next 2/2] spi: spi-qpic-snand: add support for 8 bits ECC strength
2025-05-21 5:38 ` Md Sadre Alam
@ 2025-05-21 7:52 ` Miquel Raynal
2025-05-22 17:49 ` Gabor Juhos
0 siblings, 1 reply; 15+ messages in thread
From: Miquel Raynal @ 2025-05-21 7:52 UTC (permalink / raw)
To: Md Sadre Alam
Cc: Gabor Juhos, Mark Brown, Manivannan Sadhasivam,
Richard Weinberger, Vignesh Raghavendra, Varadarajan Narayanan,
Sricharan Ramabadhran, linux-spi, linux-mtd, linux-arm-msm,
linux-kernel
On 21/05/2025 at 11:08:02 +0530, Md Sadre Alam <quic_mdalam@quicinc.com> wrote:
> Hi,
>
> On 5/16/2025 7:44 PM, Miquel Raynal wrote:
>>
>>>>> Interestingly enough, it reports the correct number of bit errors now.
>>>>> For me it seems, that the hardware reports the number of the corrected
>>>>> *bytes* instead of the corrected *bits*.
>>>> I doubt that, nobody counts bytes of errors.
>>>> You results are surprising. I initially though in favour of a software
>>>> bug, but then it looks even weirder than that. Alam?
>>> I have checked with HW team , the QPIC ECC HW engine reports the bit
>>> error byte wise not bit wise.
>>>
>>> e.g
>>> Byte0 --> 2-bitflips --> QPIC ECC counts 1 only
>>> Byte1 --> 3-bitflips --> QPIC ECC counts 1 only
>>> Byte2 --> 1-bitflips --> QPIC ECC counts 1 only
>>> Byte3 --> 4-bitflips --> QPIC ECC counts 1 only (in 8-bit ecc)
>>> Byte4 --> 6-bitflips --> QPIC ECC counts 1 only (in 8-bit ecc)
>>>
>>> Hope this can clearify the things now.
>> o_O ????
>> How is that even useful? This basically means UBI will never refresh
>> the
>> data because we will constantly underestimate the number of bitflips! We
>> need to know the actual number, this averaging does not make any sense
>> for Linux. Is there another way to get the raw number of bitflips?
> I have re-checked with HW team, unfortunately currently there is no
> register fields available to get the raw number of bit flips. But
> for newer chipset they have fixed this issue. But currently the QPIC
> QPIC_NANDC_BUFFER_STATUS | 0x79B0018 register bit-8 will get set if
> there is uncorrectable bitflips happened.
>
> For 4-bit ECC if 5-bit raw bit flips happened then bit-8 will get set in
> QPIC_NANDC_BUFFER_STATUS.
>
> similar for 8-bit ECC if 9-bit raw bit flips happened then bit-8 will
> get set in QPIC_NANDC_BUFFER_STATUS.
I believe the unrecoverable situation is handled correctly. What is not
is the fact that we care about the number of bitflips before having a
failure because if it reaches a certain threshold (typically 2/3 of the
strength) the upper layer is responsible of moving the data around to
avoid loosing it.
You need to identify the hardware revision that fixed it and provide a
warning otherwise, or at least a comment in the code...
Thanks,
Miquèl
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH next 2/2] spi: spi-qpic-snand: add support for 8 bits ECC strength
2025-05-21 7:52 ` Miquel Raynal
@ 2025-05-22 17:49 ` Gabor Juhos
0 siblings, 0 replies; 15+ messages in thread
From: Gabor Juhos @ 2025-05-22 17:49 UTC (permalink / raw)
To: Miquel Raynal, Md Sadre Alam
Cc: Mark Brown, Manivannan Sadhasivam, Richard Weinberger,
Vignesh Raghavendra, Varadarajan Narayanan, Sricharan Ramabadhran,
linux-spi, linux-mtd, linux-arm-msm, linux-kernel
2025. 05. 21. 9:52 keltezéssel, Miquel Raynal írta:
> On 21/05/2025 at 11:08:02 +0530, Md Sadre Alam <quic_mdalam@quicinc.com> wrote:
>
>> Hi,
>>
>> On 5/16/2025 7:44 PM, Miquel Raynal wrote:
>>>
>>>>>> Interestingly enough, it reports the correct number of bit errors now.
>>>>>> For me it seems, that the hardware reports the number of the corrected
>>>>>> *bytes* instead of the corrected *bits*.
>>>>> I doubt that, nobody counts bytes of errors.
>>>>> You results are surprising. I initially though in favour of a software
>>>>> bug, but then it looks even weirder than that. Alam?
>>>> I have checked with HW team , the QPIC ECC HW engine reports the bit
>>>> error byte wise not bit wise.
>>>>
>>>> e.g
>>>> Byte0 --> 2-bitflips --> QPIC ECC counts 1 only
>>>> Byte1 --> 3-bitflips --> QPIC ECC counts 1 only
>>>> Byte2 --> 1-bitflips --> QPIC ECC counts 1 only
>>>> Byte3 --> 4-bitflips --> QPIC ECC counts 1 only (in 8-bit ecc)
>>>> Byte4 --> 6-bitflips --> QPIC ECC counts 1 only (in 8-bit ecc)
>>>>
>>>> Hope this can clearify the things now.
>>> o_O ????
>>> How is that even useful? This basically means UBI will never refresh
>>> the
>>> data because we will constantly underestimate the number of bitflips! We
>>> need to know the actual number, this averaging does not make any sense
>>> for Linux. Is there another way to get the raw number of bitflips?
>> I have re-checked with HW team, unfortunately currently there is no
>> register fields available to get the raw number of bit flips. But
>> for newer chipset they have fixed this issue. But currently the QPIC
>> QPIC_NANDC_BUFFER_STATUS | 0x79B0018 register bit-8 will get set if
>> there is uncorrectable bitflips happened.
>>
>> For 4-bit ECC if 5-bit raw bit flips happened then bit-8 will get set in
>> QPIC_NANDC_BUFFER_STATUS.
>>
>> similar for 8-bit ECC if 9-bit raw bit flips happened then bit-8 will
>> get set in QPIC_NANDC_BUFFER_STATUS.
>
> I believe the unrecoverable situation is handled correctly. What is not
> is the fact that we care about the number of bitflips before having a
> failure because if it reaches a certain threshold (typically 2/3 of the
> strength) the upper layer is responsible of moving the data around to
> avoid loosing it.
>
> You need to identify the hardware revision that fixed it and provide a
> warning otherwise, or at least a comment in the code...
In itself, neither a comment, nor a warning will help as far as the upper layer
is concerned. However the driver can be changed to overestimate the number of
corrected bitflips.
I just sent a patch [1] which tries to addresses this. I admit that it is not
ideal, but in my opinion it is a reasonable tradeoff which can be used as a
temporary solution.
For a long term fix, probably it would be possible to change the driver to do
the ECC correction in software. Although I have no idea how that would impact
the performance.
[1]
https://lore.kernel.org/r/20250522-qpic-snand-overestimate-bitflips-v1-1-35c65c05068e@gmail.com
Regards,
Gabor
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2025-05-22 17:49 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-02 19:31 [PATCH next 0/2] spi: spi-qpic-snand: enable 8 bits ECC strength support Gabor Juhos
2025-05-02 19:31 ` [PATCH next 1/2] mtd: nand: qpic-common: add defines for ECC_MODE values Gabor Juhos
2025-05-05 11:08 ` Md Sadre Alam
2025-05-02 19:31 ` [PATCH next 2/2] spi: spi-qpic-snand: add support for 8 bits ECC strength Gabor Juhos
2025-05-05 11:17 ` Md Sadre Alam
2025-05-05 13:21 ` Gabor Juhos
2025-05-12 8:32 ` Miquel Raynal
2025-05-12 20:19 ` Gabor Juhos
2025-05-13 7:32 ` Miquel Raynal
2025-05-13 9:01 ` Md Sadre Alam
2025-05-13 15:35 ` Md Sadre Alam
2025-05-16 14:14 ` Miquel Raynal
2025-05-21 5:38 ` Md Sadre Alam
2025-05-21 7:52 ` Miquel Raynal
2025-05-22 17:49 ` Gabor Juhos
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).