mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 2/6] of: of_path: support barebox,fixed-partitions
Date: Mon, 17 Feb 2025 19:08:29 +0100	[thread overview]
Message-ID: <20250217180833.3955657-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20250217180833.3955657-1-a.fatoum@pengutronix.de>

barebox has for many years supported a superset of the upstream OF
partitions binding by parsing partitions out of SD/eMMC and EEPROM
in addition to MTD.

Unfortunately, we didn't upstream our binding and a different binding
went upstream into Linux v6.13-rc1 along with Linux commit
2e3a191e89f9 ("block: add support for partition table defined in OF").

Since then, if CONFIG_OF_PARTITION, which is disabled by default, is
enabled, Linux will ignore any GPT/MBR if an SD/eMMC node has a
fixed-partitions compatible subnode.

This is different from the barebox behavior, which allows both OF
partitions and GPT/MBR to co-exist as long as they don't conflict.

As many barebox boards:

  - Place the environment in non-partitioned space prior to the first
    partition

  - Fixup all fixed-partitions into the kernel device tree by default

this results in breakage if a newer kernel is booted with
CONFIG_OF_PARTITION enabled.

As first step towards resolving this, teach barebox to parse
barebox,fixed-partitions the same way it parses fixed-partitions.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/of/of_path.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/of/of_path.c b/drivers/of/of_path.c
index b3feaa07e39d..57bd82a741ba 100644
--- a/drivers/of/of_path.c
+++ b/drivers/of/of_path.c
@@ -14,7 +14,9 @@
 
 bool of_node_is_fixed_partitions(const struct device_node *np)
 {
-	return of_device_is_compatible(np, "fixed-partitions");
+	return of_device_is_compatible(np, "fixed-partitions") ||
+		of_device_is_compatible(np, "barebox,fixed-partitions");
+
 }
 
 struct device *of_find_device_by_node_path(const char *path)
-- 
2.39.5




  parent reply	other threads:[~2025-02-17 18:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-17 18:08 [PATCH 0/6] of: partition: add Linux CONFIG_OF_PARTITION-compatible adaptive fixup mode Ahmad Fatoum
2025-02-17 18:08 ` [PATCH 1/6] of: factor out of_node_is_fixed_partitions check Ahmad Fatoum
2025-02-17 18:08 ` Ahmad Fatoum [this message]
2025-02-17 18:08 ` [PATCH 3/6] ARM: IMX8MP: var-dart-dt8mcustomboard.dts: use new-style partition binding Ahmad Fatoum
2025-02-17 18:08 ` [PATCH 4/6] ARM: dts: prefix all non-MTD fixed-partitions with barebox, Ahmad Fatoum
2025-02-17 18:08 ` [PATCH 5/6] of: partition: refactor of_partition_binding checks into switch Ahmad Fatoum
2025-02-17 18:08 ` [PATCH 6/6] of: partition: add Linux CONFIG_OF_PARTITION-compatible adaptive fixup mode Ahmad Fatoum
2025-02-17 19:25 ` [PATCH 0/6] " Marco Felsch
2025-02-17 19:57   ` Ahmad Fatoum
2025-02-20  8:26 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250217180833.3955657-3-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox