mbox series

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

Message ID 20250407145546.270683-1-herve.codina@bootlin.com (mailing list archive)
Headers show
Series lan966x pci device: Add support for SFPs | expand

Message

Herve Codina April 7, 2025, 2:55 p.m. UTC
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(-)

Comments

Andy Shevchenko April 7, 2025, 3:19 p.m. UTC | #1
On Mon, Apr 07, 2025 at 04:55:31PM +0200, Herve Codina wrote:
> get_dev_from_fwnode() calls get_device() and so it acquires a reference
> on the device returned.
> 
> In order to be more obvious that this wrapper is a get_device() variant,
> rename it to get_device_from_fwnode().

+1 to the change.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Andy Shevchenko April 7, 2025, 3:43 p.m. UTC | #2
On Mon, Apr 07, 2025 at 04:55:45PM +0200, Herve Codina wrote:
> Recently, new device-tree nodes were added in the overlay to add support
> for SFPs on LAN966x PCI device.
> 
> The LAN966X Kconfig help section mentions drivers related to devices
> added based on the overlay description.
> 
> Add drivers related to devices described by those new nodes in the
> already existing driver list.

...

>  	    - lan966x-serdes (PHY_LAN966X_SERDES)
>  	    - lan966x-miim (MDIO_MSCC_MIIM)
>  	    - lan966x-switch (LAN966X_SWITCH)
> +	    - lan966x-gck (COMMON_CLK_LAN966X)

> +	    - i2c-mux-pinctrl (I2C_MUX_PINCTRL)

Perhaps keep it alphabetically ordered?

> +	    - sama5d2-flexcom (MFD_ATMEL_FLEXCOM)
> +	    - sam9x60-i2c (I2C_AT91)
> +	    - sfp (SFP)