Skip to content

Commit 38561de

Browse files
tao-renPaolo Abeni
authored andcommitted
net: ftgmac100: support fixed link
Support fixed link in ftgmac100 driver. Fixed link is used on several Meta OpenBMC platforms, such as Elbert (AST2620) and Wedge400 (AST2520). Signed-off-by: Tao Ren <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent 9724343 commit 38561de

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

drivers/net/ethernet/faraday/ftgmac100.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,10 +1701,14 @@ static int ftgmac100_setup_mdio(struct net_device *netdev)
17011701

17021702
static void ftgmac100_phy_disconnect(struct net_device *netdev)
17031703
{
1704+
struct ftgmac100 *priv = netdev_priv(netdev);
1705+
17041706
if (!netdev->phydev)
17051707
return;
17061708

17071709
phy_disconnect(netdev->phydev);
1710+
if (of_phy_is_fixed_link(priv->dev->of_node))
1711+
of_phy_deregister_fixed_link(priv->dev->of_node);
17081712
}
17091713

17101714
static void ftgmac100_destroy_mdio(struct net_device *netdev)
@@ -1867,6 +1871,26 @@ static int ftgmac100_probe(struct platform_device *pdev)
18671871
err = -EINVAL;
18681872
goto err_phy_connect;
18691873
}
1874+
} else if (np && of_phy_is_fixed_link(np)) {
1875+
struct phy_device *phy;
1876+
1877+
err = of_phy_register_fixed_link(np);
1878+
if (err) {
1879+
dev_err(&pdev->dev, "Failed to register fixed PHY\n");
1880+
goto err_phy_connect;
1881+
}
1882+
1883+
phy = of_phy_get_and_connect(priv->netdev, np,
1884+
&ftgmac100_adjust_link);
1885+
if (!phy) {
1886+
dev_err(&pdev->dev, "Failed to connect to fixed PHY\n");
1887+
of_phy_deregister_fixed_link(np);
1888+
err = -EINVAL;
1889+
goto err_phy_connect;
1890+
}
1891+
1892+
/* Display what we found */
1893+
phy_attached_info(phy);
18701894
} else if (np && of_get_property(np, "phy-handle", NULL)) {
18711895
struct phy_device *phy;
18721896

0 commit comments

Comments
 (0)