All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] optee: bind the TA drivers on OP-TEE node
@ 2022-12-15  8:54 Patrick Delaunay
  2023-01-03 13:10 ` [Uboot-stm32] " Patrice CHOTARD
  2023-01-12 15:18 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Patrick Delaunay @ 2022-12-15  8:54 UTC (permalink / raw)
  To: u-boot; +Cc: Etienne CARRIERE, Patrick Delaunay, Jens Wiklander, U-Boot STM32

In U-Boot driver model the devices can be referenced by
phandle in the U-Boot configuration nodes.

Without a valid node provided during the bind, the driver
associated to OP-TEE TA can't be referenced.

For example to force the sequence number with alias
(.flags = DM_UC_FLAG_SEQ_ALIAS)

 	aliases {
		rng0 = &optee;
 	};

or other configuration:

board-sysinfo {
   compatible = "vendor,sysinfo-board";
   ramdom = <&optee>;
}

With this patch all drivers bound from OP-TEE service
discovery are now associated are associated to OP-TEE
node, allowing to identify by phandle the driver
provided by the TA for one UCLASS without modifying
device tree.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 drivers/tee/optee/core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index 9240277579be..96f08074443f 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -92,7 +92,8 @@ static int bind_service_list(struct udevice *dev, struct tee_shm *service_list,
 		if (!service)
 			continue;
 
-		ret = device_bind_driver(dev, service->driver_name, service->driver_name, NULL);
+		ret = device_bind_driver_to_node(dev, service->driver_name, service->driver_name,
+						 dev_ofnode(dev), NULL);
 		if (ret) {
 			dev_warn(dev, "%s was not bound: %d, ignored\n", service->driver_name, ret);
 			continue;
@@ -832,7 +833,8 @@ static int optee_probe(struct udevice *dev)
 		 * Discovery of TAs on the TEE bus is not supported in U-Boot:
 		 * only bind the drivers associated to the supported OP-TEE TA
 		 */
-		ret = device_bind_driver(dev, "optee-rng", "optee-rng", NULL);
+		ret = device_bind_driver_to_node(dev, "optee-rng", "optee-rng",
+						 dev_ofnode(dev), NULL);
 		if (ret)
 			return ret;
 	}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Uboot-stm32] [PATCH] optee: bind the TA drivers on OP-TEE node
  2022-12-15  8:54 [PATCH] optee: bind the TA drivers on OP-TEE node Patrick Delaunay
@ 2023-01-03 13:10 ` Patrice CHOTARD
  2023-01-12 15:18 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Patrice CHOTARD @ 2023-01-03 13:10 UTC (permalink / raw)
  To: Patrick Delaunay, u-boot; +Cc: U-Boot STM32, Etienne CARRIERE, Jens Wiklander

Hi Patrick

just one typo

On 12/15/22 09:54, Patrick Delaunay wrote:
> In U-Boot driver model the devices can be referenced by
> phandle in the U-Boot configuration nodes.
> 
> Without a valid node provided during the bind, the driver
> associated to OP-TEE TA can't be referenced.
> 
> For example to force the sequence number with alias
> (.flags = DM_UC_FLAG_SEQ_ALIAS)
> 
>  	aliases {
> 		rng0 = &optee;
>  	};
> 
> or other configuration:
> 
> board-sysinfo {
>    compatible = "vendor,sysinfo-board";
>    ramdom = <&optee>;
> }
> 
> With this patch all drivers bound from OP-TEE service
> discovery are now associated are associated to OP-TEE

s/are now associated are associated/are now associated

> node, allowing to identify by phandle the driver
> provided by the TA for one UCLASS without modifying
> device tree.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> ---
> 
>  drivers/tee/optee/core.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> index 9240277579be..96f08074443f 100644
> --- a/drivers/tee/optee/core.c
> +++ b/drivers/tee/optee/core.c
> @@ -92,7 +92,8 @@ static int bind_service_list(struct udevice *dev, struct tee_shm *service_list,
>  		if (!service)
>  			continue;
>  
> -		ret = device_bind_driver(dev, service->driver_name, service->driver_name, NULL);
> +		ret = device_bind_driver_to_node(dev, service->driver_name, service->driver_name,
> +						 dev_ofnode(dev), NULL);
>  		if (ret) {
>  			dev_warn(dev, "%s was not bound: %d, ignored\n", service->driver_name, ret);
>  			continue;
> @@ -832,7 +833,8 @@ static int optee_probe(struct udevice *dev)
>  		 * Discovery of TAs on the TEE bus is not supported in U-Boot:
>  		 * only bind the drivers associated to the supported OP-TEE TA
>  		 */
> -		ret = device_bind_driver(dev, "optee-rng", "optee-rng", NULL);
> +		ret = device_bind_driver_to_node(dev, "optee-rng", "optee-rng",
> +						 dev_ofnode(dev), NULL);
>  		if (ret)
>  			return ret;
>  	}
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] optee: bind the TA drivers on OP-TEE node
  2022-12-15  8:54 [PATCH] optee: bind the TA drivers on OP-TEE node Patrick Delaunay
  2023-01-03 13:10 ` [Uboot-stm32] " Patrice CHOTARD
@ 2023-01-12 15:18 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2023-01-12 15:18 UTC (permalink / raw)
  To: Patrick Delaunay; +Cc: u-boot, Etienne CARRIERE, Jens Wiklander, U-Boot STM32

[-- Attachment #1: Type: text/plain, Size: 977 bytes --]

On Thu, Dec 15, 2022 at 09:54:52AM +0100, Patrick Delaunay wrote:

> In U-Boot driver model the devices can be referenced by
> phandle in the U-Boot configuration nodes.
> 
> Without a valid node provided during the bind, the driver
> associated to OP-TEE TA can't be referenced.
> 
> For example to force the sequence number with alias
> (.flags = DM_UC_FLAG_SEQ_ALIAS)
> 
>  	aliases {
> 		rng0 = &optee;
>  	};
> 
> or other configuration:
> 
> board-sysinfo {
>    compatible = "vendor,sysinfo-board";
>    ramdom = <&optee>;
> }
> 
> With this patch all drivers bound from OP-TEE service
> discovery are now associated are associated to OP-TEE
> node, allowing to identify by phandle the driver
> provided by the TA for one UCLASS without modifying
> device tree.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-12 15:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-15  8:54 [PATCH] optee: bind the TA drivers on OP-TEE node Patrick Delaunay
2023-01-03 13:10 ` [Uboot-stm32] " Patrice CHOTARD
2023-01-12 15:18 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.