]> git.baikalelectronics.ru Git - kernel.git/commit
net: dsa: realtek: rtl8365mb: fix GMII caps for ports with internal PHY
authorAlvin Šipraga <alsi@bang-olufsen.dk>
Tue, 7 Jun 2022 18:46:24 +0000 (20:46 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 9 Jun 2022 04:03:51 +0000 (21:03 -0700)
commit45b68efc4ae00c31125cc4855e73b6625504084c
treefe551ed8ea9363deb96713b0adb975b798183a68
parent0f981d6eae39f6fcfd56e0bf1e9de8308242780d
net: dsa: realtek: rtl8365mb: fix GMII caps for ports with internal PHY

Since commit cc3b49eaacf2 ("net: phylink: handle NA interface mode in
phylink_fwnode_phy_connect()"), phylib defaults to GMII when no phy-mode
or phy-connection-type property is specified in a DSA port node of the
device tree. The same commit caused a regression in rtl8365mb whereby
phylink would fail to connect, because the driver did not advertise
support for GMII for ports with internal PHY.

It should be noted that the aforementioned regression is not because the
blamed commit was incorrect: on the contrary, the blamed commit is
correcting the previous behaviour whereby unspecified phy-mode would
cause the internal interface mode to be PHY_INTERFACE_MODE_NA. The
rtl8365mb driver only worked by accident before because it _did_
advertise support for PHY_INTERFACE_MODE_NA, despite NA being reserved
for internal use by phylink. With one mistake fixed, the other was
exposed.

Commit 772dfacfdc9f ("net: dsa: rtl8365mb: add GMII as user port mode")
then introduced implicit support for GMII mode on ports with internal
PHY to allow a PHY connection for device trees where the phy-mode is not
explicitly set to "internal". At this point everything was working OK
again.

Subsequently, commit cd369db53613 ("net: dsa: realtek: convert to
phylink_generic_validate()") broke this behaviour again by discarding
the usage of rtl8365mb_phy_mode_supported() - where this GMII support
was indicated - while switching to the new .phylink_get_caps API.

With the new API, rtl8365mb_phy_mode_supported() is no longer needed.
Remove it altogether and add back the GMII capability - this time to
rtl8365mb_phylink_get_caps() - so that the above default behaviour works
for ports with internal PHY again.

Fixes: cd369db53613 ("net: dsa: realtek: convert to phylink_generic_validate()")
Signed-off-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://lore.kernel.org/r/20220607184624.417641-1-alvin@pqrs.dk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/realtek/rtl8365mb.c