From: Russell King (Oracle) <hidden> Date: 2021-12-07 10:32:51
This commit fixes a misunderstanding in commit 4a3e0aeddf09 ("net: dsa:
mv88e6xxx: don't use PHY_DETECT on internal PHY's").
For Marvell DSA switches with the PHY_DETECT bit (for non-6250 family
devices), controls whether the PPU polls the PHY to retrieve the link,
speed, duplex and pause status to update the port configuration. This
applies for both internal and external PHYs.
For some switches such as 88E6352 and 88E6390X, PHY_DETECT has an
additional function of enabling auto-media mode between the internal
PHY and SERDES blocks depending on which first gains link.
The original intention of commit 5d5b231da7ac (net: dsa: mv88e6xxx: use
PHY_DETECT in mac_link_up/mac_link_down) was to allow this bit to be
used to detect when this propagation is enabled, and allow software to
update the port configuration. This has found to be necessary for some
switches which do not automatically propagate status from the SERDES to
the port, which includes the 88E6390. However, commit 4a3e0aeddf09
("net: dsa: mv88e6xxx: don't use PHY_DETECT on internal PHY's") breaks
this assumption.
Maarten Zanders has confirmed that the issue he was addressing was for
an 88E6250 switch, which does not have a PHY_DETECT bit in bit 12, but
instead a link status bit. Therefore, mv88e6xxx_port_ppu_updates() does
not report correctly.
This patch resolves the above issues by reverting Maarten's change and
instead making mv88e6xxx_port_ppu_updates() indicate whether the port
is internal for the 88E6250 family of switches.
Yes, you're right, I'm targeting the 6250 family. And yes, your
suggestion would solve my case and is a better implementation for
the other devices (as far as I can see).
Fixes: 4a3e0aeddf09 ("net: dsa: mv88e6xxx: don't use PHY_DETECT on internal PHY's")
Signed-off-by: Russell King <redacted>
---
drivers/net/dsa/mv88e6xxx/chip.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
@@ -471,6 +471,12 @@ static int mv88e6xxx_port_ppu_updates(struct mv88e6xxx_chip *chip, int port)u16reg;interr;+/* The 88e6250 family does not have the PHY detect bit. Instead,+*reportwhethertheportisinternal.+*/+if(chip->info->family==MV88E6XXX_FAMILY_6250)+returnport<chip->info->num_internal_phys;+err=mv88e6xxx_port_read(chip,port,MV88E6XXX_PORT_STS,®);if(err){dev_err(chip->dev,
@@ -752,11 +758,10 @@ static void mv88e6xxx_mac_link_down(struct dsa_switch *ds, int port,ops=chip->info->ops;mv88e6xxx_reg_lock(chip);-/* Internal PHYs propagate their configuration directly to the MAC.-*ExternalPHYsdependonwhetherthePPUisenabledforthisport.+/* Force the link down if we know the port may not be automatically+*updatedbytheswitchorifweareusingfixed-linkmode.*/-if(((!mv88e6xxx_phy_is_internal(ds,port)&&-!mv88e6xxx_port_ppu_updates(chip,port))||+if((!mv88e6xxx_port_ppu_updates(chip,port)||mode==MLO_AN_FIXED)&&ops->port_sync_link)err=ops->port_sync_link(chip,port,mode,false);mv88e6xxx_reg_unlock(chip);
@@ -779,11 +784,11 @@ static void mv88e6xxx_mac_link_up(struct dsa_switch *ds, int port,ops=chip->info->ops;mv88e6xxx_reg_lock(chip);-/* Internal PHYs propagate their configuration directly to the MAC.-*ExternalPHYsdependonwhetherthePPUisenabledforthisport.+/* Configure and force the link up if we know that the port may not+*automaticallyupdatedbytheswitchorifweareusingfixed-link+*mode.*/-if((!mv88e6xxx_phy_is_internal(ds,port)&&-!mv88e6xxx_port_ppu_updates(chip,port))||+if(!mv88e6xxx_port_ppu_updates(chip,port)||mode==MLO_AN_FIXED){/* FIXME: for an automedia port, should we force the link*downhere-whatifthelinkcomesupdueto"other"media
Maarten Zanders has confirmed that the issue he was addressing was for
an 88E6250 switch, which does not have a PHY_DETECT bit in bit 12, but
instead a link status bit. Therefore, mv88e6xxx_port_ppu_updates() does
not report correctly.
...> Yes, you're right, I'm targeting the 6250 family. And yes, your
suggestion would solve my case and is a better implementation for
the other devices (as far as I can see).
I confirm that this patch works on my hardware, which uses an 88E6071 (88E6250 family).
From: "Russell King (Oracle)" <linux@armlinux.org.uk> Date: 2021-12-07 13:24:23
On Tue, Dec 07, 2021 at 02:22:56PM +0100, Maarten Zanders wrote:
On 12/7/21 11:32, Russell King (Oracle) wrote:
quoted
Maarten Zanders has confirmed that the issue he was addressing was for
an 88E6250 switch, which does not have a PHY_DETECT bit in bit 12, but
instead a link status bit. Therefore, mv88e6xxx_port_ppu_updates() does
not report correctly.
...> Yes, you're right, I'm targeting the 6250 family. And yes, your
quoted
suggestion would solve my case and is a better implementation for
the other devices (as far as I can see).
I confirm that this patch works on my hardware, which uses an 88E6071
(88E6250 family).
Thanks for testing! Would you be able to supply a Tested-by:
attributation for the patch, so your confirmation can be recorded in
the commit please?
Thanks again.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
This commit fixes a misunderstanding in commit 4a3e0aeddf09 ("net: dsa:
mv88e6xxx: don't use PHY_DETECT on internal PHY's").
For Marvell DSA switches with the PHY_DETECT bit (for non-6250 family
devices), controls whether the PPU polls the PHY to retrieve the link,
speed, duplex and pause status to update the port configuration. This
applies for both internal and external PHYs.
For some switches such as 88E6352 and 88E6390X, PHY_DETECT has an
additional function of enabling auto-media mode between the internal
PHY and SERDES blocks depending on which first gains link.
The original intention of commit 5d5b231da7ac (net: dsa: mv88e6xxx: use
PHY_DETECT in mac_link_up/mac_link_down) was to allow this bit to be
used to detect when this propagation is enabled, and allow software to
update the port configuration. This has found to be necessary for some
switches which do not automatically propagate status from the SERDES to
the port, which includes the 88E6390. However, commit 4a3e0aeddf09
("net: dsa: mv88e6xxx: don't use PHY_DETECT on internal PHY's") breaks
this assumption.
Maarten Zanders has confirmed that the issue he was addressing was for
an 88E6250 switch, which does not have a PHY_DETECT bit in bit 12, but
instead a link status bit. Therefore, mv88e6xxx_port_ppu_updates() does
not report correctly.
This patch resolves the above issues by reverting Maarten's change and
instead making mv88e6xxx_port_ppu_updates() indicate whether the port
is internal for the 88E6250 family of switches.
Yes, you're right, I'm targeting the 6250 family. And yes, your
suggestion would solve my case and is a better implementation for
the other devices (as far as I can see).
Fixes: 4a3e0aeddf09 ("net: dsa: mv88e6xxx: don't use PHY_DETECT on internal PHY's")
Signed-off-by: Russell King <redacted>
Tested-by: Maarten Zanders <redacted>
Thanks Russell
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski [off-list ref]:
On Tue, 07 Dec 2021 10:32:43 +0000 you wrote:
This commit fixes a misunderstanding in commit 4a3e0aeddf09 ("net: dsa:
mv88e6xxx: don't use PHY_DETECT on internal PHY's").
For Marvell DSA switches with the PHY_DETECT bit (for non-6250 family
devices), controls whether the PPU polls the PHY to retrieve the link,
speed, duplex and pause status to update the port configuration. This
applies for both internal and external PHYs.
[...]