]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: macb: rename bp->sgmii_phy field to bp->phy
authorThéo Lebrun <theo.lebrun@bootlin.com>
Thu, 23 Oct 2025 16:22:54 +0000 (18:22 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 28 Oct 2025 14:17:54 +0000 (15:17 +0100)
The bp->sgmii_phy field is initialised at probe by init_reset_optional()
if bp->phy_interface == PHY_INTERFACE_MODE_SGMII. It gets used by:
 - zynqmp_config: "cdns,zynqmp-gem" or "xlnx,zynqmp-gem" compatibles.
 - mpfs_config: "microchip,mpfs-macb" compatible.
 - versal_config: "xlnx,versal-gem" compatible.

Make name more generic as EyeQ5 requires the PHY in SGMII & RGMII cases.

Drop "for ZynqMP SGMII mode" comment that is already a lie, as it gets
used on Microchip platforms as well. And soon it won't be SGMII-only.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Link: https://patch.msgid.link/20251023-macb-eyeq5-v3-4-af509422c204@bootlin.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/cadence/macb.h
drivers/net/ethernet/cadence/macb_main.c

index 05bfa9bd47821ed1f40eaf8bc3ff024826c24aae..87414a2ddf6e3ad912b0d3c8e5e1954fe623f265 100644 (file)
@@ -1341,7 +1341,7 @@ struct macb {
 
        struct macb_ptp_info    *ptp_info;      /* macb-ptp interface */
 
-       struct phy              *sgmii_phy;     /* for ZynqMP SGMII mode */
+       struct phy              *phy;
 
        spinlock_t tsu_clk_lock; /* gem tsu clock locking */
        unsigned int tsu_rate;
index 8b688a6cb2f941a07819a12b55f2c6bc28f49a9d..44188e7eee5699ea5f010a40c7087e226004b540 100644 (file)
@@ -2965,7 +2965,7 @@ static int macb_open(struct net_device *dev)
 
        macb_init_hw(bp);
 
-       err = phy_power_on(bp->sgmii_phy);
+       err = phy_power_on(bp->phy);
        if (err)
                goto reset_hw;
 
@@ -2981,7 +2981,7 @@ static int macb_open(struct net_device *dev)
        return 0;
 
 phy_off:
-       phy_power_off(bp->sgmii_phy);
+       phy_power_off(bp->phy);
 
 reset_hw:
        macb_reset_hw(bp);
@@ -3013,7 +3013,7 @@ static int macb_close(struct net_device *dev)
        phylink_stop(bp->phylink);
        phylink_disconnect_phy(bp->phylink);
 
-       phy_power_off(bp->sgmii_phy);
+       phy_power_off(bp->phy);
 
        spin_lock_irqsave(&bp->lock, flags);
        macb_reset_hw(bp);
@@ -5141,13 +5141,13 @@ static int init_reset_optional(struct platform_device *pdev)
 
        if (bp->phy_interface == PHY_INTERFACE_MODE_SGMII) {
                /* Ensure PHY device used in SGMII mode is ready */
-               bp->sgmii_phy = devm_phy_optional_get(&pdev->dev, NULL);
+               bp->phy = devm_phy_optional_get(&pdev->dev, NULL);
 
-               if (IS_ERR(bp->sgmii_phy))
-                       return dev_err_probe(&pdev->dev, PTR_ERR(bp->sgmii_phy),
+               if (IS_ERR(bp->phy))
+                       return dev_err_probe(&pdev->dev, PTR_ERR(bp->phy),
                                             "failed to get SGMII PHY\n");
 
-               ret = phy_init(bp->sgmii_phy);
+               ret = phy_init(bp->phy);
                if (ret)
                        return dev_err_probe(&pdev->dev, ret,
                                             "failed to init SGMII PHY\n");
@@ -5176,7 +5176,7 @@ static int init_reset_optional(struct platform_device *pdev)
        /* Fully reset controller at hardware level if mapped in device tree */
        ret = device_reset_optional(&pdev->dev);
        if (ret) {
-               phy_exit(bp->sgmii_phy);
+               phy_exit(bp->phy);
                return dev_err_probe(&pdev->dev, ret, "failed to reset controller");
        }
 
@@ -5184,7 +5184,7 @@ static int init_reset_optional(struct platform_device *pdev)
 
 err_out_phy_exit:
        if (ret)
-               phy_exit(bp->sgmii_phy);
+               phy_exit(bp->phy);
 
        return ret;
 }
@@ -5594,7 +5594,7 @@ err_out_unregister_mdio:
        mdiobus_free(bp->mii_bus);
 
 err_out_phy_exit:
-       phy_exit(bp->sgmii_phy);
+       phy_exit(bp->phy);
 
 err_out_free_netdev:
        free_netdev(dev);
@@ -5618,7 +5618,7 @@ static void macb_remove(struct platform_device *pdev)
        if (dev) {
                bp = netdev_priv(dev);
                unregister_netdev(dev);
-               phy_exit(bp->sgmii_phy);
+               phy_exit(bp->phy);
                mdiobus_unregister(bp->mii_bus);
                mdiobus_free(bp->mii_bus);
 
@@ -5645,7 +5645,7 @@ static int __maybe_unused macb_suspend(struct device *dev)
        u32 tmp;
 
        if (!device_may_wakeup(&bp->dev->dev))
-               phy_exit(bp->sgmii_phy);
+               phy_exit(bp->phy);
 
        if (!netif_running(netdev))
                return 0;
@@ -5774,7 +5774,7 @@ static int __maybe_unused macb_resume(struct device *dev)
        int err;
 
        if (!device_may_wakeup(&bp->dev->dev))
-               phy_init(bp->sgmii_phy);
+               phy_init(bp->phy);
 
        if (!netif_running(netdev))
                return 0;