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

Signed-off-by: Jean-Jacques Hiblot <jjhib...@ti.com>

---

Changes in v2:
- reworked board_fit_get_additionnal_images() and how it used in spl_fit.c
- removed dtbo generation from dtso files and use .dts extension for the
  overlays
- add dynamic allocation usage in a separate patch
- defconfig change for the am335x_evm

 arch/arm/dts/Makefile             |  2 +-
 arch/arm/dts/dra76-evm-dummy.dts  | 14 +++++++++
 arch/arm/dts/dra76-evm-dummy2.dts | 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.dts
 create mode 100644 arch/arm/dts/dra76-evm-dummy2.dts
 create mode 100644 board/ti/dra7xx/evm.its

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 0e2ffdb87f..65bb6396c5 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -276,7 +276,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.dts b/arch/arm/dts/dra76-evm-dummy.dts
new file mode 100644
index 0000000000..6b55670281
--- /dev/null
+++ b/arch/arm/dts/dra76-evm-dummy.dts
@@ -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.dts 
b/arch/arm/dts/dra76-evm-dummy2.dts
new file mode 100644
index 0000000000..0f0411164c
--- /dev/null
+++ b/arch/arm/dts/dra76-evm-dummy2.dts
@@ -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 060c471032..a5e4867206 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -704,6 +704,14 @@ int board_late_init(void)
        if (device_okay("/ocp/omap_dwc3_2@488c0000"))
                enable_usb_clocks(1);
 #endif
+       char preboot_cmd[255];
+
+       sprintf(preboot_cmd, "fdt addr %p;\
+               fdt print /ocp/mmc@480b4000/dummy_node;\
+               fdt print /ocp/mmc@4809c000/dummy_node;",
+               gd->fdt_blob);
+
+       env_set("preboot", preboot_cmd);
        return 0;
 }
 
@@ -1069,6 +1077,28 @@ int ft_board_setup(void *blob, bd_t *bd)
 #endif
 
 #ifdef CONFIG_SPL_LOAD_FIT
+#define MAX_DAUGHTER_BOARDS 2
+const bool detected[MAX_DAUGHTER_BOARDS] = {false, true};
+const char *dtbo_nodes[] = {"dra76-evm-dummy", "dra76-evm-dummy2"};
+
+const char *board_fit_get_additionnal_images(int index, const char *type)
+{
+       int i, j;
+
+       if (strcmp(type, FIT_FDT_PROP))
+               return NULL;
+
+       j = 0;
+       for (i = 0; i < MAX_DAUGHTER_BOARDS; i++) {
+               if (detected[i]) {
+                       if (j == index)
+                               return dtbo_nodes[i];
+                       j++;
+               }
+       }
+       return NULL;
+}
+
 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..9f6d14cf9c
--- /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 {
+                       description = "dra76-evm dummy overlay 1";
+                       data = /incbin/("arch/arm/dts/dra76-evm-dummy.dtbo");
+               };
+
+               dra76-evm-dummy2 {
+                       description = "dra76-evm dummy overlay 2";
+                       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 3f25a2ec28..f44a673acd 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

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to