From: Andrew Lunn Both the Aspeed 2400 and 2500 and the original faraday version of the MAC have MDIO bus controllers as part of the MAC. Since it exists, always registering it makes the code simpler, and causes no harm. If there is no mdio node in device tree, of_mdiobus_register() will fall back to mdiobus_register(), making it safe. Signed-off-by: Andrew Lunn Reviewed-by: Simon Horman Signed-off-by: Jacky Chou --- drivers/net/ethernet/faraday/ftgmac100.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index f1cb5dc37919..931fdf3d07d1 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1957,6 +1957,14 @@ static int ftgmac100_probe(struct platform_device *pdev) priv->txdes0_edotr_mask = BIT(15); } + if (priv->mac_id == FTGMAC100_FARADAY || + priv->mac_id == FTGMAC100_AST2400 || + priv->mac_id == FTGMAC100_AST2500) { + err = ftgmac100_setup_mdio(netdev); + if (err) + goto err_phy_connect; + } + if (np && of_get_property(np, "use-ncsi", NULL)) { err = ftgmac100_probe_ncsi(netdev, priv, pdev); if (err) @@ -1965,18 +1973,6 @@ static int ftgmac100_probe(struct platform_device *pdev) of_get_property(np, "phy-handle", NULL))) { struct phy_device *phy; - /* Support "mdio"/"phy" child nodes for ast2400/2500 with - * an embedded MDIO controller. Automatically scan the DTS for - * available PHYs and register them. - */ - if (of_get_property(np, "phy-handle", NULL) && - (priv->mac_id == FTGMAC100_AST2400 || - priv->mac_id == FTGMAC100_AST2500)) { - err = ftgmac100_setup_mdio(netdev); - if (err) - goto err_setup_mdio; - } - phy = of_phy_get_and_connect(priv->netdev, np, &ftgmac100_adjust_link); if (!phy) { @@ -1999,9 +1995,6 @@ static int ftgmac100_probe(struct platform_device *pdev) * PHYs. */ priv->use_ncsi = false; - err = ftgmac100_setup_mdio(netdev); - if (err) - goto err_setup_mdio; err = ftgmac100_mii_probe(netdev); if (err) { -- 2.34.1