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

Tristram.Ha@microchip.com posted 3 patches 1 year ago
There is a newer version of this series
[PATCH RFC net-next v2 1/3] net: pcs: xpcs: Activate DW_XPCS_SGMII_MODE_MAC_MANUAL for KSZ9477
Posted by Tristram.Ha@microchip.com 1 year ago
From: Tristram Ha <tristram.ha@microchip.com>

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@microchip.com>
---
 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