[PATCH 00/16] lan966x pci device: Add support for SFPs

Herve Codina
2025-04-07T14:56:01Z

Hi,

This series add support for SFPs ports available on the LAN966x PCI
device. In order to have the SFPs supported, additional devices are
needed such as clock controller and I2C.

As a reminder, the LAN966x PCI device driver use a device-tree overlay
to describe devices available on the PCI board. Adding support for SFPs
ports consists in adding more devices in the already existing
device-tree overlay.

With those devices added, the device-tree overlay is more complex and
some consumer/supplier relationship are needed in order to remove
devices in correct order when the LAN966x PCI driver is removed.

Those links are typically provided by fw_devlink and we faced some
issues with fw_devlink and overlays.

This series gives the big picture related to the SFPs support from
fixing issues to adding new devices. Of course, it can be split if
needed.

The first part of the series (patch 1, 2 and 3) fixes fw_devlink when it
is used with overlay. Patches 1 and 3 were previously sent by Saravana
[0]. I just rebased them on top of v6.15-rc1 and added patch 2 in order
to take into account feedback received on the series sent by Saravana.

Those modification were not sufficient in our case and so, on top of
that, patch 4 and 5 fix some more issues related to fw_devlink.

Patches 6 and 7 are related also to fw_devlink but specific to PCI and
the device-tree nodes created during enumeration.

Patches 8, 9 and 10 are related fw_devlink too but specific to I2C
muxes. Patches purpose is to correctly set a link between an adapter
supplier and its consumer. Indeed, an i2c mux adapter's parent is not
the i2c mux supplier but the adapter the i2c mux is connected to. Adding
a new link between the adapter supplier involved when i2c muxes are used
avoid a freeze observed during device removal.

Patch 11 adds support for fw_delink on x86. fw_devlink is needed to have
the consumer/supplier relationship between devices in order to ensure a
correct device removal order. Adding fw_devlink support for x86 has been
tried in the past but was reverted [1] because it broke some systems.
Instead of disabling fw_devlink on *all* x86 system, use a finer grain
and disable it only on system which could be broken.

Patches 12 and 13 allow to build clock and i2c controller used by the
LAN966x PCI device when the LAN966x PCI device is enabled.

The next 2 patches (patches 14 and 15) update the LAN966x device-tree
overlay itself to have the SPF ports and devices they depends on
described.

The last patch (patch 16) adds new drivers in the needed driver list
available in the Kconfig help to keep this list up to date with the
devices described in the device-tree overlay.

Once again, this series gives the big picture and can be split if
needed. Let me know.

[0] https://lore.kernel.org/lkml/20240411235623.1260061-1-saravanak@google.com/
[1] https://lore.kernel.org/lkml/3c1f2473-92ad-bfc4-258e-a5a08ad73dd0@web.de/

Best regards,
Hervé

Herve Codina (14):
driver core: Rename get_dev_from_fwnode() wrapper to
get_device_from_fwnode()
driver core: Avoid warning when removing a device while its supplier
is unbinding
bus: simple-pm-bus: Populate child nodes at probe
PCI: of: Set fwnode.dev of newly created PCI device nodes
PCI: of: Remove fwnode_dev_initialized() call for a PCI root bridge
node
i2c: core: Introduce i2c_get_adapter_supplier()
i2c: mux: Set adapter supplier
i2c: mux: Create missing devlink between mux and adapter supplier
of: property: Allow fw_devlink device-tree support for x86
clk: lan966x: Add MCHP_LAN966X_PCI dependency
i2c: busses: at91: Add MCHP_LAN966X_PCI dependency
misc: lan966x_pci: Fix dtso nodes ordering
misc: lan966x_pci: Add dtso nodes in order to support SFPs
misc: lan966x_pci: Add drivers needed to support SFPs in Kconfig help

Saravana Kannan (2):
Revert "treewide: Fix probing of devices in DT overlays"
of: dynamic: Fix overlayed devices not probing because of fw_devlink

drivers/base/core.c | 93 ++++++++++++---
drivers/bus/imx-weim.c | 6 -
drivers/bus/simple-pm-bus.c | 23 ++--
drivers/clk/Kconfig | 2 +-
drivers/i2c/busses/Kconfig | 2 +-
drivers/i2c/i2c-core-base.c | 16 +++
drivers/i2c/i2c-core-of.c | 5 -
drivers/i2c/i2c-mux.c | 21 ++++
drivers/misc/Kconfig | 5 +
drivers/misc/lan966x_pci.dtso | 206 ++++++++++++++++++++++++++--------
drivers/of/dynamic.c | 1 -
drivers/of/overlay.c | 15 +++
drivers/of/platform.c | 5 -
drivers/of/property.c | 2 +-
drivers/pci/of.c | 8 +-
drivers/spi/spi.c | 5 -
include/linux/fwnode.h | 1 +
include/linux/i2c.h | 3 +
18 files changed, 318 insertions(+), 101 deletions(-)

--
2.49.0