mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-18 21:21:37 +00:00
net: phy: implement fallback mechanism for negative phy adresses
Negative phy-addresses can occour if the caller function was not able to determine a valid phy address (from device-tree for example). In this case we catch this here and search for ANY phy device on the given mdio- bus. Signed-off-by: Hannes Schmelzer <hannes.schmelzer@br-automation.com> Tested-by: Michal Simek <michal.simek@xilinx.com> Tested-by: Lukasz Majewski <lukma@denx.de>
This commit is contained in:
parent
0e62d5b2ab
commit
afbc31948a
1 changed files with 2 additions and 1 deletions
|
@ -922,13 +922,14 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr,
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
struct phy_device *phydev = NULL;
|
struct phy_device *phydev = NULL;
|
||||||
|
uint mask = (addr > 0) ? (1 << addr) : 0xffffffff;
|
||||||
|
|
||||||
#ifdef CONFIG_PHY_FIXED
|
#ifdef CONFIG_PHY_FIXED
|
||||||
phydev = phy_connect_fixed(bus, dev, interface);
|
phydev = phy_connect_fixed(bus, dev, interface);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!phydev)
|
if (!phydev)
|
||||||
phydev = phy_find_by_mask(bus, 1 << addr, interface);
|
phydev = phy_find_by_mask(bus, mask, interface);
|
||||||
|
|
||||||
if (phydev)
|
if (phydev)
|
||||||
phy_connect_dev(phydev, dev);
|
phy_connect_dev(phydev, dev);
|
||||||
|
|
Loading…
Add table
Reference in a new issue