generic: move QCOM SPI NAND driver to generic backports
QCOM SPI NAND driver got merged upstream hence we can drop the special patch from qualcommax and qualcommbe target and move them to the generic backports directory to reduce patch maintenance. While at it refresh any affected patch and target and also backport other minor fixup for the SPI NAND driver merged upstream later. Link: https://github.com/openwrt/openwrt/pull/17788 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
||||
From cf1ba3cb245020459f2ca446b7a7b199839f5d83 Mon Sep 17 00:00:00 2001
|
||||
From: Dan Carpenter <dan.carpenter@linaro.org>
|
||||
Date: Thu, 6 Mar 2025 12:40:01 +0300
|
||||
Subject: [PATCH] spi: spi-qpic-snand: Fix ECC_CFG_ECC_DISABLE shift in
|
||||
qcom_spi_read_last_cw()
|
||||
|
||||
The ECC_CFG_ECC_DISABLE define is BIT(0). It's supposed to be used
|
||||
directly instead of used as a shifter.
|
||||
|
||||
Fixes: 7304d1909080 ("spi: spi-qpic: add driver for QCOM SPI NAND flash Interface")
|
||||
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
|
||||
Link: https://patch.msgid.link/2f4b0a0b-2c03-41c0-8a4a-3d789a83832d@stanley.mountain
|
||||
Signed-off-by: Mark Brown <broonie@kernel.org>
|
||||
---
|
||||
drivers/spi/spi-qpic-snand.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/spi/spi-qpic-snand.c
|
||||
+++ b/drivers/spi/spi-qpic-snand.c
|
||||
@@ -514,7 +514,7 @@ static int qcom_spi_read_last_cw(struct
|
||||
cfg0 = (ecc_cfg->cfg0_raw & ~(7U << CW_PER_PAGE)) |
|
||||
0 << CW_PER_PAGE;
|
||||
cfg1 = ecc_cfg->cfg1_raw;
|
||||
- ecc_bch_cfg = 1 << ECC_CFG_ECC_DISABLE;
|
||||
+ ecc_bch_cfg = ECC_CFG_ECC_DISABLE;
|
||||
|
||||
snandc->regs->cmd = snandc->qspi->cmd;
|
||||
snandc->regs->cfg0 = cpu_to_le32(cfg0);
|
||||
@@ -0,0 +1,35 @@
|
||||
From d450cdd9c4398add1f2aa7200f2c95f1e3b9f9fa Mon Sep 17 00:00:00 2001
|
||||
From: Gabor Juhos <j4g8y7@gmail.com>
|
||||
Date: Thu, 13 Mar 2025 19:31:21 +0100
|
||||
Subject: [PATCH] spi: spi-qpic-snand: avoid memleak in
|
||||
qcom_spi_ecc_init_ctx_pipelined()
|
||||
|
||||
When the allocation of the OOB buffer fails, the
|
||||
qcom_spi_ecc_init_ctx_pipelined() function returns without freeing
|
||||
the memory allocated for 'ecc_cfg' thus it can cause a memory leak.
|
||||
|
||||
Call kfree() to free 'ecc_cfg' before returning from the function
|
||||
to avoid that.
|
||||
|
||||
Fixes: 7304d1909080 ("spi: spi-qpic: add driver for QCOM SPI NAND flash Interface")
|
||||
Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
|
||||
Link: https://patch.msgid.link/20250313-qpic-snand-memleak-fix-v1-1-e54e78d1da3a@gmail.com
|
||||
Signed-off-by: Mark Brown <broonie@kernel.org>
|
||||
---
|
||||
drivers/spi/spi-qpic-snand.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/spi/spi-qpic-snand.c
|
||||
+++ b/drivers/spi/spi-qpic-snand.c
|
||||
@@ -263,8 +263,10 @@ static int qcom_spi_ecc_init_ctx_pipelin
|
||||
return -ENOMEM;
|
||||
snandc->qspi->oob_buf = kzalloc(mtd->writesize + mtd->oobsize,
|
||||
GFP_KERNEL);
|
||||
- if (!snandc->qspi->oob_buf)
|
||||
+ if (!snandc->qspi->oob_buf) {
|
||||
+ kfree(ecc_cfg);
|
||||
return -ENOMEM;
|
||||
+ }
|
||||
|
||||
memset(snandc->qspi->oob_buf, 0xff, mtd->writesize + mtd->oobsize);
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
From d32c4e58545f17caaa854415f854691e32d42075 Mon Sep 17 00:00:00 2001
|
||||
From: Geert Uytterhoeven <geert+renesas@glider.be>
|
||||
Date: Wed, 26 Mar 2025 15:22:19 +0100
|
||||
Subject: [PATCH] spi: SPI_QPIC_SNAND should be tristate and depend on MTD
|
||||
|
||||
SPI_QPIC_SNAND is the only driver that selects MTD instead of depending
|
||||
on it, which could lead to circular dependencies. Moreover, as
|
||||
SPI_QPIC_SNAND is bool, this forces MTD (and various related symbols) to
|
||||
be built-in, as can be seen in an allmodconfig kernel.
|
||||
|
||||
Except for a missing semicolon, there is no reason why SPI_QPIC_SNAND
|
||||
cannot be tristate; all MODULE_*() boilerplate is already present.
|
||||
Hence make SPI_QPIC_SNAND tristate, let it depend on MTD, and add the
|
||||
missing semicolon.
|
||||
|
||||
Fixes: 7304d1909080ef0c ("spi: spi-qpic: add driver for QCOM SPI NAND flash Interface")
|
||||
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
|
||||
Link: https://patch.msgid.link/b63db431cbf35223a4400e44c296293d32c4543c.1742998909.git.geert+renesas@glider.be
|
||||
Signed-off-by: Mark Brown <broonie@kernel.org>
|
||||
---
|
||||
drivers/spi/Kconfig | 4 ++--
|
||||
drivers/spi/spi-qpic-snand.c | 2 +-
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/spi/Kconfig
|
||||
+++ b/drivers/spi/Kconfig
|
||||
@@ -871,9 +871,9 @@ config SPI_QCOM_QSPI
|
||||
QSPI(Quad SPI) driver for Qualcomm QSPI controller.
|
||||
|
||||
config SPI_QPIC_SNAND
|
||||
- bool "QPIC SNAND controller"
|
||||
+ tristate "QPIC SNAND controller"
|
||||
depends on ARCH_QCOM || COMPILE_TEST
|
||||
- select MTD
|
||||
+ depends on MTD
|
||||
help
|
||||
QPIC_SNAND (QPIC SPI NAND) driver for Qualcomm QPIC controller.
|
||||
QPIC controller supports both parallel nand and serial nand.
|
||||
--- a/drivers/spi/spi-qpic-snand.c
|
||||
+++ b/drivers/spi/spi-qpic-snand.c
|
||||
@@ -1614,7 +1614,7 @@ static const struct of_device_id qcom_sn
|
||||
.data = &ipq9574_snandc_props,
|
||||
},
|
||||
{}
|
||||
-}
|
||||
+};
|
||||
MODULE_DEVICE_TABLE(of, qcom_snandc_of_match);
|
||||
|
||||
static struct platform_driver qcom_spi_driver = {
|
||||
@@ -0,0 +1,29 @@
|
||||
From f48d80503504257682e493dc17408f2f0b47bcfa Mon Sep 17 00:00:00 2001
|
||||
From: Gabor Juhos <j4g8y7@gmail.com>
|
||||
Date: Thu, 20 Mar 2025 19:11:59 +0100
|
||||
Subject: [PATCH] spi: spi-qpic-snand: use kmalloc() for OOB buffer allocation
|
||||
|
||||
The qcom_spi_ecc_init_ctx_pipelined() function allocates zeroed
|
||||
memory for the OOB buffer, then it fills the buffer with '0xff'
|
||||
bytes right after the allocation. In this case zeroing the memory
|
||||
during allocation is superfluous, so use kmalloc() instead of
|
||||
kzalloc() to avoid that.
|
||||
|
||||
Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
|
||||
Link: https://patch.msgid.link/20250320-qpic-snand-kmalloc-v1-1-94e267550675@gmail.com
|
||||
Signed-off-by: Mark Brown <broonie@kernel.org>
|
||||
---
|
||||
drivers/spi/spi-qpic-snand.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/spi/spi-qpic-snand.c
|
||||
+++ b/drivers/spi/spi-qpic-snand.c
|
||||
@@ -261,7 +261,7 @@ static int qcom_spi_ecc_init_ctx_pipelin
|
||||
ecc_cfg = kzalloc(sizeof(*ecc_cfg), GFP_KERNEL);
|
||||
if (!ecc_cfg)
|
||||
return -ENOMEM;
|
||||
- snandc->qspi->oob_buf = kzalloc(mtd->writesize + mtd->oobsize,
|
||||
+ snandc->qspi->oob_buf = kmalloc(mtd->writesize + mtd->oobsize,
|
||||
GFP_KERNEL);
|
||||
if (!snandc->qspi->oob_buf) {
|
||||
kfree(ecc_cfg);
|
||||
@@ -28,6 +28,6 @@ Subject: [PATCH] mtd/nand: add MediaTek NAND bad block managment table
|
||||
obj-$(CONFIG_MTD_NAND_CORE) += nandcore.o
|
||||
obj-$(CONFIG_MTD_NAND_ECC_MEDIATEK) += ecc-mtk.o
|
||||
+obj-$(CONFIG_MTD_NAND_MTK_BMT) += mtk_bmt.o mtk_bmt_v2.o mtk_bmt_bbt.o mtk_bmt_nmbm.o
|
||||
obj-$(CONFIG_MTD_NAND_QCOM) += qpic_common.o
|
||||
obj-y += onenand/
|
||||
obj-y += raw/
|
||||
ifeq ($(CONFIG_SPI_QPIC_SNAND),y)
|
||||
obj-$(CONFIG_SPI_QPIC_SNAND) += qpic_common.o
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user