Re: [PATCH net] net: dsa: realtek: rtl8365mb: fix GMII caps for ports with internal PHY
From: Alvin Šipraga
Date: Tue Jun 07 2022 - 12:15:44 EST
On Tue, Jun 07, 2022 at 03:45:32PM +0100, Russell King (Oracle) wrote:
>
> This one I agree could well be the culpret, but it means that the
> original premise that PHY_INTERFACE_MODE_INTERNAL was being used is
> incorrect - it's actually been relying on using PHY_INTERFACE_MODE_NA.
>
> It instead means that PHY_INTERFACE_MODE_NA was being used, which
> really isn't good, because PHY_INTERFACE_MODE_NA internally inside
> phylink has always had a special meaning - that being with the
> validate step which has been used to get _all_ possible modes from
> the MAC. This was never intended to be used for anything except
> phylink's internal use to retrieve that information from the MAC
> driver to make decisions about what mode(s) a SFP should use.
Right, and there is even a "do not touch" warning in the enum definition of
PHY_INTERFACE_MODE_NA ;-)
Thanks for the explanation.
>
> So yes, this is most likely the culpret, and if proven, please use
> it for the Fixes: tag for any fixes to drivers that incorrectly
> relied upon that behaviour.
If I take net and revert the aforementioned commit, then I am able to connect a
PHY and indeed the mode is _NA, as evidenced by log lines like this:
[ 10.702205] realtek-smi ethernet-switch swp0: configuring for phy/ link mode
So a18e6521a7d9 is indeed the reason it broke for Luiz to begin with.
So, in summary:
- initial driver version
rtl8365mb with no phy-mode specified on the port would connect with _NA
because it supported it erroneously; at this point in time, when no phy-mode
is specified in the DT, _NA gets used, which is also technically wrong
- a18e6521a7d9 ("net: phylink: handle NA interface mode in phylink_fwnode_phy_connect()")
rtl8365mb now doesn't work without phy-mode specified because you fixed the
_NA behaviour and now _GMII is used (which is right), but rtl8365mb doesn't
support _GMII
- a5dba0f207e5 ("net: dsa: rtl8365mb: add GMII as user port mode")
rtl8365mb now supports _GMII so everything works again
- 6ff6064605e9 ("net: dsa: realtek: convert to phylink_generic_validate()")
rtl8365mb breaks again because _GMII is no longer supported due to some
refactoring
I will re-send the patch this evening with an updated description.
Kind regards,
Alvin