[PATCH RFC net-next v3 1/2] net: pcs: xpcs: Activate DW_XPCS_SGMII_MODE_MAC_MANUAL for KSZ9477

From: Tristram.Ha
Date: Fri Feb 07 2025 - 19:25:50 EST


From: Tristram Ha <tristram.ha@xxxxxxxxxxxxx>

Microchip KSZ9477 SGMII uses old XPCS IP and requires special code to
operate correctly. A special value from PMA device ids will be used to
activate DW_XPCS_SGMII_MODE_MAC_MANUL.

Signed-off-by: Tristram Ha <tristram.ha@xxxxxxxxxxxxx>
---
drivers/net/pcs/pcs-xpcs.c | 2 ++
include/linux/pcs/pcs-xpcs.h | 1 +
2 files changed, 3 insertions(+)

diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c
index d522e4a5a138..5aad67ff4a4f 100644
--- a/drivers/net/pcs/pcs-xpcs.c
+++ b/drivers/net/pcs/pcs-xpcs.c
@@ -1482,6 +1482,8 @@ static struct dw_xpcs *xpcs_create(struct mdio_device *mdiodev)
xpcs->sgmii_10_100_8bit = DW_XPCS_SGMII_10_100_8BIT;
xpcs->sgmii_mode = DW_XPCS_SGMII_MODE_PHY_HW;
} else {
+ if (xpcs->info.pma == MICROCHIP_KSZ9477_PMA_ID)
+ xpcs->sgmii_mode = DW_XPCS_SGMII_MODE_MAC_MANUAL;
xpcs->need_reset = true;
}

diff --git a/include/linux/pcs/pcs-xpcs.h b/include/linux/pcs/pcs-xpcs.h
index 733f4ddd2ef1..637d5356a961 100644
--- a/include/linux/pcs/pcs-xpcs.h
+++ b/include/linux/pcs/pcs-xpcs.h
@@ -39,6 +39,7 @@ enum dw_xpcs_pma_id {
DW_XPCS_PMA_GEN5_10G_ID,
DW_XPCS_PMA_GEN5_12G_ID,
WX_TXGBE_XPCS_PMA_10G_ID = 0x0018fc80,
+ MICROCHIP_KSZ9477_PMA_ID = 0x00229477,
};

struct dw_xpcs_info {
--
2.34.1