* Re: [net] net: usb: smsc95xx: fix external PHY reset
2022-11-14 13:16 [net] net: usb: smsc95xx: fix external PHY reset Alexandru Tachici
@ 2022-11-14 11:31 ` Russell King (Oracle)
2022-11-14 11:43 ` Sergei Shtylyov
1 sibling, 0 replies; 3+ messages in thread
From: Russell King (Oracle) @ 2022-11-14 11:31 UTC (permalink / raw)
To: Alexandru Tachici
Cc: linux-kernel, andrew, davem, edumazet, kuba, pabeni, netdev,
steve.glendinning, UNGLinuxDriver, andre.edich, linux-usb
On Mon, Nov 14, 2022 at 03:16:43PM +0200, Alexandru Tachici wrote:
> + } else {
> + /* Driver has no knowledge at this point about the external PHY.
> + * The 802.3 specifies that the reset process shall
> + * be completed within 0.5 s.
> + */
> + fsleep(500000);
> + }
It's slightly more code, but would it be better to do this in the
mdiobus reset() method?
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [net] net: usb: smsc95xx: fix external PHY reset
2022-11-14 13:16 [net] net: usb: smsc95xx: fix external PHY reset Alexandru Tachici
2022-11-14 11:31 ` Russell King (Oracle)
@ 2022-11-14 11:43 ` Sergei Shtylyov
1 sibling, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2022-11-14 11:43 UTC (permalink / raw)
To: Alexandru Tachici, linux-kernel
Cc: andrew, linux, davem, edumazet, kuba, pabeni, netdev,
steve.glendinning, UNGLinuxDriver, andre.edich, linux-usb
Hello!
On 11/14/22 4:16 PM, Alexandru Tachici wrote:
> An external PHY needs settling time after power up or reser.
Reset? :-)
> In the bind() function an mdio bus is registered. If at this point
> the external PHY is still initialising, no valid PHY ID will be
> read and on phy_find_first() the bind() function will fail.
>
> If an external PHY is present, wait the maximum time specified
> in 802.3 45.2.7.1.1.
>
> Fixes: 05b35e7eb9a1 ("smsc95xx: add phylib support")
> Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
[...]
MBR, Sergey
^ permalink raw reply [flat|nested] 3+ messages in thread
* [net] net: usb: smsc95xx: fix external PHY reset
@ 2022-11-14 13:16 Alexandru Tachici
2022-11-14 11:31 ` Russell King (Oracle)
2022-11-14 11:43 ` Sergei Shtylyov
0 siblings, 2 replies; 3+ messages in thread
From: Alexandru Tachici @ 2022-11-14 13:16 UTC (permalink / raw)
To: linux-kernel
Cc: andrew, linux, davem, edumazet, kuba, pabeni, netdev,
steve.glendinning, UNGLinuxDriver, andre.edich, linux-usb
An external PHY needs settling time after power up or reser.
In the bind() function an mdio bus is registered. If at this point
the external PHY is still initialising, no valid PHY ID will be
read and on phy_find_first() the bind() function will fail.
If an external PHY is present, wait the maximum time specified
in 802.3 45.2.7.1.1.
Fixes: 05b35e7eb9a1 ("smsc95xx: add phylib support")
Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
---
drivers/net/usb/smsc95xx.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index bfb58c91db04..5ed001c0cd56 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -1134,8 +1134,15 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
goto free_mdio;
is_internal_phy = !(val & HW_CFG_PSEL_);
- if (is_internal_phy)
+ if (is_internal_phy) {
pdata->mdiobus->phy_mask = ~(1u << SMSC95XX_INTERNAL_PHY_ID);
+ } else {
+ /* Driver has no knowledge at this point about the external PHY.
+ * The 802.3 specifies that the reset process shall
+ * be completed within 0.5 s.
+ */
+ fsleep(500000);
+ }
pdata->mdiobus->priv = dev;
pdata->mdiobus->read = smsc95xx_mdiobus_read;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-14 11:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-14 13:16 [net] net: usb: smsc95xx: fix external PHY reset Alexandru Tachici
2022-11-14 11:31 ` Russell King (Oracle)
2022-11-14 11:43 ` Sergei Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).