net: pcs: airoha: add support for Airoha AN7583 SoC
Subsystems (3)
RFC PATCH v2 1/1 net: pcs: airoha: add support for Airoha AN7583 SoC
Add support for Airoha AN7583 PCS. This use a new analog PHY implementation that doesn't require manual calibration but makes use of internal algo to lock to the center of the band EYE.
---
Changes v2:
- Fix compilation error when compiled as module
drivers/net/pcs/airoha/Kconfig | 7 + drivers/net/pcs/airoha/Makefile | 3 + drivers/net/pcs/airoha/pcs-airoha-common.c | 173 +- drivers/net/pcs/airoha/pcs-airoha.h | 450 ++++ drivers/net/pcs/airoha/pcs-an7583.c | 2349 ++++++++++++++++++++ 5 files changed, 2972 insertions(+), 10 deletions(-) create mode 100644 drivers/net/pcs/airoha/pcs-an7583.c
drivers/net/pcs/airoha/Kconfig +7 -0
@@ -11,3 +11,10 @@ config PCS_AIROHA_AN7581 help This module provides helper to phylink for managing the Airoha AN7581 PCS for SoC Ethernet and PON SERDES. + +config PCS_AIROHA_AN7583 + tristate "Airoha AN7583 PCS driver" + select PCS_AIROHA + help + This module provides helper to phylink for managing the Airoha + AN7583 PCS for SoC Ethernet and PON SERDES.
drivers/net/pcs/airoha/Makefile +3 -0
@@ -5,3 +5,6 @@ pcs-airoha-objs := pcs-airoha-common.o ifdef CONFIG_PCS_AIROHA_AN7581 pcs-airoha-objs += pcs-an7581.o endif +ifdef CONFIG_PCS_AIROHA_AN7583 +pcs-airoha-objs += pcs-an7583.o +endif
drivers/net/pcs/airoha/pcs-airoha-common.c +163 -10
285 lines not on this page · raw message
drivers/net/pcs/airoha/pcs-airoha.h +450 -0
667 lines not on this page · raw message
drivers/net/pcs/airoha/pcs-an7583.c new file +2349 -0
2,032 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.55.0
Part of the diff is not shown here. View the raw message.
Andrew Lunn
maintainerQuoted 8 lines
drivers/net/pcs/airoha/pcs-airoha-common.c +8
-0+static void an7583_pcs_setup_scu_pcie (struct airoha_pcs_priv *priv, +int index,phy_interface_t interface) +{ +u32 xsi_sel; + +if (priv->phy) +return ; +
drivers/net/pcs/airoha/pcs-airoha-common.c static void airoha_pcs_setup_scu_pcie(struct airoha_pcs_priv *priv, · line 138
Quoted 10 lines
drivers/net/pcs/airoha/pcs-airoha-common.c +10
-0+switch (interface) { +case PHY_INTERFACE_MODE_USXGMII : +case PHY_INTERFACE_MODE_10GBASER : +default : + xsi_sel =AIROHA_SCU_PCIE_XSI1_USXGMII ; + } + +regmap_update_bits (priv->scu,AIROHA_SCU_SSTR , +AIROHA_SCU_PCIE_XSI1_SEL , + xsi_sel);
I suspect the AI will be here soon. xsi_sel is initially a random stack value. IF interface is something else, you use that random value with regmap_update_bits().
drivers/net/pcs/airoha/pcs-airoha-common.c static const struct airoha_pcs_match_data an7581_pcs_usb = { · line 1440
Quoted 9 lines
static const struct
of_device_idairoha_pcs_of_table[] = {drivers/net/pcs/airoha/pcs-airoha-common.c +4
-0{ .compatible = "airoha,an7581-pcs-eth", .data = &an7581_pcs_eth }, { .compatible = "airoha,an7581-pcs-pon", .data = &an7581_pcs_pon }, { .compatible = "airoha,an7581-pcs-pcie", .data = &an7581_pcs_pcie }, { .compatible = "airoha,an7581-pcs-usb", .data = &an7581_pcs_usb }, + { .compatible = "airoha,an7583-pcs-eth", .data = &an7583_pcs_eth }, + { .compatible = "airoha,an7583-pcs-pon", .data = &an7583_pcs_pon }, + { .compatible = "airoha,an7583-pcs-pcie", .data = &an7583_pcs_pcie }, + { .compatible = "airoha,an7583-pcs-usb", .data = &an7583_pcs_usb },
Device tree binding update to list these new compatibles?
Andrew
Quoted 14 lines · Andrew Lunn
Quoted 14 lines
drivers/net/pcs/airoha/pcs-airoha-common.c +14
-0+static void an7583_pcs_setup_scu_pcie (struct airoha_pcs_priv *priv, +int index,phy_interface_t interface) +{ +u32 xsi_sel; + +if (priv->phy) +return ; + +switch (interface) { +case PHY_INTERFACE_MODE_USXGMII : +case PHY_INTERFACE_MODE_10GBASER : +default : + xsi_sel =AIROHA_SCU_PCIE_XSI1_USXGMII ; + }
Quoted 9 lines
drivers/net/pcs/airoha/pcs-airoha-common.c static void airoha_pcs_setup_scu_pcie(struct airoha_pcs_priv *priv, · line 138
Quoted 4 lines
drivers/net/pcs/airoha/pcs-airoha-common.c +4
-0+ +regmap_update_bits (priv->scu,AIROHA_SCU_SSTR , +AIROHA_SCU_PCIE_XSI1_SEL , + xsi_sel);I suspect the AI will be here soon.
xsi_selis initially a random stack value. IF interface is something else, you use that random value withregmap_update_bits().
Doesn't default address that case? Anyway PCS for PCIe here is quite special...
It does support 2500BASE-X or 10G/USXGMII, but 2500base-x is handled by the USB serdes and 10g is handled by the PCIe serdes and this is internally handled by the SCU reg.
This is modelled by the presence of the PHY in DT.
- no PHY -> 10g
- PHY -> 2500base-x and configuration done by the USB PHY
Quoted 11 lines
drivers/net/pcs/airoha/pcs-airoha-common.c static const struct airoha_pcs_match_data an7581_pcs_usb = { · line 1440
Quoted 9 lines
static const struct
of_device_idairoha_pcs_of_table[] = {drivers/net/pcs/airoha/pcs-airoha-common.c +4
-0{ .compatible = "airoha,an7581-pcs-eth", .data = &an7581_pcs_eth }, { .compatible = "airoha,an7581-pcs-pon", .data = &an7581_pcs_pon }, { .compatible = "airoha,an7581-pcs-pcie", .data = &an7581_pcs_pcie }, { .compatible = "airoha,an7581-pcs-usb", .data = &an7581_pcs_usb }, + { .compatible = "airoha,an7583-pcs-eth", .data = &an7583_pcs_eth }, + { .compatible = "airoha,an7583-pcs-pon", .data = &an7583_pcs_pon }, + { .compatible = "airoha,an7583-pcs-pcie", .data = &an7583_pcs_pcie }, + { .compatible = "airoha,an7583-pcs-usb", .data = &an7583_pcs_usb },Device tree binding update to list these new compatibles?
Yes since the AN7581 is still to be merged, I just posted the driver for reference for anyone that is currently using AN7583 and the updated schema will come when it will go out of RFC.
Quoted 2 lines
Andrew
Signature · 1 line
Ansuel
Andrew Lunn
maintainerQuoted 25 lines · Christian Marangi
Quoted 14 lines · Andrew Lunn
Quoted 14 lines
drivers/net/pcs/airoha/pcs-airoha-common.c +14
-0+static void an7583_pcs_setup_scu_pcie (struct airoha_pcs_priv *priv, +int index,phy_interface_t interface) +{ +u32 xsi_sel; + +if (priv->phy) +return ; + +switch (interface) { +case PHY_INTERFACE_MODE_USXGMII : +case PHY_INTERFACE_MODE_10GBASER : +default : + xsi_sel =AIROHA_SCU_PCIE_XSI1_USXGMII ; + }Quoted 9 lines
drivers/net/pcs/airoha/pcs-airoha-common.c static void airoha_pcs_setup_scu_pcie(struct airoha_pcs_priv *priv, · line 138
Quoted 4 lines
drivers/net/pcs/airoha/pcs-airoha-common.c +4
-0+ +regmap_update_bits (priv->scu,AIROHA_SCU_SSTR , +AIROHA_SCU_PCIE_XSI1_SEL , + xsi_sel);I suspect the AI will be here soon.
xsi_selis initially a random stack value. IF interface is something else, you use that random value withregmap_update_bits().
Quoted 1 line
Doesn't default address that case?
Yes, maybe. But why have a switch statement at all?
Andrew
Andrew Lunn
maintainerQuoted 3 lines · Christian Marangi
Add support for Airoha AN7583 PCS. This use a new analog PHY implementation that doesn't require manual calibration but makes use of internal algo to lock to the center of the band EYE.
Is this PHY capable of other things? PCIE? USB?
I ask because a generic PHY driver is often used to represent the PHY, and that can support PCIE, USB as well as networking.
Andrew
Quoted 9 lines · Andrew Lunn
Quoted 3 lines · Christian Marangi
Add support for Airoha AN7583 PCS. This use a new analog PHY implementation that doesn't require manual calibration but makes use of internal algo to lock to the center of the band EYE.
Is this PHY capable of other things? PCIE? USB?
I ask because a generic PHY driver is often used to represent the PHY, and that can support PCIE, USB as well as networking.
Ethernet and PON serdes are only for Ethernet usage. pcs-usb is USB or ethernet 2500base-x and pcs-pcie is the special thing described in the other message.
I'm already using the PHY API where possible to configure the dedicated mode and speed where the double usage is present.
Quoted 2 lines
Andrew
Signature · 1 line
Ansuel