Skip to contentSkip to conversation

sunxi: allow CONFIG_DEFAULT_FDT_FILE override

PATCH New Martin Kelly 4 participants 11 messages May 2, 2018 – Jun 1, 2018 Arm/Allwinner sunXi SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sunxi: allow CONFIG_DEFAULT_FDT_FILE override

Currently, sunxi-common.h ignores CONFIG_DEFAULT_FDT_FILE and assumes the kernel fdtfile and the u-boot devicetree names are the same. Although this is typically the case, sometimes you might want to customize one of these differently, so it's useful to allow them to be different.

Add logic in sunxi-common.h to respect CONFIG_DEFAULT_FDT_FILE, if set, and default to the values it currently uses.

---
 include/configs/sunxi-common.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/configs/sunxi-common.h +6 -0
index 9d9e9ce173..cfd0b1d8c6 100644
@@ -501,12 +501,18 @@ extern int soft_i2c_gpio_scl;
 	CONSOLE_STDIN_SETTINGS \
 	CONSOLE_STDOUT_SETTINGS
 
+#ifdef CONFIG_DEFAULT_FDT_FILE
+#define FDTFILE CONFIG_DEFAULT_FDT_FILE ".dtb"
+#else /* ifndef CONFIG_DEFAULT_FDT_FILE */
+
 #ifdef CONFIG_ARM64
 #define FDTFILE "allwinner/" CONFIG_DEFAULT_DEVICE_TREE ".dtb"
 #else
 #define FDTFILE CONFIG_DEFAULT_DEVICE_TREE ".dtb"
 #endif
 
+#endif /* ifdef CONFIG_DEFAULT_FDT_FILE */
+
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	CONSOLE_ENV_SETTINGS \
 	MEM_LAYOUT_ENV_SETTINGS \
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 sunxi: allow CONFIG_DEFAULT_FDT_FILE override

Quoted 10 lines · Martin Kelly

Currently, sunxi-common.h ignores CONFIG_DEFAULT_FDT_FILE and assumes the kernel fdtfile and the u-boot devicetree names are the same. Although this is typically the case, sometimes you might want to customize one of these differently, so it's useful to allow them to be different.

Add logic in sunxi-common.h to respect CONFIG_DEFAULT_FDT_FILE, if set, and default to the values it currently uses.

Maxime

Signature · 10 lines
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180517/de892107/attachment.sig>
#2 lore raw

PATCH 1/1 sunxi: allow CONFIG_DEFAULT_FDT_FILE override

Quoted 7 lines · Maxime Ripard
Quoted 6 lines · Martin Kelly

Currently, sunxi-common.h ignores CONFIG_DEFAULT_FDT_FILE and assumes the kernel fdtfile and the u-boot devicetree names are the same. Although this is typically the case, sometimes you might want to customize one of these differently, so it's useful to allow them to be different.

Quoted 9 lines
Quoted 4 lines

Add logic in sunxi-common.h to respect CONFIG_DEFAULT_FDT_FILE, if set, and default to the values it currently uses.

Maxime

(ping)

#3 lore raw

PATCH 1/1 sunxi: allow CONFIG_DEFAULT_FDT_FILE override

Quoted 11 lines · Martin Kelly
Quoted 10 lines · Maxime Ripard
Quoted 9 lines · Martin Kelly

Currently, sunxi-common.h ignores CONFIG_DEFAULT_FDT_FILE and assumes the kernel fdtfile and the u-boot devicetree names are the same. Although this is typically the case, sometimes you might want to customize one of these differently, so it's useful to allow them to be different.

Add logic in sunxi-common.h to respect CONFIG_DEFAULT_FDT_FILE, if set, and default to the values it currently uses.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Maxime

(ping)

(ping again)

Can we get this patch merged?

#4 lore raw

PATCH 1/1 sunxi: allow CONFIG_DEFAULT_FDT_FILE override

Hi Martin,

Quoted 18 lines · Martin Kelly
Quoted 15 lines · Martin Kelly
Quoted 14 lines · Maxime Ripard
Quoted 10 lines · Martin Kelly

Currently, sunxi-common.h ignores CONFIG_DEFAULT_FDT_FILE and assumes the kernel fdtfile and the u-boot devicetree names are the same. Although this is typically the case, sometimes you might want to customize one of these differently, so it's useful to allow them to be different.

Add logic in sunxi-common.h to respect CONFIG_DEFAULT_FDT_FILE, if set, and default to the values it currently uses.

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

Maxime

(ping)

(ping again)

Can we get this patch merged?

The else branch will never be selected. CONFIG_DEFAULT_FDT_FILE will be set to “” if not set by your defconfig.

#5 lore raw

PATCH 1/1 sunxi: allow CONFIG_DEFAULT_FDT_FILE override

Quoted 22 lines · klaus.goger at theobroma-systems.com

Hi Martin,

Quoted 20 lines · Martin Kelly
Quoted 17 lines · Martin Kelly
Quoted 16 lines · Maxime Ripard
Quoted 10 lines · Martin Kelly

Currently, sunxi-common.h ignores CONFIG_DEFAULT_FDT_FILE and assumes the kernel fdtfile and the u-boot devicetree names are the same. Although this is typically the case, sometimes you might want to customize one of these differently, so it's useful to allow them to be different.

Add logic in sunxi-common.h to respect CONFIG_DEFAULT_FDT_FILE, if set, and default to the values it currently uses.

Maxime

Quoted 9 lines
Quoted 5 lines
Quoted 1 line

(ping)

(ping again)

Can we get this patch merged?

The else branch will never be selected. CONFIG_DEFAULT_FDT_FILE will be set to “” if not set by your defconfig.

Thanks for noticing this; unfortunately you are right. I thought I tested this, but it was in the context of a larger build and I missed it.

It looks like we have two options:

(a) Test for empty string in preprocessor language. This is quite ugly and has some gotchas but should be doable (e.g.
https://stackoverflow.com/questions/3781520/how-to-test-if-preprocessor-symbol-is-defined-but-has-no-value).

(b) Always use the value of CONFIG_DEFAULT_FDT_FILE and stop using CONFIG_DEFAULT_DEVICE_TREE as a default. In each board file, explicitly set CONFIG_DEFAULT_FDT_FILE to its current default. This is what other boards are doing.

I favor (b). If others are in favor, I'll submit a patch for it.

#6 lore raw

PATCH 1/1 sunxi: allow CONFIG_DEFAULT_FDT_FILE override

Quoted 36 lines · Martin Kelly
Quoted 21 lines · klaus.goger at theobroma-systems.com

Hi Martin,

Quoted 20 lines · Martin Kelly
Quoted 17 lines · Martin Kelly
Quoted 16 lines · Maxime Ripard
Quoted 10 lines · Martin Kelly

Currently, sunxi-common.h ignores CONFIG_DEFAULT_FDT_FILE and assumes the kernel fdtfile and the u-boot devicetree names are the same. Although this is typically the case, sometimes you might want to customize one of these differently, so it's useful to allow them to be different.

Add logic in sunxi-common.h to respect CONFIG_DEFAULT_FDT_FILE, if set, and default to the values it currently uses.

Maxime

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

(ping)

(ping again)

Can we get this patch merged?

The else branch will never be selected. CONFIG_DEFAULT_FDT_FILE will be set to “” if not set by your defconfig.

Thanks for noticing this; unfortunately you are right. I thought I tested this, but it was in the context of a larger build and I missed it.

Quoted 7 lines

It looks like we have two options:

(a) Test for empty string in preprocessor language. This is quite ugly and has some gotchas but should be doable (e.g. https://stackoverflow.com/questions/3781520/how-to-test-if-preprocessor-symbol-is-defined-but-has-no-value).

(b) Always use the value of CONFIG_DEFAULT_FDT_FILE and stop using CONFIG_DEFAULT_DEVICE_TREE as a default. In each board file, explicitly set CONFIG_DEFAULT_FDT_FILE to its current default. This is what other boards are doing.

I favor (b). If others are in favor, I'll submit a patch for it.

I run into the same issue for the rockchip architecture[1]. After giving up on finding a rock-solid solution for detecting the emtpy string I decided to go with your option (b). Another solution would be to hide CONFIG_DEFAULT_DEVICE_TREE behind a Kconfig bool so it would not be defined until something like CONFIG_FDT_FILE is selected. But in favour of having U-Boot devicetree decoupled from any OS fdt I still prefer option (b).

[1] https://patchwork.ozlabs.org/patch/920785/

#7 lore raw

PATCH 1/1 sunxi: allow CONFIG_DEFAULT_FDT_FILE override

Quoted 44 lines · klaus.goger at theobroma-systems.com
Quoted 36 lines · Martin Kelly
Quoted 21 lines · klaus.goger at theobroma-systems.com

Hi Martin,

Quoted 20 lines · Martin Kelly
Quoted 17 lines · Martin Kelly
Quoted 16 lines · Maxime Ripard
Quoted 10 lines · Martin Kelly

Currently, sunxi-common.h ignores CONFIG_DEFAULT_FDT_FILE and assumes the kernel fdtfile and the u-boot devicetree names are the same. Although this is typically the case, sometimes you might want to customize one of these differently, so it's useful to allow them to be different.

Add logic in sunxi-common.h to respect CONFIG_DEFAULT_FDT_FILE, if set, and default to the values it currently uses.

Maxime

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

(ping)

(ping again)

Can we get this patch merged?

The else branch will never be selected. CONFIG_DEFAULT_FDT_FILE will be set to “” if not set by your defconfig.

Thanks for noticing this; unfortunately you are right. I thought I tested this, but it was in the context of a larger build and I missed it.

Quoted 7 lines

It looks like we have two options:

(a) Test for empty string in preprocessor language. This is quite ugly and has some gotchas but should be doable (e.g. https://stackoverflow.com/questions/3781520/how-to-test-if-preprocessor-symbol-is-defined-but-has-no-value).

(b) Always use the value of CONFIG_DEFAULT_FDT_FILE and stop using CONFIG_DEFAULT_DEVICE_TREE as a default. In each board file, explicitly set CONFIG_DEFAULT_FDT_FILE to its current default. This is what other boards are doing.

I favor (b). If others are in favor, I'll submit a patch for it.

Quoted 10 lines

I run into the same issue for the rockchip architecture[1]. After giving up on finding a rock-solid solution for detecting the emtpy string I decided to go with your option (b). Another solution would be to hide CONFIG_DEFAULT_DEVICE_TREE behind a Kconfig bool so it would not be defined until something like CONFIG_FDT_FILE is selected. But in favour of having U-Boot devicetree decoupled from any OS fdt I still prefer option (b).

[1] https://patchwork.ozlabs.org/patch/920785/

Thanks, I'll go ahead with that solution and issue a follow-up patch.

Jagan, should I make the patch against this one, or against master?

#8 lore raw

PATCH 1/1 sunxi: allow CONFIG_DEFAULT_FDT_FILE override

Quoted 2 lines · Martin Kelly
Quoted 1 line · klaus.goger at theobroma-systems.com

[snip]

Quoted 13 lines
Quoted 13 lines

I run into the same issue for the rockchip architecture[1]. After giving up on finding a
rock-solid solution for detecting the emtpy string I decided to go with your option (b).
Another solution would be to hide CONFIG_DEFAULT_DEVICE_TREE behind a Kconfig bool so it would not be defined until something like CONFIG_FDT_FILE is
selected. But in favour of having U-Boot devicetree decoupled from any OS fdt I
still prefer option (b).

Quoted 7 lines
Quoted 3 lines

[1] https://patchwork.ozlabs.org/patch/920785/

Thanks, I'll go ahead with that solution and issue a follow-up patch.

Jagan, should I make the patch against this one, or against master?

on master

#9 lore raw

PATCH 1/1 sunxi: allow CONFIG_DEFAULT_FDT_FILE override

In reply to Maxime Ripard
Quoted 7 lines · Maxime Ripard
Quoted 6 lines · Martin Kelly

Currently, sunxi-common.h ignores CONFIG_DEFAULT_FDT_FILE and assumes the kernel fdtfile and the u-boot devicetree names are the same. Although this is typically the case, sometimes you might want to customize one of these differently, so it's useful to allow them to be different.

Quoted 6 lines
Quoted 4 lines

Add logic in sunxi-common.h to respect CONFIG_DEFAULT_FDT_FILE, if set, and default to the values it currently uses.

Applied to u-boot-sunxi/master

#10 lore raw

PATCH 1/1 sunxi: allow CONFIG_DEFAULT_FDT_FILE override

Quoted 9 lines · Jagan Teki
Quoted 7 lines · Maxime Ripard
Quoted 6 lines · Martin Kelly

Currently, sunxi-common.h ignores CONFIG_DEFAULT_FDT_FILE and assumes the kernel fdtfile and the u-boot devicetree names are the same. Although this is typically the case, sometimes you might want to customize one of these differently, so it's useful to allow them to be different.

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

Add logic in sunxi-common.h to respect CONFIG_DEFAULT_FDT_FILE, if set, and default to the values it currently uses.

Applied to u-boot-sunxi/master

Thanks!