mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-02 09:46:37 +03:00
boot: Make ft_board_setup_ex() generic
In some use cases, board-specific device tree changes must not be overwritten by system fixups. Although U-Boot provides ft_board_setup_ex() for this purpose, it is currently only used on TI Keystone. Make ft_board_setup_ex() to be a generic option, allowing its use by other architectures/boards. To maintain backward compatibility, enable it by default on TI Keystone. Signed-off-by: João Paulo Gonçalves <joao.goncalves@toradex.com>
This commit is contained in:
committed by
Tom Rini
parent
dbf7fd557a
commit
2b7c6b6f3c
@@ -810,6 +810,7 @@ config ARCH_KEYSTONE
|
|||||||
imply CMD_SAVES
|
imply CMD_SAVES
|
||||||
imply DM_I2C
|
imply DM_I2C
|
||||||
imply FIT
|
imply FIT
|
||||||
|
imply OF_BOARD_SETUP_EXTENDED
|
||||||
imply SOC_TI
|
imply SOC_TI
|
||||||
imply TI_KEYSTONE_SERDES
|
imply TI_KEYSTONE_SERDES
|
||||||
|
|
||||||
|
|||||||
10
boot/Kconfig
10
boot/Kconfig
@@ -1839,6 +1839,16 @@ config OF_BOARD_SETUP
|
|||||||
board-specific information in the device tree for use by the OS.
|
board-specific information in the device tree for use by the OS.
|
||||||
The device tree is then passed to 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
|
config OF_SYSTEM_SETUP
|
||||||
bool "Set up system-specific details in device tree before boot"
|
bool "Set up system-specific details in device tree before boot"
|
||||||
help
|
help
|
||||||
|
|||||||
@@ -571,6 +571,7 @@ int image_setup_libfdt(struct bootm_headers *images, void *blob, bool lmb)
|
|||||||
{
|
{
|
||||||
ulong *initrd_start = &images->initrd_start;
|
ulong *initrd_start = &images->initrd_start;
|
||||||
ulong *initrd_end = &images->initrd_end;
|
ulong *initrd_end = &images->initrd_end;
|
||||||
|
bool skip_board_fixup = false;
|
||||||
int ret, fdt_ret, of_size;
|
int ret, fdt_ret, of_size;
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_OF_ENV_SETUP)) {
|
if (IS_ENABLED(CONFIG_OF_ENV_SETUP)) {
|
||||||
@@ -621,18 +622,18 @@ int image_setup_libfdt(struct bootm_headers *images, void *blob, bool lmb)
|
|||||||
fdt_fixup_pstore(blob);
|
fdt_fixup_pstore(blob);
|
||||||
#endif
|
#endif
|
||||||
if (IS_ENABLED(CONFIG_OF_BOARD_SETUP)) {
|
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)
|
||||||
if (skip_board_fixup && ((int)simple_strtol(skip_board_fixup, NULL, 10) == 1)) {
|
printf("skip all board fdt fixup\n");
|
||||||
printf("skip board fdt fixup\n");
|
}
|
||||||
} else {
|
|
||||||
fdt_ret = ft_board_setup(blob, gd->bd);
|
if (IS_ENABLED(CONFIG_OF_BOARD_SETUP) && !skip_board_fixup) {
|
||||||
if (fdt_ret) {
|
fdt_ret = ft_board_setup(blob, gd->bd);
|
||||||
printf("ERROR: board-specific fdt fixup failed: %s\n",
|
if (fdt_ret) {
|
||||||
fdt_strerror(fdt_ret));
|
printf("ERROR: board-specific fdt fixup failed: %s\n",
|
||||||
goto err;
|
fdt_strerror(fdt_ret));
|
||||||
}
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (IS_ENABLED(CONFIG_OF_SYSTEM_SETUP)) {
|
if (IS_ENABLED(CONFIG_OF_SYSTEM_SETUP)) {
|
||||||
@@ -685,10 +686,8 @@ int image_setup_libfdt(struct bootm_headers *images, void *blob, bool lmb)
|
|||||||
if (CONFIG_IS_ENABLED(LMB) && lmb)
|
if (CONFIG_IS_ENABLED(LMB) && lmb)
|
||||||
lmb_reserve(map_to_sysmem(blob), of_size, LMB_NONE);
|
lmb_reserve(map_to_sysmem(blob), of_size, LMB_NONE);
|
||||||
|
|
||||||
#if defined(CONFIG_ARCH_KEYSTONE)
|
if (IS_ENABLED(CONFIG_OF_BOARD_SETUP_EXTENDED) && !skip_board_fixup)
|
||||||
if (IS_ENABLED(CONFIG_OF_BOARD_SETUP))
|
|
||||||
ft_board_setup_ex(blob, gd->bd);
|
ft_board_setup_ex(blob, gd->bd);
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
err:
|
err:
|
||||||
|
|||||||
@@ -691,9 +691,9 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
|||||||
fdt_strerror(err));
|
fdt_strerror(err));
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_ARCH_KEYSTONE
|
|
||||||
ft_board_setup_ex(working_fdt, gd->bd);
|
if (IS_ENABLED(CONFIG_OF_BOARD_SETUP_EXTENDED))
|
||||||
#endif
|
ft_board_setup_ex(working_fdt, gd->bd);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Create a chosen node */
|
/* Create a chosen node */
|
||||||
|
|||||||
@@ -240,11 +240,16 @@ int board_rng_seed(struct abuf *buf);
|
|||||||
*/
|
*/
|
||||||
const char *board_fdt_chosen_bootargs(const struct fdt_property *fdt_ba);
|
const char *board_fdt_chosen_bootargs(const struct fdt_property *fdt_ba);
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* The keystone2 SOC requires all 32 bit aliased addresses to be converted
|
* ft_board_setup_ex() - Latest board-specific FDT changes
|
||||||
* to their 36 physical format. This has to happen after all fdt nodes
|
*
|
||||||
* are added or modified by the image_setup_libfdt(). The ft_board_setup_ex()
|
* @blob: FDT blob to update
|
||||||
* called at the end of the image_setup_libfdt() is to do that convertion.
|
* @bd: Pointer to board data
|
||||||
|
*
|
||||||
|
* Execute board-specific device tree modifications that must be the latest FDT
|
||||||
|
* changes and cannot be overwritten by other system fixups.
|
||||||
|
*
|
||||||
|
* This function is called if CONFIG_OF_BOARD_SETUP_EXTENDED is defined.
|
||||||
*/
|
*/
|
||||||
void ft_board_setup_ex(void *blob, struct bd_info *bd);
|
void ft_board_setup_ex(void *blob, struct bd_info *bd);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user