@@ -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>
@@ -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
@@ -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, "mac-mem");
+ if (IS_ERR(plat->axi_icc_path)) {
+ ret = ERR_CAST(plat->axi_icc_path);
+ goto error_hw_init;
+ }
+
+ plat->ahb_icc_path = devm_of_icc_get(&pdev->dev, "cpu-mac");
+ if (IS_ERR(plat->ahb_icc_path)) {
+ ret = ERR_CAST(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)) {
@@ -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;
Add interconnect support to vote for bus bandwidth based on the current speed of the driver. Adds support for two different paths - one from ethernet to DDR and the other from CPU 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(+)