From: Sagar Cheluvegowda <quic_scheluve@quicinc.com>
To: Vinod Koul <vkoul@kernel.org>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Jose Abreu <joabreu@synopsys.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"Rob Herring" <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
Bhupesh Sharma <bhupesh.sharma@linaro.org>
Cc: <kernel@quicinc.com>, Andrew Halaney <ahalaney@redhat.com>,
Andrew Lunn <andrew@lunn.ch>, <linux-arm-msm@vger.kernel.org>,
<netdev@vger.kernel.org>,
<linux-stm32@st-md-mailman.stormreply.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>,
Sagar Cheluvegowda <quic_scheluve@quicinc.com>
Subject: [PATCH v2 2/3] net: stmmac: Add interconnect support
Date: Tue, 25 Jun 2024 16:49:29 -0700 [thread overview]
Message-ID: <20240625-icc_bw_voting_from_ethqos-v2-2-eaa7cf9060f0@quicinc.com> (raw)
In-Reply-To: <20240625-icc_bw_voting_from_ethqos-v2-0-eaa7cf9060f0@quicinc.com>
Add interconnect support 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.
Suggested-by: Andrew Halaney <ahalaney@redhat.com>
Signed-off-by: Sagar Cheluvegowda <quic_scheluve@quicinc.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 +
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++++++
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 12 ++++++++++++
include/linux/stmmac.h | 2 ++
4 files changed, 23 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index b23b920eedb1..56a282d2b8cd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -21,6 +21,7 @@
#include <linux/ptp_clock_kernel.h>
#include <linux/net_tstamp.h>
#include <linux/reset.h>
+#include <linux/interconnect.h>
#include <net/page_pool/types.h>
#include <net/xdp.h>
#include <uapi/linux/bpf.h>
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index b3afc7cb7d72..ec7c61ee44d4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -985,6 +985,12 @@ static void stmmac_fpe_link_state_handle(struct stmmac_priv *priv, bool is_up)
}
}
+static void stmmac_set_icc_bw(struct stmmac_priv *priv, unsigned int speed)
+{
+ icc_set_bw(priv->plat->axi_icc_path, Mbps_to_icc(speed), Mbps_to_icc(speed));
+ icc_set_bw(priv->plat->ahb_icc_path, Mbps_to_icc(speed), Mbps_to_icc(speed));
+}
+
static void stmmac_mac_link_down(struct phylink_config *config,
unsigned int mode, phy_interface_t interface)
{
@@ -1080,6 +1086,8 @@ static void stmmac_mac_link_up(struct phylink_config *config,
if (priv->plat->fix_mac_speed)
priv->plat->fix_mac_speed(priv->plat->bsp_priv, speed, mode);
+ stmmac_set_icc_bw(priv, speed);
+
if (!duplex)
ctrl &= ~priv->hw->link.duplex;
else
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 54797edc9b38..e46c94b643a3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -642,6 +642,18 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
dev_dbg(&pdev->dev, "PTP rate %d\n", plat->clk_ptp_rate);
}
+ plat->axi_icc_path = devm_of_icc_get(&pdev->dev, "axi");
+ if (IS_ERR(plat->axi_icc_path)) {
+ ret = (void *)plat->axi_icc_path;
+ goto error_hw_init;
+ }
+
+ plat->ahb_icc_path = devm_of_icc_get(&pdev->dev, "ahb");
+ if (IS_ERR(plat->ahb_icc_path)) {
+ ret = (void *)plat->ahb_icc_path;
+ goto error_hw_init;
+ }
+
plat->stmmac_rst = devm_reset_control_get_optional(&pdev->dev,
STMMAC_RESOURCE_NAME);
if (IS_ERR(plat->stmmac_rst)) {
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index f92c195c76ed..385f352a0c23 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -283,6 +283,8 @@ struct plat_stmmacenet_data {
struct reset_control *stmmac_rst;
struct reset_control *stmmac_ahb_rst;
struct stmmac_axi *axi;
+ struct icc_path *axi_icc_path;
+ struct icc_path *ahb_icc_path;
int has_gmac4;
int rss_en;
int mac_port_sel_speed;
--
2.34.1
next prev parent reply other threads:[~2024-06-25 23:50 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-25 23:49 [PATCH v2 0/3] Add interconnect support for stmmac driver Sagar Cheluvegowda
2024-06-25 23:49 ` [PATCH v2 1/3] dt-bindings: net: qcom: ethernet: Add interconnect properties Sagar Cheluvegowda
2024-06-26 7:39 ` Krzysztof Kozlowski
2024-06-26 14:53 ` Andrew Halaney
2024-07-02 18:50 ` Sagar Cheluvegowda
2024-06-25 23:49 ` Sagar Cheluvegowda [this message]
2024-06-26 7:40 ` [PATCH v2 2/3] net: stmmac: Add interconnect support Krzysztof Kozlowski
2024-06-28 19:43 ` Sagar Cheluvegowda
2024-06-28 20:12 ` Andrew Lunn
2024-06-26 13:07 ` Andrew Lunn
2024-06-26 23:36 ` Sagar Cheluvegowda
2024-06-27 0:12 ` Andrew Lunn
2024-06-28 21:58 ` Sagar Cheluvegowda
2024-06-28 22:23 ` Andrew Lunn
2024-06-28 22:41 ` Sagar Cheluvegowda
2024-06-26 14:54 ` Andrew Halaney
2024-06-26 23:38 ` Sagar Cheluvegowda
2024-06-27 0:14 ` Andrew Lunn
2024-06-28 19:55 ` Sagar Cheluvegowda
2024-06-25 23:49 ` [PATCH v2 3/3] net: stmmac: Bring down the clocks to lower frequencies when mac link goes down Sagar Cheluvegowda
2024-06-26 14:58 ` Andrew Halaney
2024-06-26 15:10 ` Andrew Lunn
2024-06-28 21:50 ` Sagar Cheluvegowda
2024-07-01 19:18 ` Sagar Cheluvegowda
2024-06-28 22:16 ` Russell King (Oracle)
2024-07-02 23:38 ` Sagar Cheluvegowda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240625-icc_bw_voting_from_ethqos-v2-2-eaa7cf9060f0@quicinc.com \
--to=quic_scheluve@quicinc.com \
--cc=ahalaney@redhat.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew@lunn.ch \
--cc=bhupesh.sharma@linaro.org \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=joabreu@synopsys.com \
--cc=kernel@quicinc.com \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux@armlinux.org.uk \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh@kernel.org \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).