public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: davem@davemloft.net, "Andrew Lunn" <andrew@lunn.ch>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Eric Dumazet" <edumazet@google.com>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Heiner Kallweit" <hkallweit1@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	thomas.petazzoni@bootlin.com,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Köry Maincent" <kory.maincent@bootlin.com>,
	"Simon Horman" <horms@kernel.org>,
	"Romain Gantois" <romain.gantois@bootlin.com>,
	"Antoine Tenart" <atenart@kernel.org>,
	"Marek Behún" <kabel@kernel.org>
Subject: Re: [PATCH net-next 0/2] net: phy: sfp: Add single-byte SMBus SFP access
Date: Sun, 23 Feb 2025 18:48:18 +0100	[thread overview]
Message-ID: <20250223184818.1d3f7e7b@fedora.home> (raw)
In-Reply-To: <Z7tdlaGfVHuaWPaG@shell.armlinux.org.uk>

Hi Russell

On Sun, 23 Feb 2025 17:40:37 +0000
"Russell King (Oracle)" <linux@armlinux.org.uk> wrote:

> On Sun, Feb 23, 2025 at 06:28:45PM +0100, Maxime Chevallier wrote:
> > Hi everyone,
> > 
> > Some PHYs such as the VSC8552 have embedded "Two-wire Interfaces" designed to
> > access SFP modules downstream. These controllers are actually SMBus controllers
> > that can only perform single-byte accesses for read and write.  
> 
> This goes against SFF-8472, and likely breaks atomic access to 16-bit
> PHY registers.
> 
> For the former, I quote from SFF-8472:
> 
> "To guarantee coherency of the diagnostic monitoring data, the host is
> required to retrieve any multi-byte fields from the diagnostic
> monitoring data structure (e.g. Rx Power MSB - byte 104 in A2h, Rx
> Power LSB - byte 105 in A2h) by the use of a single two-byte read
> sequence across the 2-wire interface."
> 
> So, if using a SMBus controller, I think we should at the very least
> disable exporting the hwmon parameters as these become non-atomic
> reads.

That makes sense to me, it's best-effort at that point :)

> Whether PHY access works correctly or not is probably module specific.
> E.g. reading the MII_BMSR register may not return latched link status
> because the reads of the high and low bytes may be interpreted as two
> seperate distinct accesses.
> 
> In an ideal world, I'd prefer to say no to hardware designs like this,
> but unfortunately, hardware designers don't know these details of the
> protocol, and all they see is "two wire, oh SMBus will do".

On that particular PHY I'm mentionning, the feature really is advertised
to HW designers as "you connect that TWI to your SFP cage and you're
good". I was very surprised as well when digging deeper and figuring
that not only it's SMBus, and worse, 1-byte accesses only... However
there are already some HW out there with this feature in use. If this
is OK for you to accept that as a "best effort, degraded mode as
there's no hwmon", that's already great :)

Thanks for being so quick !

Maxime


  reply	other threads:[~2025-02-23 17:48 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-23 17:28 [PATCH net-next 0/2] net: phy: sfp: Add single-byte SMBus SFP access Maxime Chevallier
2025-02-23 17:28 ` [PATCH net-next 1/2] net: phy: sfp: Add support for SMBus module access Maxime Chevallier
2025-02-23 17:28 ` [PATCH net-next 2/2] net: mdio: mdio-i2c: Add support for single-byte SMBus operations Maxime Chevallier
2025-02-24  3:36   ` Andrew Lunn
2025-02-24 10:03     ` Maxime Chevallier
2025-02-23 17:40 ` [PATCH net-next 0/2] net: phy: sfp: Add single-byte SMBus SFP access Russell King (Oracle)
2025-02-23 17:48   ` Maxime Chevallier [this message]
2025-02-25 12:38   ` Bjørn Mork
2025-02-25 13:06     ` Maxime Chevallier
2025-02-25 13:29       ` Andrew Lunn
2025-02-25 17:15     ` Russell King (Oracle)
2025-02-25 18:07       ` Bjørn Mork
2025-02-25 18:40         ` Russell King (Oracle)
2025-02-23 18:37 ` Bjørn Mork
2025-02-23 20:31   ` Russell King (Oracle)
2025-02-24  3:32     ` Andrew Lunn
2025-02-24  7:13       ` Bjørn Mork
2025-02-24  8:47         ` Russell King (Oracle)
2025-02-24  9:35           ` Maxime Chevallier
2025-02-24 13:31         ` Andrew Lunn
2025-02-24 13:48           ` Russell King (Oracle)
2025-02-24 14:18             ` Andrew Lunn
2025-02-24 14:32             ` Marek Behún
2025-02-24 14:38               ` Russell King (Oracle)
2025-02-24 16:24             ` Maxime Chevallier
2025-02-25  8:08               ` Maxime Chevallier
2025-02-24  9:38   ` Maxime Chevallier
2025-02-24 10:36     ` Marek Behún
2025-02-24 16:30 ` Sean Anderson

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=20250223184818.1d3f7e7b@fedora.home \
    --to=maxime.chevallier@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=atenart@kernel.org \
    --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=kory.maincent@bootlin.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 \
    --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