From: Manorit Chawdhry Date: Fri, 14 Apr 2023 04:18:00 +0000 (+0530) Subject: remoteproc: ti_k3_arm64: Change the startup of arm64 core X-Git-Url: http://git.dujemihanovic.xyz/login.html?a=commitdiff_plain;h=65f3afc6b92a4c1cb4fa0dc47d810db9a4dad5e9;p=u-boot.git remoteproc: ti_k3_arm64: Change the startup of arm64 core 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 --- diff --git a/drivers/remoteproc/ti_k3_arm64_rproc.c b/drivers/remoteproc/ti_k3_arm64_rproc.c index 1f2415dc1a..99f11000df 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; }