From 2a792753d6a1fe8f2310928ebd5534e4d87a8030 Mon Sep 17 00:00:00 2001 From: mario.six@gdsys.cc Date: Wed, 22 Feb 2017 16:07:22 +0100 Subject: dm: Add callback to modify the device tree Certain boards come in different variations by way of utilizing daughter boards, for example. These boards might contain additional chips, which are added to the main board's busses, e.g. I2C. The device tree support for such boards would either, quite naturally, employ the overlay mechanism to add such chips to the tree, or would use one large default device tree, and delete the devices that are actually not present. Regardless of approach, even on the U-Boot level, a modification of the device tree is a prerequisite to have such modular families of boards supported properly. Therefore, we add an option to make the U-Boot device tree (the actual copy later used by the driver model) writeable, and add a callback method that allows boards to modify the device tree at an early stage, at which, hopefully, also the application of device tree overlays will be possible. Signed-off-by: Mario Six Reviewed-by: Simon Glass Signed-off-by: Stefan Roese --- common/board_f.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'common/board_f.c') diff --git a/common/board_f.c b/common/board_f.c index 7d1ede0404d..bb24a633fb7 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -751,6 +751,13 @@ static int setup_reloc(void) return 0; } +#ifdef CONFIG_OF_BOARD_FIXUP +static int fix_fdt(void) +{ + return board_fix_fdt((void *)gd->fdt_blob); +} +#endif + /* ARM calls relocate_code from its crt0.S */ #if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX) && \ !CONFIG_IS_ENABLED(X86_64) @@ -1011,6 +1018,9 @@ static const init_fnc_t init_sequence_f[] = { display_new_sp, #ifdef CONFIG_SYS_EXTBDINFO setup_board_extra, +#endif +#ifdef CONFIG_OF_BOARD_FIXUP + fix_fdt, #endif INIT_FUNC_WATCHDOG_RESET reloc_fdt, -- cgit v1.2.3