diff mbox

[U-Boot,v3,5/7] arm: omap5: Add OPTEE node to fdt

Message ID 20161129223326.3115-6-afd@ti.com
State Accepted
Commit a8ff9685206bc3dd187a604a9d8c75f47a0d3502
Delegated to: Tom Rini
Headers show

Commit Message

Andrew Davis Nov. 29, 2016, 10:33 p.m. UTC
Add an OPTEE node to the FDT when TEE installation has completed
successfully. This informs the kernel of the presence of OPTEE.

Signed-off-by: Andrew F. Davis <afd@ti.com>
---
 arch/arm/mach-omap2/omap5/fdt.c | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

Comments

Tom Rini Nov. 30, 2016, 2:13 p.m. UTC | #1
On Tue, Nov 29, 2016 at 04:33:24PM -0600, Andrew F. Davis wrote:

> Add an OPTEE node to the FDT when TEE installation has completed
> successfully. This informs the kernel of the presence of OPTEE.
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>
Tom Rini Dec. 4, 2016, 1:07 a.m. UTC | #2
On Tue, Nov 29, 2016 at 04:33:24PM -0600, Andrew F. Davis wrote:

> Add an OPTEE node to the FDT when TEE installation has completed
> successfully. This informs the kernel of the presence of OPTEE.
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/omap5/fdt.c b/arch/arm/mach-omap2/omap5/fdt.c
index da8d59b..afa0037 100644
--- a/arch/arm/mach-omap2/omap5/fdt.c
+++ b/arch/arm/mach-omap2/omap5/fdt.c
@@ -212,6 +212,38 @@  static int ft_hs_fixup_dram(void *fdt, bd_t *bd)
 static int ft_hs_fixup_dram(void *fdt, bd_t *bd) { return 0; }
 #endif
 
+static int ft_hs_add_tee(void *fdt, bd_t *bd)
+{
+	const char *path, *subpath;
+	int offs;
+
+	extern int tee_loaded;
+	if (!tee_loaded)
+		return 0;
+
+	path = "/";
+	offs = fdt_path_offset(fdt, path);
+
+	subpath = "firmware";
+	offs = fdt_add_subnode(fdt, offs, subpath);
+	if (offs < 0) {
+		printf("Could not create %s node.\n", subpath);
+		return 1;
+	}
+
+	subpath = "optee";
+	offs = fdt_add_subnode(fdt, offs, subpath);
+	if (offs < 0) {
+		printf("Could not create %s node.\n", subpath);
+		return 1;
+	}
+
+	fdt_setprop_string(fdt, offs, "compatible", "linaro,optee-tz");
+	fdt_setprop_string(fdt, offs, "method", "smc");
+
+	return 0;
+}
+
 static void ft_hs_fixups(void *fdt, bd_t *bd)
 {
 	/* Check we are running on an HS/EMU device type */
@@ -219,7 +251,8 @@  static void ft_hs_fixups(void *fdt, bd_t *bd)
 		if ((ft_hs_fixup_crossbar(fdt, bd) == 0) &&
 		    (ft_hs_disable_rng(fdt, bd) == 0) &&
 		    (ft_hs_fixup_sram(fdt, bd) == 0) &&
-		    (ft_hs_fixup_dram(fdt, bd) == 0))
+		    (ft_hs_fixup_dram(fdt, bd) == 0) &&
+		    (ft_hs_add_tee(fdt, bd) == 0))
 			return;
 	} else {
 		printf("ERROR: Incorrect device type (GP) detected!");