linux/drivers/net/dsa/microchip
Tobias Jakobi (Compleo) 7faff12e82 net: dsa: microchip: fix register write order in ksz8_ind_write8()
[ Upstream commit b7fb7729c9 ]

This bug was noticed while re-implementing parts of the kernel
driver in userspace using spidev. The goal was to enable some
of the errata workarounds that Microchip describes in their
errata sheet [1].

Both the errata sheet and the regular datasheet of e.g. the KSZ8795
imply that you need to do this for indirect register accesses:
- write a 16-bit value to a control register pair (this value
  consists of the indirect register table, and the offset inside
  the table)
- either read or write an 8-bit value from the data storage
  register (indicated by REG_IND_BYTE in the kernel)

The current implementation has the order swapped. It can be
proven, by reading back some indirect register with known content
(the EEE register modified in ksz8_handle_global_errata() is one of
these), that this implementation does not work.

Private discussion with Oleksij Rempel of Pengutronix has revealed
that the workaround was apparantly never tested on actual hardware.

[1] https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/Errata/KSZ87xx-Errata-DS80000687C.pdf

Signed-off-by: Tobias Jakobi (Compleo) <tobias.jakobi.compleo@gmail.com>
Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>
Fixes: 7b6e6235b6 ("net: dsa: microchip: ksz8795: handle eee specif erratum")
Link: https://lore.kernel.org/r/20240304154135.161332-1-tobias.jakobi.compleo@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2024-03-15 10:48:15 -04:00
..
Kconfig net: dsa: microchip: add DSA support for microchip LAN937x 2022-07-02 16:34:05 +01:00
ksz8.h net: dsa: microchip: ksz8: Make ksz8_r_sta_mac_table() static 2023-07-27 08:50:41 +02:00
ksz8795.c net: dsa: microchip: fix register write order in ksz8_ind_write8() 2024-03-15 10:48:15 -04:00
ksz8795_reg.h net: dsa: microchip: ksz8795: use common xmii function 2022-07-27 09:39:17 +01:00
ksz8863_smi.c net: dsa: microchip: ksz8863_smi: fix bulk access 2023-04-06 12:10:45 +02:00
ksz9477.c net: dsa: microchip: ksz9477: port map correction in ALU table entry register 2023-02-01 08:34:26 +01:00
ksz9477.h net: dsa: microchip: add the support for set_ageing_time 2022-09-16 21:51:47 +01:00
ksz9477_i2c.c net: dsa: microchip: fix probe of I2C-connected KSZ8563 2023-02-01 08:34:45 +01:00
ksz9477_reg.h net: dsa: microchip: add the support for set_ageing_time 2022-09-16 21:51:47 +01:00
ksz_common.c net: dsa: microchip: KSZ9477 register regmap alignment to 32 bit boundaries 2023-09-13 09:42:23 +02:00
ksz_common.h net: dsa: microchip: correct KSZ8795 static MAC table access 2023-07-27 08:50:42 +02:00
ksz_spi.c net: dsa: microchip: remove unnecessary set_drvdata() 2022-09-22 19:30:36 -07:00
lan937x.h net: dsa: microchip: add the support for set_ageing_time 2022-09-16 21:51:47 +01:00
lan937x_main.c net: dsa: microchip: move interrupt handling logic from lan937x to ksz_common 2022-09-26 12:41:57 -07:00
lan937x_reg.h net: dsa: microchip: add the support for set_ageing_time 2022-09-16 21:51:47 +01:00
Makefile net: dsa: microchip: add DSA support for microchip LAN937x 2022-07-02 16:34:05 +01:00