tree is available in the global data as gd->fdt_blob.
U-Boot needs to get its device tree from somewhere. This can
- be done using one of the two options below:
+ be done using one of the three options below:
CONFIG_OF_EMBED
If this variable is defined, U-Boot will embed a device tree
still use the individual files if you need something more
exotic.
+ CONFIG_OF_BOARD
+ If this variable is defined, U-Boot will use the device tree
+ provided by the board at runtime instead of embedding one with
+ the image. Only boards defining board_fdt_blob_setup() support
+ this option (see include/fdtdec.h file).
+
- Watchdog:
CONFIG_WATCHDOG
If this variable is defined, it enables watchdog
return bcm2835_power_on_module(BCM2835_MBOX_POWER_DEVID_USB_HCD);
}
+/*
+ * If the firmware passed a device tree use it for U-Boot.
+ */
+void *board_fdt_blob_setup(void)
+{
+ if (fdt_magic(fw_dtb_pointer) != FDT_MAGIC)
+ return NULL;
+ return (void *)fw_dtb_pointer;
+}
+
int ft_board_setup(void *blob, bd_t *bd)
{
/*
CONFIG_SPL_FRAMEWORK, then u-boot.img will be built to include the device
tree binary.
+If CONFIG_OF_BOARD is defined, a board-specific routine will provide the
+device tree at runtime, for example if an earlier bootloader stage creates
+it and passes it to U-Boot.
+
If CONFIG_OF_HOSTFILE is defined, then it will be read from a file on
startup. This is only useful for sandbox. Use the -d flag to U-Boot to
specify the file to read.
and development only and is not recommended for production devices.
Boards in the mainline U-Boot tree should not use it.
+config OF_BOARD
+ bool "Provided by the board at runtime"
+ depends on !SANDBOX
+ help
+ If this option is enabled, the device tree will be provided by
+ the board at runtime if the board supports it, instead of being
+ bundled with the image.
+
config OF_HOSTFILE
bool "Host filed DTB for DT control"
depends on SANDBOX
*/
int fdtdec_setup(void);
+/**
+ * Board-specific FDT initialization. Returns the address to a device tree blob.
+ * Called when CONFIG_OF_BOARD is defined.
+ */
+void *board_fdt_blob_setup(void);
+
#endif
/* FDT is at end of image */
gd->fdt_blob = (ulong *)&_end;
# endif
+# elif defined(CONFIG_OF_BOARD)
+ /* Allow the board to override the fdt address. */
+ gd->fdt_blob = board_fdt_blob_setup();
# elif defined(CONFIG_OF_HOSTFILE)
if (sandbox_read_fdt_from_file()) {
puts("Failed to read control FDT\n");