net: dsa: microchip: implement PHY loopback configuration for KSZ8794 and KSZ8873
authorOleksij Rempel <o.rempel@pengutronix.de>
Wed, 24 Jan 2024 12:33:14 +0000 (13:33 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 27 Jan 2024 05:25:25 +0000 (21:25 -0800)
commit9e62bed6e105f2f522e360a024fc93c64c58a207
tree50c21a15c42a2928feef6ee5eafb6a2ea15c5663
parentd1b7d0d85d59bfe6f57b1604a922466e4f8ee734
net: dsa: microchip: implement PHY loopback configuration for KSZ8794 and KSZ8873

Correct the PHY loopback bit handling in the ksz8_w_phy_bmcr and
ksz8_r_phy_bmcr functions for KSZ8794 and KSZ8873 variants in the ksz8795
driver. Previously, the code erroneously used Bit 7 of port register 0xD
for both chip variants, which is actually for LED configuration. This
update ensures the correct registers and bits are used for the PHY
loopback feature:

- For KSZ8794: Use 0xF / Bit 7.
- For KSZ8873: Use 0xD / Bit 0.

The lack of loopback support was seen on KSZ8873 system by using
"ethtool -t lanX". After this patch, the ethtool selftest will work,
but only if port is not part of a bridge.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Acked-by: Arun Ramadoss <arun.ramadoss@microchip.com>
Link: https://lore.kernel.org/r/20240124123314.734815-4-o.rempel@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/microchip/ksz8795.c
drivers/net/dsa/microchip/ksz8795_reg.h