[][kernel][mt7987][eth][Add the MAC to PCS mapping rule for the NETSYSv3.1]
[Description]
Add the MAC to PCS mapping rule for the NETSYSv3.1.
Without this patch, the ETH driver cannot configure correct SGMII PCS
for the GMAC1 and GMAC3 for the NETSYSv3.1.
[Release-log]
N/A
Change-Id: Ia860377e5d7162d866a7f8a90ef388fb76d74c06
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/9825314
diff --git a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_usxgmii.c b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_usxgmii.c
index a981b27..1606928 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_usxgmii.c
+++ b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_usxgmii.c
@@ -91,17 +91,32 @@
u32 xgmii_id = mac_id;
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) {
- switch (mac_id) {
- case MTK_GMAC1_ID:
- case MTK_GMAC2_ID:
- xgmii_id = 1;
- break;
- case MTK_GMAC3_ID:
- xgmii_id = 0;
- break;
- default:
- pr_info("[%s] Warning: get illegal mac_id=%d !=!!!\n",
- __func__, mac_id);
+ if (eth->soc->caps == MT7988_CAPS) {
+ switch (mac_id) {
+ case MTK_GMAC1_ID:
+ case MTK_GMAC2_ID:
+ xgmii_id = 1;
+ break;
+ case MTK_GMAC3_ID:
+ xgmii_id = 0;
+ break;
+ default:
+ pr_info("[%s] Warning: get illegal mac_id=%d !=!!!\n",
+ __func__, mac_id);
+ }
+ } else {
+ switch (mac_id) {
+ case MTK_GMAC1_ID:
+ xgmii_id = 0;
+ break;
+ case MTK_GMAC2_ID:
+ case MTK_GMAC3_ID:
+ xgmii_id = 1;
+ break;
+ default:
+ pr_info("[%s] Warning: get illegal mac_id=%d !=!!!\n",
+ __func__, mac_id);
+ }
}
}
@@ -113,16 +128,30 @@
u32 mac_id = xgmii_id;
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) {
- switch (xgmii_id) {
- case 0:
- mac_id = 2;
- break;
- case 1:
- mac_id = 1;
- break;
- default:
- pr_info("[%s] Warning: get illegal xgmii_id=%d !=!!!\n",
- __func__, xgmii_id);
+ if (eth->soc->caps == MT7988_CAPS) {
+ switch (xgmii_id) {
+ case 0:
+ mac_id = 2;
+ break;
+ case 1:
+ mac_id = 1;
+ break;
+ default:
+ pr_info("[%s] Warning: get illegal xgmii_id=%d !=!!!\n",
+ __func__, xgmii_id);
+ }
+ } else {
+ switch (xgmii_id) {
+ case 0:
+ mac_id = 0;
+ break;
+ case 1:
+ mac_id = 2;
+ break;
+ default:
+ pr_info("[%s] Warning: get illegal xgmii_id=%d !=!!!\n",
+ __func__, xgmii_id);
+ }
}
}