Skip to content

Commit 8a88093

Browse files
joabreudavem330
authored andcommitted
net: stmmac: Add XLGMII support
Add XLGMII support for stmmac including the list of speeds and defines for them. Signed-off-by: Jose Abreu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7c6dbd2 commit 8a88093

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

drivers/net/ethernet/stmicro/stmmac/common.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,12 @@ struct mac_link {
426426
u32 speed5000;
427427
u32 speed10000;
428428
} xgmii;
429+
struct {
430+
u32 speed25000;
431+
u32 speed40000;
432+
u32 speed50000;
433+
u32 speed100000;
434+
} xlgmii;
429435
};
430436

431437
struct mii_regs {

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,38 @@ static void stmmac_validate(struct phylink_config *config,
849849
phylink_set(mac_supported, 10000baseKX4_Full);
850850
phylink_set(mac_supported, 10000baseKR_Full);
851851
}
852+
if (!max_speed || (max_speed >= 25000)) {
853+
phylink_set(mac_supported, 25000baseCR_Full);
854+
phylink_set(mac_supported, 25000baseKR_Full);
855+
phylink_set(mac_supported, 25000baseSR_Full);
856+
}
857+
if (!max_speed || (max_speed >= 40000)) {
858+
phylink_set(mac_supported, 40000baseKR4_Full);
859+
phylink_set(mac_supported, 40000baseCR4_Full);
860+
phylink_set(mac_supported, 40000baseSR4_Full);
861+
phylink_set(mac_supported, 40000baseLR4_Full);
862+
}
863+
if (!max_speed || (max_speed >= 50000)) {
864+
phylink_set(mac_supported, 50000baseCR2_Full);
865+
phylink_set(mac_supported, 50000baseKR2_Full);
866+
phylink_set(mac_supported, 50000baseSR2_Full);
867+
phylink_set(mac_supported, 50000baseKR_Full);
868+
phylink_set(mac_supported, 50000baseSR_Full);
869+
phylink_set(mac_supported, 50000baseCR_Full);
870+
phylink_set(mac_supported, 50000baseLR_ER_FR_Full);
871+
phylink_set(mac_supported, 50000baseDR_Full);
872+
}
873+
if (!max_speed || (max_speed >= 100000)) {
874+
phylink_set(mac_supported, 100000baseKR4_Full);
875+
phylink_set(mac_supported, 100000baseSR4_Full);
876+
phylink_set(mac_supported, 100000baseCR4_Full);
877+
phylink_set(mac_supported, 100000baseLR4_ER4_Full);
878+
phylink_set(mac_supported, 100000baseKR2_Full);
879+
phylink_set(mac_supported, 100000baseSR2_Full);
880+
phylink_set(mac_supported, 100000baseCR2_Full);
881+
phylink_set(mac_supported, 100000baseLR2_ER2_FR2_Full);
882+
phylink_set(mac_supported, 100000baseDR2_Full);
883+
}
852884
}
853885

854886
/* Half-Duplex can only work with single queue */
@@ -929,6 +961,32 @@ static void stmmac_mac_link_up(struct phylink_config *config,
929961
default:
930962
return;
931963
}
964+
} else if (interface == PHY_INTERFACE_MODE_XLGMII) {
965+
switch (speed) {
966+
case SPEED_100000:
967+
ctrl |= priv->hw->link.xlgmii.speed100000;
968+
break;
969+
case SPEED_50000:
970+
ctrl |= priv->hw->link.xlgmii.speed50000;
971+
break;
972+
case SPEED_40000:
973+
ctrl |= priv->hw->link.xlgmii.speed40000;
974+
break;
975+
case SPEED_25000:
976+
ctrl |= priv->hw->link.xlgmii.speed25000;
977+
break;
978+
case SPEED_10000:
979+
ctrl |= priv->hw->link.xgmii.speed10000;
980+
break;
981+
case SPEED_2500:
982+
ctrl |= priv->hw->link.speed2500;
983+
break;
984+
case SPEED_1000:
985+
ctrl |= priv->hw->link.speed1000;
986+
break;
987+
default:
988+
return;
989+
}
932990
} else {
933991
switch (speed) {
934992
case SPEED_2500:

0 commit comments

Comments
 (0)