lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221114131643.19450-1-alexandru.tachici@analog.com>
Date:   Mon, 14 Nov 2022 15:16:43 +0200
From:   Alexandru Tachici <alexandru.tachici@...log.com>
To:     <linux-kernel@...r.kernel.org>
CC:     <andrew@...n.ch>, <linux@...linux.org.uk>, <davem@...emloft.net>,
        <edumazet@...gle.com>, <kuba@...nel.org>, <pabeni@...hat.com>,
        <netdev@...r.kernel.org>, <steve.glendinning@...well.net>,
        <UNGLinuxDriver@...rochip.com>, <andre.edich@...rochip.com>,
        <linux-usb@...r.kernel.org>
Subject: [net] net: usb: smsc95xx: fix external PHY reset

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@...log.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ