[openwrt/openwrt] mediatek: add work-around for ASUS bootloader MTD behavior
LEDE Commits
lede-commits at lists.infradead.org
Sun Feb 16 17:34:24 PST 2025
dangole pushed a commit to openwrt/openwrt.git, branch openwrt-24.10:
https://git.openwrt.org/36bde27e796475d12dc5de205ed328ab0768a6b6
commit 36bde27e796475d12dc5de205ed328ab0768a6b6
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Thu Feb 6 05:17:54 2025 +0000
mediatek: add work-around for ASUS bootloader MTD behavior
ASUS makes use of U-Boot's fdt_fixup_mtdparts() function which applies
the partitions defined in U-Boot's mtdparts and mtdids environment
variables to the devicetree passed over to Linux.
The undesired side-effect is that in this way also all additional
properties and child nodes get wiped, preventing NVMEM cells to be
defined for MTD partitions or UBI volumes.
To work-around this issue, add an additional compatible string
'u-boot-dont-touch-spi-nand' which can be used instead of 'spi-nand' in
case the replacement of the MTD partitions by U-Boot should be skipped
alltogether.
In practise this is mostly relevant for SPI-NAND which anyway comes only
with two partitions nowadays: 'Bootloader' and 'UBI_DEV'. Hence this
work-around is applicable for SPI-NAND only. Similar work-arounds for
other MTD devices can be created as well should they actually be needed.
Signed-off-by: Daniel Golle <daniel at makrotopia.org>
(cherry picked from commit c48afca32ca875c4176b4c41be94335e61556783)
---
.../960-asus-hack-u-boot-ignore-mtdparts.patch | 47 ++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/target/linux/mediatek/patches-6.6/960-asus-hack-u-boot-ignore-mtdparts.patch b/target/linux/mediatek/patches-6.6/960-asus-hack-u-boot-ignore-mtdparts.patch
new file mode 100644
index 0000000000..0fe2b95e8a
--- /dev/null
+++ b/target/linux/mediatek/patches-6.6/960-asus-hack-u-boot-ignore-mtdparts.patch
@@ -0,0 +1,47 @@
+From 30a04cf5b6ffa1249df72ccd98cef05f37890f89 Mon Sep 17 00:00:00 2001
+From: Daniel Golle <daniel at makrotopia.org>
+Date: Thu, 6 Feb 2025 05:07:20 +0000
+Subject: [PATCH] mtd: spinand: add work-around to prevent bootloader wiping
+ mtdparts
+
+ASUS makes use of U-Boot's fdt_fixup_mtdparts() function which applies
+the partitions defined in U-Boot's mtdparts and mtdids environment
+variables to the devicetree passed over to Linux.
+
+The undesired side-effect is that in this way also all additional
+properties and child nodes get wiped, preventing NVMEM cells to be
+defined for MTD partitions or UBI volumes.
+
+To work-around this issue, add an additional compatible string
+'u-boot-dont-touch-spi-nand' which can be used instead of 'spi-nand' in
+case the replacement of the MTD partitions by U-Boot should be skipped
+alltogether.
+
+In practise this is mostly relevant for SPI-NAND which anyway comes only
+with two partitions nowadays: 'Bootloader' and 'UBI_DEV'. Hence this
+work-around is applicable for SPI-NAND only. Similar work-arounds for
+other MTD devices can be created as well should they actually be needed.
+
+Signed-off-by: Daniel Golle <daniel at makrotopia.org>
+---
+ drivers/mtd/nand/spi/core.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/mtd/nand/spi/core.c
++++ b/drivers/mtd/nand/spi/core.c
+@@ -1441,6 +1441,7 @@ static int spinand_remove(struct spi_mem
+
+ static const struct spi_device_id spinand_ids[] = {
+ { .name = "spi-nand" },
++ { .name = "u-boot-dont-touch-spi-nand" },
+ { /* sentinel */ },
+ };
+ MODULE_DEVICE_TABLE(spi, spinand_ids);
+@@ -1448,6 +1449,7 @@ MODULE_DEVICE_TABLE(spi, spinand_ids);
+ #ifdef CONFIG_OF
+ static const struct of_device_id spinand_of_ids[] = {
+ { .compatible = "spi-nand" },
++ { .compatible = "u-boot-dont-touch-spi-nand" },
+ { /* sentinel */ },
+ };
+ MODULE_DEVICE_TABLE(of, spinand_of_ids);
More information about the lede-commits
mailing list