[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <99a49ad0-911b-4320-9222-198a12a1280e@lunn.ch>
Date: Wed, 3 Jan 2024 02:27:02 +0100
From: Andrew Lunn <andrew@...n.ch>
To: "Russell King (Oracle)" <linux@...linux.org.uk>
Cc: Asmaa Mnebhi <asmaa@...dia.com>, davem@...emloft.net,
netdev@...r.kernel.org, davthompson@...dia.com
Subject: Re: [PATCH v1 1/1] net: phy: micrel: Add workaround for incomplete
autonegotiation
On Tue, Jan 02, 2024 at 06:45:17PM +0000, Russell King (Oracle) wrote:
> On Tue, Dec 26, 2023 at 09:19:03AM -0500, Asmaa Mnebhi wrote:
> > + /* KSZ9031's autonegotiation takes normally 4-5 seconds to complete.
> > + * Occasionally it fails to complete autonegotiation. The workaround is
> > + * to restart it.
> > + */
> > + if (phydev->autoneg == AUTONEG_ENABLE) {
> > + while (timeout) {
> > + if (phy_aneg_done(phydev))
> > + break;
> > + mdelay(1000);
> > + timeout--;
> > + };
>
> Extra needless ;
>
> Also.. ouch! This means we end up holding phydev->lock for up to ten
> seconds, which prevents anything else happening with phylib during
> that time. Not sure I can see a good way around that though. Andrew?
Is there any status registers which indicate energy detection? No
point doing retries if there is no sign of a link partner.
I would also suggest moving the timeout into a driver private data
structure, and rely on phylib polling the PHY once per second and
restart autoneg from that. That will avoid holding the lock for a long
time.
Andrew
Powered by blists - more mailing lists