* [PATCH] spi: spi-qpic-snand: Increase ECC strength for large OOB SPI-NAND devices
@ 2026-07-16 5:43 Md Sadre Alam
2026-07-27 23:12 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Md Sadre Alam @ 2026-07-16 5:43 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-spi, linux-kernel, Md Sadre Alam
Some SPI-NAND devices with large OOB areas require a stronger ECC
configuration than the default one provided through firmware
description. For example, Macronix devices with a 256-byte OOB area
report that 4-bit ECC is insufficient and trigger:
nand: WARNING: the ECC used on your system is too weak compared
to the one required by the NAND chip
The QPIC SPI-NAND controller supports both 4-bit and 8-bit BCH ECC
modes. When a device exposes an OOB area of at least 128 bytes, there
is sufficient space to accommodate 8-bit ECC without exceeding the OOB
layout constraints.
Automatically increase the ECC strength to 8 bits when the detected OOB
size is 128 bytes or larger and the current configuration requests a
weaker ECC level. This avoids ECC capability mismatches on devices that
require stronger error correction and improves reliability.
Signed-off-by: Md Sadre Alam <md.alam@oss.qualcomm.com>
---
drivers/spi/spi-qpic-snand.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/spi/spi-qpic-snand.c b/drivers/spi/spi-qpic-snand.c
index 6cc53586b8a8..19812400124f 100644
--- a/drivers/spi/spi-qpic-snand.c
+++ b/drivers/spi/spi-qpic-snand.c
@@ -274,6 +274,19 @@ static int qcom_spi_ecc_init_ctx_pipelined(struct nand_device *nand)
ecc_cfg->strength = 4;
}
+ /*
+ * Override ECC strength based on OOB size to avoid weak ECC warning.
+ * If OOB size is more than 128 bytes, use 8-bit ECC for better
+ * error correction capability, which is required by chips with
+ * larger OOB areas like Macronix SPI NAND with 256 bytes OOB.
+ */
+ if (mtd->oobsize >= 128 && ecc_cfg->strength < 8) {
+ dev_info(snandc->dev,
+ "Upgrading ECC strength from %d to 8 bits (OOB size: %d bytes)\n",
+ ecc_cfg->strength, mtd->oobsize);
+ ecc_cfg->strength = 8;
+ }
+
if (ecc_cfg->step_size != NANDC_STEP_SIZE) {
dev_err(snandc->dev,
"only %u bytes ECC step size is supported\n",
---
base-commit: 19827e7930a5511c68e12aac6e4522f3661a1709
change-id: 20260716-8bitecc-b9be3d2e7690
Best regards,
--
Md Sadre Alam <md.alam@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] spi: spi-qpic-snand: Increase ECC strength for large OOB SPI-NAND devices
2026-07-16 5:43 [PATCH] spi: spi-qpic-snand: Increase ECC strength for large OOB SPI-NAND devices Md Sadre Alam
@ 2026-07-27 23:12 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2026-07-27 23:12 UTC (permalink / raw)
To: Md Sadre Alam; +Cc: linux-spi, linux-kernel
On Thu, 16 Jul 2026 11:13:05 +0530, Md Sadre Alam wrote:
> spi: spi-qpic-snand: Increase ECC strength for large OOB SPI-NAND devices
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-7.3
Thanks!
[1/1] spi: spi-qpic-snand: Increase ECC strength for large OOB SPI-NAND devices
https://git.kernel.org/broonie/spi/c/ed4b52b24c55
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-29 13:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-16 5:43 [PATCH] spi: spi-qpic-snand: Increase ECC strength for large OOB SPI-NAND devices Md Sadre Alam
2026-07-27 23:12 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®