> Subject: Re: [PATCH] imx8m: soc: cope with existing optee node > > Hi Vincent, > > On Mon, Mar 10, 2025 at 9:36 AM Vincent Stehlé > <vincent.ste...@arm.com> wrote: > > > --- a/arch/arm/mach-imx/imx8m/soc.c > > +++ b/arch/arm/mach-imx/imx8m/soc.c > > @@ -1270,8 +1270,9 @@ static int ft_add_optee_node(void *fdt, > struct bd_info *bd) > > } > > } > > > > + /* Locate the optee node if it exists or create it. */ > > subpath = "optee"; > > - offs = fdt_add_subnode(fdt, offs, subpath); > > + offs = fdt_find_or_add_subnode(fdt, offs, subpath); > > if (offs < 0) { > > printf("Could not create %s node.\n", subpath); > > return offs; > > This looks correct. > > However, shouldn't we add the optee node only when CONFIG_OPTEE > is selected?
Partially right. But The issue here is to handle the case that the node is created by optee os and uboot should bypass creating it again. Regards, Peng > > --- a/arch/arm/mach-imx/imx8m/soc.c > +++ b/arch/arm/mach-imx/imx8m/soc.c > @@ -1235,6 +1235,9 @@ static int ft_add_optee_node(void *fdt, > struct bd_info *bd) > int offs; > int ret; > > + if (!IS_ENABLED(CONFIG_OPTEE)) > + return 0; > + > /* > * No TEE space allocated indicating no TEE running, so no > * need to add optee node in dts