[U-Boot] [RFC PATCH v1 9/9] !!! TEMP !!! For demonstration only !!! DRA76: Usage of overlays in SPL

Jean-Jacques Hiblot jjhiblot at ti.com
Fri Mar 22 14:39:56 UTC 2019


This is an example of how to apply overlays in SPL for the DRA76

Signed-off-by: Jean-Jacques Hiblot <jjhiblot at ti.com>


---

 arch/arm/dts/Makefile              |  2 +-
 arch/arm/dts/dra76-evm-dummy.dtso  | 14 +++++++++
 arch/arm/dts/dra76-evm-dummy2.dtso | 15 ++++++++++
 board/ti/dra7xx/evm.c              | 30 +++++++++++++++++++
 board/ti/dra7xx/evm.its            | 48 ++++++++++++++++++++++++++++++
 configs/dra7xx_evm_defconfig       |  2 ++
 6 files changed, 110 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/dra76-evm-dummy.dtso
 create mode 100644 arch/arm/dts/dra76-evm-dummy2.dtso
 create mode 100644 board/ti/dra7xx/evm.its

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 2a040b20a5..a6e29ebfd4 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -228,7 +228,7 @@ dtb-$(CONFIG_ARCH_SOCFPGA) +=				\
 	socfpga_stratix10_socdk.dtb
 
 dtb-$(CONFIG_TARGET_DRA7XX_EVM) += dra72-evm.dtb dra7-evm.dtb	\
-	dra72-evm-revc.dtb dra71-evm.dtb dra76-evm.dtb
+	dra72-evm-revc.dtb dra71-evm.dtb dra76-evm.dtb dra76-evm-dummy.dtbo dra76-evm-dummy2.dtbo
 dtb-$(CONFIG_TARGET_AM57XX_EVM) += am57xx-beagle-x15.dtb \
 	am57xx-beagle-x15-revb1.dtb \
 	am57xx-beagle-x15-revc.dtb \
diff --git a/arch/arm/dts/dra76-evm-dummy.dtso b/arch/arm/dts/dra76-evm-dummy.dtso
new file mode 100644
index 0000000000..6b55670281
--- /dev/null
+++ b/arch/arm/dts/dra76-evm-dummy.dtso
@@ -0,0 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
+ */
+
+/dts-v1/;
+/plugin/;
+
+
+&mmc1 {
+	dummy_node {
+		dummy_val = "this is only in overlay 1";
+	};
+};
diff --git a/arch/arm/dts/dra76-evm-dummy2.dtso b/arch/arm/dts/dra76-evm-dummy2.dtso
new file mode 100644
index 0000000000..0f0411164c
--- /dev/null
+++ b/arch/arm/dts/dra76-evm-dummy2.dtso
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
+ */
+
+/dts-v1/;
+/plugin/;
+
+
+&mmc2 {
+	dummy_node {
+		dummy_val = "this is only in overlay 2";
+	};
+
+};
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index d69641e3a0..f560159bce 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -704,6 +704,13 @@ int board_late_init(void)
 	if (device_okay("/ocp/omap_dwc3_2 at 488c0000"))
 		enable_usb_clocks(1);
 #endif
+	char preboot_cmd[255];
+	sprintf(preboot_cmd, "fdt addr %p;\
+		fdt print /ocp/mmc at 480b4000/dummy_node;\
+		fdt print /ocp/mmc at 4809c000/dummy_node;",
+		gd->fdt_blob);
+
+	env_set("preboot", preboot_cmd);
 	return 0;
 }
 
@@ -1069,6 +1076,29 @@ int ft_board_setup(void *blob, bd_t *bd)
 #endif
 
 #ifdef CONFIG_SPL_LOAD_FIT
+bool use_dummy_2 = true;
+bool use_dummy = false;
+
+int board_fit_get_additionnal_images(int index, const char *type, const char **name)
+{
+	const char *dtbo = NULL;
+
+	if (strcmp(type, FIT_FDT_PROP))
+		return -ENOENT;
+
+	if (index > 2)
+		return -ENOENT;
+
+	if (index == 1 && use_dummy_2)
+		dtbo = "dra76-evm-dummy2.dtbo";
+	else if (index == 2 && use_dummy)
+		dtbo = "dra76-evm-dummy.dtbo";
+
+	*name = dtbo;
+
+	return 0;
+}
+
 int board_fit_config_name_match(const char *name)
 {
 	if (is_dra72x()) {
diff --git a/board/ti/dra7xx/evm.its b/board/ti/dra7xx/evm.its
new file mode 100644
index 0000000000..d0fc0d46eb
--- /dev/null
+++ b/board/ti/dra7xx/evm.its
@@ -0,0 +1,48 @@
+/dts-v1/;
+
+/ {
+	description = "Firmware image with one or more FDT blobs";
+	#address-cells = <0x1>;
+
+	images {
+
+		firmware-1 {
+			description = "U-Boot 2019.01 for DRA76 board";
+                        type = "firmware";
+                        arch = "arm";
+                        os = "u-boot";
+                        compression = "none";
+                        load = <0x80800000>;
+                        entry = <0x0>;
+			data = /incbin/("u-boot-nodtb.bin");
+
+		};
+
+		fdt-1 {
+			description = "dra76-evm";
+			type = "fdt";
+			data = /incbin/("arch/arm/dts/dra76-evm.dtb");
+		};
+
+		dra76-evm-dummy.dtbo {
+			description = "dra76-evm-dummy.dtbo";
+			data = /incbin/("arch/arm/dts/dra76-evm-dummy.dtbo");
+		};
+
+		dra76-evm-dummy2.dtbo {
+			description = "dra76-evm-dummy2.dtbo";
+			data = /incbin/("arch/arm/dts/dra76-evm-dummy2.dtbo");
+		};
+	};
+
+	configurations {
+		default = "dra76-evm";
+
+                dra76-evm {
+                        description = "dra76-evm";
+                        firmware = "firmware-1";
+                        fdt = "fdt-1";
+                };
+
+	};
+};
diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig
index ef061501ef..f9d296ea2d 100644
--- a/configs/dra7xx_evm_defconfig
+++ b/configs/dra7xx_evm_defconfig
@@ -12,10 +12,12 @@ CONFIG_AHCI=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_SPL_LOAD_FIT=y
+CONFIG_SPL_FIT_SOURCE="board/ti/dra7xx/evm.its"
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="androidboot.serialno=${serial#} console=ttyS0,115200 androidboot.console=ttyS0 androidboot.hardware=jacinto6evmboard"
 # CONFIG_USE_BOOTCOMMAND is not set
+CONFIG_USE_PREBOOT=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 # CONFIG_MISC_INIT_R is not set
 CONFIG_VERSION_VARIABLE=y
-- 
2.17.1



More information about the U-Boot mailing list