From: Thangaraj Samynathan <thangaraj.s@microchip.com>
To: <netdev@vger.kernel.org>
Cc: <andrew+netdev@lunn.ch>, <davem@davemloft.net>,
<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
<bryan.whitehead@microchip.com>, <UNGLinuxDriver@microchip.com>,
<linux@armlinux.org.uk>, <linux-kernel@vger.kernel.org>
Subject: [PATCH v4 0/5] net: lan743x: Add SFP support for PCI11x1x
Date: Thu, 14 May 2026 16:20:23 +0530 [thread overview]
Message-ID: <20260514105028.42942-1-thangaraj.s@microchip.com> (raw)
This series adds SFP module support for the Microchip PCI11x1x Ethernet
controller family by integrating with the kernel's phylink/SFP subsystem.
The PCI11x1x device contains an embedded PCIe switch with downstream
ports for the Ethernet controller and a multi-function peripheral endpoint
(GPIO, I2C, UART, SPI controllers). SFP support relies on this peripheral
endpoint: the GPIO controller provides the SFP control/status signals and
the I2C controller provides access to the SFP module EEPROM. SFP capability
is hardware-strapped and detected at probe time.
Patch 1 renames the misleading is_sgmii_en flag to is_pcs_en to better
reflect that it tracks PCS interface enablement rather than a specific
SGMII mode. No functional change.
Patch 2 reads the SFP enable straps (STRAP_SFP_USE_EN_ and STRAP_SFP_EN_)
from the PCI11x1x strap registers and stores the result in a new
is_sfp_support_en flag. A validation check ensures PCS is also enabled
whenever SFP support is requested, since SFP operation requires the PCS
interface.
Patch 3 registers software nodes to describe the SFP hardware topology to
the kernel: the GPIO device (for TX-fault, TX-disable, LOS, mod-def0, and
rate-select0 signals), the I2C adapter (for SFP EEPROM access), the SFP
cage node, and a phylink node configured for in-band-status mode. The
driver navigates the PCI topology at probe time to locate the paired
peripheral controller functions. A new CONFIG_LAN743X_SFP Kconfig symbol
guards the feature and selects the required I2C, GPIO, SFP, and PCS_XPCS
dependencies.
Patch 4 registers an SFP platform device backed by the SFP software node
when SFP support is enabled, and associates the I2C adapter's firmware node
so the SFP subsystem can manage module detection and EEPROM reads.
Patch 5 adds a dedicated PCS MDIO bus and an XPCS instance for SFP link
management. C45 read/write callbacks are wired to the existing internal
SGMII access functions. The mac_select_pcs phylink callback returns the
XPCS instance when present. SGMII and 2.5GBASE-X interface modes are
enabled in phylink to support the range of SFP modules. The phylink
connect path is also updated to skip the fallback PHY scan when SFP
support is active.
Based on original work by Raju Lakkaraju:
https://lwn.net/ml/all/20240911161054.4494-1-Raju.Lakkaraju%40microchip.com/
Change Log:
===========
v3 -> v4:
- Use device_find_child() + i2c_verify_adapter() to locate the I2C
adapter and dev_is_auxiliary() + name match to locate the GPIO aux
device; removes dependency on peripheral driver struct layouts
[patch 3/5, 4/5]
- Use pci_walk_bus() for PCI peripheral device traversal [patch 4/5]
- Fix memory leak on error paths in lan743x_swnodes_register()
[patch 3/5]
- Fix missing NULL terminator in property_entry arrays [patch 3/5]
- Use DL_FLAG_AUTOREMOVE_CONSUMER for device links to peripheral
devices [patch 4/5]
- Set phy_mask = ~0 on PCS MDIO bus to prevent unintended PHY scan
[patch 5/5]
- Style fixes [patch 3/5]
v2 -> v3:
- Add patch 1/5 to rename is_sgmii_en -> is_pcs_en as a prerequisite
cleanup before the SFP series [patch 1/5]
- Update error message to reference strap names:
"SFP_EN strap specified without SGMII_EN strap" [patch 2/5]
- Use str_enable_disable() helper for debug logging instead of open-coded
ternary [patch 2/5]
- Add is_sfp_support_en initialisation to false in probe [patch 2/5]
- Move <linux/i2c.h>, <linux/gpio/machine.h>, <linux/auxiliary_bus.h>
includes, PCI1XXXX_*/PCI11X1X_* macros, NODE_PROP macro and helper
structs from lan743x_main.c to lan743x_main.h [patch 3/5]
- Add lan743x_swnodes_unregister() helper with kfree inside the if block
[patch 3/5]
- Move software node registration out of lan743x_hardware_init() into
lan743x_phylink_create() with proper error unwind, so it is not called
on PM resume path [patch 3/5]
- Move software node unregistration from lan743x_full_cleanup() into
lan743x_destroy_phylink() to be symmetric with registration and handle
probe failure path correctly [patch 3/5]
- Use kzalloc_obj() instead of kzalloc() for sw_nodes allocation
[patch 3/5]
- Fix typo: "SPIcontrollers" -> "SPI controllers" in comment [patch 3/5]
- Add cleanup_sfp: label in probe error path; null sfp_dev and i2c_adap
pointers after unregister in lan743x_full_cleanup() [patch 4/5]
- Move <linux/platform_device.h> to lan743x_main.h where
struct platform_device *sfp_dev is declared [patch 4/5]
- Fix probe failure path: goto cleanup_hardware -> goto cleanup_phylink
on lan743x_sfp_register() failure [patch 4/5]
- Consolidate phylink PCS and 2500Base-X support into a single patch
[patch 5/5]
- Switch from struct dw_xpcs * to struct phylink_pcs * internally; use
xpcs_create_pcs_mdiodev() instead of xpcs_create_mdiodev() +
xpcs_to_phylink_pcs(), and xpcs_destroy_pcs() instead of
xpcs_destroy() [patch 5/5]
- Use devm_mdiobus_alloc() instead of mdiobus_alloc() for pcs_mdiobus
[patch 5/5]
- Move <linux/phylink.h> and <linux/pcs/pcs-xpcs.h> from
lan743x_main.c to lan743x_main.h [patch 5/5]
v1 -> v2:
- Split the patches to 'PHYLINK' and 'SFP' parts
- Change variable name from 'chip_rev' to 'fpga_rev'
- SFP GPIO definitions and other macros move from lan743x_main.c to
lan743x_main.h file
- Change from 'PCI11X1X_' to 'PCI11X1X_EVB_PCI11010_' strings for
GPIO macros
- Add platform_device_unregister() when sfp register fail
- Add two new patches to this patch series
Thangaraj Samynathan (5):
net: lan743x: rename is_sgmii_en to is_pcs_en
net: lan743x: read SFP straps from PCI11x1x device
net: lan743x: Add support to software-nodes for SFP
net: lan743x: Register SFP platform device for PCI11x1x
net: lan743x: Add PCS/XPCS support for SFP on PCI11x1x
drivers/net/ethernet/microchip/Kconfig | 15 +
.../net/ethernet/microchip/lan743x_ethtool.c | 4 +-
drivers/net/ethernet/microchip/lan743x_main.c | 450 +++++++++++++++++-
drivers/net/ethernet/microchip/lan743x_main.h | 69 ++-
4 files changed, 520 insertions(+), 18 deletions(-)
--
2.34.1
next reply other threads:[~2026-05-14 10:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-14 10:50 Thangaraj Samynathan [this message]
2026-05-14 10:50 ` [PATCH v4 1/5] net: lan743x: rename is_sgmii_en to is_pcs_en Thangaraj Samynathan
2026-05-14 12:38 ` Andrew Lunn
2026-05-14 10:50 ` [PATCH v4 2/5] net: lan743x: read SFP straps from PCI11x1x device Thangaraj Samynathan
2026-05-14 12:47 ` Andrew Lunn
2026-05-14 10:50 ` [PATCH v4 3/5] net: lan743x: Add support to software-nodes for SFP Thangaraj Samynathan
2026-05-14 12:57 ` Andrew Lunn
2026-05-14 13:02 ` Andrew Lunn
2026-05-14 10:50 ` [PATCH v4 4/5] net: lan743x: Register SFP platform device for PCI11x1x Thangaraj Samynathan
2026-05-14 10:50 ` [PATCH v4 5/5] net: lan743x: Add PCS/XPCS support for SFP on PCI11x1x Thangaraj Samynathan
2026-05-14 13:16 ` 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=20260514105028.42942-1-thangaraj.s@microchip.com \
--to=thangaraj.s@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew+netdev@lunn.ch \
--cc=bryan.whitehead@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.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