summaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
Diffstat (limited to 'boot')
-rw-r--r--boot/Kconfig10
-rw-r--r--boot/image-fdt.c27
2 files changed, 23 insertions, 14 deletions
diff --git a/boot/Kconfig b/boot/Kconfig
index a671d78e570..2ff6f003738 100644
--- a/boot/Kconfig
+++ b/boot/Kconfig
@@ -1850,6 +1850,16 @@ config OF_BOARD_SETUP
board-specific information in the device tree for use by the OS.
The device tree is then passed to the OS.
+config OF_BOARD_SETUP_EXTENDED
+ bool "Set up latest board-specific details in device tree before boot"
+ imply OF_BOARD_SETUP
+ help
+ This causes U-Boot to call ft_board_setup_ex() before booting into
+ the Operating System. Similar function as ft_board_setup(). However,
+ its modifications are not overwritten by other system changes and are
+ applied to the device tree as the very last step before boot.
+ The device tree is then passed to the OS.
+
config OF_SYSTEM_SETUP
bool "Set up system-specific details in device tree before boot"
help
diff --git a/boot/image-fdt.c b/boot/image-fdt.c
index 97b6385ab7c..3f0ac54f76f 100644
--- a/boot/image-fdt.c
+++ b/boot/image-fdt.c
@@ -587,6 +587,7 @@ int image_setup_libfdt(struct bootm_headers *images, void *blob, bool lmb)
{
ulong *initrd_start = &images->initrd_start;
ulong *initrd_end = &images->initrd_end;
+ bool skip_board_fixup = false;
int ret, fdt_ret, of_size;
if (IS_ENABLED(CONFIG_OF_ENV_SETUP)) {
@@ -637,18 +638,18 @@ int image_setup_libfdt(struct bootm_headers *images, void *blob, bool lmb)
fdt_fixup_pstore(blob);
#endif
if (IS_ENABLED(CONFIG_OF_BOARD_SETUP)) {
- const char *skip_board_fixup;
+ skip_board_fixup = (env_get_ulong("skip_board_fixup", 10, 0) == 1);
- skip_board_fixup = env_get("skip_board_fixup");
- if (skip_board_fixup && ((int)simple_strtol(skip_board_fixup, NULL, 10) == 1)) {
- printf("skip board fdt fixup\n");
- } else {
- fdt_ret = ft_board_setup(blob, gd->bd);
- if (fdt_ret) {
- printf("ERROR: board-specific fdt fixup failed: %s\n",
- fdt_strerror(fdt_ret));
- goto err;
- }
+ if (skip_board_fixup)
+ printf("skip all board fdt fixup\n");
+ }
+
+ if (IS_ENABLED(CONFIG_OF_BOARD_SETUP) && !skip_board_fixup) {
+ fdt_ret = ft_board_setup(blob, gd->bd);
+ if (fdt_ret) {
+ printf("ERROR: board-specific fdt fixup failed: %s\n",
+ fdt_strerror(fdt_ret));
+ goto err;
}
}
if (IS_ENABLED(CONFIG_OF_SYSTEM_SETUP)) {
@@ -710,10 +711,8 @@ int image_setup_libfdt(struct bootm_headers *images, void *blob, bool lmb)
}
}
-#if defined(CONFIG_ARCH_KEYSTONE)
- if (IS_ENABLED(CONFIG_OF_BOARD_SETUP))
+ if (IS_ENABLED(CONFIG_OF_BOARD_SETUP_EXTENDED) && !skip_board_fixup)
ft_board_setup_ex(blob, gd->bd);
-#endif
return 0;
err: