devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next PATCH 0/6] net: pcs: Introduce support for PCS OF
@ 2025-03-18 23:58 Christian Marangi
  2025-03-18 23:58 ` [net-next PATCH 1/6] net: phylink: reset PCS-Phylink double reference on phylink_stop Christian Marangi
                   ` (7 more replies)
  0 siblings, 8 replies; 34+ messages in thread
From: Christian Marangi @ 2025-03-18 23:58 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Heiner Kallweit, Russell King, Philipp Zabel, Christian Marangi,
	Daniel Golle, netdev, devicetree, linux-kernel, upstream

This series introduce a most awaited feature that is correctly
provide PCS with OF without having to use specific export symbol.

The concept is to implement a producer-consumer API similar to other
subsystem like clock or PHY.

That seems to be the best solution to the problem as PCS driver needs
to be detached from phylink and implement a simple way to provide a
PCS while maintaining support for probe defer or driver removal.

To keep the implementation simple, the PCS driver devs needs some
collaboration to correctly implement this. This is O.K. as helper
to correctly implement this are provided hence it's really a matter
of following a pattern to correct follow removal of a PCS driver.

A PCS provider have to implement and call of_pcs_add_provider() in
probe function and define an xlate function to define how the PCS
should be provided based on the requested interface and phandle spec
defined in DT (based on the #pcs-cells)

of_pcs_get() is provided to provide a specific PCS declared in DT
an index.

A simple xlate function is provided for simple single PCS
implementation, of_pcs_simple_get.

A PCS provider on driver removal should first call
phylink_pcs_release() to release the PCS from phylink and then
delete itself as a provider with of_pcs_del_provider() helper.

A PCS declared with a PCS provider implementation can be used
by declaring in the MAC OPs the .mac_select_pcs with the helper
of_phylink_mac_select_pcs().

This helper will just try every phandle declared in "pcs-handle"
until one supported for the requested interface is found.

A user for this new implementation is provided as an Airoha PCS
driver. This was also tested downstream with the IPQ95xx QCOM SoC
and with the help of Daniel also on the various Mediatek MT7988
SoC with both SFP cage implementation and DSA attached.

Lots of tests were done with driver unbind/bind and with interface
up/down. It was initially used phylink_stop to handle PCS driver
removal, but it was then decided to use dev_close with
phylink_pcs_release() as it does better handle interface drop
and communicate more info to the user than leaving the interface
in a dangling state.

Christian Marangi (6):
  net: phylink: reset PCS-Phylink double reference on phylink_stop
  net: pcs: Implement OF support for PCS driver
  net: phylink: Correctly handle PCS probe defer from PCS provider
  dt-bindings: net: ethernet-controller: permit to define multiple PCS
  net: pcs: airoha: add PCS driver for Airoha SoC
  dt-bindings: net: pcs: Document support for Airoha Ethernet PCS

 .../bindings/net/ethernet-controller.yaml     |    2 -
 .../bindings/net/pcs/airoha,pcs.yaml          |  112 +
 drivers/net/pcs/Kconfig                       |   13 +
 drivers/net/pcs/Makefile                      |    2 +
 drivers/net/pcs/pcs-airoha.c                  | 2858 +++++++++++++++++
 drivers/net/pcs/pcs.c                         |  185 ++
 drivers/net/phy/phylink.c                     |   46 +-
 include/linux/pcs/pcs-airoha.h                |   11 +
 include/linux/pcs/pcs-provider.h              |   46 +
 include/linux/pcs/pcs.h                       |   62 +
 include/linux/phylink.h                       |    2 +
 11 files changed, 3336 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/pcs/airoha,pcs.yaml
 create mode 100644 drivers/net/pcs/pcs-airoha.c
 create mode 100644 drivers/net/pcs/pcs.c
 create mode 100644 include/linux/pcs/pcs-airoha.h
 create mode 100644 include/linux/pcs/pcs-provider.h
 create mode 100644 include/linux/pcs/pcs.h

-- 
2.48.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2025-04-02 15:09 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-18 23:58 [net-next PATCH 0/6] net: pcs: Introduce support for PCS OF Christian Marangi
2025-03-18 23:58 ` [net-next PATCH 1/6] net: phylink: reset PCS-Phylink double reference on phylink_stop Christian Marangi
2025-03-18 23:58 ` [net-next PATCH 2/6] net: pcs: Implement OF support for PCS driver Christian Marangi
2025-03-19  9:11   ` Christian Marangi
2025-03-19  9:25   ` Christian Marangi
2025-03-19 15:17   ` Russell King (Oracle)
2025-03-19 16:03     ` Christian Marangi
2025-03-19 16:26       ` Russell King (Oracle)
2025-03-19 17:05   ` kernel test robot
2025-04-01 20:59   ` Sean Anderson
2025-03-18 23:58 ` [net-next PATCH 3/6] net: phylink: Correctly handle PCS probe defer from PCS provider Christian Marangi
2025-03-19 15:58   ` Russell King (Oracle)
2025-03-19 16:18     ` Christian Marangi
2025-03-19 17:02       ` Russell King (Oracle)
2025-03-19 17:35         ` Christian Marangi
2025-03-19 19:31           ` Russell King (Oracle)
2025-03-27 17:37             ` Christian Marangi
2025-03-27 18:08               ` Russell King (Oracle)
2025-03-28  8:59               ` Russell King (Oracle)
2025-03-18 23:58 ` [net-next PATCH 4/6] dt-bindings: net: ethernet-controller: permit to define multiple PCS Christian Marangi
2025-03-21 16:18   ` Rob Herring
2025-03-27 15:49     ` Christian Marangi
2025-04-01 20:12       ` Sean Anderson
2025-03-18 23:58 ` [net-next PATCH 5/6] net: pcs: airoha: add PCS driver for Airoha SoC Christian Marangi
2025-03-19  9:13   ` Christian Marangi
2025-03-19 20:41   ` kernel test robot
2025-03-20  1:54   ` kernel test robot
2025-03-21  6:35   ` kernel test robot
2025-03-18 23:58 ` [net-next PATCH 6/6] dt-bindings: net: pcs: Document support for Airoha Ethernet PCS Christian Marangi
2025-03-21 16:22   ` Rob Herring
2025-03-19 17:29 ` [net-next PATCH 0/6] net: pcs: Introduce support for PCS OF Russell King (Oracle)
2025-03-19 17:44   ` Christian Marangi
2025-04-02  0:14 ` Sean Anderson
2025-04-02 15:08   ` Christian Marangi (Ansuel)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).