All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: ezra@synergy-village.org, Russell King <linux@armlinux.org.uk>,
	Tristram Ha <Tristram.Ha@microchip.com>,
	Michael Walle <michael@walle.cc>,
	Jesse Brandeburg <jesse.brandeburg@intel.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH net] net: mdio: Prevent Clause 45 scan on SMSC PHYs
Date: Tue, 2 Jan 2024 15:06:54 +0100	[thread overview]
Message-ID: <8eb06ee9-d02d-4113-ba1e-e8ee99acc2fd@gmail.com> (raw)
In-Reply-To: <1297166c-38c1-4041-8a7f-403477b871cf@lunn.ch>

On 02.01.2024 14:42, Andrew Lunn wrote:
> On Mon, Jan 01, 2024 at 11:44:38PM +0100, Heiner Kallweit wrote:
>> On 01.01.2024 22:31, Ezra Buehler wrote:
>>> 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.
>>>
>>
>> I'm not convinced that some heuristic based on vendors is a
>> sustainable approach. Also I'd like to avoid (as far as possible)
>> that core code includes vendor driver headers. Maybe we could use
>> a new PHY driver flag. Approaches I could think of:
> 
> We already have a core hack for these broken PHYs:
> 
Excluding all PHY's from a vendor for me is a quite big hammer.
I think we should make this more granular.
And mdio-bus.c including micrel_phy.h also isn't too nice.
Maybe we should move all OUI definitions in drivers to a
core header. Because the OUI seems to be all we need from
these headers.

> /*
>  * There are some C22 PHYs which do bad things when where is a C45
>  * transaction on the bus, like accepting a read themselves, and
>  * stomping over the true devices reply, to performing a write to
>  * themselves which was intended for another device. Now that C22
>  * devices have been found, see if any of them are bad for C45, and if we
>  * should skip the C45 scan.
>  */
> static bool mdiobus_prevent_c45_scan(struct mii_bus *bus)
> {
>         int i;
> 
>         for (i = 0; i < PHY_MAX_ADDR; i++) {
>                 struct phy_device *phydev;
>                 u32 oui;
> 
>                 phydev = mdiobus_get_phy(bus, i);
>                 if (!phydev)
>                         continue;
>                 oui = phydev->phy_id >> 10;
> 
>                 if (oui == MICREL_OUI)
>                         return true;
>         }
>         return false;
> }
> 
> So it seems we need to extend this with another OUI.
> 
> 	Andrew


  parent reply	other threads:[~2024-01-02 14:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=8eb06ee9-d02d-4113-ba1e-e8ee99acc2fd@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=Tristram.Ha@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=ezra@synergy-village.org \
    --cc=jesse.brandeburg@intel.com \
    --cc=linux@armlinux.org.uk \
    --cc=michael@walle.cc \
    --cc=netdev@vger.kernel.org \
    /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.