Commit 38561ded authored by Tao Ren's avatar Tao Ren Committed by Paolo Abeni
Browse files

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: default avatarTao Ren <rentao.bupt@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 9724343e
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -1701,10 +1701,14 @@ static int ftgmac100_setup_mdio(struct net_device *netdev)

static void ftgmac100_phy_disconnect(struct net_device *netdev)
{
	struct ftgmac100 *priv = netdev_priv(netdev);

	if (!netdev->phydev)
		return;

	phy_disconnect(netdev->phydev);
	if (of_phy_is_fixed_link(priv->dev->of_node))
		of_phy_deregister_fixed_link(priv->dev->of_node);
}

static void ftgmac100_destroy_mdio(struct net_device *netdev)
@@ -1867,6 +1871,26 @@ static int ftgmac100_probe(struct platform_device *pdev)
			err = -EINVAL;
			goto err_phy_connect;
		}
	} else if (np && of_phy_is_fixed_link(np)) {
		struct phy_device *phy;

		err = of_phy_register_fixed_link(np);
		if (err) {
			dev_err(&pdev->dev, "Failed to register fixed PHY\n");
			goto err_phy_connect;
		}

		phy = of_phy_get_and_connect(priv->netdev, np,
					     &ftgmac100_adjust_link);
		if (!phy) {
			dev_err(&pdev->dev, "Failed to connect to fixed PHY\n");
			of_phy_deregister_fixed_link(np);
			err = -EINVAL;
			goto err_phy_connect;
		}

		/* Display what we found */
		phy_attached_info(phy);
	} else if (np && of_get_property(np, "phy-handle", NULL)) {
		struct phy_device *phy;