[PATCH 3/3] imx8: Use the optee lib to add the optee firmware node to the FDT
Alban Bedel
alban.bedel at aerq.com
Mon May 16 10:21:39 CEST 2022
Use the function provided by the optee lib to add the firmware node to
the FDT. Enable the optee lib on all imx8 defconfig to keep the same
behavior.
Signed-off-by: Alban Bedel <alban.bedel at aerq.com>
---
arch/arm/mach-imx/imx8/fdt.c | 59 ++++----------------------
configs/apalis-imx8_defconfig | 1 +
configs/cgtqmx8_defconfig | 1 +
configs/colibri-imx8x_defconfig | 1 +
configs/deneb_defconfig | 1 +
configs/giedi_defconfig | 1 +
configs/imx8qm_mek_defconfig | 1 +
configs/imx8qm_rom7720_a1_4G_defconfig | 1 +
configs/imx8qxp_mek_defconfig | 1 +
9 files changed, 16 insertions(+), 51 deletions(-)
diff --git a/arch/arm/mach-imx/imx8/fdt.c b/arch/arm/mach-imx/imx8/fdt.c
index a132ce2e6a3a..60d6a6bb85b8 100644
--- a/arch/arm/mach-imx/imx8/fdt.c
+++ b/arch/arm/mach-imx/imx8/fdt.c
@@ -11,6 +11,7 @@
#include <dm/ofnode.h>
#include <fdt_support.h>
#include <linux/libfdt.h>
+#include <tee/optee.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -229,56 +230,6 @@ static int config_smmu_fdt(void *blob)
return 0;
}
-static int ft_add_optee_node(void *fdt, struct bd_info *bd)
-{
- const char *path, *subpath;
- int offs;
-
- /*
- * No TEE space allocated indicating no TEE running, so no
- * need to add optee node in dts
- */
- if (!boot_pointer[1])
- return 0;
-
- offs = fdt_increase_size(fdt, 512);
- if (offs) {
- printf("No Space for dtb\n");
- return 1;
- }
-
- path = "/firmware";
- offs = fdt_path_offset(fdt, path);
- if (offs < 0) {
- path = "/";
- offs = fdt_path_offset(fdt, path);
-
- if (offs < 0) {
- printf("Could not find root node.\n");
- return offs;
- }
-
- subpath = "firmware";
- offs = fdt_add_subnode(fdt, offs, subpath);
- if (offs < 0) {
- printf("Could not create %s node.\n", subpath);
- return offs;
- }
- }
-
- subpath = "optee";
- offs = fdt_add_subnode(fdt, offs, subpath);
- if (offs < 0) {
- printf("Could not create %s node.\n", subpath);
- return offs;
- }
-
- fdt_setprop_string(fdt, offs, "compatible", "linaro,optee-tz");
- fdt_setprop_string(fdt, offs, "method", "smc");
-
- return 0;
-}
-
int ft_system_setup(void *blob, struct bd_info *bd)
{
int ret;
@@ -300,5 +251,11 @@ int ft_system_setup(void *blob, struct bd_info *bd)
return ret;
}
- return ft_add_optee_node(blob, bd);
+ if (boot_pointer[1]) {
+ ret = optee_add_firmware_node(blob, "linaro,optee-tz", "smc");
+ if (ret)
+ return ret;
+ }
+
+ return 0;
}
diff --git a/configs/apalis-imx8_defconfig b/configs/apalis-imx8_defconfig
index beb20f6e1c01..f3dbb4bd9c19 100644
--- a/configs/apalis-imx8_defconfig
+++ b/configs/apalis-imx8_defconfig
@@ -72,3 +72,4 @@ CONFIG_FSL_LPUART=y
CONFIG_DM_THERMAL=y
CONFIG_IMX_SCU_THERMAL=y
# CONFIG_EFI_LOADER is not set
+CONFIG_OPTEE_LIB=y
diff --git a/configs/cgtqmx8_defconfig b/configs/cgtqmx8_defconfig
index 2cf882f826ab..ac251f37fed5 100644
--- a/configs/cgtqmx8_defconfig
+++ b/configs/cgtqmx8_defconfig
@@ -90,3 +90,4 @@ CONFIG_DM_SERIAL=y
CONFIG_FSL_LPUART=y
CONFIG_SPL_TINY_MEMSET=y
# CONFIG_EFI_LOADER is not set
+CONFIG_OPTEE_LIB=y
diff --git a/configs/colibri-imx8x_defconfig b/configs/colibri-imx8x_defconfig
index 0c9d6b64c1b6..f37da2411b04 100644
--- a/configs/colibri-imx8x_defconfig
+++ b/configs/colibri-imx8x_defconfig
@@ -70,3 +70,4 @@ CONFIG_FSL_LPUART=y
CONFIG_DM_THERMAL=y
CONFIG_IMX_SCU_THERMAL=y
# CONFIG_EFI_LOADER is not set
+CONFIG_OPTEE_LIB=y
diff --git a/configs/deneb_defconfig b/configs/deneb_defconfig
index 425fff6c70a6..e8f8cd18cacf 100644
--- a/configs/deneb_defconfig
+++ b/configs/deneb_defconfig
@@ -114,3 +114,4 @@ CONFIG_IMX_SCU_THERMAL=y
# CONFIG_SPL_WDT is not set
CONFIG_SPL_TINY_MEMSET=y
# CONFIG_EFI_LOADER is not set
+CONFIG_OPTEE_LIB=y
diff --git a/configs/giedi_defconfig b/configs/giedi_defconfig
index 4fbf7ebdcd95..7ee50e1f45c5 100644
--- a/configs/giedi_defconfig
+++ b/configs/giedi_defconfig
@@ -114,3 +114,4 @@ CONFIG_IMX_SCU_THERMAL=y
# CONFIG_SPL_WDT is not set
CONFIG_SPL_TINY_MEMSET=y
# CONFIG_EFI_LOADER is not set
+CONFIG_OPTEE_LIB=y
diff --git a/configs/imx8qm_mek_defconfig b/configs/imx8qm_mek_defconfig
index 2e42872f843d..10b61d62a821 100644
--- a/configs/imx8qm_mek_defconfig
+++ b/configs/imx8qm_mek_defconfig
@@ -91,3 +91,4 @@ CONFIG_DM_SERIAL=y
CONFIG_FSL_LPUART=y
CONFIG_SPL_TINY_MEMSET=y
# CONFIG_EFI_LOADER is not set
+CONFIG_OPTEE_LIB=y
diff --git a/configs/imx8qm_rom7720_a1_4G_defconfig b/configs/imx8qm_rom7720_a1_4G_defconfig
index d9997cfa8280..dc94fc67261c 100644
--- a/configs/imx8qm_rom7720_a1_4G_defconfig
+++ b/configs/imx8qm_rom7720_a1_4G_defconfig
@@ -86,3 +86,4 @@ CONFIG_DM_SERIAL=y
CONFIG_FSL_LPUART=y
CONFIG_SPL_TINY_MEMSET=y
# CONFIG_EFI_LOADER is not set
+CONFIG_OPTEE_LIB=y
diff --git a/configs/imx8qxp_mek_defconfig b/configs/imx8qxp_mek_defconfig
index 43f42f7a58af..250ce43758cf 100644
--- a/configs/imx8qxp_mek_defconfig
+++ b/configs/imx8qxp_mek_defconfig
@@ -94,3 +94,4 @@ CONFIG_DM_THERMAL=y
CONFIG_IMX_SCU_THERMAL=y
CONFIG_SPL_TINY_MEMSET=y
# CONFIG_EFI_LOADER is not set
+CONFIG_OPTEE_LIB=y
--
2.34.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3627 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20220516/27ae8e40/attachment.bin>
More information about the U-Boot
mailing list