linux/drivers/net/dsa/microchip
Tristram Ha e8c35bfce4 net: dsa: microchip: Add SGMII port support to KSZ9477 switch
The KSZ9477 switch driver uses the XPCS driver to operate its SGMII
port.  However there are some hardware bugs in the KSZ9477 SGMII
module so workarounds are needed.  There was a proposal to update the
XPCS driver to accommodate KSZ9477, but the new code is not generic
enough to be used by other vendors.  It is better to do all these
workarounds inside the KSZ9477 driver instead of modifying the XPCS
driver.

There are 3 hardware issues.  The first is the MII_ADVERTISE register
needs to be write once after reset for the correct code word to be
sent.  The XPCS driver disables auto-negotiation first before
configuring the SGMII/1000BASE-X mode and then enables it back.  The
KSZ9477 driver then writes the MII_ADVERTISE register before enabling
auto-negotiation.  In 1000BASE-X mode the MII_ADVERTISE register will
be set, so KSZ9477 driver does not need to write it.

The second issue is the MII_BMCR register needs to set the exact speed
and duplex mode when running in SGMII mode.  During link polling the
KSZ9477 will check the speed and duplex mode are different from
previous ones and update the MII_BMCR register accordingly.

The last issue is 1000BASE-X mode does not work with auto-negotiation
on.  The cause is the local port hardware does not know the link is up
and so network traffic is not forwarded.  The workaround is to write 2
additional bits when 1000BASE-X mode is configured.

Note the SGMII interrupt in the port cannot be masked.  As that
interrupt is not handled in the KSZ9477 driver the SGMII interrupt bit
will not be set even when the XPCS driver sets it.

Signed-off-by: Tristram Ha <tristram.ha@microchip.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Tested-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://patch.msgid.link/20250520230720.23425-1-Tristram.Ha@microchip.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2025-05-26 17:15:51 +02:00
..
Kconfig net: dsa: microchip: Add SGMII port support to KSZ9477 switch 2025-05-26 17:15:51 +02:00
Makefile net: dsa: microchip: rename ksz8 series files 2024-09-06 08:41:35 +01:00
ksz8.c net: dsa: microchip: fix DCB apptrust configuration on KSZ88x3 2025-03-25 10:40:54 -07:00
ksz8.h net: dsa: microchip: add WoL support for KSZ87xx family 2024-08-16 10:25:02 -07:00
ksz8_reg.h net: dsa: microchip: clean up ksz8_reg definition macros 2024-09-06 08:41:35 +01:00
ksz8863_smi.c net: dsa: microchip: replace unclear KSZ8830 strings 2024-09-06 08:41:35 +01:00
ksz9477.c net: dsa: microchip: Add SGMII port support to KSZ9477 switch 2025-05-26 17:15:51 +02:00
ksz9477.h net: dsa: microchip: Add SGMII port support to KSZ9477 switch 2025-05-26 17:15:51 +02:00
ksz9477_acl.c
ksz9477_i2c.c net: dsa: microchip: Add suspend/resume support to KSZ DSA driver 2024-12-19 18:05:57 -08:00
ksz9477_reg.h net: dsa: microchip: Fix KSZ9477 set_ageing_time function 2024-12-19 18:04:04 -08:00
ksz9477_tc_flower.c net: dsa: microchip: ksz9477: flower: validate control flags 2024-04-15 10:33:14 +01:00
ksz_common.c net: dsa: microchip: Add SGMII port support to KSZ9477 switch 2025-05-26 17:15:51 +02:00
ksz_common.h net: dsa: microchip: Add SGMII port support to KSZ9477 switch 2025-05-26 17:15:51 +02:00
ksz_dcb.c net: dsa: microchip: fix DCB apptrust configuration on KSZ88x3 2025-03-25 10:40:54 -07:00
ksz_dcb.h net: dsa: microchip: add support DSCP priority mapping 2024-05-08 10:35:11 +01:00
ksz_ptp.c net: dsa: convert to ndo_hwtstamp_get() and ndo_hwtstamp_set() 2025-05-09 16:34:09 -07:00
ksz_ptp.h net: dsa: convert to ndo_hwtstamp_get() and ndo_hwtstamp_set() 2025-05-09 16:34:09 -07:00
ksz_ptp_reg.h
ksz_spi.c net: dsa: microchip: Add suspend/resume support to KSZ DSA driver 2024-12-19 18:05:57 -08:00
lan937x.h net: dsa: microchip: add support for side MDIO interface in LAN937x 2024-11-11 16:04:32 -08:00
lan937x_main.c net: dsa: microchip: Fix LAN937X set_ageing_time function 2024-12-19 18:04:04 -08:00
lan937x_reg.h net: dsa: microchip: Fix LAN937X set_ageing_time function 2024-12-19 18:04:04 -08:00