]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ARM: dts: stm32: Generate u-boot.itb using binman on DH STM32 DHSOM
authorMarek Vasut <marex@denx.de>
Sat, 5 Oct 2024 01:15:50 +0000 (03:15 +0200)
committerPatrick Delaunay <patrick.delaunay@foss.st.com>
Wed, 16 Oct 2024 18:12:35 +0000 (20:12 +0200)
Describe the u-boot.its generation in stm32mp15xx-dhsom-u-boot.dtsi
binman {} DT node as a replacement for current CONFIG_SPL_FIT_SOURCE
use, dispose of both u-boot-dhcom.its and u-boot-dhcor.its.

Use fdt-SEQ/config-SEQ to generate a list of fdt-N fitImage images {} and
matching configuration {} node entries. The configuration node entry names
no longer encode _somrevN_boardrevN suffix, which was never really used, so
drop this functionality by default. Rework board_fit_config_name_match() to
match on the new configuration node entry names.

Users who do need the match on _somrevN_boardrevN can either replace the
fdt-SEQ/config-SEQ with fixed fdt-N/config-N nodes which each encode the
matching 'description = "NAME_somrevN_boardrevN"' to restore the old
behavior verbatim, or better use SPL DT overlays for U-Boot control DT
the same way e.g. i.MX8MP DHCOM does to support multiple SoM and board
variants.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi
arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi
arch/arm/dts/stm32mp15xx-dhsom-u-boot.dtsi [new file with mode: 0644]
board/dhelectronics/dh_stm32mp1/board.c
board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its [deleted file]
board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its [deleted file]
configs/stm32mp15_dhcom_basic_defconfig
configs/stm32mp15_dhcor_basic_defconfig

index d7b78cdcfa9294b821abdb43dc31250b4983c554..dd67e960a641c388ec6f465ad0890c0fe15ca997 100644 (file)
@@ -8,6 +8,7 @@
 #include "stm32mp15-ddr3-dhsom-2x1Gb-1066-binG.dtsi"
 #include "stm32mp15-ddr3-dhsom-2x2Gb-1066-binG.dtsi"
 #include "stm32mp15-ddr3-dhsom-2x4Gb-1066-binG.dtsi"
+#include "stm32mp15xx-dhsom-u-boot.dtsi"
 
 / {
        aliases {
index ba84db679e150cc5d4f79b0244c1a705cc049956..08439342cb28e706690f81e150b0ae53cba4d268 100644 (file)
@@ -12,6 +12,7 @@
 #include "stm32mp15-ddr3-dhsom-2x1Gb-1066-binG.dtsi"
 #include "stm32mp15-ddr3-dhsom-2x2Gb-1066-binG.dtsi"
 #include "stm32mp15-ddr3-dhsom-2x4Gb-1066-binG.dtsi"
+#include "stm32mp15xx-dhsom-u-boot.dtsi"
 
 / {
        bootph-all;
diff --git a/arch/arm/dts/stm32mp15xx-dhsom-u-boot.dtsi b/arch/arm/dts/stm32mp15xx-dhsom-u-boot.dtsi
new file mode 100644 (file)
index 0000000..386c605
--- /dev/null
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+/*
+ * Copyright (C) 2024 Marek Vasut <marex@denx.de>
+ */
+
+&binman {
+        u-boot {
+               filename = "u-boot.itb";
+
+               fit {
+                       description = "U-Boot mainline";
+                       fit,fdt-list = "of-list";
+                       #address-cells = <1>;
+
+                       images {
+                               uboot {
+                                       arch = "arm";
+                                       compression = "none";
+                                       description = "U-Boot (32-bit)";
+                                       entry = <CONFIG_TEXT_BASE>;
+                                       load = <CONFIG_TEXT_BASE>;
+                                       type = "standalone";
+
+                                       uboot-blob {
+                                               filename = "u-boot-nodtb.bin";
+                                               type = "blob-ext";
+                                       };
+                               };
+
+                               @fdt-SEQ {
+                                       compression = "none";
+                                       description = "NAME";
+                                       type = "flat_dt";
+
+                                       uboot-fdt-blob {
+                                               filename = "u-boot.dtb";
+                                               type = "blob-ext";
+                                       };
+                               };
+                       };
+
+                       configurations {
+                               default = "@config-DEFAULT-SEQ";
+
+                               @config-SEQ {
+                                       description = "NAME";
+                                       fdt = "fdt-SEQ";
+                                       firmware = "uboot";
+                               };
+                       };
+               };
+       };
+};
index a975fd2978ce88c1e881551318aa10fb900c1dc0..d30171f1fbe5712edbcfa440008bd759a51b3d88 100644 (file)
@@ -276,15 +276,26 @@ int board_early_init_f(void)
 #ifdef CONFIG_SPL_LOAD_FIT
 int board_fit_config_name_match(const char *name)
 {
+       char *cdevice, *ndevice;
        const char *compat;
-       char test[128];
 
        compat = ofnode_get_property(ofnode_root(), "compatible", NULL);
+       if (!compat)
+               return -EINVAL;
+
+       cdevice = strchr(compat, ',');
+       if (!cdevice)
+               return -ENODEV;
+
+       cdevice++;      /* Move past the comma right after vendor prefix. */
+
+       ndevice = strchr(name, '/');
+       if (!ndevice)
+               return -ENODEV;
 
-       snprintf(test, sizeof(test), "%s_somrev%d_boardrev%d",
-               compat, somcode, brdcode);
+       ndevice++;      /* Move past the last slash in DT path */
 
-       if (!strcmp(name, test))
+       if (!strcmp(cdevice, ndevice))
                return 0;
 
        return -EINVAL;
diff --git a/board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its b/board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its
deleted file mode 100644 (file)
index 38ecb60..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/dts-v1/;
-
-/ {
-       description = "U-Boot mainline";
-       #address-cells = <1>;
-
-       images {
-               uboot {
-                       description = "U-Boot (32-bit)";
-                       data = /incbin/("u-boot-nodtb.bin");
-                       type = "standalone";
-                       os = "U-Boot";
-                       arch = "arm";
-                       compression = "none";
-                       load = <0xc0100000>;
-                       entry = <0xc0100000>;
-               };
-
-               fdt-1 {
-                       description = ".dtb";
-                       data = /incbin/("dts/upstream/src/arm/st/stm32mp157c-dhcom-pdk2.dtb");
-                       type = "flat_dt";
-                       arch = "arm";
-                       compression = "none";
-               };
-
-               fdt-2 {
-                       description = ".dtb";
-                       data = /incbin/("dts/upstream/src/arm/st/stm32mp153c-dhcom-drc02.dtb");
-                       type = "flat_dt";
-                       arch = "arm";
-                       compression = "none";
-               };
-
-               fdt-3 {
-                       description = ".dtb";
-                       data = /incbin/("dts/upstream/src/arm/st/stm32mp157c-dhcom-picoitx.dtb");
-                       type = "flat_dt";
-                       arch = "arm";
-                       compression = "none";
-               };
-       };
-
-       configurations {
-               default = "config-1";
-
-               config-1 {
-                       /* DT+SoM+board model */
-                       description = "dh,stm32mp157c-dhcom-pdk2_somrev0_boardrev0";
-                       firmware = "uboot";
-                       fdt = "fdt-1";
-               };
-
-               config-2 {
-                       /* DT+SoM+board model */
-                       description = "dh,stm32mp157c-dhcom-pdk2_somrev1_boardrev0";
-                       firmware = "uboot";
-                       fdt = "fdt-1";
-               };
-
-               config-3 {
-                       /* DT+SoM+board model */
-                       description = "dh,stm32mp153c-dhcom-drc02_somrev0_boardrev0";
-                       firmware = "uboot";
-                       fdt = "fdt-2";
-               };
-
-               config-4 {
-                       /* DT+SoM+board model */
-                       description = "dh,stm32mp153c-dhcom-drc02_somrev1_boardrev0";
-                       firmware = "uboot";
-                       fdt = "fdt-2";
-               };
-
-               config-5 {
-                       /* DT+SoM+board model */
-                       description = "dh,stm32mp157c-dhcom-picoitx_somrev0_boardrev0";
-                       loadables = "uboot";
-                       fdt = "fdt-3";
-               };
-
-               config-6 {
-                       /* DT+SoM+board model */
-                       description = "dh,stm32mp157c-dhcom-picoitx_somrev1_boardrev0";
-                       loadables = "uboot";
-                       fdt = "fdt-3";
-               };
-
-               /* Add 587-100..587-400 with fdt-2..fdt-4 here */
-       };
-};
diff --git a/board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its b/board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its
deleted file mode 100644 (file)
index e17dac7..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/dts-v1/;
-
-/ {
-       description = "U-Boot mainline";
-       #address-cells = <1>;
-
-       images {
-               uboot {
-                       description = "U-Boot (32-bit)";
-                       data = /incbin/("u-boot-nodtb.bin");
-                       type = "standalone";
-                       os = "U-Boot";
-                       arch = "arm";
-                       compression = "none";
-                       load = <0xc0100000>;
-                       entry = <0xc0100000>;
-               };
-
-               fdt-1 {
-                       description = ".dtb";
-                       data = /incbin/("dts/upstream/src/arm/st/stm32mp151a-dhcor-testbench.dtb");
-                       type = "flat_dt";
-                       arch = "arm";
-                       compression = "none";
-               };
-
-               fdt-2 {
-                       description = ".dtb";
-                       data = /incbin/("dts/upstream/src/arm/st/stm32mp157a-dhcor-avenger96.dtb");
-                       type = "flat_dt";
-                       arch = "arm";
-                       compression = "none";
-               };
-
-               fdt-3 {
-                       description = ".dtb";
-                       data = /incbin/("dts/upstream/src/arm/st/stm32mp153c-dhcor-drc-compact.dtb");
-                       type = "flat_dt";
-                       arch = "arm";
-                       compression = "none";
-               };
-       };
-
-       configurations {
-               default = "config-1";
-
-               config-1 {
-                       /* DT+SoM+board model */
-                       description = "dh,stm32mp151a-dhcor-testbench_somrev0_boardrev1";
-                       firmware = "uboot";
-                       fdt = "fdt-1";
-               };
-
-               config-2 {
-                       /* DT+SoM+board model */
-                       description = "arrow,stm32mp157a-avenger96_somrev0_boardrev1";
-                       firmware = "uboot";
-                       fdt = "fdt-2";
-               };
-
-               config-3 {
-                       /* DT+SoM+board model */
-                       description = "dh,stm32mp153c-dhcor-drc-compact_somrev0_boardrev0";
-                       firmware = "uboot";
-                       fdt = "fdt-3";
-               };
-
-               /* Add 586-200..586-400 with fdt-2..fdt-4 here */
-       };
-};
index c5a10e0f8dbf5f9725683450e78326360af1df08..a92c615d2506980224687f879f5769a8d073cb8a 100644 (file)
@@ -32,7 +32,6 @@ CONFIG_BOARD_SIZE_LIMIT=1441792
 CONFIG_FIT=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0xc1000000
-CONFIG_SPL_FIT_SOURCE="board/dhelectronics/dh_stm32mp1/u-boot-dhcom.its"
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=1
 CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
@@ -56,7 +55,6 @@ CONFIG_SPL_POWER=y
 CONFIG_SPL_RAM_DEVICE=y
 CONFIG_SPL_SPI_FLASH_MTD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x80000
-CONFIG_SPL_TARGET="u-boot.itb"
 CONFIG_SYS_PROMPT="STM32MP> "
 # CONFIG_CMD_ELF is not set
 # CONFIG_CMD_EXPORTENV is not set
index cc82e21c35df0f928cd389680850a0b564839ad4..4162eda67a042cc8443879673a8976084926f2c3 100644 (file)
@@ -30,7 +30,6 @@ CONFIG_BOARD_SIZE_LIMIT=1441792
 CONFIG_FIT=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0xc1000000
-CONFIG_SPL_FIT_SOURCE="board/dhelectronics/dh_stm32mp1/u-boot-dhcor.its"
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=1
 CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
@@ -54,7 +53,6 @@ CONFIG_SPL_POWER=y
 CONFIG_SPL_RAM_DEVICE=y
 CONFIG_SPL_SPI_FLASH_MTD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x80000
-CONFIG_SPL_TARGET="u-boot.itb"
 CONFIG_SYS_PROMPT="STM32MP> "
 # CONFIG_CMD_ELF is not set
 # CONFIG_CMD_EXPORTENV is not set