diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2018-02-08 09:03:46 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-02-08 09:03:46 +0100 |
commit | 490a3c496454cea131dbd5edadbe7d7cfce4cfa8 (patch) | |
tree | 5222ffde63801a98ce90168d6be2247cc39bcfa7 /drivers/net/phy | |
parent | b84f8a712ffe04def5f3d402ef9be990d485ecce (diff) | |
parent | 5316da0098c913b1e548801a57b7d5d9fd5a4d6d (diff) | |
download | barebox-490a3c496454cea131dbd5edadbe7d7cfce4cfa8.tar.gz barebox-490a3c496454cea131dbd5edadbe7d7cfce4cfa8.tar.xz |
Merge branch 'for-next/misc'
Diffstat (limited to 'drivers/net/phy')
-rw-r--r-- | drivers/net/phy/phy.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 35a9ce7ea8..42dcad9069 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -309,8 +309,13 @@ static struct phy_device *of_phy_register_fixed_link(struct device_node *np, phydev->dev.parent = &edev->dev; phydev->registered = 1; - phydev->speed = 1000; - phydev->duplex = 1; + phydev->link = 1; + + if (of_property_read_u32(np, "speed", &phydev->speed)) + return NULL; + phydev->duplex = of_property_read_bool(np,"full-duplex"); + phydev->pause = of_property_read_bool(np, "pause"); + phydev->asym_pause = of_property_read_bool(np, "asym-pause"); return phydev; } @@ -319,6 +324,8 @@ static struct phy_device *of_mdio_find_phy(struct eth_device *edev) { struct device_d *dev; struct device_node *phy_node; + struct mii_bus *bus; + int addr; if (!IS_ENABLED(CONFIG_OFDEVICE)) return NULL; @@ -340,6 +347,16 @@ static struct phy_device *of_mdio_find_phy(struct eth_device *edev) if (!phy_node) return NULL; + if (!of_property_read_u32(phy_node, "reg", &addr)) { + for_each_mii_bus(bus) { + if (bus->parent->device_node == phy_node->parent) { + struct phy_device *phy = mdiobus_scan(bus, addr); + if (!IS_ERR(phy)) + return phy; + } + } + } + bus_for_each_device(&mdio_bus_type, dev) { if (dev->device_node == phy_node) return container_of(dev, struct phy_device, dev); |