]> git.hungrycats.org Git - linux/commitdiff
net: dsa: microchip: fix KSZ8765 fiber detection
authorSebastien Royen <sebastien.royen@armadeus.com>
Wed, 7 Oct 2026 08:05:57 +0000 (10:05 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 8 Oct 2026 17:48:00 +0000 (10:48 -0700)
The KSZ8765 is similar to the KSZ8795 but has two fiber ports.

KSZ8_PORT_STATUS_0 is used to detect fiber mode. It is currently
defined as 0x08, which is the Global Control 6 MIB Control register
and has bit 7 defined as Flush Counter.

Set KSZ8_PORT_STATUS_0 to 0x18, which is the Port 1 Status 0 register
where bit 7 is the Fiber Mode bit.

This issue was discovered when upgrading an embedded device from kernel
5.10 to 6.16. The device was using a KSZ8765 device tree configuration
and the corresponding hardware, but during boot the kernel incorrectly
detected it as a KSZ8795. The relevant boot messages were:

  ksz-switch spi0.0: found switch: KSZ8795, rev 0
  ksz-switch spi0.0: Device tree specifies chip KSZ8765 but found KSZ8795, please fix it!

Cc: stable@vger.kernel.org
Fixes: 91a98917a883 ("net: dsa: microchip: move switch chip_id detection to ksz_common")
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Signed-off-by: Sebastien Royen <sebastien.royen@armadeus.com>
Link: https://patch.msgid.link/20261007080557.15719-1-sebastien.royen@armadeus.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/microchip/ksz_common.h

index cbe98494578c371ee22b80f9508c3b35b8d6291a..f6104f714a8d160f69a761fd3a2297df35010e0b 100644 (file)
@@ -853,7 +853,7 @@ static inline bool ksz_is_sgmii_port(struct ksz_device *dev, int port)
 #define KSZ88_FAMILY_ID                        0x88
 #define KSZ8895_FAMILY_ID              0x95
 
-#define KSZ8_PORT_STATUS_0             0x08
+#define KSZ8_PORT_STATUS_0             0x18
 #define KSZ8_PORT_FIBER_MODE           BIT(7)
 
 #define SW_CHIP_ID_M                   GENMASK(7, 4)