public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Kory Maincent <kory.maincent@bootlin.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Carlo Szelinsky <github@szelinsky.de>,
	o.rempel@pengutronix.de, andrew+netdev@lunn.ch,
	hkallweit1@gmail.com, linux@armlinux.org.uk, kuba@kernel.org,
	davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
	horms@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 3/3] net: mdio: treat PSE EPROBE_DEFER as non-fatal during PHY registration
Date: Thu, 9 Apr 2026 15:09:22 +0200	[thread overview]
Message-ID: <20260409150922.74d82c39@kmaincent-XPS-13-7390> (raw)
In-Reply-To: <841e0a96-5e5c-4225-a426-24726163699f@lunn.ch>

On Thu, 9 Apr 2026 14:30:53 +0200
Andrew Lunn <andrew@lunn.ch> wrote:

> On Wed, Apr 08, 2026 at 11:07:11PM +0200, Carlo Szelinsky wrote:
> > So I went ahead and tested the phy_probe() approach on my setup (RTL930x
> > DSA switch with an I2C Hasivo HS104 PSE controller as module).
> > 
> > PoE itself works fine, but phydev->psec never gets set - ethtool just
> > says "No PSE is attached" on all ports.
> > 
> > Took me a while to figure out what's going on. The problem is how DSA
> > handles PHYs: when phy_probe() returns -EPROBE_DEFER because the PSE
> > controller hasn't probed yet, the PHY device is registered but sits
> > there unprobed. Then the DSA switch comes along, sets up its ports, and
> > phy_attach_direct() force-binds the generic PHY driver with
> > device_bind_driver(). Now the device already has a driver, so when the
> > deferred probe retry kicks in it just skips it. phy_probe() never runs
> > again and psec stays NULL.
> > 
> > What I'm seeing timing-wise:
> >   - MDIO scan registers PHYs, phy_probe() defers (no PSE yet)
> >   - DSA probes, phy_attach_direct() binds genphy
> >   - t=17s: HS104 finally probes
> >   - deferred retry: nope, driver already bound
> >   - t=35s: regulator_late_cleanup (caught by admin_state_synced)
> > 
> > Not sure what the best path forward is here. Should we look at fixing
> > phy_attach_direct() to handle this case, or go back to the non-fatal
> > EPROBE_DEFER approach from v2 for now?  
> 
> I thought about this some more. Looking at the phydev->drv might solve
> it for DSA switches, but it is not a general solution for when the PSE
> is used with a normal MAC, and the phylink_connect() happens in
> open().
>
> Now, the HS104 appears to be a quad device, intended for switches. So
> maybe solving the issue only for DSA is O.K?
> 
> Otherwise, maybe we need the ability to associate the PSE controller
> to the MAC? At a quick look, PSE and PHY are not tightly bound
> together. So we could make the MAC driver call something similar to
> of_pse_control_get() in its probe function, where it can return
> EPRODE_DEFFER. net/ethtool/pse-pd.c would need some changes as well.

I don't think we should associate it to the MAC. In a hardware point of view the
PSE Power Interfaces are wired the MDIs. It was associated historically to the
PHY, because, at that time there was no representation of the MDI. Now thanks
to Maxime there is, so in the future we should associate the PSE control to the
MDI only. We will already have to keep the PHY association compatibility to not
break binding API but please do not add another layer of association that will
increase more compatibility burden for the future.

As I proposed in another thread, if the PHY can't find the PSE PI, we could
save the phandle of the PSE PI somewhere in the PHY structure. Then at PSE
register time, look for each PHY and try to resolve every unresolved phandle.

Regards,
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

  reply	other threads:[~2026-04-09 13:09 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-29 16:10 [PATCH 0/3] net: pse-pd: support module-based PSE controller drivers Carlo Szelinsky
2026-03-29 16:10 ` [PATCH 1/3] net: mdio: treat PSE EPROBE_DEFER as non-fatal during PHY registration Carlo Szelinsky
2026-03-30 11:16   ` Kory Maincent
2026-03-29 16:10 ` [PATCH 2/3] net: pse-pd: prevent regulator cleanup from disabling unclaimed PSE PIs Carlo Szelinsky
2026-03-30 11:17   ` Kory Maincent
2026-03-29 16:10 ` [PATCH 3/3] net: pse-pd: add lazy PSE control resolution for modular drivers Carlo Szelinsky
2026-03-30 11:23   ` Kory Maincent
2026-03-30 11:09 ` [PATCH 0/3] net: pse-pd: support module-based PSE controller drivers Kory Maincent
2026-03-30 13:29 ` [PATCH net-next v2 " Carlo Szelinsky
2026-03-30 13:29   ` [PATCH net-next v2 1/3] net: pse-pd: prevent regulator cleanup from disabling unclaimed PSE PIs Carlo Szelinsky
2026-04-01  2:28     ` Jakub Kicinski
2026-04-06 10:22     ` Oleksij Rempel
2026-03-30 13:29   ` [PATCH net-next v2 2/3] net: pse-pd: add lazy PSE control resolution for modular drivers Carlo Szelinsky
2026-03-30 13:29   ` [PATCH net-next v2 3/3] net: mdio: treat PSE EPROBE_DEFER as non-fatal during PHY registration Carlo Szelinsky
2026-03-30 14:11     ` Andrew Lunn
2026-04-03 13:31       ` Carlo Szelinsky
2026-04-03 13:38         ` Kory Maincent
2026-04-06  8:42           ` Oleksij Rempel
2026-04-07  9:31             ` Kory Maincent
2026-04-03 15:16         ` Andrew Lunn
2026-04-05 18:57           ` Carlo Szelinsky
2026-04-06  9:30             ` Oleksij Rempel
2026-04-06 12:22               ` Andrew Lunn
2026-04-06 14:12                 ` Oleksij Rempel
2026-04-07  9:40                   ` Kory Maincent
2026-04-06 12:42             ` Andrew Lunn
2026-04-06 14:43               ` Carlo Szelinsky
2026-04-06 15:21                 ` Andrew Lunn
2026-04-08 21:07                   ` Carlo Szelinsky
2026-04-08 21:56                     ` Andrew Lunn
2026-04-09 12:30                     ` Andrew Lunn
2026-04-09 13:09                       ` Kory Maincent [this message]
2026-04-09 15:34                         ` Andrew Lunn
2026-04-09 16:08                           ` Russell King (Oracle)
2026-04-09 19:54                             ` Andrew Lunn
2026-04-13  9:28                               ` Kory Maincent

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=20260409150922.74d82c39@kmaincent-XPS-13-7390 \
    --to=kory.maincent@bootlin.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=github@szelinsky.de \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox