mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-30 08:30:50 +09:00
imx8: fdt: add optee node
Add OP-TEE device tree node for Linux according to args passed from ATF. If ATF has been built with OP-TEE running, boot_pointer[1] will indicate that. Signed-off-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
parent
fefe051335
commit
94e4d028b2
@ -226,6 +226,56 @@ static int config_smmu_fdt(void *blob)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 (!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, bd_t *bd)
|
int ft_system_setup(void *blob, bd_t *bd)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@ -238,5 +288,5 @@ int ft_system_setup(void *blob, bd_t *bd)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return ft_add_optee_node(blob, bd);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user