Skip to content

Commit 23d775f

Browse files
l00g33kkuba-moo
authored andcommitted
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: a3dcb3e ("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>
1 parent de4c5ef commit 23d775f

File tree

1 file changed

+8
-0
lines changed
  • drivers/net/dsa/mv88e6xxx

1 file changed

+8
-0
lines changed

drivers/net/dsa/mv88e6xxx/chip.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3034,6 +3034,14 @@ static void mv88e6xxx_hardware_reset(struct mv88e6xxx_chip *chip)
30343034

30353035
/* If there is a GPIO connected to the reset pin, toggle it */
30363036
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+
30373045
gpiod_set_value_cansleep(gpiod, 1);
30383046
usleep_range(10000, 20000);
30393047
gpiod_set_value_cansleep(gpiod, 0);

0 commit comments

Comments
 (0)