linux-kernelorg-stable/drivers/net/mdio
Maxime Chevallier 4dc8b26a3a net: mdio: mdio-i2c: Hold the i2c bus lock during smbus transactions
When accessing an MDIO register using single-byte smbus accesses, we have to
perform 2 consecutive operations targeting the same address,
first accessing the MSB then the LSB of the 16 bit register:

  read_1_byte(addr); <- returns MSB of register at address 'addr'
  read_1_byte(addr); <- returns LSB

Some PHY devices present in SFP such as the Broadcom 5461 don't like
seeing foreign i2c transactions in-between these 2 smbus accesses, and
will return the MSB a second time when trying to read the LSB :

  read_1_byte(addr); <- returns MSB

  	i2c_transaction_for_other_device_on_the_bus();

  read_1_byte(addr); <- returns MSB again

Given the already fragile nature of accessing PHYs/SFPs with single-byte
smbus accesses, it's safe to say that this Broadcom PHY may not be the
only one acting like this.

Let's therefore hold the i2c bus lock while performing our smbus
transactions to avoid interleaved accesses.

Fixes: d4bd3aca33 ("net: mdio: mdio-i2c: Add support for single-byte SMBus operations")
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20251003070311.861135-1-maxime.chevallier@bootlin.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2025-10-07 10:44:46 +02:00
..
Kconfig net: phy: move config symbol MDIO_BUS to drivers/net/phy/Kconfig 2025-09-23 16:56:27 -07:00
Makefile net: mdio: Add MDIO bus controller for Airoha AN7583 2025-06-27 10:09:36 +01:00
acpi_mdio.c
fwnode_mdio.c net: pse-pd: Introduce attached_phydev to pse control 2025-06-18 19:00:15 -07:00
mdio-airoha.c net: mdio: Add MDIO bus controller for Airoha AN7583 2025-06-27 10:09:36 +01:00
mdio-aspeed.c
mdio-bcm-iproc.c
mdio-bcm-unimac.c net: mdio: mdio-bcm-unimac: Refine incorrect clock message 2025-08-12 17:16:20 -07:00
mdio-bitbang.c
mdio-cavium.c
mdio-cavium.h
mdio-gpio.c
mdio-hisi-femac.c
mdio-i2c.c net: mdio: mdio-i2c: Hold the i2c bus lock during smbus transactions 2025-10-07 10:44:46 +02:00
mdio-ipq4019.c
mdio-ipq8064.c
mdio-moxart.c
mdio-mscc-miim.c
mdio-mux-bcm-iproc.c
mdio-mux-bcm6368.c
mdio-mux-gpio.c net: mdio: mux-gpio: use gpiod_multi_set_value_cansleep 2025-06-12 18:37:51 -07:00
mdio-mux-meson-g12a.c
mdio-mux-meson-gxl.c net: mdio: mux-meson-gxl: set reversed bit when using internal phy 2025-04-29 12:01:53 -07:00
mdio-mux-mmioreg.c
mdio-mux-multiplexer.c
mdio-mux.c
mdio-mvusb.c
mdio-octeon.c
mdio-realtek-rtl9300.c net: mdio: Add RTL9300 MDIO driver 2025-04-15 11:00:37 +02:00
mdio-regmap.c
mdio-sun4i.c
mdio-thunder.c net: mdio: thunder: Use pure PCI devres API 2025-04-28 16:19:16 -07:00
mdio-xgene.c
of_mdio.c of: mdio: warn if deprecated fixed-link binding is used 2025-09-15 18:15:41 -07:00