net: stmmac: add new mode parameter for fix_mac_speed
authorShenwei Wang <shenwei.wang@nxp.com>
Mon, 7 Aug 2023 16:07:15 +0000 (11:07 -0500)
committerJakub Kicinski <kuba@kernel.org>
Fri, 11 Aug 2023 00:26:06 +0000 (17:26 -0700)
A mode parameter has been added to the callback function of fix_mac_speed
to indicate the physical layer type.

The mode can be one the following:
MLO_AN_PHY - Conventional PHY
MLO_AN_FIXED - Fixed-link mode
MLO_AN_INBAND - In-band protocol

Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
Link: https://lore.kernel.org/r/20230807160716.259072-2-shenwei.wang@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
14 files changed:
drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c
drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c
drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
include/linux/stmmac.h

index 74c10373cc3993f666985ba4b4a971c0286ac365..61ebf36da13de7eec8b55ae63812fb56a04c36a4 100644 (file)
@@ -178,7 +178,7 @@ static void dwc_qos_remove(struct platform_device *pdev)
 #define AUTO_CAL_STATUS 0x880c
 #define  AUTO_CAL_STATUS_ACTIVE BIT(31)
 
-static void tegra_eqos_fix_speed(void *priv, unsigned int speed)
+static void tegra_eqos_fix_speed(void *priv, unsigned int speed, unsigned int mode)
 {
        struct tegra_eqos *eqos = priv;
        unsigned long rate = 125000000;
index 645a9454a49047764eff1b1cc72fc3dc9dc3f61e..7c4f3ad88bdcd5ae0c3925c1b01b5ac996e03c58 100644 (file)
@@ -178,7 +178,7 @@ static void imx_dwmac_exit(struct platform_device *pdev, void *priv)
        /* nothing to do now */
 }
 
-static void imx_dwmac_fix_speed(void *priv, unsigned int speed)
+static void imx_dwmac_fix_speed(void *priv, unsigned int speed, unsigned int mode)
 {
        struct plat_stmmacenet_data *plat_dat;
        struct imx_priv_data *dwmac = priv;
index a5e639ab0b9e742e1caa0aac104fa5a88851dc77..d352a14f9d483c5e43628c889e405c17f8e74616 100644 (file)
@@ -22,13 +22,13 @@ struct intel_dwmac {
 };
 
 struct intel_dwmac_data {
-       void (*fix_mac_speed)(void *priv, unsigned int speed);
+       void (*fix_mac_speed)(void *priv, unsigned int speed, unsigned int mode);
        unsigned long ptp_ref_clk_rate;
        unsigned long tx_clk_rate;
        bool tx_clk_en;
 };
 
-static void kmb_eth_fix_mac_speed(void *priv, unsigned int speed)
+static void kmb_eth_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode)
 {
        struct intel_dwmac *dwmac = priv;
        unsigned long rate;
index e39406df8516f1a0006725b1ad041747bd73b133..9b02007491094890834ee9bc3da7825590c427ed 100644 (file)
@@ -257,7 +257,7 @@ static int ipq806x_gmac_of_parse(struct ipq806x_gmac *gmac)
        return PTR_ERR_OR_ZERO(gmac->qsgmii_csr);
 }
 
-static void ipq806x_gmac_fix_mac_speed(void *priv, unsigned int speed)
+static void ipq806x_gmac_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode)
 {
        struct ipq806x_gmac *gmac = priv;
 
index 7aa5e6bc04ebab474bb5631c4b5a4b90c77b1d26..959f88c6da16f1fe87f5392fb66527a31699184f 100644 (file)
@@ -22,7 +22,7 @@ struct meson_dwmac {
        void __iomem    *reg;
 };
 
-static void meson6_dwmac_fix_mac_speed(void *priv, unsigned int speed)
+static void meson6_dwmac_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode)
 {
        struct meson_dwmac *dwmac = priv;
        unsigned int val;
index 5b3df27035ec9624e5a9d5115ff4ed47ea359116..d3bf42d0fceb69bd084b9d05db0f7dacdb8cff18 100644 (file)
@@ -630,7 +630,7 @@ static int ethqos_configure(struct qcom_ethqos *ethqos)
        return ethqos->configure_func(ethqos);
 }
 
-static void ethqos_fix_mac_speed(void *priv, unsigned int speed)
+static void ethqos_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode)
 {
        struct qcom_ethqos *ethqos = priv;
 
index 35789cb549f72e14bbe2e6af9112622771ab9dca..d920a50dd16c7ce39b5e26a7b016ce2ceded95fd 100644 (file)
@@ -1785,7 +1785,7 @@ static void rk_gmac_powerdown(struct rk_priv_data *gmac)
        gmac_clk_enable(gmac, false);
 }
 
-static void rk_fix_speed(void *priv, unsigned int speed)
+static void rk_fix_speed(void *priv, unsigned int speed, unsigned int mode)
 {
        struct rk_priv_data *bsp_priv = priv;
        struct device *dev = &bsp_priv->pdev->dev;
index 6267bcb60206b3201d6990a01304e13d15034178..7db176e8691f89e1c6ebb49624cd5ecf15dbad60 100644 (file)
@@ -61,7 +61,7 @@ struct socfpga_dwmac {
        struct mdio_device *pcs_mdiodev;
 };
 
-static void socfpga_dwmac_fix_mac_speed(void *priv, unsigned int speed)
+static void socfpga_dwmac_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode)
 {
        struct socfpga_dwmac *dwmac = (struct socfpga_dwmac *)priv;
        void __iomem *splitter_base = dwmac->splitter_base;
index b1c5f2527c0d0e253e3d93b56102fe98b5709595..8926125646945cb40ef07963fb162e25916ba4ae 100644 (file)
@@ -24,7 +24,7 @@ struct starfive_dwmac {
        struct clk *clk_tx;
 };
 
-static void starfive_dwmac_fix_mac_speed(void *priv, unsigned int speed)
+static void starfive_dwmac_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode)
 {
        struct starfive_dwmac *dwmac = priv;
        unsigned long rate;
index ef03e466949182d5136f4167b13de41c6151fb27..0d653bbb931bdd0d110935575fdc536f9ea5bbff 100644 (file)
@@ -103,11 +103,11 @@ struct sti_dwmac {
        struct regmap *regmap;
        bool gmac_en;
        u32 speed;
-       void (*fix_retime_src)(void *priv, unsigned int speed);
+       void (*fix_retime_src)(void *priv, unsigned int speed, unsigned int mode);
 };
 
 struct sti_dwmac_of_data {
-       void (*fix_retime_src)(void *priv, unsigned int speed);
+       void (*fix_retime_src)(void *priv, unsigned int speed, unsigned int mode);
 };
 
 static u32 phy_intf_sels[] = {
@@ -135,7 +135,7 @@ static u32 stih4xx_tx_retime_val[] = {
                                 | STIH4XX_ETH_SEL_INTERNAL_NOTEXT_PHYCLK,
 };
 
-static void stih4xx_fix_retime_src(void *priv, u32 spd)
+static void stih4xx_fix_retime_src(void *priv, u32 spd, unsigned int mode)
 {
        struct sti_dwmac *dwmac = priv;
        u32 src = dwmac->tx_retime_src;
@@ -187,7 +187,7 @@ static int sti_dwmac_set_mode(struct sti_dwmac *dwmac)
        val = (iface == PHY_INTERFACE_MODE_REVMII) ? 0 : ENMII;
        regmap_update_bits(regmap, reg, ENMII_MASK, val);
 
-       dwmac->fix_retime_src(dwmac, dwmac->speed);
+       dwmac->fix_retime_src(dwmac, dwmac->speed, 0);
 
        return 0;
 }
index 50963e91c347a3d589223c98059ea0fe93f8874e..beceeae579bf1b094bcafe80bfa0390474d790be 100644 (file)
@@ -72,7 +72,7 @@ static void sun7i_gmac_exit(struct platform_device *pdev, void *priv)
                regulator_disable(gmac->regulator);
 }
 
-static void sun7i_fix_speed(void *priv, unsigned int speed)
+static void sun7i_fix_speed(void *priv, unsigned int speed, unsigned int mode)
 {
        struct sunxi_priv_data *gmac = priv;
 
index a8731ce0fff0993b5ab95f5ec285bd61b8a51d6e..22d113fb8e09cb0db115f3c4ea3d20b635998a9c 100644 (file)
@@ -54,7 +54,7 @@ struct visconti_eth {
        spinlock_t lock; /* lock to protect register update */
 };
 
-static void visconti_eth_fix_mac_speed(void *priv, unsigned int speed)
+static void visconti_eth_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode)
 {
        struct visconti_eth *dwmac = priv;
        struct net_device *netdev = dev_get_drvdata(dwmac->dev);
index fcab363d8dfa245269d6c3729951aa7fc4de37e1..351eca6109e01120dfbb7bbab7ba9f824d41b359 100644 (file)
@@ -1064,7 +1064,7 @@ static void stmmac_mac_link_up(struct phylink_config *config,
        priv->speed = speed;
 
        if (priv->plat->fix_mac_speed)
-               priv->plat->fix_mac_speed(priv->plat->bsp_priv, speed);
+               priv->plat->fix_mac_speed(priv->plat->bsp_priv, speed, mode);
 
        if (!duplex)
                ctrl &= ~priv->hw->link.duplex;
index 652404c03944b054cde9a81df7cd4627c01fbfb2..784277d666eb581ab00662165d2ccbeb51f9bf2b 100644 (file)
@@ -256,7 +256,7 @@ struct plat_stmmacenet_data {
        u8 tx_sched_algorithm;
        struct stmmac_rxq_cfg rx_queues_cfg[MTL_MAX_RX_QUEUES];
        struct stmmac_txq_cfg tx_queues_cfg[MTL_MAX_TX_QUEUES];
-       void (*fix_mac_speed)(void *priv, unsigned int speed);
+       void (*fix_mac_speed)(void *priv, unsigned int speed, unsigned int mode);
        int (*fix_soc_reset)(void *priv, void __iomem *ioaddr);
        int (*serdes_powerup)(struct net_device *ndev, void *priv);
        void (*serdes_powerdown)(struct net_device *ndev, void *priv);