[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZO83htinyfAp4mWw@shell.armlinux.org.uk>
Date: Wed, 30 Aug 2023 13:35:18 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Oleksij Rempel <o.rempel@...gutronix.de>
Cc: Lukasz Majewski <lukma@...x.de>,
Eric Dumazet <edumazet@...gle.com>,
Andrew Lunn <andrew@...n.ch>, davem@...emloft.net,
Woojung Huh <woojung.huh@...rochip.com>,
Vladimir Oltean <olteanv@...il.com>, Tristram.Ha@...rochip.com,
Florian Fainelli <f.fainelli@...il.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, UNGLinuxDriver@...rochip.com,
Heiner Kallweit <hkallweit1@...il.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] net: phy: Provide Module 4 KSZ9477 errata
(DS80000754C)
On Wed, Aug 30, 2023 at 02:17:38PM +0200, Oleksij Rempel wrote:
> On Wed, Aug 30, 2023 at 01:51:51PM +0200, Lukasz Majewski wrote:
> > Hi Oleksij,
>
> > It looks like the most optimal solution would be the one proposed by
> > Tristam:
> > https://www.spinics.net/lists/netdev/msg932044.html
>
> In this case, please add the reason why it would work on this HW and
> will not break by any changes in PHYlib or micrel.c driver.
>
> If I remember it correctly, in KSZ9477 variants, if you write to EEE
> advertisement register, it will affect the state of a EEE capability
> register. Which break IEEE 802.3 specification and the reason why
> ksz9477_get_features() actually exist. But can be used as workaround if
> it is written early enough before PHYlib tried to read EEE capability
> register.
>
> Please confirm my assumption by applying your workaround and testing it
> with ethtool --show-eee lanX.
>
> It should be commented in the code with all kind of warnings:
> Don't move!!! We use one bug to workaround another bug!!! If PHYlib
> start scanning PHYs before this code is executed, then thing may break!!
Why would phylib's scanning cause breakage?
phylib's scanning for PHYs is about reading the ID registers etc. It
doesn't do anything until the PHY has been found, and then the first
thing that happens when the phy_device structure is created is an
appropriate driver is located, and the driver's ->probe function
is called.
If that is successful, then the fewatures are read. If the PHY
driver's ->features member is set, then that initialises the
"supported" mask and we read the EEE abilities.
If ->features is not set, then we look to see whether the driver
provides a ->get_features method, and call that.
Otherwise we use the generic genphy_c45_pma_read_abilities() or
genphy_read_abilities() depending whether the PHY's is_c45 is set
or not.
So, if you want to do something very early before features are read,
then either don't set .features, and do it early in .get_features
before calling anything else, or do it in the ->probe function.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists