From: Hannes Schmelzer <hannes.schmelzer@br-automation.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] drivers/net/phy: implement fallback mechanism for negative phy adresses
Date: Fri, 29 Mar 2019 07:03:11 +0100 [thread overview]
Message-ID: <1553839391-22437-1-git-send-email-hannes.schmelzer@br-automation.com> (raw)
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>
---
drivers/net/phy/phy.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 0c8b29d..916b525 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) ? (0x1 << 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);
--
2.7.4
next reply other threads:[~2019-03-29 6:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-29 6:03 Hannes Schmelzer [this message]
2019-03-29 6:08 ` [U-Boot] [PATCH] drivers/net/phy: implement fallback mechanism for negative phy adresses Hannes Schmelzer
2019-03-29 8:23 ` Michal Simek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1553839391-22437-1-git-send-email-hannes.schmelzer@br-automation.com \
--to=hannes.schmelzer@br-automation.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.