@@ -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;
}
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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@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(-)