[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240619-icc_bw_voting_from_ethqos-v1-1-6112948b825e@quicinc.com>
Date: Wed, 19 Jun 2024 15:41:29 -0700
From: Sagar Cheluvegowda <quic_scheluve@...cinc.com>
To: Vinod Koul <vkoul@...nel.org>,
Alexandre Torgue
<alexandre.torgue@...s.st.com>,
Jose Abreu <joabreu@...opsys.com>,
"David S.
Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
"Jakub
Kicinski" <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Maxime Coquelin
<mcoquelin.stm32@...il.com>,
Russell King <linux@...linux.org.uk>, "Rob
Herring" <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
"Conor
Dooley" <conor+dt@...nel.org>,
Bhupesh Sharma <bhupesh.sharma@...aro.org>
CC: <kernel@...cinc.com>, Andrew Halaney <ahalaney@...hat.com>,
<linux-arm-msm@...r.kernel.org>, <netdev@...r.kernel.org>,
<linux-stm32@...md-mailman.stormreply.com>,
<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
<devicetree@...r.kernel.org>,
Sagar Cheluvegowda <quic_scheluve@...cinc.com>
Subject: [PATCH 1/3] net: stmmac: Add interconnect support in qcom-ethqos
driver
Add interconnect support in qcom-ethqos driver to vote for bus
bandwidth based on the current speed of the driver.
This change adds support for two different paths - one from ethernet
to DDR and the other from Apps to ethernet.
Vote from each interconnect client is aggregated and the on-chip
interconnect hardware is configured to the most appropriate
bandwidth profile.
Signed-off-by: Sagar Cheluvegowda <quic_scheluve@...cinc.com>
---
.../net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index e254b21fdb59..682e68f37dbd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -7,6 +7,7 @@
#include <linux/platform_device.h>
#include <linux/phy.h>
#include <linux/phy/phy.h>
+#include <linux/interconnect.h>
#include "stmmac.h"
#include "stmmac_platform.h"
@@ -113,6 +114,9 @@ struct qcom_ethqos {
unsigned int num_por;
bool rgmii_config_loopback_en;
bool has_emac_ge_3;
+
+ struct icc_path *axi_icc_path;
+ struct icc_path *ahb_icc_path;
};
static int rgmii_readl(struct qcom_ethqos *ethqos, unsigned int offset)
@@ -668,12 +672,19 @@ static int ethqos_configure(struct qcom_ethqos *ethqos)
return ethqos->configure_func(ethqos);
}
+static void ethqos_set_icc_bw(struct qcom_ethqos *ethqos, unsigned int speed)
+{
+ icc_set_bw(ethqos->axi_icc_path, Mbps_to_icc(speed), Mbps_to_icc(speed));
+ icc_set_bw(ethqos->ahb_icc_path, Mbps_to_icc(speed), Mbps_to_icc(speed));
+}
+
static void ethqos_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode)
{
struct qcom_ethqos *ethqos = priv;
ethqos->speed = speed;
ethqos_update_link_clk(ethqos, speed);
+ ethqos_set_icc_bw(ethqos, speed);
ethqos_configure(ethqos);
}
@@ -813,6 +824,14 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
return dev_err_probe(dev, PTR_ERR(ethqos->link_clk),
"Failed to get link_clk\n");
+ ethqos->axi_icc_path = devm_of_icc_get(dev, "axi_icc_path");
+ if (IS_ERR(ethqos->axi_icc_path))
+ return PTR_ERR(ethqos->axi_icc_path);
+
+ ethqos->ahb_icc_path = devm_of_icc_get(dev, "ahb_icc_path");
+ if (IS_ERR(ethqos->axi_icc_path))
+ return PTR_ERR(ethqos->axi_icc_path);
+
ret = ethqos_clks_config(ethqos, true);
if (ret)
return ret;
--
2.34.1
Powered by blists - more mailing lists