On Thu, May 19, 2022 at 04:15:32PM +0100, Russell King (Oracle) wrote: > On Thu, May 19, 2022 at 02:59:36PM +0000, Vladimir Oltean wrote: > > Hi Andrew, > > > > On Sat, May 14, 2022 at 02:23:51AM +0200, Andrew Lunn wrote: > > > There is a very different approach, which might be simpler. > > > > > > We know polling will always work. And it should be possible to > > > transition between polling and interrupt at any point, so long as the > > > phylock is held. So if you get -EPROBE_DEFFER during probe, mark some > > > state in phydev that there should be an irq, but it is not around yet. > > > When the phy is started, and phylib starts polling, look for the state > > > and try getting the IRQ again. If successful, swap to interrupts, if > > > not, keep polling. Maybe after 60 seconds of polling and trying, give > > > up trying to find the irq and stick with polling. > > > > That doesn't sound like something that I'd backport to stable kernels. > > Letting the PHY driver dynamically switch from poll to IRQ mode risks > > racing with phylink's workqueue, and generally speaking, phylink doesn't > > seem to be built around the idea that "bool poll" can change after > > phylink_start(). > > I think you're confused. Andrew is merely talking about phylib's > polling, not phylink's. > > Phylink's polling is only ever used in two circumstances: > > 1. In fixed-link mode where we have an interruptless GPIO. > 2. In in-band mode when the PCS specifies it needs to be polled. > > This is not used to poll ethernet PHYs - ethernet PHY polling is > handled entirely by phylib itself. You're right, I would have probably figured that out if I actually tried to implement what Andrew is proposing and not just superficially looking at the code. I guess I'll try that now and see where that leads me to. The only thing that remains in that case is fw_devlink blocking PHY probing for lack of a supplier.