|
@@ -713,7 +713,7 @@ static void xgene_enet_adjust_link(struct net_device *ndev)
|
|
|
{
|
|
|
struct xgene_enet_pdata *pdata = netdev_priv(ndev);
|
|
|
const struct xgene_mac_ops *mac_ops = pdata->mac_ops;
|
|
|
- struct phy_device *phydev = pdata->phy_dev;
|
|
|
+ struct phy_device *phydev = ndev->phydev;
|
|
|
|
|
|
if (phydev->link) {
|
|
|
if (pdata->phy_speed != phydev->speed) {
|
|
@@ -773,15 +773,13 @@ int xgene_enet_phy_connect(struct net_device *ndev)
|
|
|
netdev_err(ndev, "Could not connect to PHY\n");
|
|
|
return -ENODEV;
|
|
|
}
|
|
|
-
|
|
|
- pdata->phy_dev = phy_dev;
|
|
|
} else {
|
|
|
#ifdef CONFIG_ACPI
|
|
|
struct acpi_device *adev = acpi_phy_find_device(dev);
|
|
|
if (adev)
|
|
|
- pdata->phy_dev = adev->driver_data;
|
|
|
-
|
|
|
- phy_dev = pdata->phy_dev;
|
|
|
+ phy_dev = adev->driver_data;
|
|
|
+ else
|
|
|
+ phy_dev = NULL;
|
|
|
|
|
|
if (!phy_dev ||
|
|
|
phy_connect_direct(ndev, phy_dev, &xgene_enet_adjust_link,
|
|
@@ -849,8 +847,6 @@ static int xgene_mdiobus_register(struct xgene_enet_pdata *pdata,
|
|
|
if (!phy)
|
|
|
return -EIO;
|
|
|
|
|
|
- pdata->phy_dev = phy;
|
|
|
-
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
@@ -890,14 +886,18 @@ int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata)
|
|
|
|
|
|
void xgene_enet_phy_disconnect(struct xgene_enet_pdata *pdata)
|
|
|
{
|
|
|
- if (pdata->phy_dev)
|
|
|
- phy_disconnect(pdata->phy_dev);
|
|
|
+ struct net_device *ndev = pdata->ndev;
|
|
|
+
|
|
|
+ if (ndev->phydev)
|
|
|
+ phy_disconnect(ndev->phydev);
|
|
|
}
|
|
|
|
|
|
void xgene_enet_mdio_remove(struct xgene_enet_pdata *pdata)
|
|
|
{
|
|
|
- if (pdata->phy_dev)
|
|
|
- phy_disconnect(pdata->phy_dev);
|
|
|
+ struct net_device *ndev = pdata->ndev;
|
|
|
+
|
|
|
+ if (ndev->phydev)
|
|
|
+ phy_disconnect(ndev->phydev);
|
|
|
|
|
|
mdiobus_unregister(pdata->mdio_bus);
|
|
|
mdiobus_free(pdata->mdio_bus);
|