From 41e73dfe10eb1384faac0daddd877ca8145343df Mon Sep 17 00:00:00 2001 From: Serge Semin Date: Thu, 6 Jul 2023 14:39:34 +0300 Subject: net: pcs: xpcs: Add Baikal-T1 XPCS support Baikal-T1 SoC is synthesized with the DW XPCS v3.11b IP-core attached to DW xGMAC v2.11a over the XGMII interface. DW XPCS is configured to be of the Back-plane multi-mode with KR/KX4 speeds support (no 1G speed). Thus the PCS sublayer supports Clause 73 and 72 auto-negotiations performed over the 10GBASE-KR and 10GBASE-KX4 link modes. So in order to have the denoted features enabled for the Baikal-T1 XGMAC/XPCS chain the DW XPCS driver is updated with the Baikal-T1 XPCS-specific compat-list. It will be selected in case if the platform detects the "baikal,bt1-xpcs" compatible device or a device with the custom BT1_XGMAC_XPCS_ID id. Note the XPCS device is synthesized with the Synopsys 10G Gen5 PMA. Thus the corresponding PMA-id is specified in order activate the PMA-specific config methods. Signed-off-by: Serge Semin --- drivers/net/pcs/pcs-xpcs-plat.c | 2 ++ drivers/net/pcs/pcs-xpcs.c | 28 ++++++++++++++++++++++++++++ include/linux/pcs/pcs-xpcs.h | 1 + 3 files changed, 31 insertions(+) diff --git a/drivers/net/pcs/pcs-xpcs-plat.c b/drivers/net/pcs/pcs-xpcs-plat.c index e48b9586026c..7ee57de7ec57 100644 --- a/drivers/net/pcs/pcs-xpcs-plat.c +++ b/drivers/net/pcs/pcs-xpcs-plat.c @@ -427,6 +427,7 @@ DW_XPCS_INFO_DECLARE(xpcs_pma_gen4_3g, DW_XPCS_ID_NATIVE, DW_XPCS_PMA_GEN4_3G_ID DW_XPCS_INFO_DECLARE(xpcs_pma_gen4_6g, DW_XPCS_ID_NATIVE, DW_XPCS_PMA_GEN4_6G_ID); DW_XPCS_INFO_DECLARE(xpcs_pma_gen5_10g, DW_XPCS_ID_NATIVE, DW_XPCS_PMA_GEN5_10G_ID); DW_XPCS_INFO_DECLARE(xpcs_pma_gen5_12g, DW_XPCS_ID_NATIVE, DW_XPCS_PMA_GEN5_12G_ID); +DW_XPCS_INFO_DECLARE(xpcs_bt1, BT1_XGMAC_XPCS_ID, DW_XPCS_PMA_GEN5_10G_ID); static const struct of_device_id xpcs_of_ids[] = { { .compatible = "snps,dw-xpcs", .data = &xpcs_generic }, @@ -437,6 +438,7 @@ static const struct of_device_id xpcs_of_ids[] = { { .compatible = "snps,dw-xpcs-gen4-6g", .data = &xpcs_pma_gen4_6g }, { .compatible = "snps,dw-xpcs-gen5-10g", .data = &xpcs_pma_gen5_10g }, { .compatible = "snps,dw-xpcs-gen5-12g", .data = &xpcs_pma_gen5_12g }, + { .compatible = "baikal,bt1-xpcs", .data = &xpcs_bt1 }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, xpcs_of_ids); diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index fcf43f2e82c5..cceae9767399 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -1642,6 +1642,30 @@ static const struct dw_xpcs_compat nxp_sja1110_xpcs_compat[] = { } }; +static const struct dw_xpcs_compat bt1_xpcs_compat[] = { + { + .interface = PHY_INTERFACE_MODE_XGMII, + .supported = xpcs_xgmii_features, + .an_mode = DW_AN_C73, + }, { + .interface = PHY_INTERFACE_MODE_10GBASER, + .supported = xpcs_10gbaser_features, + .an_mode = DW_10GBASER, + .pma_config = xpcs_10gbaser_pma_config, + }, { + .interface = PHY_INTERFACE_MODE_10GBASEX, + .supported = xpcs_10gbasex_features, + .an_mode = DW_10GBASEX, + .pma_config = xpcs_10gbasex_pma_config, + }, { + .interface = PHY_INTERFACE_MODE_XAUI, + .supported = xpcs_10gbasex_features, + .an_mode = DW_10GBASEX, + .pma_config = xpcs_10gbasex_pma_config, + }, { + } +}; + static const struct dw_xpcs_desc xpcs_desc_list[] = { { .id = DW_XPCS_ID, @@ -1655,6 +1679,10 @@ static const struct dw_xpcs_desc xpcs_desc_list[] = { .id = NXP_SJA1110_XPCS_ID, .mask = DW_XPCS_ID_MASK, .compat = nxp_sja1110_xpcs_compat, + }, { + .id = BT1_XGMAC_XPCS_ID, + .mask = DW_XPCS_ID_MASK, + .compat = bt1_xpcs_compat, }, }; diff --git a/include/linux/pcs/pcs-xpcs.h b/include/linux/pcs/pcs-xpcs.h index 67d3d92bc4e0..e9f29dc33a46 100644 --- a/include/linux/pcs/pcs-xpcs.h +++ b/include/linux/pcs/pcs-xpcs.h @@ -24,6 +24,7 @@ enum dw_xpcs_pcs_id { DW_XPCS_ID_NATIVE = 0, + BT1_XGMAC_XPCS_ID, NXP_SJA1105_XPCS_ID = 0x00000010, NXP_SJA1110_XPCS_ID = 0x00000020, DW_XPCS_ID = 0x7996ced0, -- cgit v1.2.3