Add a Kconfig for OPTEE_LOAD_ADDRESS which adds tee.bin to the
imx8m{m,n,p} FIT image.

Prior to using binman for image creation the presense of tee.bin in the
directory would cause mkimage_fit_atf.sh to add the tee.bin node
to the FIT image. Once boards moved away from using
CONFIG_SPL_FIT_GENERATOR this was lost. This patch restores that
functionality. A Kconfig option is added due to binman not being
able to utilize env variables.

Signed-off-by: Tim Harvey <[email protected]>
---
 arch/arm/dts/imx8mm-u-boot.dtsi | 19 +++++++++++++++++++
 arch/arm/dts/imx8mn-u-boot.dtsi | 19 +++++++++++++++++++
 arch/arm/dts/imx8mp-u-boot.dtsi | 19 +++++++++++++++++++
 drivers/tee/optee/Kconfig       |  7 +++++++
 4 files changed, 64 insertions(+)

diff --git a/arch/arm/dts/imx8mm-u-boot.dtsi b/arch/arm/dts/imx8mm-u-boot.dtsi
index a843bb851eaf..61f907a4743b 100644
--- a/arch/arm/dts/imx8mm-u-boot.dtsi
+++ b/arch/arm/dts/imx8mm-u-boot.dtsi
@@ -124,6 +124,21 @@
                                                type = "atf-bl31";
                                        };
                                };
+
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+                               tee {
+                                       description = "TEE firmware";
+                                       type = "firmware";
+                                       arch = "arm64";
+                                       compression = "none";
+                                       load = <CONFIG_OPTEE_LOAD_ADDRESS>;
+                                       entry = <CONFIG_OPTEE_LOAD_ADDRESS>;
+
+                                       tee_blob: blob-ext {
+                                               filename = "tee.bin";
+                                       };
+                               };
+#endif
 #endif
 
                                binman_fip: fip {
@@ -154,7 +169,11 @@
                                        fdt = "fdt-SEQ";
                                        firmware = "uboot";
 #ifndef CONFIG_ARMV8_PSCI
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+                                       loadables = "atf", "tee";
+#else
                                        loadables = "atf";
+#endif
 #endif
                                };
                        };
diff --git a/arch/arm/dts/imx8mn-u-boot.dtsi b/arch/arm/dts/imx8mn-u-boot.dtsi
index 86c9a6cd67f0..15cec4ffab44 100644
--- a/arch/arm/dts/imx8mn-u-boot.dtsi
+++ b/arch/arm/dts/imx8mn-u-boot.dtsi
@@ -181,6 +181,21 @@
                                                type = "atf-bl31";
                                        };
                                };
+
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+                               tee {
+                                       description = "TEE firmware";
+                                       type = "firmware";
+                                       arch = "arm64";
+                                       compression = "none";
+                                       load = <CONFIG_OPTEE_LOAD_ADDRESS>;
+                                       entry = <CONFIG_OPTEE_LOAD_ADDRESS>;
+
+                                       tee_blob: blob-ext {
+                                               filename = "tee.bin";
+                                       };
+                               };
+#endif
 #endif
 
                                binman_fip: fip {
@@ -211,7 +226,11 @@
                                        fdt = "fdt-SEQ";
                                        firmware = "uboot";
 #ifndef CONFIG_ARMV8_PSCI
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+                                       loadables = "atf", "tee";
+#else
                                        loadables = "atf";
+#endif
 #endif
                                };
                        };
diff --git a/arch/arm/dts/imx8mp-u-boot.dtsi b/arch/arm/dts/imx8mp-u-boot.dtsi
index 8c9d6412ccb5..b46fc7eeed0d 100644
--- a/arch/arm/dts/imx8mp-u-boot.dtsi
+++ b/arch/arm/dts/imx8mp-u-boot.dtsi
@@ -145,6 +145,21 @@
                                                type = "atf-bl31";
                                        };
                                };
+
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+                               tee {
+                                       description = "TEE firmware";
+                                       type = "firmware";
+                                       arch = "arm64";
+                                       compression = "none";
+                                       load = <CONFIG_OPTEE_LOAD_ADDRESS>;
+                                       entry = <CONFIG_OPTEE_LOAD_ADDRESS>;
+
+                                       tee_blob: blob-ext {
+                                               filename = "tee.bin";
+                                       };
+                               };
+#endif
 #endif
 
                                @fdt-SEQ {
@@ -166,7 +181,11 @@
                                        fdt = "fdt-SEQ";
                                        firmware = "uboot";
 #ifndef CONFIG_ARMV8_PSCI
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+                                       loadables = "atf", "tee";
+#else
                                        loadables = "atf";
+#endif
 #endif
                                };
                        };
diff --git a/drivers/tee/optee/Kconfig b/drivers/tee/optee/Kconfig
index 9dc65b0501e2..09a8bbd2fafd 100644
--- a/drivers/tee/optee/Kconfig
+++ b/drivers/tee/optee/Kconfig
@@ -14,6 +14,13 @@ if OPTEE || SANDBOX
 
 menu "OP-TEE options"
 
+config OPTEE_LOAD_ADDRESS
+       hex "Load address of OPTEE"
+       help
+         Defines the load and entry address used by U-Boot FIT images
+         for tee.bin. This address must match the link address that
+         tee.bin was built with.
+
 config OPTEE_TA_AVB
        bool "Support AVB TA"
        default y
-- 
2.25.1

Reply via email to