From patchwork Thu Dec 15 08:54:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1716043 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=foss.st.com header.i=@foss.st.com header.a=rsa-sha256 header.s=selector1 header.b=Lo26vSGD; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NXmK1186Gz23yy for ; Thu, 15 Dec 2022 19:55:15 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E1EB48543C; Thu, 15 Dec 2022 09:55:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=foss.st.com header.i=@foss.st.com header.b="Lo26vSGD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A5F5A85471; Thu, 15 Dec 2022 09:55:06 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 484B285100 for ; Thu, 15 Dec 2022 09:55:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=prvs=83484b6235=patrick.delaunay@foss.st.com Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BF62X0V021276; Thu, 15 Dec 2022 09:55:03 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=selector1; bh=wFknKSWjLkofcPFEJjs1Y0LJF4H2YXvaa19vmHa/i/U=; b=Lo26vSGDsfFTV4cIqw19ioycZyRi58Qrix3hEDO75tZEeCwCVhY8huaDiF9PhvqkbRhv tEJzo6W1C0yU5gLlgvoKrw09Yy13MH20Tb3nQtaNmHNMnHCFv/5F7uHxWB5WgGOEXxzs t+ELMnpiV6m+m9Tb/vcnRVR6bjaLKfo8lZ/PhvGQEdpWJXocyIG96Q3A5wO6v/9YnlRE 0E9vCAme4LEfdVwKvf3cNQxqAp6cYCBVTBmByGI7XTe/o4K28z4xGZ0rqAJuuLhPMf8b DSdJKC+kIyLQLJaAPnWwN9wTYWyNbnzEvx1llAWoH0WFpJmiFgv46yjGiPcmNYQZkEFN OQ== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3mf6uwsmtn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Dec 2022 09:55:03 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D4978100034; Thu, 15 Dec 2022 09:54:58 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id BDCE7215123; Thu, 15 Dec 2022 09:54:58 +0100 (CET) Received: from localhost (10.48.0.157) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.13; Thu, 15 Dec 2022 09:54:56 +0100 From: Patrick Delaunay To: CC: Etienne CARRIERE , Patrick Delaunay , Jens Wiklander , U-Boot STM32 Subject: [PATCH] optee: bind the TA drivers on OP-TEE node Date: Thu, 15 Dec 2022 09:54:52 +0100 Message-ID: <20221215095446.1.Ia16a826f3adcee45569a6d47e8ba5b5e3c1d7373@changeid> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.48.0.157] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-15_03,2022-12-14_01,2022-06-22_01 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean 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 Reviewed-by: Patrice Chotard --- 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; }