summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorINAGAKI Hiroshi2025-02-14 09:19:58 +0000
committerRobert Marko2025-04-22 18:58:29 +0000
commitfc3ff2af0c57504a2e03d635692396c5bb099f17 (patch)
tree0de1e01f51e4c16ad0098d05ce329e20063633d9
parent70b5252265873ed4ac4ee32d10ef105082e93035 (diff)
downloadopenwrt-fc3ff2af0c57504a2e03d635692396c5bb099f17.tar.gz
qualcommax: allow overriding ECC strength for qpic-snand
Make the ECC strength in the qpic-snand driver configurable via device tree to use the device-specific ECC strength value. Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com> Link: https://github.com/openwrt/openwrt/pull/18543 Signed-off-by: Robert Marko <robimarko@gmail.com>
-rw-r--r--target/linux/qualcommax/patches-6.6/0413-spi-spi-qpic-snand-add-user-config-support.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/target/linux/qualcommax/patches-6.6/0413-spi-spi-qpic-snand-add-user-config-support.patch b/target/linux/qualcommax/patches-6.6/0413-spi-spi-qpic-snand-add-user-config-support.patch
new file mode 100644
index 0000000000..37c6fdc752
--- /dev/null
+++ b/target/linux/qualcommax/patches-6.6/0413-spi-spi-qpic-snand-add-user-config-support.patch
@@ -0,0 +1,35 @@
+From 589b7e9600b1e50574ce91e4d6fc903ef81d957f Mon Sep 17 00:00:00 2001
+From: INAGAKI Hiroshi <musashino.open@gmail.com>
+Date: Fri, 14 Feb 2025 18:19:58 +0900
+Subject: [PATCH] spi: spi-qpic-snand: add user_config support for ECC
+
+Make the ECC strength in the qpic-snand driver configurable via device
+tree to use the device-specific ECC strength value.
+
+Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
+---
+--- a/drivers/spi/spi-qpic-snand.c
++++ b/drivers/spi/spi-qpic-snand.c
+@@ -274,8 +274,20 @@ static int qcom_spi_ecc_init_ctx_pipelin
+ nand->ecc.ctx.priv = ecc_cfg;
+ snandc->qspi->mtd = mtd;
+
+- /* BCH8 or BCH4 */
+- ecc_mode = mtd->oobsize > 64 ? 1 : 0;
++ /* BCH4 or BCH8 */
++ switch (nand->ecc.user_conf.strength) {
++ case 4:
++ ecc_mode = 0;
++ break;
++ case 8:
++ ecc_mode = 1;
++ break;
++ default:
++ ecc_mode = mtd->oobsize > 64 ? 1 : 0;
++ dev_warn(snandc->dev,
++ "invalid ECC strength detected, configured from mtd oobsize\n");
++ break;
++ }
+
+ ecc_cfg->ecc_bytes_hw = ecc_mode ? 13 : 7;
+ ecc_cfg->spare_bytes = ecc_mode ? 2 : 4;