Skip to contentSkip to conversation

sunxi: avoid double vendor prefix when CONFIG_OF_UPSTREAM is enabled

PATCH In review Bohdan Chubuk 2 participants 2 messages Nov 24, 2025 – Jan 19 Arm/Allwinner sunXi SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sunxi: avoid double vendor prefix when CONFIG_OF_UPSTREAM is enabled

When CONFIG_OF_UPSTREAM is enabled, the device tree name provided by SPL already includes the vendor directory (e.g., "allwinner/board-name").

The existing logic in misc_init_r() unconditionally prepends "allwinner/" for ARM64 builds, resulting in an incorrect path like "allwinner/allwinner/board-name.dtb".

This patch modifies the logic to only prepend the vendor prefix if CONFIG_OF_UPSTREAM is NOT enabled. This ensures compatibility with both legacy builds and the new upstream devicetree structure.

---
 board/sunxi/board.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
board/sunxi/board.c +4 -1
index 2929bc17f08..c68b51d370d 100644
@@ -834,7 +834,10 @@ int misc_init_r(void)
 	/* Set fdtfile to match the FIT configuration chosen in SPL. */
 	spl_dt_name = get_spl_dt_name();
 	if (spl_dt_name) {
-		char *prefix = IS_ENABLED(CONFIG_ARM64) ? "allwinner/" : "";
+		const char *prefix = "";
+
+		if (IS_ENABLED(CONFIG_ARM64) && !IS_ENABLED(CONFIG_OF_UPSTREAM))
+			prefix = "allwinner/";
 		char str[64];
 
 		snprintf(str, sizeof(str), "%s%s.dtb", prefix, spl_dt_name);
Signature · 1 line
2.52.0
#1 lore raw

On Sun, 23 Nov 2025 22:43:46 +0200
Bohdan Chubuk <[email protected]> wrote:

Hi Bohdan,

thanks for the patch!

Quoted 10 lines

When CONFIG_OF_UPSTREAM is enabled, the device tree name provided by SPL already includes the vendor directory (e.g., "allwinner/board-name").

The existing logic in misc_init_r() unconditionally prepends "allwinner/" for ARM64 builds, resulting in an incorrect path like "allwinner/allwinner/board-name.dtb".

This patch modifies the logic to only prepend the vendor prefix if CONFIG_OF_UPSTREAM is NOT enabled. This ensures compatibility with both legacy builds and the new upstream devicetree structure.

Weird, I thought we already fixed that.
Anyway, looks good to me, will take it. Just fixing up the one nit below.

Quoted 11 lines
---
 board/sunxi/board.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
board/sunxi/board.c +0 -0
index 2929bc17f08..c68b51d370d 100644

board/sunxi/board.c int misc_init_r(void) · line 841

Quoted 9 lines
board/sunxi/board.c +4 -1
@@ -834,7 +834,10 @@ int misc_init_r(void)
 	/* Set fdtfile to match the FIT configuration chosen in SPL. */
 	spl_dt_name = get_spl_dt_name();
 	if (spl_dt_name) {
-		char *prefix = IS_ENABLED(CONFIG_ARM64) ? "allwinner/" : "";
+		const char *prefix = "";
+
+		if (IS_ENABLED(CONFIG_ARM64) && !IS_ENABLED(CONFIG_OF_UPSTREAM))
+			prefix = "allwinner/";
 		char str[64];

We should keep variable declarations together, so moving this. Will fix this while committing.

Cheers,
Andre

Quoted 2 lines
board/sunxi/board.c +0 -0
 		snprintf(str, sizeof(str), "%s%s.dtb", prefix, spl_dt_name);