public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Jonas Jelonek <jelonek.jonas@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Bjørn Mork" <bjorn@mork.no>
Subject: Re: [PATCH net-next v4] net: sfp: add SMBus I2C block support
Date: Fri, 9 Jan 2026 18:03:23 +0100	[thread overview]
Message-ID: <0c181c3d-cb68-4ce4-b505-6fc9d10495cd@bootlin.com> (raw)
In-Reply-To: <397e0cdd-86de-4978-a068-da8237b6e247@gmail.com>

Hi Jonas,

On 09/01/2026 17:48, Jonas Jelonek wrote:
> Hi Maxime,
> 
> On 09.01.26 16:51, Maxime Chevallier wrote:
>> Hi,
>>
>> On 09/01/2026 11:13, Jonas Jelonek wrote:
>>> Commit 7662abf4db94 ("net: phy: sfp: Add support for SMBus module access")
>>> added support for SMBus-only controllers for module access. However,
>>> this is restricted to single-byte accesses and has the implication that
>>> hwmon is disabled (due to missing atomicity of 16-bit accesses) and
>>> warnings are printed.
>>>
>>> There are probably a lot of SMBus-only I2C controllers out in the wild
>>> which support block reads. Right now, they don't work with SFP modules.
>>> This applies - amongst others - to I2C/SMBus-only controllers in Realtek
>>> longan and mango SoCs.
>>>
>>> Downstream in OpenWrt, a patch similar to the abovementioned patch is
>>> used for current LTS kernel 6.12. However, this uses byte-access for all
>>> kinds of access and thus disregards the atomicity for wider access.
>>>
>>> Introduce read/write SMBus I2C block operations to support SMBus-only
>>> controllers with appropriate support for block read/write. Those
>>> operations are used for all accesses if supported, otherwise the
>>> single-byte operations will be used. With block reads, atomicity for
>>> 16-bit reads as required by hwmon is preserved and thus, hwmon can be
>>> used.
>>>
>>> The implementation requires the I2C_FUNC_SMBUS_I2C_BLOCK to be
>>> supported as it relies on reading a pre-defined amount of bytes.
>>> This isn't intended by the official SMBus Block Read but supported by
>>> several I2C controllers/drivers.
>>>
>>> Support for word access is not implemented due to issues regarding
>>> endianness.
>> This patch should probably be accompanied with a similar addition to the
>> mdio-i2c driver. for now, we only support full-featured I2C adapters, or
>> single-byte smbus, nothing in-between :(
>>
>> Do you have something like this in the pipe ? not that this blocks this
>> particular patch, however I think that Russell's suggestion of making
>> this generic is the way to go.
> 
> I agree to Russell's suggestion and will work on that. Apart from that, I haven't
> considered a similar change for mdio-i2c yet. No issue to deal with that but 
> I think I have no way to test this properly.

ACK, I'll gladly help with testing. This should actually be easily
achievable with a board that has a real i2c interface connected to the
SFP cage, as there's a i2c smbus emulation layer. The SMBus helpers will
work with a true I2C adapter, you may have to tweak the code though.

This is relevant for modules that have a built-in PHY that you can
access, if you don't have any I can run some tests here, I have more
than enough modules...

If you don't have time at all for that, I may give this a shot at some
point, but my time is a bit scarce right now :'(

Maxime



>> Maxime
> 
> Best,
> Jonas


  reply	other threads:[~2026-01-09 17:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-09 10:13 [PATCH net-next v4] net: sfp: add SMBus I2C block support Jonas Jelonek
2026-01-09 12:13 ` Russell King (Oracle)
2026-01-09 16:21   ` Russell King (Oracle)
2026-01-09 16:46     ` Jonas Jelonek
2026-01-09 15:51 ` Maxime Chevallier
2026-01-09 16:48   ` Jonas Jelonek
2026-01-09 17:03     ` Maxime Chevallier [this message]
2026-01-16 11:16       ` Jonas Jelonek
2026-01-16 11:21         ` Russell King (Oracle)
2026-01-16 11:51           ` Bjørn Mork
2026-01-16 13:14         ` Maxime Chevallier
2026-01-16 13:15         ` Andrew Lunn

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=0c181c3d-cb68-4ce4-b505-6fc9d10495cd@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=bjorn@mork.no \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=jelonek.jonas@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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