net: stmmac: convert plat->phylink_node to fwnode
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Thu, 24 Aug 2023 13:37:58 +0000 (14:37 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 26 Aug 2023 01:55:18 +0000 (18:55 -0700)
All users of plat->phylink_node first convert it to a fwnode. Rather
than repeatedly convert to a fwnode, store it as a fwnode. To reflect
this change, call it plat->port_node instead - it is used for more
than just phylink.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://lore.kernel.org/r/E1qZAX8-005pTo-OT@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
include/linux/stmmac.h

index 7a9bbcf..a2dfb62 100644 (file)
@@ -1153,7 +1153,7 @@ static int stmmac_init_phy(struct net_device *dev)
        if (!phylink_expects_phy(priv->phylink))
                return 0;
 
-       fwnode = of_fwnode_handle(priv->plat->phylink_node);
+       fwnode = priv->plat->port_node;
        if (!fwnode)
                fwnode = dev_fwnode(priv->device);
 
@@ -1200,7 +1200,7 @@ static int stmmac_init_phy(struct net_device *dev)
 static int stmmac_phy_setup(struct stmmac_priv *priv)
 {
        struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data;
-       struct fwnode_handle *fwnode = of_fwnode_handle(priv->plat->phylink_node);
+       struct fwnode_handle *fwnode = priv->plat->port_node;
        int max_speed = priv->plat->max_speed;
        int mode = priv->plat->phy_interface;
        struct phylink *phylink;
index dd9e2fe..fa9e7e7 100644 (file)
@@ -533,11 +533,11 @@ int stmmac_mdio_register(struct net_device *ndev)
        int err = 0;
        struct mii_bus *new_bus;
        struct stmmac_priv *priv = netdev_priv(ndev);
-       struct fwnode_handle *fwnode = of_fwnode_handle(priv->plat->phylink_node);
        struct stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data;
        struct device_node *mdio_node = priv->plat->mdio_node;
        struct device *dev = ndev->dev.parent;
        struct fwnode_handle *fixed_node;
+       struct fwnode_handle *fwnode;
        int addr, found, max_addr;
 
        if (!mdio_bus_data)
@@ -601,6 +601,7 @@ int stmmac_mdio_register(struct net_device *ndev)
                stmmac_xgmac2_mdio_read_c45(new_bus, 0, 0, 0);
 
        /* If fixed-link is set, skip PHY scanning */
+       fwnode = priv->plat->port_node;
        if (!fwnode)
                fwnode = dev_fwnode(priv->device);
 
index be8e79c..ff33042 100644 (file)
@@ -428,7 +428,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
        plat->phy_node = of_parse_phandle(np, "phy-handle", 0);
 
        /* PHYLINK automatically parses the phy-handle property */
-       plat->phylink_node = np;
+       plat->port_node = of_fwnode_handle(np);
 
        /* Get max speed of operation from device tree */
        of_property_read_u32(np, "max-speed", &plat->max_speed);
index 784277d..b2ccd82 100644 (file)
@@ -227,7 +227,7 @@ struct plat_stmmacenet_data {
        phy_interface_t phy_interface;
        struct stmmac_mdio_bus_data *mdio_bus_data;
        struct device_node *phy_node;
-       struct device_node *phylink_node;
+       struct fwnode_handle *port_node;
        struct device_node *mdio_node;
        struct stmmac_dma_cfg *dma_cfg;
        struct stmmac_est *est;