Commit ab21cf92 authored by Ong Boon Leong's avatar Ong Boon Leong Committed by David S. Miller

net: stmmac: make mdio register skips PHY scanning for fixed-link

stmmac_mdio_register() lacks fixed-link consideration and only skip PHY
scanning if it has done DT style PHY discovery. So, for DT or ACPI _DSD
setting of fixed-link, the PHY scanning should not happen.

v2: fix incorrect order related to fwnode that is not caught in non-DT
    platform.
Tested-by: default avatarEmilio Riva <emilio.riva@ericsson.com>
Signed-off-by: default avatarOng Boon Leong <boon.leong.ong@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 72edaf39
...@@ -1128,18 +1128,20 @@ static void stmmac_check_pcs_mode(struct stmmac_priv *priv) ...@@ -1128,18 +1128,20 @@ static void stmmac_check_pcs_mode(struct stmmac_priv *priv)
static int stmmac_init_phy(struct net_device *dev) static int stmmac_init_phy(struct net_device *dev)
{ {
struct stmmac_priv *priv = netdev_priv(dev); struct stmmac_priv *priv = netdev_priv(dev);
struct device_node *node; struct fwnode_handle *fwnode;
int ret; int ret;
node = priv->plat->phylink_node; fwnode = of_fwnode_handle(priv->plat->phylink_node);
if (!fwnode)
fwnode = dev_fwnode(priv->device);
if (node) if (fwnode)
ret = phylink_of_phy_connect(priv->phylink, node, 0); ret = phylink_fwnode_phy_connect(priv->phylink, fwnode, 0);
/* Some DT bindings do not set-up the PHY handle. Let's try to /* Some DT bindings do not set-up the PHY handle. Let's try to
* manually parse it * manually parse it
*/ */
if (!node || ret) { if (!fwnode || ret) {
int addr = priv->plat->phy_addr; int addr = priv->plat->phy_addr;
struct phy_device *phydev; struct phy_device *phydev;
......
...@@ -434,9 +434,11 @@ int stmmac_mdio_register(struct net_device *ndev) ...@@ -434,9 +434,11 @@ int stmmac_mdio_register(struct net_device *ndev)
int err = 0; int err = 0;
struct mii_bus *new_bus; struct mii_bus *new_bus;
struct stmmac_priv *priv = netdev_priv(ndev); 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 stmmac_mdio_bus_data *mdio_bus_data = priv->plat->mdio_bus_data;
struct device_node *mdio_node = priv->plat->mdio_node; struct device_node *mdio_node = priv->plat->mdio_node;
struct device *dev = ndev->dev.parent; struct device *dev = ndev->dev.parent;
struct fwnode_handle *fixed_node;
int addr, found, max_addr; int addr, found, max_addr;
if (!mdio_bus_data) if (!mdio_bus_data)
...@@ -490,6 +492,18 @@ int stmmac_mdio_register(struct net_device *ndev) ...@@ -490,6 +492,18 @@ int stmmac_mdio_register(struct net_device *ndev)
if (priv->plat->has_xgmac) if (priv->plat->has_xgmac)
stmmac_xgmac2_mdio_read(new_bus, 0, MII_ADDR_C45); stmmac_xgmac2_mdio_read(new_bus, 0, MII_ADDR_C45);
/* If fixed-link is set, skip PHY scanning */
if (!fwnode)
fwnode = dev_fwnode(priv->device);
if (fwnode) {
fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link");
if (fixed_node) {
fwnode_handle_put(fixed_node);
goto bus_register_done;
}
}
if (priv->plat->phy_node || mdio_node) if (priv->plat->phy_node || mdio_node)
goto bus_register_done; goto bus_register_done;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment