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