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 65FD5C77B6E for ; Wed, 12 Apr 2023 08:30:24 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 850A585FC0; Wed, 12 Apr 2023 10:29:07 +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="D71x710D"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3C86B85F95; Wed, 12 Apr 2023 10:28:44 +0200 (CEST) Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (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 5371685ED1 for ; Wed, 12 Apr 2023 10:28:35 +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 lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 33C8SW2L020623; Wed, 12 Apr 2023 03:28:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1681288112; bh=OJBdejvfwpHRYic6k8pquc+04HtoO3t1KOFYgRiXMgg=; h=From:Date:Subject:References:In-Reply-To:To:CC; b=D71x710DP7qPpnv3NeT9vUfqslv2xgG1RJghCCwXeGYuik7dMxX8MylhktEHG8dtk Ezdu4uyAkVChR5Wy9ordY7NxVUh3Q2Bq3TBKpPGEJF3/pbJVWzaag4s9VVCnVfNAOG fW2xDgYvtDg2OrwS+OG89yOQP1X/mh3B4zJn4WZs= Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 33C8SW5x058133 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 12 Apr 2023 03:28:32 -0500 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16; Wed, 12 Apr 2023 03:28:31 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE107.ent.ti.com (157.170.170.37) 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; Wed, 12 Apr 2023 03:28:31 -0500 Received: from [127.0.1.1] (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 33C8SAAV098022; Wed, 12 Apr 2023 03:28:30 -0500 From: Manorit Chawdhry Date: Wed, 12 Apr 2023 13:58:06 +0530 Subject: [PATCH 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-v1-9-44771ffee620@ti.com> References: <20230411-upstream-firewalling-v1-0-44771ffee620@ti.com> In-Reply-To: <20230411-upstream-firewalling-v1-0-44771ffee620@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=1681288090; l=3669; i=m-chawdhry@ti.com; s=20230324; h=from:subject:message-id; bh=zql0qjDvUdC/0Mco7AjWpS2JLunleFVmSsRYPiRkW38=; b=0mpO/48NhBMRv3q531ug0TWchmJ9Cuw4rMrgSHYzvua3ZqkssVscFCQSmeCr33kLiImSp1AVI xiyquSq8IDJAb+0o57mY4DWFj/ZD5M6nV/sz3JRKC6pvG/mDOFl+t0Z 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