9
0
Fork 0

net: phy: move phy_init_hw to phy_device_connect

This is needed when a phy gets registered outsize of phy_device_connect
but has to be attached to an ethernet device later.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2013-12-11 11:09:46 +01:00
parent 33790253da
commit 5200678e86
2 changed files with 9 additions and 8 deletions

View File

@ -181,14 +181,6 @@ static int mdio_bus_probe(struct device_d *_dev)
dev->supported = drv->features;
dev->advertising = drv->features;
ret = phy_init_hw(dev);
if (ret)
goto err;
/* Sanitize settings based on PHY capabilities */
if ((dev->supported & SUPPORTED_Autoneg) == 0)
dev->autoneg = AUTONEG_DISABLE;
dev_add_param_int_ro(&dev->dev, "phy_addr", dev->addr, "%d");
dev_add_param_int_ro(&dev->dev, "phy_id", dev->phy_id, "0x%08x");

View File

@ -306,6 +306,15 @@ int phy_device_connect(struct eth_device *edev, struct mii_bus *bus, int addr,
edev->phydev = dev;
dev->attached_dev = edev;
ret = phy_init_hw(dev);
if (ret)
goto fail;
/* Sanitize settings based on PHY capabilities */
if ((dev->supported & SUPPORTED_Autoneg) == 0)
dev->autoneg = AUTONEG_DISABLE;
phy_config_aneg(edev->phydev);
dev->adjust_link = adjust_link;