]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: stmmac: sunxi: convert to set_clk_tx_rate()
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Tue, 15 Apr 2025 12:58:00 +0000 (13:58 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 18 Apr 2025 01:41:40 +0000 (18:41 -0700)
Convert sunxi to use the set_clk_tx_rate() callback rather than the
fix_mac_speed() callback.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1u4frU-000nMf-6o@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c

index 9f098ff0ff05851017596c8bcb522d7a1f445a3c..a245c223a18f7d98db338efaf6be9dd089eef13e 100644 (file)
@@ -72,28 +72,28 @@ static void sun7i_gmac_exit(struct platform_device *pdev, void *priv)
                regulator_disable(gmac->regulator);
 }
 
-static void sun7i_fix_speed(void *priv, int speed, unsigned int mode)
+static int sun7i_set_clk_tx_rate(void *bsp_priv, struct clk *clk_tx_i,
+                                phy_interface_t interface, int speed)
 {
-       struct sunxi_priv_data *gmac = priv;
-
-       /* only GMII mode requires us to reconfigure the clock lines */
-       if (gmac->interface != PHY_INTERFACE_MODE_GMII)
-               return;
-
-       if (gmac->clk_enabled) {
-               clk_disable(gmac->tx_clk);
-               gmac->clk_enabled = 0;
-       }
-       clk_unprepare(gmac->tx_clk);
-
-       if (speed == 1000) {
-               clk_set_rate(gmac->tx_clk, SUN7I_GMAC_GMII_RGMII_RATE);
-               clk_prepare_enable(gmac->tx_clk);
-               gmac->clk_enabled = 1;
-       } else {
-               clk_set_rate(gmac->tx_clk, SUN7I_GMAC_MII_RATE);
-               clk_prepare(gmac->tx_clk);
+       struct sunxi_priv_data *gmac = bsp_priv;
+
+       if (interface == PHY_INTERFACE_MODE_GMII) {
+               if (gmac->clk_enabled) {
+                       clk_disable(gmac->tx_clk);
+                       gmac->clk_enabled = 0;
+               }
+               clk_unprepare(gmac->tx_clk);
+
+               if (speed == 1000) {
+                       clk_set_rate(gmac->tx_clk, SUN7I_GMAC_GMII_RGMII_RATE);
+                       clk_prepare_enable(gmac->tx_clk);
+                       gmac->clk_enabled = 1;
+               } else {
+                       clk_set_rate(gmac->tx_clk, SUN7I_GMAC_MII_RATE);
+                       clk_prepare(gmac->tx_clk);
+               }
        }
+       return 0;
 }
 
 static int sun7i_gmac_probe(struct platform_device *pdev)
@@ -140,7 +140,7 @@ static int sun7i_gmac_probe(struct platform_device *pdev)
        plat_dat->bsp_priv = gmac;
        plat_dat->init = sun7i_gmac_init;
        plat_dat->exit = sun7i_gmac_exit;
-       plat_dat->fix_mac_speed = sun7i_fix_speed;
+       plat_dat->set_clk_tx_rate = sun7i_set_clk_tx_rate;
        plat_dat->tx_fifo_size = 4096;
        plat_dat->rx_fifo_size = 16384;