Skip to content

Commit 2b29cb9

Browse files
Russell King (Oracle)kuba-moo
authored andcommitted
net: dsa: mv88e6xxx: fix "don't use PHY_DETECT on internal PHY's"
This commit fixes a misunderstanding in commit 4a3e0ae ("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 5d5b231 (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 4a3e0ae ("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: 4a3e0ae ("net: dsa: mv88e6xxx: don't use PHY_DETECT on internal PHY's") Signed-off-by: Russell King <[email protected]> Tested-by: Maarten Zanders <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent b5bd95d commit 2b29cb9

File tree

1 file changed

+13
-8
lines changed
  • drivers/net/dsa/mv88e6xxx

1 file changed

+13
-8
lines changed

drivers/net/dsa/mv88e6xxx/chip.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,12 @@ static int mv88e6xxx_port_ppu_updates(struct mv88e6xxx_chip *chip, int port)
471471
u16 reg;
472472
int err;
473473

474+
/* The 88e6250 family does not have the PHY detect bit. Instead,
475+
* report whether the port is internal.
476+
*/
477+
if (chip->info->family == MV88E6XXX_FAMILY_6250)
478+
return port < chip->info->num_internal_phys;
479+
474480
err = mv88e6xxx_port_read(chip, port, MV88E6XXX_PORT_STS, &reg);
475481
if (err) {
476482
dev_err(chip->dev,
@@ -752,11 +758,10 @@ static void mv88e6xxx_mac_link_down(struct dsa_switch *ds, int port,
752758
ops = chip->info->ops;
753759

754760
mv88e6xxx_reg_lock(chip);
755-
/* Internal PHYs propagate their configuration directly to the MAC.
756-
* External PHYs depend on whether the PPU is enabled for this port.
761+
/* Force the link down if we know the port may not be automatically
762+
* updated by the switch or if we are using fixed-link mode.
757763
*/
758-
if (((!mv88e6xxx_phy_is_internal(ds, port) &&
759-
!mv88e6xxx_port_ppu_updates(chip, port)) ||
764+
if ((!mv88e6xxx_port_ppu_updates(chip, port) ||
760765
mode == MLO_AN_FIXED) && ops->port_sync_link)
761766
err = ops->port_sync_link(chip, port, mode, false);
762767
mv88e6xxx_reg_unlock(chip);
@@ -779,11 +784,11 @@ static void mv88e6xxx_mac_link_up(struct dsa_switch *ds, int port,
779784
ops = chip->info->ops;
780785

781786
mv88e6xxx_reg_lock(chip);
782-
/* Internal PHYs propagate their configuration directly to the MAC.
783-
* External PHYs depend on whether the PPU is enabled for this port.
787+
/* Configure and force the link up if we know that the port may not
788+
* automatically updated by the switch or if we are using fixed-link
789+
* mode.
784790
*/
785-
if ((!mv88e6xxx_phy_is_internal(ds, port) &&
786-
!mv88e6xxx_port_ppu_updates(chip, port)) ||
791+
if (!mv88e6xxx_port_ppu_updates(chip, port) ||
787792
mode == MLO_AN_FIXED) {
788793
/* FIXME: for an automedia port, should we force the link
789794
* down here - what if the link comes up due to "other" media

0 commit comments

Comments
 (0)