Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: dsa: mv88e6xxx: Wait for EEPROM done before HW reset

If the switch is reset during active EEPROM transactions, as in
just after an SoC reset after power up, the I2C bus transaction
may be cut short leaving the EEPROM internal I2C state machine
in the wrong state. When the switch is reset again, the bad
state machine state may result in data being read from the wrong
memory location causing the switch to enter unexpected mode
rendering it inoperational.

Fixes: a3dcb3e7e70c ("net: dsa: mv88e6xxx: Wait for EEPROM done after HW reset")
Signed-off-by: Alfred Lee <l00g33k@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20230815001323.24739-1-l00g33k@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Alfred Lee and committed by
Jakub Kicinski
23d775f1 de4c5efe

+8
+8
drivers/net/dsa/mv88e6xxx/chip.c
··· 3034 3034 3035 3035 /* If there is a GPIO connected to the reset pin, toggle it */ 3036 3036 if (gpiod) { 3037 + /* If the switch has just been reset and not yet completed 3038 + * loading EEPROM, the reset may interrupt the I2C transaction 3039 + * mid-byte, causing the first EEPROM read after the reset 3040 + * from the wrong location resulting in the switch booting 3041 + * to wrong mode and inoperable. 3042 + */ 3043 + mv88e6xxx_g1_wait_eeprom_done(chip); 3044 + 3037 3045 gpiod_set_value_cansleep(gpiod, 1); 3038 3046 usleep_range(10000, 20000); 3039 3047 gpiod_set_value_cansleep(gpiod, 0);