diff mbox

[U-Boot,v2,3/6] arm: mach-omap2: fdt-common: Add OP-TEE node when firmware node is defined

Message ID 20170710194554.23430-4-afd@ti.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Andrew Davis July 10, 2017, 7:45 p.m. UTC
If a firmware node is already present in the FDT we will fail to create
one and so fail to add our OP-TEE node, make this fixup first check for
a firmware node and then only try to add one if it is not found.

Signed-off-by: Andrew F. Davis <afd@ti.com>
---
 arch/arm/mach-omap2/fdt-common.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

Comments

Tom Rini July 25, 2017, 12:42 a.m. UTC | #1
On Mon, Jul 10, 2017 at 02:45:51PM -0500, Andrew F. Davis wrote:

> If a firmware node is already present in the FDT we will fail to create
> one and so fail to add our OP-TEE node, make this fixup first check for
> a firmware node and then only try to add one if it is not found.
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>

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

Patch

diff --git a/arch/arm/mach-omap2/fdt-common.c b/arch/arm/mach-omap2/fdt-common.c
index 297d4d4df5..9297e9db48 100644
--- a/arch/arm/mach-omap2/fdt-common.c
+++ b/arch/arm/mach-omap2/fdt-common.c
@@ -134,14 +134,22 @@  int ft_hs_add_tee(void *fdt, bd_t *bd)
 	if (!tee_loaded)
 		return 0;
 
-	path = "/";
+	path = "/firmware";
 	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;
+		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);
+			return 1;
+		}
 	}
 
 	subpath = "optee";