From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Greg Patrick <gregspatrick@hotmail.com>,
Russell King <linux@armlinux.org.uk>,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Manuel Stocker <mensi@mensi.ch>
Subject: Re: [PATCH net-next v3] net: phy: sfp: detect presence via I2C when no MOD_DEF0 GPIO
Date: Mon, 15 Jun 2026 19:19:07 +0200 [thread overview]
Message-ID: <df98cce0-e9ff-4680-92a1-9d5a6e18be47@bootlin.com> (raw)
In-Reply-To: <20260611175341.2223184-1-gregspatrick@hotmail.com>
Hi,
On 6/11/26 19:53, Greg Patrick wrote:
> An SFP cage (compatible "sff,sfp") whose MOD_DEF0 signal is not wired to a
> GPIO currently falls back to sff_gpio_get_state(), which unconditionally
> reports the module as present. An empty cage therefore fails its probe and
> is parked in SFP_MOD_ERROR forever; because SFP_F_PRESENT never deasserts
> there is no REMOVE event to recover the state machine, so a module inserted
> after boot is never detected, and empty cages spam -EIO at boot.
>
> This affects boards that route none of the cage presence signal to a
> software-readable input. On the NicGiga S100-0800S-M (RTL9303, 8x SFP+) the
> cage I2C bus is the switch's SMBus master; TX_DISABLE is driven via a
> PCA9534 I/O expander, but no MOD_ABS/MOD_DEF0 line reaches a readable GPIO
> (the RTL9303 gpio0 lines read stuck-low, the single PCA9534 is fully
> consumed by TX_DISABLE, and there is no RTL8231). The Horaco ZX-SW82TS-L2P
> (RTL9302D, 2x SFP+) is independently affected in the same way.
>
> For such an SFP cage, derive presence from a throttled single-byte I2C read
> of the module EEPROM instead: a successful read asserts SFP_F_PRESENT,
> R_PROBE_ABSENT consecutive failures clear it (to ride out a transient error
> on a live module). The existing poll then emits SFP_E_INSERT / SFP_E_REMOVE
> normally, giving working hot-plug and silencing the boot-time -EIO spam on
> empty cages. Presence is re-probed every T_PROBE_PRESENT, so insertion is
> detected within that interval and removal within
> T_PROBE_PRESENT * R_PROBE_ABSENT.
>
> A soldered-down module (compatible "sff,sff") has no presence signal and is
> genuinely always present, so it continues to use sff_gpio_get_state(); the
> new path is gated on the cage type advertising SFP_F_PRESENT.
>
> Signed-off-by: Greg Patrick <gregspatrick@hotmail.com>
> Tested-by: Manuel Stocker <mensi@mensi.ch>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
And it doesn't regress any boards I've tested this on (although this was
very quick testing), so
Tested-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
I'm wondering if a followup could be to add another loud warning to
dmesg that the HW design is broken, leading to potentially quirky behaviour.
We have lots of those for SFP.
Maxime
next prev parent reply other threads:[~2026-06-15 17:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 17:53 [PATCH net-next v3] net: phy: sfp: detect presence via I2C when no MOD_DEF0 GPIO Greg Patrick
2026-06-15 17:19 ` Maxime Chevallier [this message]
2026-06-15 19:50 ` 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=df98cce0-e9ff-4680-92a1-9d5a6e18be47@bootlin.com \
--to=maxime.chevallier@bootlin.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gregspatrick@hotmail.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mensi@mensi.ch \
--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