]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
airoha: spi: update airoha-snfi patches and en7523 dts 21299/head
authorMikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Sat, 27 Dec 2025 05:28:09 +0000 (08:28 +0300)
committerRobert Marko <robimarko@gmail.com>
Sun, 28 Dec 2025 11:48:12 +0000 (12:48 +0100)
Changes:
* use upstream patches for airoha-snfi driver
* update in kernel en7523 dts to add spinand support

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Link: https://github.com/openwrt/openwrt/pull/21299
Signed-off-by: Robert Marko <robimarko@gmail.com>
12 files changed:
target/linux/airoha/patches-6.12/029-05-v6.19-spi-airoha-remove-unnecessary-restriction-length.patch [moved from target/linux/airoha/patches-6.12/029-02-spi-airoha-remove-unnecessary-restriction-length.patch with 73% similarity]
target/linux/airoha/patches-6.12/029-06-v6.19-spi-airoha-remove-unnecessary-switch-to-non-dma-mode.patch [moved from target/linux/airoha/patches-6.12/029-04-spi-airoha-remove-unnecessary-switch-to-non-dma-m.patch with 74% similarity]
target/linux/airoha/patches-6.12/029-07-v6.19-spi-airoha-unify-dirmap-read-write-code.patch [moved from target/linux/airoha/patches-6.12/029-07-spi-airoha-unify-dirmap-read-write-code.patch with 92% similarity]
target/linux/airoha/patches-6.12/029-08-v6.19-spi-airoha-support-of-dualio-quadio-flash-reading-co.patch [moved from target/linux/airoha/patches-6.12/029-08-spi-airoha-support-of-dualio-quadio-flash-reading.patch with 90% similarity]
target/linux/airoha/patches-6.12/029-09-v6.19-spi-airoha-avoid-setting-of-page-oob-sizes-in-REG_SP.patch [moved from target/linux/airoha/patches-6.12/029-10-spi-airoha-avoid-setting-of-page-oob-sizes-in-REG.patch with 83% similarity]
target/linux/airoha/patches-6.12/029-10-v6.19-spi-airoha-reduce-the-number-of-modification-of-REG_.patch [moved from target/linux/airoha/patches-6.12/029-11-spi-airoha-reduce-the-number-of-modification-of-R.patch with 92% similarity]
target/linux/airoha/patches-6.12/029-11-v6.19-spi-airoha-set-custom-sector-size-equal-to-flash-pag.patch [moved from target/linux/airoha/patches-6.12/029-12-spi-airoha-set-custom-sector-size-equal-to-flash-.patch with 91% similarity]
target/linux/airoha/patches-6.12/029-12-v6.19-spi-airoha-avoid-reading-flash-page-settings-from-SN.patch [moved from target/linux/airoha/patches-6.12/029-13-spi-airoha-avoid-reading-flash-page-settings-from.patch with 91% similarity]
target/linux/airoha/patches-6.12/029-13-v6.19-spi-airoha-buffer-must-be-0xff-ed-before-writing.patch [moved from target/linux/airoha/patches-6.12/029-09-spi-airoha-buffer-must-be-0xff-ed-before-writing.patch with 63% similarity]
target/linux/airoha/patches-6.12/029-14-spi-airoha-snfi-en7523-workaround-flash-damaging.patch [deleted file]
target/linux/airoha/patches-6.12/029-14-v6.19-spi-airoha-snfi-en7523-workaround-flash-damaging-if-.patch [new file with mode: 0644]
target/linux/airoha/patches-6.12/029-15-arm-dts-airoha-en7523-add-SNAND-node.patch [new file with mode: 0644]

similarity index 73%
rename from target/linux/airoha/patches-6.12/029-02-spi-airoha-remove-unnecessary-restriction-length.patch
rename to target/linux/airoha/patches-6.12/029-05-v6.19-spi-airoha-remove-unnecessary-restriction-length.patch
index e3b9f0ccbec64aeb217fc999752b10888b8c6a18..c99c25921c7b812ea37c90b3f600abee9add162f 100644 (file)
@@ -1,7 +1,7 @@
-From 4658f57ba7f60c3bd8e14c1ca7acf2090aee8436 Mon Sep 17 00:00:00 2001
+From 661856ca131c8bf6724905966e02149805660abe Mon Sep 17 00:00:00 2001
 From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
-Date: Tue, 12 Aug 2025 06:21:35 +0300
-Subject: [PATCH v6 02/13] spi: airoha: remove unnecessary restriction length
+Date: Sun, 12 Oct 2025 15:16:53 +0300
+Subject: [PATCH 05/14] spi: airoha: remove unnecessary restriction length
 
 The "length < 160" restriction is not needed because airoha_snand_write_data()
 and airoha_snand_read_data() will properly handle data transfers above
@@ -9,6 +9,8 @@ SPI_MAX_TRANSFER_SIZE.
 
 Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
 Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Link: https://patch.msgid.link/20251012121707.2296160-3-mikhail.kshevetskiy@iopsys.eu
+Signed-off-by: Mark Brown <broonie@kernel.org>
 ---
  drivers/spi/spi-airoha-snfi.c | 7 -------
  1 file changed, 7 deletions(-)
similarity index 74%
rename from target/linux/airoha/patches-6.12/029-04-spi-airoha-remove-unnecessary-switch-to-non-dma-m.patch
rename to target/linux/airoha/patches-6.12/029-06-v6.19-spi-airoha-remove-unnecessary-switch-to-non-dma-mode.patch
index 626e5c0ad99a2b811d1a0db3400bc2100a24a91a..afe496c968f02f11e3c39ea8b2fe4b3cb76637af 100644 (file)
@@ -1,8 +1,7 @@
-From fb41a3e3bc357592b28a8abb504df99dad642588 Mon Sep 17 00:00:00 2001
+From 7350f8dc15bfbb7abf1ce4babea6fcace1c574c5 Mon Sep 17 00:00:00 2001
 From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
-Date: Mon, 11 Aug 2025 13:09:51 +0300
-Subject: [PATCH v6 04/13] spi: airoha: remove unnecessary switch to non-dma
- mode
+Date: Sun, 12 Oct 2025 15:16:55 +0300
+Subject: [PATCH 06/14] spi: airoha: remove unnecessary switch to non-dma mode
 
 The code switches to dma at the start of dirmap operation and returns
 to non-dma at the end of dirmap operation, so an additional switch to
@@ -11,6 +10,8 @@ non-dma at the start of dirmap write is not required.
 Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
 Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
 Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Link: https://patch.msgid.link/20251012121707.2296160-5-mikhail.kshevetskiy@iopsys.eu
+Signed-off-by: Mark Brown <broonie@kernel.org>
 ---
  drivers/spi/spi-airoha-snfi.c | 3 ---
  1 file changed, 3 deletions(-)
similarity index 92%
rename from target/linux/airoha/patches-6.12/029-07-spi-airoha-unify-dirmap-read-write-code.patch
rename to target/linux/airoha/patches-6.12/029-07-v6.19-spi-airoha-unify-dirmap-read-write-code.patch
index 4be20c5b5589b4a24cebaca59ee5bc2e3c62b62d..c85c6861fc2ba7b318109eab1fd63fa0531d5dd5 100644 (file)
@@ -1,12 +1,14 @@
-From 995b1a65206ee28d5403db0518cb230f2ce429ef Mon Sep 17 00:00:00 2001
+From 233a22687411ea053a4b169c07324ee6aa33bf38 Mon Sep 17 00:00:00 2001
 From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
-Date: Mon, 11 Aug 2025 19:57:43 +0300
-Subject: [PATCH v6 07/13] spi: airoha: unify dirmap read/write code
+Date: Sun, 12 Oct 2025 15:16:58 +0300
+Subject: [PATCH 07/14] spi: airoha: unify dirmap read/write code
 
 Makes dirmap writing looks similar to dirmap reading. Just a minor
 refactoring, no behavior change is expected.
 
 Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
+Link: https://patch.msgid.link/20251012121707.2296160-8-mikhail.kshevetskiy@iopsys.eu
+Signed-off-by: Mark Brown <broonie@kernel.org>
 ---
  drivers/spi/spi-airoha-snfi.c | 50 ++++++++++++++++++++++-------------
  1 file changed, 32 insertions(+), 18 deletions(-)
similarity index 90%
rename from target/linux/airoha/patches-6.12/029-08-spi-airoha-support-of-dualio-quadio-flash-reading.patch
rename to target/linux/airoha/patches-6.12/029-08-v6.19-spi-airoha-support-of-dualio-quadio-flash-reading-co.patch
index 4e00e7c17826d85ca15fc5562d36c9142312f3b2..7e3fcb47647a0b448a458a8f116dc6e85929736b 100644 (file)
@@ -1,7 +1,7 @@
-From baaba9b8d3d907575323cbb7fabeae23db2a542b Mon Sep 17 00:00:00 2001
+From 80b09137aeab27e59004383058f8cc696a9ee048 Mon Sep 17 00:00:00 2001
 From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
-Date: Mon, 11 Aug 2025 20:52:34 +0300
-Subject: [PATCH v6 08/13] spi: airoha: support of dualio/quadio flash reading
+Date: Sun, 12 Oct 2025 15:16:59 +0300
+Subject: [PATCH 08/14] spi: airoha: support of dualio/quadio flash reading
  commands
 
 Airoha snfi spi controller supports acceleration of DUAL/QUAD
@@ -12,6 +12,8 @@ DUAL_IO/QUAD_IO one.
 
 Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
 Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Link: https://patch.msgid.link/20251012121707.2296160-9-mikhail.kshevetskiy@iopsys.eu
+Signed-off-by: Mark Brown <broonie@kernel.org>
 ---
  drivers/spi/spi-airoha-snfi.c | 28 ++++++++++++++++++++++------
  1 file changed, 22 insertions(+), 6 deletions(-)
similarity index 83%
rename from target/linux/airoha/patches-6.12/029-10-spi-airoha-avoid-setting-of-page-oob-sizes-in-REG.patch
rename to target/linux/airoha/patches-6.12/029-09-v6.19-spi-airoha-avoid-setting-of-page-oob-sizes-in-REG_SP.patch
index 0a3ddc8be3529a97ae7e08b9ac75e14fdeda4f68..f8902f7e575ec72be972fe602c7c2755a21c7994 100644 (file)
@@ -1,7 +1,7 @@
-From 4abbbc74306598159fe1dc545f929ae594bf4dd1 Mon Sep 17 00:00:00 2001
+From 70eec454f2d6cdfab547c262781acd38328e11a1 Mon Sep 17 00:00:00 2001
 From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
-Date: Thu, 14 Aug 2025 18:00:32 +0300
-Subject: [PATCH v6 10/13] spi: airoha: avoid setting of page/oob sizes in
+Date: Sun, 12 Oct 2025 15:17:00 +0300
+Subject: [PATCH 09/14] spi: airoha: avoid setting of page/oob sizes in
  REG_SPI_NFI_PAGEFMT
 
 spi-airoha-snfi uses custom sector size in REG_SPI_NFI_SECCUS_SIZE
@@ -9,6 +9,8 @@ register, so setting of page/oob sizes in REG_SPI_NFI_PAGEFMT is not
 required.
 
 Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
+Link: https://patch.msgid.link/20251012121707.2296160-10-mikhail.kshevetskiy@iopsys.eu
+Signed-off-by: Mark Brown <broonie@kernel.org>
 ---
  drivers/spi/spi-airoha-snfi.c | 38 -----------------------------------
  1 file changed, 38 deletions(-)
similarity index 92%
rename from target/linux/airoha/patches-6.12/029-11-spi-airoha-reduce-the-number-of-modification-of-R.patch
rename to target/linux/airoha/patches-6.12/029-10-v6.19-spi-airoha-reduce-the-number-of-modification-of-REG_.patch
index 2193994ed95d7d87a2cf550cf91b00d1e70d2e82..40e2f6ea218c0a6e23afbcc05c1a12bb10b9567c 100644 (file)
@@ -1,7 +1,7 @@
-From 0d8f58869192df0acdba286d233b57a4feeaf94b Mon Sep 17 00:00:00 2001
+From d1ff30df1d9a4eb4c067795abb5e2a66910fd108 Mon Sep 17 00:00:00 2001
 From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
-Date: Thu, 14 Aug 2025 18:49:34 +0300
-Subject: [PATCH v6 11/13] spi: airoha: reduce the number of modification of
+Date: Sun, 12 Oct 2025 15:17:01 +0300
+Subject: [PATCH 10/14] spi: airoha: reduce the number of modification of
  REG_SPI_NFI_CNFG and REG_SPI_NFI_SECCUS_SIZE registers
 
 This just reduce the number of modification of REG_SPI_NFI_CNFG and
@@ -12,6 +12,8 @@ from SNFI registers during driver startup.
 
 Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
 Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Link: https://patch.msgid.link/20251012121707.2296160-11-mikhail.kshevetskiy@iopsys.eu
+Signed-off-by: Mark Brown <broonie@kernel.org>
 ---
  drivers/spi/spi-airoha-snfi.c | 135 +++++++++++++++++++++++++---------
  1 file changed, 102 insertions(+), 33 deletions(-)
@@ -103,7 +105,7 @@ Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com
        err = regmap_write(as_ctrl->regmap_nfi, REG_SPI_NFI_CMD, 0x0);
        if (err)
                goto error_dma_unmap;
-@@ -819,7 +855,48 @@ static ssize_t airoha_snand_dirmap_write
+@@ -815,7 +851,48 @@ static ssize_t airoha_snand_dirmap_write
        if (err < 0)
                return err;
  
@@ -153,7 +155,7 @@ Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com
        if (err)
                goto error_dma_mode_off;
  
-@@ -835,8 +912,16 @@ static ssize_t airoha_snand_dirmap_write
+@@ -831,8 +908,16 @@ static ssize_t airoha_snand_dirmap_write
        if (err)
                goto error_dma_unmap;
  
@@ -172,7 +174,7 @@ Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com
        err = regmap_update_bits(as_ctrl->regmap_nfi,
                                 REG_SPI_NFI_SNF_MISC_CTL2,
                                 SPI_NFI_PROG_LOAD_BYTE_NUM, val);
-@@ -861,22 +946,6 @@ static ssize_t airoha_snand_dirmap_write
+@@ -857,22 +942,6 @@ static ssize_t airoha_snand_dirmap_write
        if (err)
                goto error_dma_unmap;
  
similarity index 91%
rename from target/linux/airoha/patches-6.12/029-12-spi-airoha-set-custom-sector-size-equal-to-flash-.patch
rename to target/linux/airoha/patches-6.12/029-11-v6.19-spi-airoha-set-custom-sector-size-equal-to-flash-pag.patch
index d9f35366b42d544c58e16d9dab5c04223838689d..514212835cea5034ddb1fd16b73829499b590aef 100644 (file)
@@ -1,8 +1,8 @@
-From 893ee23d650ca9ee36541b9a5ae0bc18be01a11f Mon Sep 17 00:00:00 2001
+From fb81b5cecb8553e3ca2b45288cf340d43c9c2991 Mon Sep 17 00:00:00 2001
 From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
-Date: Thu, 14 Aug 2025 22:47:17 +0300
-Subject: [PATCH v6 12/13] spi: airoha: set custom sector size equal to flash
page size
+Date: Sun, 12 Oct 2025 15:17:02 +0300
+Subject: [PATCH 11/14] spi: airoha: set custom sector size equal to flash page
+ size
 
 Set custom sector size equal to flash page size including oob. Thus we
 will always read a single sector. The maximum custom sector size is
@@ -13,6 +13,8 @@ from SNFI registers during driver startup.
 
 Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
 Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Link: https://patch.msgid.link/20251012121707.2296160-12-mikhail.kshevetskiy@iopsys.eu
+Signed-off-by: Mark Brown <broonie@kernel.org>
 ---
  drivers/spi/spi-airoha-snfi.c | 35 +++++++++++++++++++----------------
  1 file changed, 19 insertions(+), 16 deletions(-)
@@ -102,7 +104,7 @@ Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com
        opcode = desc->info.op_tmpl.cmd.opcode;
        switch (opcode) {
        case SPI_NAND_OP_PROGRAM_LOAD_SINGLE:
-@@ -884,18 +889,17 @@ static ssize_t airoha_snand_dirmap_write
+@@ -880,18 +885,17 @@ static ssize_t airoha_snand_dirmap_write
                goto error_dma_mode_off;
  
        /* Set number of sector will be written */
@@ -124,7 +126,7 @@ Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com
                                 SPI_NFI_CUS_SEC_SIZE_EN);
        if (err)
                goto error_dma_mode_off;
-@@ -920,11 +924,10 @@ static ssize_t airoha_snand_dirmap_write
+@@ -916,11 +920,10 @@ static ssize_t airoha_snand_dirmap_write
         *        = NFI_SNF_MISC_CTL2.write_data_byte_number =
         *        = NFI_CON.sector_number * NFI_SECCUS.custom_sector_size
         */
similarity index 91%
rename from target/linux/airoha/patches-6.12/029-13-spi-airoha-avoid-reading-flash-page-settings-from.patch
rename to target/linux/airoha/patches-6.12/029-12-v6.19-spi-airoha-avoid-reading-flash-page-settings-from-SN.patch
index 2efc56f3567704b669cbe1b51a33c0d9828546f6..c785ae8d5635cba1da9d45dcf062d5ad90c71a79 100644 (file)
@@ -1,7 +1,7 @@
-From 64a4d6e84145227211485067022cd4e5cf052e04 Mon Sep 17 00:00:00 2001
+From 902c0ea18a97b1a6eeee5799cb1fd9a79ef9208e Mon Sep 17 00:00:00 2001
 From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
-Date: Thu, 14 Aug 2025 23:56:24 +0300
-Subject: [PATCH v6 13/13] spi: airoha: avoid reading flash page settings from
+Date: Sun, 12 Oct 2025 15:17:03 +0300
+Subject: [PATCH 12/14] spi: airoha: avoid reading flash page settings from
  SNFI registers during driver startup
 
 The spinand driver do 3 type of dirmap requests:
@@ -25,6 +25,8 @@ SNFI registers during driver startup. Also airoha_snand_adjust_op_size()
 function becomes unnecessary.
 
 Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
+Link: https://patch.msgid.link/20251012121707.2296160-13-mikhail.kshevetskiy@iopsys.eu
+Signed-off-by: Mark Brown <broonie@kernel.org>
 ---
  drivers/spi/spi-airoha-snfi.c | 115 ++--------------------------------
  1 file changed, 5 insertions(+), 110 deletions(-)
@@ -148,7 +150,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
  
        opcode = desc->info.op_tmpl.cmd.opcode;
        switch (opcode) {
-@@ -1080,7 +1006,6 @@ static int airoha_snand_exec_op(struct s
+@@ -1076,7 +1002,6 @@ static int airoha_snand_exec_op(struct s
  }
  
  static const struct spi_controller_mem_ops airoha_snand_mem_ops = {
@@ -156,7 +158,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
        .supports_op = airoha_snand_supports_op,
        .exec_op = airoha_snand_exec_op,
        .dirmap_create = airoha_snand_dirmap_create,
-@@ -1105,36 +1030,6 @@ static int airoha_snand_setup(struct spi
+@@ -1101,36 +1026,6 @@ static int airoha_snand_setup(struct spi
        return 0;
  }
  
@@ -193,7 +195,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
  static const struct regmap_config spi_ctrl_regmap_config = {
        .name           = "ctrl",
        .reg_bits       = 32,
-@@ -1208,7 +1103,7 @@ static int airoha_snand_probe(struct pla
+@@ -1204,7 +1099,7 @@ static int airoha_snand_probe(struct pla
        ctrl->setup = airoha_snand_setup;
        device_set_node(&ctrl->dev, dev_fwnode(dev));
  
similarity index 63%
rename from target/linux/airoha/patches-6.12/029-09-spi-airoha-buffer-must-be-0xff-ed-before-writing.patch
rename to target/linux/airoha/patches-6.12/029-13-v6.19-spi-airoha-buffer-must-be-0xff-ed-before-writing.patch
index 7eef83d5626a1adb39a3013c05853512781abb04..669f9b2dd438e494e0ce13de316e9b2ee511e73a 100644 (file)
@@ -1,7 +1,7 @@
-From 6ca9cd453cb5d8a6411791295771b4dbd1c623de Mon Sep 17 00:00:00 2001
+From 0743acf746a81e0460a56fd5ff847d97fa7eb370 Mon Sep 17 00:00:00 2001
 From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
-Date: Mon, 11 Aug 2025 21:18:04 +0300
-Subject: [PATCH v6 09/13] spi: airoha: buffer must be 0xff-ed before writing
+Date: Sun, 12 Oct 2025 15:17:04 +0300
+Subject: [PATCH 13/14] spi: airoha: buffer must be 0xff-ed before writing
 
 During writing, the entire flash page (including OOB) will be updated
 with the values from the temporary buffer, so we need to fill the
@@ -9,13 +9,16 @@ untouched areas of the buffer with 0xff value to prevent accidental
 data overwriting.
 
 Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
+Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Link: https://patch.msgid.link/20251012121707.2296160-14-mikhail.kshevetskiy@iopsys.eu
+Signed-off-by: Mark Brown <broonie@kernel.org>
 ---
  drivers/spi/spi-airoha-snfi.c | 4 ++++
  1 file changed, 4 insertions(+)
 
 --- a/drivers/spi/spi-airoha-snfi.c
 +++ b/drivers/spi/spi-airoha-snfi.c
-@@ -847,7 +847,11 @@ static ssize_t airoha_snand_dirmap_write
+@@ -776,7 +776,11 @@ static ssize_t airoha_snand_dirmap_write
                return -EOPNOTSUPP;
        }
  
diff --git a/target/linux/airoha/patches-6.12/029-14-spi-airoha-snfi-en7523-workaround-flash-damaging.patch b/target/linux/airoha/patches-6.12/029-14-spi-airoha-snfi-en7523-workaround-flash-damaging.patch
deleted file mode 100644 (file)
index c40645b..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-From 86f88e604305186aec1fb6eebbf8f0a42c2435d3 Mon Sep 17 00:00:00 2001
-From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
-Date: Thu, 9 Oct 2025 19:33:23 +0300
-Subject: [PATCH] spi: airoha-snfi: en7523: workaround flash damaging
- if UART_TXD was short to GND
-
-We found that some serial console may pull TX line to GROUND during board
-boot time. Airoha uses TX line as one of it's BOOT pins. This will lead
-to booting in RESERVED boot mode.
-
-It was found that some flashes operates incorrectly in RESERVED mode.
-Micron and Skyhigh flashes are definitely affected by the issue,
-Winbond flashes are NOT affected.
-
-Details:
---------
-DMA reading of odd pages on affected flashes operates incorrectly. Page
-reading offset (start of the page) on hardware level is replaced by 0x10.
-Thus results in incorrect data reading. Usage of UBI make things even
-worse. Any attempt to access UBI leads to ubi damaging. As result OS loading
-becomes impossible.
-
-Non-DMA reading is OK.
-
-This patch detects booting in reserved mode, turn off DMA and print big
-fat warning.
-
-Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
----
- drivers/spi/spi-airoha-snfi.c | 40 ++++++++++++++++++++++++++++++-----
- 1 file changed, 35 insertions(+), 5 deletions(-)
-
---- a/drivers/spi/spi-airoha-snfi.c
-+++ b/drivers/spi/spi-airoha-snfi.c
-@@ -1013,6 +1013,11 @@ static const struct spi_controller_mem_o
-       .dirmap_write = airoha_snand_dirmap_write,
- };
-+static const struct spi_controller_mem_ops airoha_snand_nodma_mem_ops = {
-+      .supports_op = airoha_snand_supports_op,
-+      .exec_op = airoha_snand_exec_op,
-+};
-+
- static int airoha_snand_setup(struct spi_device *spi)
- {
-       struct airoha_snand_ctrl *as_ctrl;
-@@ -1058,7 +1063,8 @@ static int airoha_snand_probe(struct pla
-       struct device *dev = &pdev->dev;
-       struct spi_controller *ctrl;
-       void __iomem *base;
--      int err;
-+      int err, dma_enabled;
-+      u32 sfc_strap;
-       ctrl = devm_spi_alloc_host(dev, sizeof(*as_ctrl));
-       if (!ctrl)
-@@ -1092,12 +1098,36 @@ static int airoha_snand_probe(struct pla
-               return dev_err_probe(dev, PTR_ERR(as_ctrl->spi_clk),
-                                    "unable to get spi clk\n");
--      err = dma_set_mask(as_ctrl->dev, DMA_BIT_MASK(32));
--      if (err)
--              return err;
-+      dma_enabled = 1;
-+      if (device_is_compatible(dev, "airoha,en7523-snand")) {
-+              err = regmap_read(as_ctrl->regmap_ctrl,
-+                                REG_SPI_CTRL_SFC_STRAP, &sfc_strap);
-+              if (err)
-+                      return err;
-+
-+              if (!(sfc_strap & 0x04)) {
-+                      dma_enabled = 0;
-+                      printk(KERN_WARNING "\n"
-+                              "=== WARNING ======================================================\n"
-+                              "Detected booting in RESERVED mode (UART_TXD was short to GND).\n"
-+                              "This mode is known for incorrect DMA reading of some flashes.\n"
-+                              "Usage of DMA for flash operations will be disabled to prevent data\n"
-+                              "damage. Unplug your serial console and power cycle the board\n"
-+                              "to boot with full performance.\n"
-+                              "==================================================================\n\n");
-+              }
-+      }
-+
-+      if (dma_enabled) {
-+              err = dma_set_mask(as_ctrl->dev, DMA_BIT_MASK(32));
-+              if (err)
-+                      return err;
-+      }
-       ctrl->num_chipselect = 2;
--      ctrl->mem_ops = &airoha_snand_mem_ops;
-+      ctrl->mem_ops = dma_enabled ?
-+                              &airoha_snand_mem_ops :
-+                              &airoha_snand_nodma_mem_ops;
-       ctrl->bits_per_word_mask = SPI_BPW_MASK(8);
-       ctrl->mode_bits = SPI_RX_DUAL;
-       ctrl->setup = airoha_snand_setup;
diff --git a/target/linux/airoha/patches-6.12/029-14-v6.19-spi-airoha-snfi-en7523-workaround-flash-damaging-if-.patch b/target/linux/airoha/patches-6.12/029-14-v6.19-spi-airoha-snfi-en7523-workaround-flash-damaging-if-.patch
new file mode 100644 (file)
index 0000000..cd59624
--- /dev/null
@@ -0,0 +1,102 @@
+From 061795b345aff371df8f71d54ae7c7dc8ae630d0 Mon Sep 17 00:00:00 2001
+From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
+Date: Wed, 26 Nov 2025 02:40:45 +0300
+Subject: [PATCH 14/14] spi: airoha-snfi: en7523: workaround flash damaging if
+ UART_TXD was short to GND
+
+Airoha EN7523 specific bug
+--------------------------
+We found that some serial console may pull TX line to GROUND during board
+boot time. Airoha uses TX line as one of its bootstrap pins. On the EN7523
+SoC this may lead to booting in RESERVED boot mode.
+
+It was found that some flashes operates incorrectly in RESERVED mode.
+Micron and Skyhigh flashes are definitely affected by the issue,
+Winbond flashes are not affected.
+
+Details:
+--------
+DMA reading of odd pages on affected flashes operates incorrectly. Page
+reading offset (start of the page) on hardware level is replaced by 0x10.
+Thus results in incorrect data reading. As result OS loading becomes
+impossible.
+
+Usage of UBI make things even worse. On attaching, UBI will detects
+corruptions (because of wrong reading of odd pages) and will try to
+recover. For recovering UBI will erase and write 'damaged' blocks with
+a valid information. This will destroy all UBI data.
+
+Non-DMA reading is OK.
+
+This patch detects booting in reserved mode, turn off DMA and print big
+fat warning.
+
+It's worth noting that the boot configuration is preserved across reboots.
+Therefore, to boot normally, you should do the following:
+- disconnect the serial console from the board,
+- power cycle the board.
+
+Fixes: a403997c12019 ("spi: airoha: add SPI-NAND Flash controller driver")
+Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
+Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
+Link: https://patch.msgid.link/20251125234047.1101985-2-mikhail.kshevetskiy@iopsys.eu
+Signed-off-by: Mark Brown <broonie@kernel.org>
+---
+ drivers/spi/spi-airoha-snfi.c | 25 ++++++++++++++++++++++++-
+ 1 file changed, 24 insertions(+), 1 deletion(-)
+
+--- a/drivers/spi/spi-airoha-snfi.c
++++ b/drivers/spi/spi-airoha-snfi.c
+@@ -1013,6 +1013,11 @@ static const struct spi_controller_mem_o
+       .dirmap_write = airoha_snand_dirmap_write,
+ };
++static const struct spi_controller_mem_ops airoha_snand_nodma_mem_ops = {
++      .supports_op = airoha_snand_supports_op,
++      .exec_op = airoha_snand_exec_op,
++};
++
+ static int airoha_snand_setup(struct spi_device *spi)
+ {
+       struct airoha_snand_ctrl *as_ctrl;
+@@ -1057,7 +1062,9 @@ static int airoha_snand_probe(struct pla
+       struct airoha_snand_ctrl *as_ctrl;
+       struct device *dev = &pdev->dev;
+       struct spi_controller *ctrl;
++      bool dma_enable = true;
+       void __iomem *base;
++      u32 sfc_strap;
+       int err;
+       ctrl = devm_spi_alloc_host(dev, sizeof(*as_ctrl));
+@@ -1092,12 +1099,28 @@ static int airoha_snand_probe(struct pla
+               return dev_err_probe(dev, PTR_ERR(as_ctrl->spi_clk),
+                                    "unable to get spi clk\n");
++      if (device_is_compatible(dev, "airoha,en7523-snand")) {
++              err = regmap_read(as_ctrl->regmap_ctrl,
++                                REG_SPI_CTRL_SFC_STRAP, &sfc_strap);
++              if (err)
++                      return err;
++
++              if (!(sfc_strap & 0x04)) {
++                      dma_enable = false;
++                      dev_warn(dev, "Detected booting in RESERVED mode (UART_TXD was short to GND).\n");
++                      dev_warn(dev, "This mode is known for incorrect DMA reading of some flashes.\n");
++                      dev_warn(dev, "Much slower PIO mode will be used to prevent flash data damage.\n");
++                      dev_warn(dev, "Unplug UART cable and power cycle board to get full performance.\n");
++              }
++      }
++
+       err = dma_set_mask(as_ctrl->dev, DMA_BIT_MASK(32));
+       if (err)
+               return err;
+       ctrl->num_chipselect = 2;
+-      ctrl->mem_ops = &airoha_snand_mem_ops;
++      ctrl->mem_ops = dma_enable ? &airoha_snand_mem_ops
++                                 : &airoha_snand_nodma_mem_ops;
+       ctrl->bits_per_word_mask = SPI_BPW_MASK(8);
+       ctrl->mode_bits = SPI_RX_DUAL;
+       ctrl->setup = airoha_snand_setup;
diff --git a/target/linux/airoha/patches-6.12/029-15-arm-dts-airoha-en7523-add-SNAND-node.patch b/target/linux/airoha/patches-6.12/029-15-arm-dts-airoha-en7523-add-SNAND-node.patch
new file mode 100644 (file)
index 0000000..bd68440
--- /dev/null
@@ -0,0 +1,40 @@
+From bb2f9b3d71717c7df942deb1488c56e544d4a32c Mon Sep 17 00:00:00 2001
+From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
+Date: Fri, 10 Oct 2025 06:01:33 +0300
+Subject: [PATCH v6 3/3] arm: dts: airoha: en7523: add SNAND node
+
+Add SNAND node to enable support of attached SPI-NAND on the EN7523 SoC.
+
+Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
+Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+---
+ arch/arm/boot/dts/airoha/en7523.dtsi | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+--- a/arch/arm/boot/dts/airoha/en7523.dtsi
++++ b/arch/arm/boot/dts/airoha/en7523.dtsi
+@@ -203,4 +203,24 @@
+                       #interrupt-cells = <1>;
+               };
+       };
++
++      spi_ctrl: spi@1fa10000 {
++              compatible = "airoha,en7523-snand", "airoha,en7581-snand";
++              reg = <0x1fa10000 0x140>,
++                    <0x1fa11000 0x160>;
++
++              clocks = <&scu EN7523_CLK_SPI>;
++              clock-names = "spi";
++
++              #address-cells = <1>;
++              #size-cells = <0>;
++
++              nand: nand@0 {
++                      compatible = "spi-nand";
++                      reg = <0>;
++                      spi-max-frequency = <50000000>;
++                      spi-tx-bus-width = <1>;
++                      spi-rx-bus-width = <2>;
++              };
++      };
+ };