summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannes Schmelzer <hannes.schmelzer@br-automation.com>2019-03-29 09:54:05 +0100
committerChristoph Müllner <christophm30@gmail.com>2019-04-26 00:52:31 +0200
commit72c9af85b58d0b5926457e2885536228aacbd229 (patch)
treedf64dfbfcab1f6be261797aa6b117c7333d921cf
parentbfde21dd44b4e63b541510dff8025dc38da746a8 (diff)
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>
-rw-r--r--drivers/net/phy/phy.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 0c8b29dae4..4e8d2943ee 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -922,13 +922,14 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr,
#endif
{
struct phy_device *phydev = NULL;
+ uint mask = (addr > 0) ? (1 << addr) : 0xffffffff;
#ifdef CONFIG_PHY_FIXED
phydev = phy_connect_fixed(bus, dev, interface);
#endif
if (!phydev)
- phydev = phy_find_by_mask(bus, 1 << addr, interface);
+ phydev = phy_find_by_mask(bus, mask, interface);
if (phydev)
phy_connect_dev(phydev, dev);