Skip to content

Commit

Permalink
net: bcmgenet: use the new fixed PHY helpers
Browse files Browse the repository at this point in the history
of_phy_connect_fixed_link() is becoming obsolete, and also required
platform code to register the fixed PHYs at the specified addresses for
those to be usable. Get rid of it and use the new of_phy_is_fixed_link()
plus of_phy_register_fixed_link() helpers to transition over the new
scheme.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Florian Fainelli authored and David S. Miller committed May 22, 2014
1 parent ae21888 commit 9abf0c2
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions drivers/net/ethernet/broadcom/genet/bcmmii.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ int bcmgenet_mii_config(struct net_device *dev)
static int bcmgenet_mii_probe(struct net_device *dev)
{
struct bcmgenet_priv *priv = netdev_priv(dev);
struct device_node *dn = priv->pdev->dev.of_node;
struct phy_device *phydev;
unsigned int phy_flags;
int ret;
Expand All @@ -307,15 +308,19 @@ static int bcmgenet_mii_probe(struct net_device *dev)
return 0;
}

if (priv->phy_dn)
phydev = of_phy_connect(dev, priv->phy_dn,
bcmgenet_mii_setup, 0,
priv->phy_interface);
else
phydev = of_phy_connect_fixed_link(dev,
bcmgenet_mii_setup,
priv->phy_interface);
/* In the case of a fixed PHY, the DT node associated
* to the PHY is the Ethernet MAC DT node.
*/
if (of_phy_is_fixed_link(dn)) {
ret = of_phy_register_fixed_link(dn);
if (ret)
return ret;

priv->phy_dn = dn;
}

phydev = of_phy_connect(dev, priv->phy_dn, bcmgenet_mii_setup, 0,
priv->phy_interface);
if (!phydev) {
pr_err("could not attach to PHY\n");
return -ENODEV;
Expand Down

0 comments on commit 9abf0c2

Please sign in to comment.