Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BF0DDC77B6E for ; Fri, 14 Apr 2023 04:20:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9C1C585EFE; Fri, 14 Apr 2023 06:19:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="j8H7K9Yr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 794E885E3B; Fri, 14 Apr 2023 06:18:34 +0200 (CEST) Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (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 880ED85C52 for ; Fri, 14 Apr 2023 06:18:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=m-chawdhry@ti.com Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 33E4IRgv098187; Thu, 13 Apr 2023 23:18:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1681445907; bh=OJBdejvfwpHRYic6k8pquc+04HtoO3t1KOFYgRiXMgg=; h=From:Date:Subject:References:In-Reply-To:To:CC; b=j8H7K9YrK08NKV2tuXq/MAqiiRylF3D897eDvsDX3oNAsyg0npY8JuIcQib9kIuEQ exJRiid35T2bYijzFvT1Fx1iR/cBAd137+/BmNYvei/jhBI0gYhF5c/tB4FU417ITK jBQl1DqnfyCga97hjUgGEi0WlsXrlE13/wx9SmkM= Received: from DFLE111.ent.ti.com (dfle111.ent.ti.com [10.64.6.32]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 33E4IRVi001354 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 13 Apr 2023 23:18:27 -0500 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16; Thu, 13 Apr 2023 23:18:27 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16 via Frontend Transport; Thu, 13 Apr 2023 23:18:27 -0500 Received: from [127.0.1.1] (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 33E4I66W085211; Thu, 13 Apr 2023 23:18:25 -0500 From: Manorit Chawdhry Date: Fri, 14 Apr 2023 09:48:00 +0530 Subject: [PATCH v2 09/10] remoteproc: ti_k3_arm64: Change the startup of arm64 core MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-ID: <20230411-upstream-firewalling-v2-9-b6c705d50099@ti.com> References: <20230411-upstream-firewalling-v2-0-b6c705d50099@ti.com> In-Reply-To: <20230411-upstream-firewalling-v2-0-b6c705d50099@ti.com> To: Tom Rini CC: , Andrew Davis , Vignesh Raghavendra , Kamlesh Gurudasani , Manorit Chawdhry X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1681445886; l=3669; i=m-chawdhry@ti.com; s=20230324; h=from:subject:message-id; bh=zql0qjDvUdC/0Mco7AjWpS2JLunleFVmSsRYPiRkW38=; b=7SgApy7U1c8Kg7SfhqxpfM8On0J6f0S5dmCwlRARtBjuiEEW4wSN29SRbUaX/PXlpYbt4ng3H DvSyOzFK9+qA3Vl+5BTGA/LJRhF1uppx4Nr+/rTM+dfzRlqojVqrEF/ X-Developer-Key: i=m-chawdhry@ti.com; a=ed25519; pk=Z51yAzxWCcDqKRLHiDBrUxIdXbB21R89ms8xgECdiak= X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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.8 at phobos.denx.de X-Virus-Status: Clean Configuring master firewalls require the power of the cluster to be enabled before configuring them, change the load of rproc to configure the gtc clocks and start the cluster along with configuring the boot vector. The start of rproc will only start the core. Signed-off-by: Manorit Chawdhry --- drivers/remoteproc/ti_k3_arm64_rproc.c | 62 +++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/drivers/remoteproc/ti_k3_arm64_rproc.c b/drivers/remoteproc/ti_k3_arm64_rproc.c index 1f2415dc1a68..99f11000dfbf 100644 --- a/drivers/remoteproc/ti_k3_arm64_rproc.c +++ b/drivers/remoteproc/ti_k3_arm64_rproc.c @@ -36,6 +36,8 @@ * @gtc_base: Timer base address. */ struct k3_arm64_privdata { + bool has_cluster_node; + struct power_domain cluster_pwrdmn; struct power_domain rproc_pwrdmn; struct power_domain gtc_pwrdmn; struct reset_ctl rproc_rst; @@ -55,6 +57,7 @@ struct k3_arm64_privdata { static int k3_arm64_load(struct udevice *dev, ulong addr, ulong size) { struct k3_arm64_privdata *rproc = dev_get_priv(dev); + ulong gtc_rate; int ret; dev_dbg(dev, "%s addr = 0x%lx, size = 0x%lx\n", __func__, addr, size); @@ -64,26 +67,10 @@ static int k3_arm64_load(struct udevice *dev, ulong addr, ulong size) if (ret) return ret; - return ti_sci_proc_set_config(&rproc->tsp, addr, 0, 0); -} - -/** - * k3_arm64_start() - Start the remote processor - * @dev: rproc device pointer - * - * Return: 0 if all went ok, else return appropriate error - */ -static int k3_arm64_start(struct udevice *dev) -{ - struct k3_arm64_privdata *rproc = dev_get_priv(dev); - ulong gtc_rate; - int ret; - - dev_dbg(dev, "%s\n", __func__); - ret = power_domain_on(&rproc->gtc_pwrdmn); if (ret) { - dev_err(dev, "power_domain_on() failed: %d\n", ret); + dev_err(dev, "power_domain_on(&rproc->gtc_pwrdmn) failed: %d\n", + ret); return ret; } @@ -100,9 +87,36 @@ static int k3_arm64_start(struct udevice *dev) * assigned-clock-rates during the device probe. So no need to * set the frequency again here. */ + if (rproc->has_cluster_node) { + ret = power_domain_on(&rproc->cluster_pwrdmn); + if (ret) { + dev_err(dev, + "power_domain_on(&rproc->cluster_pwrdmn) failed: %d\n", + ret); + return ret; + } + } + + return ti_sci_proc_set_config(&rproc->tsp, addr, 0, 0); +} + +/** + * k3_arm64_start() - Start the remote processor + * @dev: rproc device pointer + * + * Return: 0 if all went ok, else return appropriate error + */ +static int k3_arm64_start(struct udevice *dev) +{ + struct k3_arm64_privdata *rproc = dev_get_priv(dev); + int ret; + + dev_dbg(dev, "%s\n", __func__); ret = power_domain_on(&rproc->rproc_pwrdmn); if (ret) { - dev_err(dev, "power_domain_on() failed: %d\n", ret); + dev_err(dev, + "power_domain_on(&rproc->rproc_pwrdmn) failed: %d\n", + ret); return ret; } @@ -166,9 +180,17 @@ static int k3_arm64_of_to_priv(struct udevice *dev, dev_dbg(dev, "%s\n", __func__); + /* Cluster needs to be powered on if firewalls are being configured */ + rproc->has_cluster_node = true; + ret = power_domain_get_by_index(dev, &rproc->cluster_pwrdmn, 2); + if (ret) { + dev_dbg(dev, "warning: power_domain_get_cluster() failed: %d\n", ret); + rproc->has_cluster_node = false; + } + ret = power_domain_get_by_index(dev, &rproc->rproc_pwrdmn, 1); if (ret) { - dev_err(dev, "power_domain_get() failed: %d\n", ret); + dev_err(dev, "power_domain_get_rproc() failed: %d\n", ret); return ret; } -- 2.34.1