kernel: mtd: backport upstream physmap OF partition order main master
authorLinus Walleij <linusw@kernel.org>
Thu, 29 Jan 2026 23:24:31 +0000 (00:24 +0100)
committerLinus Walleij <linusw@kernel.org>
Sat, 31 Jan 2026 22:13:46 +0000 (23:13 +0100)
This patch was applied upstream and makes it possible to override
RedBoot partitions with fixed-partitions for platforms using
physmap.

Link: https://lore.kernel.org/linux-mtd/176971394786.256159.18224773453751051734.b4-ty@bootlin.com/
Link: https://github.com/openwrt/openwrt/pull/21788
Signed-off-by: Linus Walleij <linusw@kernel.org>
target/linux/generic/backport-6.12/799-v7.0-mtd-physmap-core-Prioritize-ofparts-for-OF-probe.patch [new file with mode: 0644]

diff --git a/target/linux/generic/backport-6.12/799-v7.0-mtd-physmap-core-Prioritize-ofparts-for-OF-probe.patch b/target/linux/generic/backport-6.12/799-v7.0-mtd-physmap-core-Prioritize-ofparts-for-OF-probe.patch
new file mode 100644 (file)
index 0000000..4aac643
--- /dev/null
@@ -0,0 +1,33 @@
+From cd3303e9081050ad09b031bc5b58c89fe6902f86 Mon Sep 17 00:00:00 2001
+From: Linus Walleij <linusw@kernel.org>
+Date: Thu, 29 Jan 2026 00:48:36 +0100
+Subject: [PATCH] mtd: physmap-core: Prioritize ofparts for OF probe
+
+Place the ofparts before RedBoot partitions in the OF probe
+path: this makes it possible to override any existing
+RedBoot partitions with fixed-partitions which may be necessary,
+such as when you need to repartition the flash from Linux'
+point of view but not necessary from the bootloaders point
+of view.
+
+This happens when a device such as Raidsonic IB-4220-B has
+three partitions named "Kern", "Ramdisk" and "Application"
+that we want to merge into one for more efficient use
+of the flash memory in OpenWrt.
+
+Signed-off-by: Linus Walleij <linusw@kernel.org>
+---
+ drivers/mtd/maps/physmap-core.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/mtd/maps/physmap-core.c
++++ b/drivers/mtd/maps/physmap-core.c
+@@ -268,7 +268,7 @@ static const struct of_device_id of_flas
+ MODULE_DEVICE_TABLE(of, of_flash_match);
+ static const char * const of_default_part_probes[] = {
+-      "cmdlinepart", "RedBoot", "ofpart", "ofoldpart", NULL
++      "cmdlinepart", "ofpart", "ofoldpart", "RedBoot", NULL
+ };
+ static const char * const *of_get_part_probes(struct platform_device *dev)