Re: [PATCH net-next v5] net: sfp: extend SMBus support

From: Maxime Chevallier

Date: Fri Jan 16 2026 - 09:16:33 EST




On 16/01/2026 15:07, Andrew Lunn wrote:
> On Fri, Jan 16, 2026 at 02:43:47PM +0100, Jonas Jelonek wrote:
>> Hi,
>>
>> On 16.01.26 14:23, Maxime Chevallier wrote:
>>> I think Russell pointed it out, but I was also wondering the same.
>>> How do we deal with controllers that cannot do neither block nor
>>> single-byte, i.e. that can only do word access ?
>>>
>>> We can't do transfers that have an odd length. And there are some,
>>> see sfp_cotsworks_fixup_check() for example.
>>>
>>> Maybe these smbus controller don't even exist, but I think we should
>>> anyway have some log saying that this doesn't work, either at SFP
>>> access time, or at init time.
>>
>> I tried to guard that in the sfp_i2c_configure() right now. The whole path
>> to allow SMBus transfers is only allowed if there's at least byte access. For
>> exactly the reason that we need byte access in case of odd lengths.
>
> Is there a use case for odd lengths? Apart from 1.

There's sfp_cotsworks_fixup_check() that does a 3-byte access :

id->base.phys_id = SFF8024_ID_SFF_8472;
id->base.phys_ext_id = SFP_PHYS_EXT_ID_SFP;
id->base.connector = SFF8024_CONNECTOR_LC;
sfp_write(sfp, false, SFP_PHYS_ID, &id->base, 3);

It may be possible to turn that into 2 2-byte accesses if we write

id->base.phys_id = SFF8024_ID_SFF_8472;
id->base.phys_ext_id = SFP_PHYS_EXT_ID_SFP;

and then

id->base.phys_ext_id = SFP_PHYS_EXT_ID_SFP;
id->base.connector = SFF8024_CONNECTOR_LC;

But let's first figure-out if word-only smbus are really a thing

>
>> This of course rules out any controllers which just can do word access.
>
> There are some PHYs embedded within SFPs which kill the bus if you do
> anything but 1 byte access. There is a quirk for it. We should refuse
> to drive the SFP if we have such an SFP and an I2C bus that can only
> do words.

Heh true, same for the weird SGMII <-> 100FX from Prolabs

Maxime