summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2026-02-25 04:43:25 +0300
committerJakub Kicinski <kuba@kernel.org>2026-02-25 04:43:25 +0300
commita09eb622f383e6ceff7d55072cba4d4b8234d5d5 (patch)
treed2fab21f7ffe0efaea93fc54a4bb446ca9d57fc0
parent583706230ea4d5f7f88563cd63056220a5f48c73 (diff)
parent9192320a65b7b1496fa9d39f7207d6d1fca48b06 (diff)
downloadlinux-a09eb622f383e6ceff7d55072cba4d4b8234d5d5.tar.xz
Merge branch 'net-stmmac-qcom-ethqos-cleanups-and-re-organise-serdes-handling'
Russell King says: ==================== net: stmmac: qcom-ethqos: cleanups and re-organise SerDes handling As the last series had issues with stability, I've changed the approach in this series to concentrate on keeping much of the SerDes related code within the qcom-ethqos driver rather than trying to move it out at this stage. This means it should be possible to bisect these patches and pinpoint exactly the code movement that causes any instability. This series starts with various cleanups to qcom-ethqos (the first four patches) before beginning to move code, passing phylink's phy interface (which will change) to the fix_mac_speed() method, and then using that to configure the serdes and inband setting before moving the SerDes code. This patch set has been tested. ==================== Link: https://patch.msgid.link/aZwfAFJQcp9f0niI@shell.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c3
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c11
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c3
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c135
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c3
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c11
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c3
-rw-r--r--include/linux/stmmac.h3
8 files changed, 101 insertions, 71 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
index d043bad4a862..0495437d3a6e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
@@ -112,7 +112,8 @@ static int dwc_qos_probe(struct platform_device *pdev,
#define AUTO_CAL_STATUS 0x880c
#define AUTO_CAL_STATUS_ACTIVE BIT(31)
-static void tegra_eqos_fix_speed(void *bsp_priv, int speed, unsigned int mode)
+static void tegra_eqos_fix_speed(void *bsp_priv, phy_interface_t interface,
+ int speed, unsigned int mode)
{
struct tegra_eqos *eqos = bsp_priv;
bool needs_calibration = false;
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
index c4e85197629d..9f5a15b81f8a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
@@ -48,7 +48,8 @@ struct imx_dwmac_ops {
int (*fix_soc_reset)(struct stmmac_priv *priv);
int (*set_intf_mode)(struct imx_priv_data *dwmac, u8 phy_intf_sel);
- void (*fix_mac_speed)(void *priv, int speed, unsigned int mode);
+ void (*fix_mac_speed)(void *priv, phy_interface_t interface,
+ int speed, unsigned int mode);
};
struct imx_priv_data {
@@ -160,7 +161,8 @@ static int imx_dwmac_set_clk_tx_rate(void *bsp_priv, struct clk *clk_tx_i,
return stmmac_set_clk_tx_rate(bsp_priv, clk_tx_i, interface, speed);
}
-static void imx_dwmac_fix_speed(void *priv, int speed, unsigned int mode)
+static void imx_dwmac_fix_speed(void *priv, phy_interface_t interface,
+ int speed, unsigned int mode)
{
struct plat_stmmacenet_data *plat_dat;
struct imx_priv_data *dwmac = priv;
@@ -185,13 +187,14 @@ static void imx_dwmac_fix_speed(void *priv, int speed, unsigned int mode)
dev_err(dwmac->dev, "failed to set tx rate %lu\n", rate);
}
-static void imx93_dwmac_fix_speed(void *priv, int speed, unsigned int mode)
+static void imx93_dwmac_fix_speed(void *priv, phy_interface_t interface,
+ int speed, unsigned int mode)
{
struct imx_priv_data *dwmac = priv;
unsigned int iface;
int ctrl, old_ctrl;
- imx_dwmac_fix_speed(priv, speed, mode);
+ imx_dwmac_fix_speed(priv, interface, speed, mode);
if (!dwmac || mode != MLO_AN_FIXED)
return;
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
index 815213223583..9c51c96223ad 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
@@ -143,7 +143,8 @@ static struct stmmac_pci_info loongson_gmac_pci_info = {
.setup = loongson_gmac_data,
};
-static void loongson_gnet_fix_speed(void *priv, int speed, unsigned int mode)
+static void loongson_gnet_fix_speed(void *priv, phy_interface_t interface,
+ int speed, unsigned int mode)
{
struct loongson_data *ld = (struct loongson_data *)priv;
struct net_device *ndev = dev_get_drvdata(ld->dev);
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index af8204c0e188..ad5b5d950fff 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -87,8 +87,8 @@ struct ethqos_emac_por {
};
struct ethqos_emac_driver_data {
- const struct ethqos_emac_por *por;
- unsigned int num_por;
+ const struct ethqos_emac_por *rgmii_por;
+ unsigned int num_rgmii_por;
bool rgmii_config_loopback_en;
bool has_emac_ge_3;
const char *link_clk_name;
@@ -100,16 +100,16 @@ struct ethqos_emac_driver_data {
struct qcom_ethqos {
struct platform_device *pdev;
void __iomem *rgmii_base;
- int (*configure_func)(struct qcom_ethqos *ethqos, int speed);
+ void (*configure_func)(struct qcom_ethqos *ethqos,
+ phy_interface_t interface, int speed);
- unsigned int link_clk_rate;
struct clk *link_clk;
struct phy *serdes_phy;
int serdes_speed;
phy_interface_t phy_mode;
- const struct ethqos_emac_por *por;
- unsigned int num_por;
+ const struct ethqos_emac_por *rgmii_por;
+ unsigned int num_rgmii_por;
bool rgmii_config_loopback_en;
bool has_emac_ge_3;
bool needs_sgmii_loopback;
@@ -174,19 +174,20 @@ static void rgmii_dump(void *priv)
rgmii_readl(ethqos, EMAC_SYSTEM_LOW_POWER_DEBUG));
}
-static void
-ethqos_update_link_clk(struct qcom_ethqos *ethqos, int speed)
+static int ethqos_set_clk_tx_rate(void *bsp_priv, struct clk *clk_tx_i,
+ phy_interface_t interface, int speed)
{
+ struct qcom_ethqos *ethqos = bsp_priv;
long rate;
- if (!phy_interface_mode_is_rgmii(ethqos->phy_mode))
- return;
+ if (!phy_interface_mode_is_rgmii(interface))
+ return 0;
rate = rgmii_clock(speed);
- if (rate > 0)
- ethqos->link_clk_rate = rate * 2;
+ if (rate < 0)
+ return rate;
- clk_set_rate(ethqos->link_clk, ethqos->link_clk_rate);
+ return clk_set_rate(ethqos->link_clk, rate * 2);
}
static void
@@ -204,7 +205,6 @@ qcom_ethqos_set_sgmii_loopback(struct qcom_ethqos *ethqos, bool enable)
static void ethqos_set_func_clk_en(struct qcom_ethqos *ethqos)
{
- qcom_ethqos_set_sgmii_loopback(ethqos, true);
rgmii_setmask(ethqos, RGMII_CONFIG_FUNC_CLK_EN, RGMII_IO_MACRO_CONFIG);
}
@@ -218,8 +218,8 @@ static const struct ethqos_emac_por emac_v2_3_0_por[] = {
};
static const struct ethqos_emac_driver_data emac_v2_3_0_data = {
- .por = emac_v2_3_0_por,
- .num_por = ARRAY_SIZE(emac_v2_3_0_por),
+ .rgmii_por = emac_v2_3_0_por,
+ .num_rgmii_por = ARRAY_SIZE(emac_v2_3_0_por),
.rgmii_config_loopback_en = true,
.has_emac_ge_3 = false,
};
@@ -234,8 +234,8 @@ static const struct ethqos_emac_por emac_v2_1_0_por[] = {
};
static const struct ethqos_emac_driver_data emac_v2_1_0_data = {
- .por = emac_v2_1_0_por,
- .num_por = ARRAY_SIZE(emac_v2_1_0_por),
+ .rgmii_por = emac_v2_1_0_por,
+ .num_rgmii_por = ARRAY_SIZE(emac_v2_1_0_por),
.rgmii_config_loopback_en = false,
.has_emac_ge_3 = false,
};
@@ -250,8 +250,8 @@ static const struct ethqos_emac_por emac_v3_0_0_por[] = {
};
static const struct ethqos_emac_driver_data emac_v3_0_0_data = {
- .por = emac_v3_0_0_por,
- .num_por = ARRAY_SIZE(emac_v3_0_0_por),
+ .rgmii_por = emac_v3_0_0_por,
+ .num_rgmii_por = ARRAY_SIZE(emac_v3_0_0_por),
.rgmii_config_loopback_en = false,
.has_emac_ge_3 = true,
.dwmac4_addrs = {
@@ -282,8 +282,8 @@ static const struct ethqos_emac_por emac_v4_0_0_por[] = {
};
static const struct ethqos_emac_driver_data emac_v4_0_0_data = {
- .por = emac_v4_0_0_por,
- .num_por = ARRAY_SIZE(emac_v4_0_0_por),
+ .rgmii_por = emac_v4_0_0_por,
+ .num_rgmii_por = ARRAY_SIZE(emac_v4_0_0_por),
.rgmii_config_loopback_en = false,
.has_emac_ge_3 = true,
.link_clk_name = "phyaux",
@@ -361,10 +361,12 @@ static int ethqos_dll_configure(struct qcom_ethqos *ethqos)
SDCC_HC_REG_DLL_CONFIG2);
rgmii_updatel(ethqos, SDCC_DLL_CONFIG2_MCLK_FREQ_CALC,
- 0x1A << 10, SDCC_HC_REG_DLL_CONFIG2);
+ FIELD_PREP(SDCC_DLL_CONFIG2_MCLK_FREQ_CALC, 26),
+ SDCC_HC_REG_DLL_CONFIG2);
rgmii_updatel(ethqos, SDCC_DLL_CONFIG2_DDR_TRAFFIC_INIT_SEL,
- BIT(2), SDCC_HC_REG_DLL_CONFIG2);
+ FIELD_PREP(SDCC_DLL_CONFIG2_DDR_TRAFFIC_INIT_SEL,
+ 1), SDCC_HC_REG_DLL_CONFIG2);
rgmii_setmask(ethqos, SDCC_DLL_CONFIG2_DDR_TRAFFIC_INIT_SW,
SDCC_HC_REG_DLL_CONFIG2);
@@ -425,11 +427,13 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos, int speed)
if (ethqos->has_emac_ge_3) {
/* 0.9 ns */
rgmii_updatel(ethqos, SDCC_DDR_CONFIG_PRG_RCLK_DLY,
- 115, SDCC_HC_REG_DDR_CONFIG);
+ FIELD_PREP(SDCC_DDR_CONFIG_PRG_RCLK_DLY,
+ 115), SDCC_HC_REG_DDR_CONFIG);
} else {
/* 1.8 ns */
rgmii_updatel(ethqos, SDCC_DDR_CONFIG_PRG_RCLK_DLY,
- 57, SDCC_HC_REG_DDR_CONFIG);
+ FIELD_PREP(SDCC_DDR_CONFIG_PRG_RCLK_DLY,
+ 57), SDCC_HC_REG_DDR_CONFIG);
}
rgmii_setmask(ethqos, SDCC_DDR_CONFIG_PRG_DLY_EN,
SDCC_HC_REG_DDR_CONFIG);
@@ -451,7 +455,8 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos, int speed)
rgmii_updatel(ethqos, RGMII_CONFIG2_TX_CLK_PHASE_SHIFT_EN,
phase_shift, RGMII_IO_MACRO_CONFIG2);
rgmii_updatel(ethqos, RGMII_CONFIG_MAX_SPD_PRG_2,
- BIT(6), RGMII_IO_MACRO_CONFIG);
+ FIELD_PREP(RGMII_CONFIG_MAX_SPD_PRG_2, 1),
+ RGMII_IO_MACRO_CONFIG);
rgmii_clrmask(ethqos, RGMII_CONFIG2_RSVD_CONFIG15,
RGMII_IO_MACRO_CONFIG2);
@@ -464,7 +469,8 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos, int speed)
/* Write 0x5 to PRG_RCLK_DLY_CODE */
rgmii_updatel(ethqos, SDCC_DDR_CONFIG_EXT_PRG_RCLK_DLY_CODE,
- (BIT(29) | BIT(27)), SDCC_HC_REG_DDR_CONFIG);
+ FIELD_PREP(SDCC_DDR_CONFIG_EXT_PRG_RCLK_DLY_CODE,
+ 5), SDCC_HC_REG_DDR_CONFIG);
rgmii_setmask(ethqos, SDCC_DDR_CONFIG_EXT_PRG_RCLK_DLY,
SDCC_HC_REG_DDR_CONFIG);
rgmii_setmask(ethqos, SDCC_DDR_CONFIG_EXT_PRG_RCLK_DLY_EN,
@@ -487,7 +493,7 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos, int speed)
rgmii_updatel(ethqos, RGMII_CONFIG2_TX_CLK_PHASE_SHIFT_EN,
phase_shift, RGMII_IO_MACRO_CONFIG2);
rgmii_updatel(ethqos, RGMII_CONFIG_MAX_SPD_PRG_9,
- BIT(12) | GENMASK(9, 8),
+ FIELD_PREP(RGMII_CONFIG_MAX_SPD_PRG_9, 19),
RGMII_IO_MACRO_CONFIG);
rgmii_clrmask(ethqos, RGMII_CONFIG2_RSVD_CONFIG15,
RGMII_IO_MACRO_CONFIG2);
@@ -499,7 +505,8 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos, int speed)
RGMII_IO_MACRO_CONFIG2);
/* Write 0x5 to PRG_RCLK_DLY_CODE */
rgmii_updatel(ethqos, SDCC_DDR_CONFIG_EXT_PRG_RCLK_DLY_CODE,
- (BIT(29) | BIT(27)), SDCC_HC_REG_DDR_CONFIG);
+ FIELD_PREP(SDCC_DDR_CONFIG_EXT_PRG_RCLK_DLY_CODE,
+ 5), SDCC_HC_REG_DDR_CONFIG);
rgmii_setmask(ethqos, SDCC_DDR_CONFIG_EXT_PRG_RCLK_DLY,
SDCC_HC_REG_DDR_CONFIG);
rgmii_setmask(ethqos, SDCC_DDR_CONFIG_EXT_PRG_RCLK_DLY_EN,
@@ -515,16 +522,18 @@ static int ethqos_rgmii_macro_init(struct qcom_ethqos *ethqos, int speed)
return 0;
}
-static int ethqos_configure_rgmii(struct qcom_ethqos *ethqos, int speed)
+static void ethqos_configure_rgmii(struct qcom_ethqos *ethqos,
+ phy_interface_t interface, int speed)
{
struct device *dev = &ethqos->pdev->dev;
unsigned int i;
u32 val;
/* Reset to POR values and enable clk */
- for (i = 0; i < ethqos->num_por; i++)
- rgmii_writel(ethqos, ethqos->por[i].value,
- ethqos->por[i].offset);
+ for (i = 0; i < ethqos->num_rgmii_por; i++)
+ rgmii_writel(ethqos, ethqos->rgmii_por[i].value,
+ ethqos->rgmii_por[i].offset);
+
ethqos_set_func_clk_en(ethqos);
/* Initialize the DLL first */
@@ -580,8 +589,6 @@ static int ethqos_configure_rgmii(struct qcom_ethqos *ethqos, int speed)
ethqos_dll_configure(ethqos);
ethqos_rgmii_macro_init(ethqos, speed);
-
- return 0;
}
static void ethqos_set_serdes_speed(struct qcom_ethqos *ethqos, int speed)
@@ -600,53 +607,43 @@ static void ethqos_pcs_set_inband(struct stmmac_priv *priv, bool enable)
/* On interface toggle MAC registers gets reset.
* Configure MAC block for SGMII on ethernet phy link up
*/
-static int ethqos_configure_sgmii(struct qcom_ethqos *ethqos, int speed)
+static void ethqos_configure_sgmii(struct qcom_ethqos *ethqos,
+ phy_interface_t interface, int speed)
{
struct net_device *dev = platform_get_drvdata(ethqos->pdev);
struct stmmac_priv *priv = netdev_priv(dev);
switch (speed) {
case SPEED_2500:
- rgmii_setmask(ethqos, RGMII_CONFIG2_RGMII_CLK_SEL_CFG,
- RGMII_IO_MACRO_CONFIG2);
- ethqos_set_serdes_speed(ethqos, SPEED_2500);
- ethqos_pcs_set_inband(priv, false);
- break;
case SPEED_1000:
rgmii_setmask(ethqos, RGMII_CONFIG2_RGMII_CLK_SEL_CFG,
RGMII_IO_MACRO_CONFIG2);
- ethqos_set_serdes_speed(ethqos, SPEED_1000);
- ethqos_pcs_set_inband(priv, true);
break;
case SPEED_100:
- ethqos_set_serdes_speed(ethqos, SPEED_1000);
- ethqos_pcs_set_inband(priv, true);
break;
case SPEED_10:
rgmii_updatel(ethqos, RGMII_CONFIG_SGMII_CLK_DVDR,
FIELD_PREP(RGMII_CONFIG_SGMII_CLK_DVDR,
SGMII_10M_RX_CLK_DVDR),
RGMII_IO_MACRO_CONFIG);
- ethqos_set_serdes_speed(ethqos, SPEED_1000);
- ethqos_pcs_set_inband(priv, true);
break;
}
- return 0;
+ ethqos_pcs_set_inband(priv, interface == PHY_INTERFACE_MODE_SGMII);
}
-static int ethqos_configure(struct qcom_ethqos *ethqos, int speed)
+static void ethqos_configure(struct qcom_ethqos *ethqos,
+ phy_interface_t interface, int speed)
{
- return ethqos->configure_func(ethqos, speed);
+ return ethqos->configure_func(ethqos, interface, speed);
}
-static void ethqos_fix_mac_speed(void *priv, int speed, unsigned int mode)
+static void ethqos_fix_mac_speed(void *priv, phy_interface_t interface,
+ int speed, unsigned int mode)
{
struct qcom_ethqos *ethqos = priv;
- qcom_ethqos_set_sgmii_loopback(ethqos, false);
- ethqos_update_link_clk(ethqos, speed);
- ethqos_configure(ethqos, speed);
+ ethqos_configure(ethqos, interface, speed);
}
static int qcom_ethqos_serdes_powerup(struct net_device *ndev, void *priv)
@@ -681,6 +678,22 @@ static void qcom_ethqos_serdes_powerdown(struct net_device *ndev, void *priv)
phy_exit(ethqos->serdes_phy);
}
+static int ethqos_mac_finish_serdes(struct net_device *ndev, void *priv,
+ unsigned int mode,
+ phy_interface_t interface)
+{
+ struct qcom_ethqos *ethqos = priv;
+
+ qcom_ethqos_set_sgmii_loopback(ethqos, false);
+
+ if (interface == PHY_INTERFACE_MODE_SGMII)
+ ethqos_set_serdes_speed(ethqos, SPEED_1000);
+ else if (interface == PHY_INTERFACE_MODE_2500BASEX)
+ ethqos_set_serdes_speed(ethqos, SPEED_2500);
+
+ return 0;
+}
+
static int ethqos_clks_config(void *priv, bool enabled)
{
struct qcom_ethqos *ethqos = priv;
@@ -698,6 +711,7 @@ static int ethqos_clks_config(void *priv, bool enabled)
* cycled. The actual configuration will be adjusted once
* ethqos_fix_mac_speed() is invoked.
*/
+ qcom_ethqos_set_sgmii_loopback(ethqos, true);
ethqos_set_func_clk_en(ethqos);
} else {
clk_disable_unprepare(ethqos->link_clk);
@@ -766,6 +780,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
case PHY_INTERFACE_MODE_2500BASEX:
case PHY_INTERFACE_MODE_SGMII:
ethqos->configure_func = ethqos_configure_sgmii;
+ plat_dat->mac_finish = ethqos_mac_finish_serdes;
break;
default:
dev_err(dev, "Unsupported phy mode %s\n",
@@ -780,8 +795,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
"Failed to map rgmii resource\n");
data = of_device_get_match_data(dev);
- ethqos->por = data->por;
- ethqos->num_por = data->num_por;
+ ethqos->rgmii_por = data->rgmii_por;
+ ethqos->num_rgmii_por = data->num_rgmii_por;
ethqos->rgmii_config_loopback_en = data->rgmii_config_loopback_en;
ethqos->has_emac_ge_3 = data->has_emac_ge_3;
ethqos->needs_sgmii_loopback = data->needs_sgmii_loopback;
@@ -805,10 +820,14 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
"Failed to get serdes phy\n");
ethqos->serdes_speed = SPEED_1000;
- ethqos_update_link_clk(ethqos, SPEED_1000);
+ ethqos_set_clk_tx_rate(ethqos, NULL, plat_dat->phy_interface,
+ SPEED_1000);
+
+ qcom_ethqos_set_sgmii_loopback(ethqos, true);
ethqos_set_func_clk_en(ethqos);
plat_dat->bsp_priv = ethqos;
+ plat_dat->set_clk_tx_rate = ethqos_set_clk_tx_rate;
plat_dat->fix_mac_speed = ethqos_fix_mac_speed;
plat_dat->dump_debug_regs = rgmii_dump;
plat_dat->ptp_clk_freq_config = ethqos_ptp_clk_freq_config;
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index 4c8991f3b38d..c6b99814d391 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -72,7 +72,8 @@ struct socfpga_dwmac {
const struct socfpga_dwmac_ops *ops;
};
-static void socfpga_dwmac_fix_mac_speed(void *bsp_priv, int speed,
+static void socfpga_dwmac_fix_mac_speed(void *bsp_priv,
+ phy_interface_t interface, int speed,
unsigned int mode)
{
struct socfpga_dwmac *dwmac = (struct socfpga_dwmac *)bsp_priv;
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
index f50547b67fbc..6ebbf95d158f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
@@ -91,11 +91,13 @@ struct sti_dwmac {
struct regmap *regmap;
bool gmac_en;
int speed;
- void (*fix_retime_src)(void *priv, int speed, unsigned int mode);
+ void (*fix_retime_src)(void *priv, phy_interface_t interface,
+ int speed, unsigned int mode);
};
struct sti_dwmac_of_data {
- void (*fix_retime_src)(void *priv, int speed, unsigned int mode);
+ void (*fix_retime_src)(void *priv, phy_interface_t interface,
+ int speed, unsigned int mode);
};
enum {
@@ -114,7 +116,8 @@ static u32 stih4xx_tx_retime_val[] = {
| STIH4XX_ETH_SEL_INTERNAL_NOTEXT_PHYCLK,
};
-static void stih4xx_fix_retime_src(void *priv, int spd, unsigned int mode)
+static void stih4xx_fix_retime_src(void *priv, phy_interface_t interface,
+ int spd, unsigned int mode)
{
struct sti_dwmac *dwmac = priv;
u32 src = dwmac->tx_retime_src;
@@ -170,7 +173,7 @@ static int sti_set_phy_intf_sel(void *bsp_priv, u8 phy_intf_sel)
val = (dwmac->interface == PHY_INTERFACE_MODE_REVMII) ? 0 : ENMII;
regmap_update_bits(regmap, reg, ENMII_MASK, val);
- dwmac->fix_retime_src(dwmac, dwmac->speed, 0);
+ dwmac->fix_retime_src(dwmac, dwmac->interface, dwmac->speed, 0);
return 0;
}
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 82375d34ad57..d7c730179a7f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1071,7 +1071,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);
+ priv->plat->fix_mac_speed(priv->plat->bsp_priv, interface,
+ speed, mode);
if (!duplex)
ctrl &= ~priv->hw->link.duplex;
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 32352a216567..b96ae9dadfab 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -256,7 +256,8 @@ struct plat_stmmacenet_data {
int (*set_phy_intf_sel)(void *priv, u8 phy_intf_sel);
int (*set_clk_tx_rate)(void *priv, struct clk *clk_tx_i,
phy_interface_t interface, int speed);
- void (*fix_mac_speed)(void *priv, int speed, unsigned int mode);
+ void (*fix_mac_speed)(void *priv, phy_interface_t interface,
+ int speed, unsigned int mode);
int (*fix_soc_reset)(struct stmmac_priv *priv);
int (*serdes_powerup)(struct net_device *ndev, void *priv);
void (*serdes_powerdown)(struct net_device *ndev, void *priv);