From: Kory Maincent <kory.maincent@bootlin.com>
To: Maxime Chevallier <maxime.chevallier@bootlin.com>
Cc: davem@davemloft.net, "Andrew Lunn" <andrew@lunn.ch>,
"Jakub Kicinski" <kuba@kernel.org>,
"Eric Dumazet" <edumazet@google.com>,
"Paolo Abeni" <pabeni@redhat.com>,
"Russell King" <linux@armlinux.org.uk>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
thomas.petazzoni@bootlin.com,
"Florian Fainelli" <f.fainelli@gmail.com>,
"Simon Horman" <horms@kernel.org>,
"Romain Gantois" <romain.gantois@bootlin.com>,
"Marek Behún" <kabel@kernel.org>
Subject: Re: [PATCH net] net: mdio: mdio-i2c: Hold the i2c bus lock during smbus transactions
Date: Fri, 3 Oct 2025 16:13:30 +0200 [thread overview]
Message-ID: <20251003161241.5da55da1@kmaincent-XPS-13-7390> (raw)
In-Reply-To: <20251003070311.861135-1-maxime.chevallier@bootlin.com>
On Fri, 3 Oct 2025 09:03:06 +0200
Maxime Chevallier <maxime.chevallier@bootlin.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@bootlin.com>
Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>
Thank you!
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2025-10-03 14:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-03 7:03 [PATCH net] net: mdio: mdio-i2c: Hold the i2c bus lock during smbus transactions Maxime Chevallier
2025-10-03 14:13 ` Kory Maincent [this message]
2025-10-06 13:24 ` Andrew Lunn
2025-10-07 9:00 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251003161241.5da55da1@kmaincent-XPS-13-7390 \
--to=kory.maincent@bootlin.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=horms@kernel.org \
--cc=kabel@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=maxime.chevallier@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=romain.gantois@bootlin.com \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox