[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251003161241.5da55da1@kmaincent-XPS-13-7390>
Date: Fri, 3 Oct 2025 16:13:30 +0200
From: Kory Maincent <kory.maincent@...tlin.com>
To: Maxime Chevallier <maxime.chevallier@...tlin.com>
Cc: davem@...emloft.net, Andrew Lunn <andrew@...n.ch>, Jakub Kicinski
<kuba@...nel.org>, Eric Dumazet <edumazet@...gle.com>, Paolo Abeni
<pabeni@...hat.com>, Russell King <linux@...linux.org.uk>, Heiner Kallweit
<hkallweit1@...il.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, thomas.petazzoni@...tlin.com, Florian
Fainelli <f.fainelli@...il.com>, Simon Horman <horms@...nel.org>, Romain
Gantois <romain.gantois@...tlin.com>, Marek Behún
<kabel@...nel.org>
Subject: Re: [PATCH net] net: mdio: mdio-i2c: Hold the i2c bus lock during
smbus transactions
On Fri, 3 Oct 2025 09:03:06 +0200
Maxime Chevallier <maxime.chevallier@...tlin.com> wrote:
> 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: d4bd3aca33c2 ("net: mdio: mdio-i2c: Add support for single-byte SMBus
> operations") Signed-off-by: Maxime Chevallier <maxime.chevallier@...tlin.com>
Reviewed-by: Kory Maincent <kory.maincent@...tlin.com>
Thank you!
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
Powered by blists - more mailing lists