diff options
author | Moritz Fischer <mdf@kernel.org> | 2019-02-04 20:30:39 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-02-05 21:34:34 +0300 |
commit | 8dc0ae90ad02b368ffdbee7a3509750dcd3c1b13 (patch) | |
tree | 0370c7ec5914ff7dd49dd011ac7c24b45dc74986 /drivers/net/ethernet/ni | |
parent | dd648818dad3ad5ab5151c7f5ca0bb55a0bf71de (diff) | |
download | linux-8dc0ae90ad02b368ffdbee7a3509750dcd3c1b13.tar.xz |
net: nixge: Add support for fixed-link configurations
Add support for fixed-link configurations to nixge driver.
Signed-off-by: Moritz Fischer <mdf@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ni')
-rw-r--r-- | drivers/net/ethernet/ni/nixge.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c index c8dd1e4c759d..96f7a9818294 100644 --- a/drivers/net/ethernet/ni/nixge.c +++ b/drivers/net/ethernet/ni/nixge.c @@ -1282,9 +1282,9 @@ static int nixge_of_get_resources(struct platform_device *pdev) static int nixge_probe(struct platform_device *pdev) { + struct device_node *mn, *phy_node; struct nixge_priv *priv; struct net_device *ndev; - struct device_node *mn; const u8 *mac_addr; int err; @@ -1353,21 +1353,30 @@ static int nixge_probe(struct platform_device *pdev) goto unregister_mdio; } - priv->phy_node = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0); - if (!priv->phy_node) { - netdev_err(ndev, "not find \"phy-handle\" property\n"); - err = -EINVAL; - goto unregister_mdio; + phy_node = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0); + if (!phy_node && of_phy_is_fixed_link(pdev->dev.of_node)) { + err = of_phy_register_fixed_link(pdev->dev.of_node); + if (err < 0) { + netdev_err(ndev, "broken fixed-link specification\n"); + goto unregister_mdio; + } + phy_node = of_node_get(pdev->dev.of_node); } + priv->phy_node = phy_node; err = register_netdev(priv->ndev); if (err) { netdev_err(ndev, "register_netdev() error (%i)\n", err); - goto unregister_mdio; + goto free_phy; } return 0; +free_phy: + if (of_phy_is_fixed_link(pdev->dev.of_node)) + of_phy_deregister_fixed_link(pdev->dev.of_node); + of_node_put(phy_node); + unregister_mdio: if (priv->mii_bus) mdiobus_unregister(priv->mii_bus); @@ -1385,6 +1394,10 @@ static int nixge_remove(struct platform_device *pdev) unregister_netdev(ndev); + if (of_phy_is_fixed_link(pdev->dev.of_node)) + of_phy_deregister_fixed_link(pdev->dev.of_node); + of_node_put(priv->phy_node); + if (priv->mii_bus) mdiobus_unregister(priv->mii_bus); |