diff options
author | Silvano di Ninno <silvano.dininno@nxp.com> | 2018-11-21 05:41:20 +0100 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2018-11-22 17:36:09 -0800 |
commit | d941a0bc9a3825c85c67707245b4f49ffe098864 (patch) | |
tree | 43a99c9478e88da30cb0ecaf0c9b551af58c99f6 /arch | |
parent | 15ff24b14220b98637c95684268994c5cec95995 (diff) |
TEE-329-2: OP-TEE: Allow u-boot to add optee node in dtb
If OP-TEE is loaded by ATF, u-boot will add
optee device tree node in th edtb so that
Linux can loads OP-TEE driver.
Signed-off-by: Silvano di Ninno <silvano.dininno@nxp.com>
(cherry picked from commit 441c23698ffd5c90c6421113da55fae420072473)
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-imx/imx8/cpu.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/imx8/cpu.c b/arch/arm/mach-imx/imx8/cpu.c index d7eb03086b..55cc320c80 100644 --- a/arch/arm/mach-imx/imx8/cpu.c +++ b/arch/arm/mach-imx/imx8/cpu.c @@ -1300,6 +1300,54 @@ static int config_smmu_fdt(void *blob) #endif #ifdef CONFIG_OF_SYSTEM_SETUP +static int ft_add_optee_node(void *fdt, bd_t *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 (!rom_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 1; + } + + subpath = "firmware"; + offs = fdt_add_subnode(fdt, offs, subpath); + if (offs < 0) { + printf("Could not create %s node.\n", subpath); + } + } + + subpath = "optee"; + offs = fdt_add_subnode(fdt, offs, subpath); + if (offs < 0) { + printf("Could not create %s node.\n", subpath); + } + + fdt_setprop_string(fdt, offs, "compatible", "linaro,optee-tz"); + fdt_setprop_string(fdt, offs, "method", "smc"); + + return 0; +} + int ft_system_setup(void *blob, bd_t *bd) { #ifdef BOOTAUX_RESERVED_MEM_BASE @@ -1320,6 +1368,7 @@ int ft_system_setup(void *blob, bd_t *bd) config_smmu_fdt(blob); #endif + ft_add_optee_node(blob, bd); return 0; } #endif |