netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: mdio: Prevent Clause 45 scan on SMSC PHYs
@ 2024-01-01 21:31 Ezra Buehler
  2024-01-01 22:44 ` Heiner Kallweit
  0 siblings, 1 reply; 17+ messages in thread
From: Ezra Buehler @ 2024-01-01 21:31 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, Tristram Ha
  Cc: Michael Walle, Jesse Brandeburg, netdev

Since commit 1a136ca2e089 ("net: mdio: scan bus based on bus
capabilities for C22 and C45") our AT91SAM9G25-based GARDENA smart
Gateway will no longer boot.

Prior to the mentioned change, probe_capabilities would be set to
MDIOBUS_NO_CAP (0) and therefore, no Clause 45 scan was performed.
Running a Clause 45 scan on an SMSC/Microchip LAN8720A PHY will (at
least with our setup) considerably slow down kernel startup and
ultimately result in a board reset.

AFAICT all SMSC/Microchip PHYs are Clause 22 devices. Some have a
"Clause 45 protection" feature (e.g. LAN8830) and others like the
LAN8804 will explicitly state the following in the datasheet:

    This device may respond to Clause 45 accesses and so must not be
    mixed with Clause 45 devices on the same MDIO bus.

Fixes: 1a136ca2e089 ("net: mdio: scan bus based on bus capabilities for C22 and C45")
Signed-off-by: Ezra Buehler <ezra.buehler@husqvarnagroup.com>
---

This change is modeled after commit 348659337485 ("net: mdio: Add
workaround for Micrel PHYs which are not C45 compatible"). However,
I find the name SMSC_OUI somewhat misleading as the value is not the
full OUI (0x00800f) but, just the OUI part of phy_id, which is quite
different.

 drivers/net/phy/mdio_bus.c | 3 ++-
 include/linux/smscphy.h    | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 25dcaa49ab8b..63f1c42fbc8d 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -31,6 +31,7 @@
 #include <linux/reset.h>
 #include <linux/skbuff.h>
 #include <linux/slab.h>
+#include <linux/smscphy.h>
 #include <linux/spinlock.h>
 #include <linux/string.h>
 #include <linux/uaccess.h>
@@ -632,7 +633,7 @@ static bool mdiobus_prevent_c45_scan(struct mii_bus *bus)
 			continue;
 		oui = phydev->phy_id >> 10;
 
-		if (oui == MICREL_OUI)
+		if (oui == MICREL_OUI || oui == SMSC_OUI)
 			return true;
 	}
 	return false;
diff --git a/include/linux/smscphy.h b/include/linux/smscphy.h
index 1a6a851d2cf8..069d6d226abd 100644
--- a/include/linux/smscphy.h
+++ b/include/linux/smscphy.h
@@ -2,6 +2,8 @@
 #ifndef __LINUX_SMSCPHY_H__
 #define __LINUX_SMSCPHY_H__
 
+#define SMSC_OUI 0x01f0
+
 #define MII_LAN83C185_ISF 29 /* Interrupt Source Flags */
 #define MII_LAN83C185_IM  30 /* Interrupt Mask */
 #define MII_LAN83C185_CTRL_STATUS 17 /* Mode/Status Register */
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2024-01-07 13:51 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-01 21:31 [PATCH net] net: mdio: Prevent Clause 45 scan on SMSC PHYs Ezra Buehler
2024-01-01 22:44 ` Heiner Kallweit
2024-01-02  8:50   ` Michael Walle
2024-01-02  9:14     ` Heiner Kallweit
2024-01-02 12:02   ` Russell King (Oracle)
2024-01-02 13:42   ` Andrew Lunn
2024-01-02 14:00     ` Russell King (Oracle)
2024-01-02 14:04     ` Ezra Buehler
2024-01-02 14:06     ` Heiner Kallweit
2024-01-02 15:50       ` Andrew Lunn
2024-01-02 18:08         ` Ezra Buehler
2024-01-02 18:57           ` Russell King (Oracle)
2024-01-06 12:41             ` Ezra Buehler
2024-01-06 15:20               ` Andrew Lunn
2024-01-07 13:51                 ` Ezra Buehler
2024-01-02 19:49           ` Andrew Lunn
2024-01-02 20:05             ` Ezra Buehler

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).