bianbu-linux-6.6/drivers/net/dsa/mv88e6xxx
Fabio Estevam 6ccf50d4d4 net: dsa: mv88e6xxx: Avoid EEPROM timeout when EEPROM is absent
Since commit 23d775f12d ("net: dsa: mv88e6xxx: Wait for EEPROM done
before HW reset") the following error is seen on a imx8mn board with
a 88E6320 switch:

mv88e6085 30be0000.ethernet-1:00: Timeout waiting for EEPROM done

This board does not have an EEPROM attached to the switch though.

This problem is well explained by Andrew Lunn:

"If there is an EEPROM, and the EEPROM contains a lot of data, it could
be that when we perform a hardware reset towards the end of probe, it
interrupts an I2C bus transaction, leaving the I2C bus in a bad state,
and future reads of the EEPROM do not work.

The work around for this was to poll the EEInt status and wait for it
to go true before performing the hardware reset.

However, we have discovered that for some boards which do not have an
EEPROM, EEInt never indicates complete. As a result,
mv88e6xxx_g1_wait_eeprom_done() spins for a second and then prints a
warning.

We probably need a different solution than calling
mv88e6xxx_g1_wait_eeprom_done(). The datasheet for 6352 documents the
EEPROM Command register:

bit 15 is:

  EEPROM Unit Busy. This bit must be set to a one to start an EEPROM
  operation (see EEOp below). Only one EEPROM operation can be
  executing at one time so this bit must be zero before setting it to
  a one.  When the requested EEPROM operation completes this bit will
  automatically be cleared to a zero. The transition of this bit from
  a one to a zero can be used to generate an interrupt (the EEInt in
  Global 1, offset 0x00).

and more interesting is bit 11:

  Register Loader Running. This bit is set to one whenever the
  register loader is busy executing instructions contained in the
  EEPROM."

Change to using mv88e6xxx_g2_eeprom_wait() to fix the timeout error
when the EEPROM chip is not present.

Fixes: 23d775f12d ("net: dsa: mv88e6xxx: Wait for EEPROM done before HW reset")
Suggested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2023-10-02 07:26:48 +01:00
..
chip.c net: dsa: mv88e6xxx: Avoid EEPROM timeout when EEPROM is absent 2023-10-02 07:26:48 +01:00
chip.h net: dsa: mv88e6xxx: cleanup after phylink_pcs conversion 2023-07-14 08:51:49 +01:00
devlink.c net: devlink: let the core report the driver name instead of the drivers 2022-11-30 21:49:38 -08:00
devlink.h net: dsa: tear down devlink port regions when tearing down the devlink port on error 2021-09-19 13:05:44 +01:00
global1.c net: dsa: mv88e6xxx: Avoid EEPROM timeout when EEPROM is absent 2023-10-02 07:26:48 +01:00
global1.h net: dsa: mv88e6xxx: Avoid EEPROM timeout when EEPROM is absent 2023-10-02 07:26:48 +01:00
global1_atu.c net: dsa: mv88e6xxx: mac-auth/MAB implementation 2023-01-10 11:58:39 +01:00
global1_vtu.c net: dsa: mv88e6xxx: replace VTU violation prints with trace points 2022-12-12 15:01:18 -08:00
global2.c net: dsa: mv88e6xxx: Avoid EEPROM timeout when EEPROM is absent 2023-10-02 07:26:48 +01:00
global2.h net: dsa: mv88e6xxx: Avoid EEPROM timeout when EEPROM is absent 2023-10-02 07:26:48 +01:00
global2_avb.c net: dsa: mv88e6xxx: wait for AVB Busy bit 2019-08-11 21:27:15 -07:00
global2_scratch.c net: dsa: mv88e6xxx: add mv88e6352_g2_scratch_port_has_serdes() 2022-02-03 14:10:35 +00:00
hwtstamp.c net: dsa: Use netif_rx(). 2022-03-04 12:02:19 +00:00
hwtstamp.h net: dsa: no longer clone skb in core driver 2021-04-27 14:10:15 -07:00
Kconfig net: dsa: mv88e6xxx: depend on PTP conditionally 2022-12-26 09:03:44 +00:00
Makefile net: dsa: mv88e6xxx: convert 88e639x to phylink_pcs 2023-07-14 08:51:49 +01:00
pcs-639x.c net: dsa: mv88e6xxx: Add erratum 3.14 for 88E6390X and 88E6190X 2023-08-02 10:32:00 +01:00
pcs-6185.c net: dsa: mv88e6xxx: convert 88e6185 to phylink_pcs 2023-07-14 08:51:48 +01:00
pcs-6352.c net: dsa: mv88e6xxx: convert 88e6352 to phylink_pcs 2023-07-14 08:51:49 +01:00
phy.c net: dsa: mv88e6xxx: Separate C22 and C45 transactions 2023-01-10 15:53:37 -08:00
phy.h net: dsa: mv88e6xxx: Separate C22 and C45 transactions 2023-01-10 15:53:37 -08:00
port.c net: dsa: mv88e6xxx: cleanup after phylink_pcs conversion 2023-07-14 08:51:49 +01:00
port.h net: dsa: mv88e6xxx: add support for MV88E6071 switch 2023-05-31 09:56:08 +01:00
port_hidden.c net: dsa: mv88e6xxx: Fix port_hidden_wait to account for port_base_addr 2022-04-26 12:03:58 +02:00
ptp.c net: dsa: mv88e6xxx: Enable PTP receive for mv88e6390 2023-01-16 13:36:57 +00:00
ptp.h net: dsa: mv88e6xxx: Enable PTP receive for mv88e6390 2023-01-16 13:36:57 +00:00
serdes.c net: dsa: mv88e6xxx: convert 88e639x to phylink_pcs 2023-07-14 08:51:49 +01:00
serdes.h net: dsa: mv88e6xxx: cleanup after phylink_pcs conversion 2023-07-14 08:51:49 +01:00
smi.c net: dsa: mv88e6xxx: Improve indirect addressing performance 2022-01-31 11:29:12 +00:00
smi.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
switchdev.c net: dsa: mv88e6xxx: mac-auth/MAB implementation 2023-01-10 11:58:39 +01:00
switchdev.h net: dsa: mv88e6xxx: mac-auth/MAB implementation 2023-01-10 11:58:39 +01:00
trace.c net: dsa: mv88e6xxx: replace ATU violation prints with trace points 2022-12-12 15:01:18 -08:00
trace.h net: dsa: mv88e6xxx: replace VTU violation prints with trace points 2022-12-12 15:01:18 -08:00