mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 21:54:01 +00:00
fdt: Add ft_system_setup() function for system device tree additions
Add an additional function for adding information to the device tree before booting. This permits additions which are not board-specific. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Anatolij Gustschin <agust@denx.de> Reviewed-by: Tom Rini <trini@ti.com>
This commit is contained in:
parent
6f4dbc21e4
commit
c654b5172a
5 changed files with 48 additions and 1 deletions
7
README
7
README
|
@ -669,6 +669,13 @@ The following options need to be configured:
|
||||||
Board code has addition modification that it wants to make
|
Board code has addition modification that it wants to make
|
||||||
to the flat device tree before handing it off to the kernel
|
to the flat device tree before handing it off to the kernel
|
||||||
|
|
||||||
|
CONFIG_OF_SYSTEM_SETUP
|
||||||
|
|
||||||
|
Other code has addition modification that it wants to make
|
||||||
|
to the flat device tree before handing it off to the kernel.
|
||||||
|
This causes ft_system_setup() to be called before booting
|
||||||
|
the kernel.
|
||||||
|
|
||||||
CONFIG_OF_BOOT_CPU
|
CONFIG_OF_BOOT_CPU
|
||||||
|
|
||||||
This define fills in the correct boot CPU in the boot
|
This define fills in the correct boot CPU in the boot
|
||||||
|
|
|
@ -575,6 +575,18 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_OF_SYSTEM_SETUP
|
||||||
|
/* Call the board-specific fixup routine */
|
||||||
|
else if (strncmp(argv[1], "sys", 3) == 0) {
|
||||||
|
int err = ft_system_setup(working_fdt, gd->bd);
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
printf("Failed to add system information to FDT: %s\n",
|
||||||
|
fdt_strerror(err));
|
||||||
|
return CMD_RET_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Create a chosen node */
|
/* Create a chosen node */
|
||||||
else if (strncmp(argv[1], "cho", 3) == 0) {
|
else if (strncmp(argv[1], "cho", 3) == 0) {
|
||||||
|
@ -1014,6 +1026,9 @@ static char fdt_help_text[] =
|
||||||
"addr [-c] <addr> [<length>] - Set the [control] fdt location to <addr>\n"
|
"addr [-c] <addr> [<length>] - Set the [control] fdt location to <addr>\n"
|
||||||
#ifdef CONFIG_OF_BOARD_SETUP
|
#ifdef CONFIG_OF_BOARD_SETUP
|
||||||
"fdt boardsetup - Do board-specific set up\n"
|
"fdt boardsetup - Do board-specific set up\n"
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_OF_SYSTEM_SETUP
|
||||||
|
"fdt systemsetup - Do system-specific set up\n"
|
||||||
#endif
|
#endif
|
||||||
"fdt move <fdt> <newaddr> <length> - Copy the fdt to <addr> and make it active\n"
|
"fdt move <fdt> <newaddr> <length> - Copy the fdt to <addr> and make it active\n"
|
||||||
"fdt resize - Resize fdt to size + padding to 4k addr\n"
|
"fdt resize - Resize fdt to size + padding to 4k addr\n"
|
||||||
|
|
|
@ -479,6 +479,13 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (IMAGE_OF_SYSTEM_SETUP) {
|
||||||
|
if (ft_system_setup(blob, gd->bd)) {
|
||||||
|
printf("ERROR: system-specific fdt fixup failed: %s\n",
|
||||||
|
fdt_strerror(fdt_ret));
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
}
|
||||||
fdt_fixup_ethernet(blob);
|
fdt_fixup_ethernet(blob);
|
||||||
|
|
||||||
/* Delete the old LMB reservation */
|
/* Delete the old LMB reservation */
|
||||||
|
|
|
@ -88,6 +88,18 @@ void ft_board_setup_ex(void *blob, bd_t *bd);
|
||||||
void ft_cpu_setup(void *blob, bd_t *bd);
|
void ft_cpu_setup(void *blob, bd_t *bd);
|
||||||
void ft_pci_setup(void *blob, bd_t *bd);
|
void ft_pci_setup(void *blob, bd_t *bd);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add system-specific data to the FDT before booting the OS.
|
||||||
|
*
|
||||||
|
* Use CONFIG_SYS_FDT_PAD to ensure there is sufficient space.
|
||||||
|
* This function is called if CONFIG_OF_SYSTEM_SETUP is defined
|
||||||
|
*
|
||||||
|
* @param blob FDT blob to update
|
||||||
|
* @param bd_t Pointer to board data
|
||||||
|
* @return 0 if ok, or -FDT_ERR_... on error
|
||||||
|
*/
|
||||||
|
int ft_system_setup(void *blob, bd_t *bd);
|
||||||
|
|
||||||
void set_working_fdt_addr(void *addr);
|
void set_working_fdt_addr(void *addr);
|
||||||
int fdt_shrink_to_minimum(void *blob);
|
int fdt_shrink_to_minimum(void *blob);
|
||||||
int fdt_increase_size(void *fdt, int add_len);
|
int fdt_increase_size(void *fdt, int add_len);
|
||||||
|
|
|
@ -119,6 +119,12 @@ struct lmb;
|
||||||
# define IMAGE_OF_BOARD_SETUP 0
|
# define IMAGE_OF_BOARD_SETUP 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_OF_SYSTEM_SETUP
|
||||||
|
# define IMAGE_OF_SYSTEM_SETUP 1
|
||||||
|
#else
|
||||||
|
# define IMAGE_OF_SYSTEM_SETUP 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Operating System Codes
|
* Operating System Codes
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue