diff mbox series

[v3,09/19] am65: dts: binman: Package tiboot3.bin, sysfw.itb, tispl.bin, u-boot.img

Message ID 20230421123203.1315330-10-n-francis@ti.com
State Changes Requested
Delegated to: Tom Rini
Headers show
Series Migration to using binman for bootloader | expand

Commit Message

Neha Malcom Francis April 21, 2023, 12:31 p.m. UTC
Support added for HS and GP boot binaries for AM65x.

tiboot3.bin, sysfw.itb, tispl.bin and u-boot.img: For HS devices
tiboot3.bin_unsigned, sysfw.itb, tispl.bin_unsigned,
u-boot.img_unsigned: For GP devices

Note that the bootflow followed by AM65x requires:

tiboot3.bin:
	* R5 SPL
	* R5 SPL dtbs
sysfw.itb:
	* sysfw
	* board-cfg
	* pm-cfg
	* sec-cfg
	* rm-cfg

tispl.bin:
	* ATF
	* OPTEE
	* A53 SPL
	* A53 SPL dtbs

u-boot.img:
	* A53 U-Boot
	* A53 U-Boot dtbs

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi  |   1 +
 .../dts/k3-am654-r5-base-board-u-boot.dtsi    |   1 +
 arch/arm/dts/k3-am65x-binman.dtsi             | 551 ++++++++++++++++++
 board/ti/am65x/Kconfig                        |   2 +
 4 files changed, 555 insertions(+)
 create mode 100644 arch/arm/dts/k3-am65x-binman.dtsi

Comments

Simon Glass April 24, 2023, 7:42 p.m. UTC | #1
Hi Neha,

On Fri, 21 Apr 2023 at 06:32, Neha Malcom Francis <n-francis@ti.com> wrote:
>
> Support added for HS and GP boot binaries for AM65x.
>
> tiboot3.bin, sysfw.itb, tispl.bin and u-boot.img: For HS devices
> tiboot3.bin_unsigned, sysfw.itb, tispl.bin_unsigned,
> u-boot.img_unsigned: For GP devices
>
> Note that the bootflow followed by AM65x requires:
>
> tiboot3.bin:
>         * R5 SPL
>         * R5 SPL dtbs
> sysfw.itb:
>         * sysfw
>         * board-cfg
>         * pm-cfg
>         * sec-cfg
>         * rm-cfg
>
> tispl.bin:
>         * ATF
>         * OPTEE
>         * A53 SPL
>         * A53 SPL dtbs
>
> u-boot.img:
>         * A53 U-Boot
>         * A53 U-Boot dtbs
>
> Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
> ---
>  arch/arm/dts/k3-am654-base-board-u-boot.dtsi  |   1 +
>  .../dts/k3-am654-r5-base-board-u-boot.dtsi    |   1 +
>  arch/arm/dts/k3-am65x-binman.dtsi             | 551 ++++++++++++++++++
>  board/ti/am65x/Kconfig                        |   2 +
>  4 files changed, 555 insertions(+)
>  create mode 100644 arch/arm/dts/k3-am65x-binman.dtsi

Reviewed-by: Simon Glass <sjg@chromium.org>

Is there any way that these boards could share a .dtsi with just the
different bits in each board's dtsi? There seems to be a lot of
duplicate.

Regards,
Simon
Neha Malcom Francis April 25, 2023, 7:26 a.m. UTC | #2
Hi Simon,

On 25/04/23 01:12, Simon Glass wrote:
> Hi Neha,
> 
> On Fri, 21 Apr 2023 at 06:32, Neha Malcom Francis <n-francis@ti.com> wrote:
>>
>> Support added for HS and GP boot binaries for AM65x.
>>
>> tiboot3.bin, sysfw.itb, tispl.bin and u-boot.img: For HS devices
>> tiboot3.bin_unsigned, sysfw.itb, tispl.bin_unsigned,
>> u-boot.img_unsigned: For GP devices
>>
>> Note that the bootflow followed by AM65x requires:
>>
>> tiboot3.bin:
>>          * R5 SPL
>>          * R5 SPL dtbs
>> sysfw.itb:
>>          * sysfw
>>          * board-cfg
>>          * pm-cfg
>>          * sec-cfg
>>          * rm-cfg
>>
>> tispl.bin:
>>          * ATF
>>          * OPTEE
>>          * A53 SPL
>>          * A53 SPL dtbs
>>
>> u-boot.img:
>>          * A53 U-Boot
>>          * A53 U-Boot dtbs
>>
>> Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
>> ---
>>   arch/arm/dts/k3-am654-base-board-u-boot.dtsi  |   1 +
>>   .../dts/k3-am654-r5-base-board-u-boot.dtsi    |   1 +
>>   arch/arm/dts/k3-am65x-binman.dtsi             | 551 ++++++++++++++++++
>>   board/ti/am65x/Kconfig                        |   2 +
>>   4 files changed, 555 insertions(+)
>>   create mode 100644 arch/arm/dts/k3-am65x-binman.dtsi
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
> Is there any way that these boards could share a .dtsi with just the
> different bits in each board's dtsi? There seems to be a lot of
> duplicate.
> 

Maybe a common k3-binman.dtsi, but the common nodes (where the filenames 
of both the generated file as well as component files are all common) 
would be the ti-board-config ones... and if we change that as per last 
review comment to point to board/ti/<device>/config.bin then we'd have 
that particular to each device as well right?

Or do you mean to say we use #defines for all?

> Regards,
> Simon
Simon Glass April 25, 2023, 6:01 p.m. UTC | #3
Hi Neha,

On Tue, 25 Apr 2023 at 01:26, Neha Malcom Francis <n-francis@ti.com> wrote:
>
> Hi Simon,
>
> On 25/04/23 01:12, Simon Glass wrote:
> > Hi Neha,
> >
> > On Fri, 21 Apr 2023 at 06:32, Neha Malcom Francis <n-francis@ti.com> wrote:
> >>
> >> Support added for HS and GP boot binaries for AM65x.
> >>
> >> tiboot3.bin, sysfw.itb, tispl.bin and u-boot.img: For HS devices
> >> tiboot3.bin_unsigned, sysfw.itb, tispl.bin_unsigned,
> >> u-boot.img_unsigned: For GP devices
> >>
> >> Note that the bootflow followed by AM65x requires:
> >>
> >> tiboot3.bin:
> >>          * R5 SPL
> >>          * R5 SPL dtbs
> >> sysfw.itb:
> >>          * sysfw
> >>          * board-cfg
> >>          * pm-cfg
> >>          * sec-cfg
> >>          * rm-cfg
> >>
> >> tispl.bin:
> >>          * ATF
> >>          * OPTEE
> >>          * A53 SPL
> >>          * A53 SPL dtbs
> >>
> >> u-boot.img:
> >>          * A53 U-Boot
> >>          * A53 U-Boot dtbs
> >>
> >> Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
> >> ---
> >>   arch/arm/dts/k3-am654-base-board-u-boot.dtsi  |   1 +
> >>   .../dts/k3-am654-r5-base-board-u-boot.dtsi    |   1 +
> >>   arch/arm/dts/k3-am65x-binman.dtsi             | 551 ++++++++++++++++++
> >>   board/ti/am65x/Kconfig                        |   2 +
> >>   4 files changed, 555 insertions(+)
> >>   create mode 100644 arch/arm/dts/k3-am65x-binman.dtsi
> >
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> >
> > Is there any way that these boards could share a .dtsi with just the
> > different bits in each board's dtsi? There seems to be a lot of
> > duplicate.
> >
>
> Maybe a common k3-binman.dtsi, but the common nodes (where the filenames
> of both the generated file as well as component files are all common)
> would be the ti-board-config ones... and if we change that as per last
> review comment to point to board/ti/<device>/config.bin then we'd have
> that particular to each device as well right?
>
> Or do you mean to say we use #defines for all?

No I just mean having a common .dtsi as you say above.

You can still override things in that if you want to, by adding a
phandle and then referencing it in the board-specific file.

Regards,
Simon
diff mbox series

Patch

diff --git a/arch/arm/dts/k3-am654-base-board-u-boot.dtsi b/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
index 0c1305df7e..e4cbc47c2a 100644
--- a/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
@@ -4,6 +4,7 @@ 
  */
 
 #include "k3-am654-r5-base-board-u-boot.dtsi"
+#include "k3-am65x-binman.dtsi"
 
 &pru0_0 {
 	remoteproc-name = "pru0_0";
diff --git a/arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi b/arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi
index 4516ab1437..949320c91d 100644
--- a/arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am654-r5-base-board-u-boot.dtsi
@@ -5,6 +5,7 @@ 
 
 #include <dt-bindings/pinctrl/k3.h>
 #include <dt-bindings/net/ti-dp83867.h>
+#include "k3-am65x-binman.dtsi"
 
 / {
 	chosen {
diff --git a/arch/arm/dts/k3-am65x-binman.dtsi b/arch/arm/dts/k3-am65x-binman.dtsi
new file mode 100644
index 0000000000..5103997505
--- /dev/null
+++ b/arch/arm/dts/k3-am65x-binman.dtsi
@@ -0,0 +1,551 @@ 
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+/ {
+	binman: binman {
+		multiple-images;
+	};
+};
+
+#ifdef CONFIG_TARGET_AM654_R5_EVM
+
+&binman {
+	board-cfg {
+		filename = "board-cfg.bin";
+		ti-board-config {
+			config = "board-cfg.yaml";
+			schema = "schema.yaml";
+		};
+	};
+	pm-cfg {
+		filename = "pm-cfg.bin";
+		ti-board-config {
+			config = "pm-cfg.yaml";
+			schema = "schema.yaml";
+		};
+	};
+	rm-cfg {
+		filename = "rm-cfg.bin";
+		ti-board-config {
+			config = "rm-cfg.yaml";
+			schema = "schema.yaml";
+		};
+	};
+	sec-cfg {
+		filename = "sec-cfg.bin";
+		ti-board-config {
+			config = "sec-cfg.yaml";
+			schema = "schema.yaml";
+		};
+	};
+
+	tiboot3 {
+		filename = "tiboot3.bin";
+		ti-secure-rom {
+			content = <&u_boot_spl>;
+			core = "public";
+			load = <CONFIG_SPL_TEXT_BASE>;
+			keyfile = "custMpk.pem";
+		};
+		u_boot_spl: u-boot-spl {
+			no-expanded;
+		};
+	};
+	sysfw {
+		filename = "sysfw.bin";
+		ti-secure-rom {
+			content = <&ti_sci_cert>;
+			core = "secure";
+			load = <0x40000>;
+			keyfile = "custMpk.pem";
+			countersign;
+		};
+		ti_sci_cert: ti-sci-cert.bin {
+			filename = "ti-sysfw/ti-sci-firmware-am65x-hs-cert.bin";
+			type = "blob-ext";
+			optional;
+		};
+		ti-sci-firmware-am65x-hs-enc.bin {
+			filename = "ti-sysfw/ti-sci-firmware-am65x-hs-enc.bin";
+			type = "blob-ext";
+			optional;
+		};
+	};
+	itb {
+		filename = "sysfw-am65x-hs.itb";
+		fit {
+			description = "SYSFW and Config fragments";
+			#address-cells = <1>;
+			images {
+				sysfw.bin {
+					description = "sysfw";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					blob-ext {
+					    filename = "sysfw.bin";
+					};
+				};
+				board-cfg.bin {
+					description = "board-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&board_cfg>;
+						keyfile = "custMpk.pem";
+					};
+					board_cfg: board-cfg {
+						filename = "board-cfg.bin";
+						type = "blob-ext";
+					};
+				};
+				pm-cfg.bin {
+					description = "pm-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&pm_cfg>;
+						keyfile = "custMpk.pem";
+					};
+					pm_cfg: pm-cfg {
+						filename = "pm-cfg.bin";
+						type = "blob-ext";
+					};
+				};
+				rm-cfg.bin {
+					description = "rm-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&rm_cfg>;
+						keyfile = "custMpk.pem";\
+					};
+					rm_cfg: rm-cfg {
+						filename = "rm-cfg.bin";
+						type = "blob-ext";
+					};
+				};
+				sec-cfg.bin {
+					description = "sec-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&sec_cfg>;
+						keyfile = "custMpk.pem";
+					};
+					sec_cfg: sec-cfg {
+						filename = "sec-cfg.bin";
+						type = "blob-ext";
+					};
+				};
+			};
+		};
+	};
+};
+
+&binman {
+	tiboot3_unsigned {
+		filename = "tiboot3.bin_unsigned";
+		ti-secure-rom {
+			content = <&u_boot_spl_unsigned>;
+			core = "public";
+			load = <CONFIG_SPL_TEXT_BASE>;
+			sw-rev = <CONFIG_K3_X509_SWRV>;
+			keyfile = "ti-degenerate-key.pem";
+		};
+		u_boot_spl_unsigned: u-boot-spl {
+			no-expanded;
+		};
+	};
+	sysfw_gp {
+		filename = "sysfw.bin_gp";
+		ti-secure-rom {
+			content = <&ti_sci>;
+			core = "secure";
+			load = <0x40000>;
+			sw-rev = <CONFIG_K3_X509_SWRV>;
+			keyfile = "ti-degenerate-key.pem";
+			countersign;
+		};
+		ti_sci: ti-sci.bin {
+			filename = "ti-sysfw/ti-sci-firmware-am65x-gp.bin";
+			type = "blob-ext";
+			optional;
+		};
+	};
+	itb_gp {
+		filename = "sysfw-am65x-gp-evm.itb";
+		symlink = "sysfw.itb";
+		fit {
+			description = "SYSFW and Config fragments";
+			#address-cells = <1>;
+			images {
+				sysfw.bin {
+					description = "sysfw";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					blob-ext {
+					    filename = "sysfw.bin_gp";
+					};
+				};
+				board-cfg.bin {
+					description = "board-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					blob-ext {
+						filename = "board-cfg.bin";
+					};
+				};
+				pm-cfg.bin {
+					description = "pm-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					blob-ext {
+						filename = "pm-cfg.bin";
+					};
+				};
+				rm-cfg.bin {
+					description = "rm-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					blob-ext {
+						filename = "rm-cfg.bin";
+					};
+				};
+				sec-cfg.bin {
+					description = "sec-cfg";
+					type = "firmware";
+					arch = "arm";
+					compression = "none";
+					blob-ext {
+						filename = "sec-cfg.bin";
+					};
+				};
+			};
+		};
+	};
+};
+#endif
+
+#ifdef CONFIG_TARGET_AM654_A53_EVM
+
+#define SPL_NODTB "spl/u-boot-spl-nodtb.bin"
+#define SPL_AM654_EVM_DTB "spl/dts/k3-am654-base-board.dtb"
+
+#define UBOOT_NODTB "u-boot-nodtb.bin"
+#define AM654_EVM_DTB "arch/arm/dts/k3-am654-base-board.dtb"
+
+&binman {
+	ti-spl {
+		filename = "tispl.bin";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "Configuration to load ATF and SPL";
+			#address-cells = <1>;
+
+			images {
+
+				atf {
+					description = "ARM Trusted Firmware";
+					type = "firmware";
+					arch = "arm64";
+					compression = "none";
+					os = "arm-trusted-firmware";
+					load = <CONFIG_K3_ATF_LOAD_ADDR>;
+					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
+					ti-secure {
+						content = <&atf>;
+						keyfile = "custMpk.pem";
+					};
+					atf: atf-bl31 {
+					};
+				};
+
+				tee {
+					description = "OPTEE";
+					type = "tee";
+					arch = "arm64";
+					compression = "none";
+					os = "tee";
+					load = <0x9e800000>;
+					entry = <0x9e800000>;
+					ti-secure {
+						content = <&tee>;
+						keyfile = "custMpk.pem";
+					};
+					tee: tee-os {
+					};
+				};
+
+				dm {
+					description = "DM binary";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "DM";
+					load = <0x89000000>;
+					entry = <0x89000000>;
+					blob-ext {
+						filename = "/dev/null";
+					};
+				};
+
+				spl {
+					description = "SPL (64-bit)";
+					type = "standalone";
+					os = "U-Boot";
+					arch = "arm64";
+					compression = "none";
+					load = <CONFIG_SPL_TEXT_BASE>;
+					entry = <CONFIG_SPL_TEXT_BASE>;
+					ti-secure {
+						content = <&u_boot_spl_nodtb>;
+						keyfile = "custMpk.pem";
+
+					};
+					u_boot_spl_nodtb: blob-ext {
+						filename = SPL_NODTB;
+					};
+				};
+
+				fdt-0 {
+					description = "k3-am654-base-board";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&spl_am65x_evm_dtb>;
+						keyfile = "custMpk.pem";
+					};
+					spl_am65x_evm_dtb: blob-ext {
+						filename = SPL_AM654_EVM_DTB;
+					};
+				};
+			};
+
+			configurations {
+				default = "conf-0";
+
+				conf-0 {
+					description = "k3-am654-base-board";
+					firmware = "atf";
+					loadables = "tee", "dm", "spl";
+					fdt = "fdt-0";
+				};
+			};
+		};
+	};
+};
+
+&binman {
+	u-boot {
+		filename = "u-boot.img";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "FIT image with multiple configurations";
+
+			images {
+				uboot {
+					description = "U-Boot for AM65 board";
+					type = "firmware";
+					os = "u-boot";
+					arch = "arm";
+					compression = "none";
+					load = <CONFIG_TEXT_BASE>;
+					ti-secure {
+						content = <&u_boot_nodtb>;
+						keyfile = "custMpk.pem";
+					};
+					u_boot_nodtb: u-boot-nodtb {
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+
+				fdt-0 {
+					description = "k3-am654-base-board";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					ti-secure {
+						content = <&am65x_evm_dtb>;
+						keyfile = "custMpk.pem";
+
+					};
+					am65x_evm_dtb: blob-ext {
+						filename = AM654_EVM_DTB;
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+
+			};
+
+			configurations {
+				default = "conf-0";
+
+				conf-0 {
+					description = "k3-am654-base-board";
+					firmware = "uboot";
+					loadables = "uboot";
+					fdt = "fdt-0";
+				};
+			};
+		};
+	};
+};
+
+&binman {
+	ti-spl_unsigned {
+		filename = "tispl.bin_unsigned";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "Configuration to load ATF and SPL";
+			#address-cells = <1>;
+
+			images {
+
+				atf {
+					description = "ARM Trusted Firmware";
+					type = "firmware";
+					arch = "arm64";
+					compression = "none";
+					os = "arm-trusted-firmware";
+					load = <CONFIG_K3_ATF_LOAD_ADDR>;
+					entry = <CONFIG_K3_ATF_LOAD_ADDR>;
+					atf-bl31 {
+						filename = "bl31.bin";
+					};
+				};
+
+				tee {
+					description = "OPTEE";
+					type = "tee";
+					arch = "arm64";
+					compression = "none";
+					os = "tee";
+					load = <0x9e800000>;
+					entry = <0x9e800000>;
+					tee-os {
+						filename = "tee-pager_v2.bin";
+					};
+				};
+
+				dm {
+					description = "DM binary";
+					type = "firmware";
+					arch = "arm32";
+					compression = "none";
+					os = "DM";
+					load = <0x89000000>;
+					entry = <0x89000000>;
+					blob-ext {
+						filename = "/dev/null";
+					};
+				};
+
+				spl {
+					description = "SPL (64-bit)";
+					type = "standalone";
+					os = "U-Boot";
+					arch = "arm64";
+					compression = "none";
+					load = <CONFIG_SPL_TEXT_BASE>;
+					entry = <CONFIG_SPL_TEXT_BASE>;
+					blob-ext {
+						filename = SPL_NODTB;
+					};
+				};
+
+				fdt-0 {
+					description = "k3-j721e-common-proc-board";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					blob {
+						filename = SPL_AM654_EVM_DTB;
+					};
+				};
+			};
+
+			configurations {
+				default = "conf-0";
+
+				conf-0 {
+					description = "k3-am654-base-board";
+					firmware = "atf";
+					loadables = "tee", "dm", "spl";
+					fdt = "fdt-0";
+				};
+			};
+		};
+	};
+};
+
+&binman {
+	u-boot_unsigned {
+		filename = "u-boot.img_unsigned";
+		pad-byte = <0xff>;
+
+		fit {
+			description = "FIT image with multiple configurations";
+
+			images {
+				uboot {
+					description = "U-Boot for AM65 board";
+					type = "firmware";
+					os = "u-boot";
+					arch = "arm";
+					compression = "none";
+					load = <CONFIG_TEXT_BASE>;
+					blob {
+						filename = UBOOT_NODTB;
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+
+				fdt-0 {
+					description = "k3-am654-base-board";
+					type = "flat_dt";
+					arch = "arm";
+					compression = "none";
+					blob {
+						filename = AM654_EVM_DTB;
+					};
+					hash {
+						algo = "crc32";
+					};
+				};
+			};
+
+			configurations {
+				default = "conf-0";
+
+				conf-0 {
+					description = "k3-am654-base-board";
+					firmware = "uboot";
+					loadables = "uboot";
+					fdt = "fdt-0";
+				};
+			};
+		};
+	};
+};
+#endif
diff --git a/board/ti/am65x/Kconfig b/board/ti/am65x/Kconfig
index 220dd0234c..5fd19d652a 100644
--- a/board/ti/am65x/Kconfig
+++ b/board/ti/am65x/Kconfig
@@ -12,6 +12,7 @@  config TARGET_AM654_A53_EVM
 	select ARM64
 	select SYS_DISABLE_DCACHE_OPS
 	select BOARD_LATE_INIT
+	select BINMAN
 	imply TI_I2C_BOARD_DETECT
 
 config TARGET_AM654_R5_EVM
@@ -20,6 +21,7 @@  config TARGET_AM654_R5_EVM
 	select SYS_THUMB_BUILD
 	select K3_LOAD_SYSFW
 	select K3_AM654_DDRSS
+	select BINMAN
 	imply SYS_K3_SPL_ATF
 	imply TI_I2C_BOARD_DETECT