amd-xgbe: add 2.5GbE support to 10G BaseT mode
authorRaju Rangoju <Raju.Rangoju@amd.com>
Wed, 1 Feb 2023 05:49:31 +0000 (11:19 +0530)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 2 Feb 2023 14:17:19 +0000 (15:17 +0100)
Add support to the driver to fully recognize and enable 2.5GbE speed in
10GBaseT mode.

Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c

index f4683d53e58c0d457fd0595190ce963ae72be14d..eea06e07b4a0300273390d7d98f08d811300db2e 100644 (file)
@@ -1882,6 +1882,9 @@ static void xgbe_phy_an_advertising(struct xgbe_prv_data *pdata,
                if (phy_data->phydev &&
                    (phy_data->phydev->speed == SPEED_10000))
                        XGBE_SET_ADV(dlks, 10000baseKR_Full);
+               else if (phy_data->phydev &&
+                        (phy_data->phydev->speed == SPEED_2500))
+                       XGBE_SET_ADV(dlks, 2500baseX_Full);
                else
                        XGBE_SET_ADV(dlks, 1000baseKX_Full);
                break;
@@ -2282,9 +2285,11 @@ static enum xgbe_mode xgbe_phy_switch_baset_mode(struct xgbe_prv_data *pdata)
        case XGBE_MODE_SGMII_100:
        case XGBE_MODE_SGMII_1000:
                return XGBE_MODE_KR;
+       case XGBE_MODE_KX_2500:
+               return XGBE_MODE_SGMII_1000;
        case XGBE_MODE_KR:
        default:
-               return XGBE_MODE_SGMII_1000;
+               return XGBE_MODE_KX_2500;
        }
 }
 
@@ -2644,7 +2649,8 @@ static bool xgbe_phy_valid_speed_baset_mode(struct xgbe_prv_data *pdata,
        case SPEED_1000:
                return true;
        case SPEED_2500:
-               return (phy_data->port_mode == XGBE_PORT_MODE_NBASE_T);
+               return ((phy_data->port_mode == XGBE_PORT_MODE_10GBASE_T) ||
+                       (phy_data->port_mode == XGBE_PORT_MODE_NBASE_T));
        case SPEED_10000:
                return (phy_data->port_mode == XGBE_PORT_MODE_10GBASE_T);
        default:
@@ -3024,6 +3030,7 @@ static bool xgbe_phy_port_mode_mismatch(struct xgbe_prv_data *pdata)
                if ((phy_data->port_speeds & XGBE_PHY_PORT_SPEED_10) ||
                    (phy_data->port_speeds & XGBE_PHY_PORT_SPEED_100) ||
                    (phy_data->port_speeds & XGBE_PHY_PORT_SPEED_1000) ||
+                   (phy_data->port_speeds & XGBE_PHY_PORT_SPEED_2500) ||
                    (phy_data->port_speeds & XGBE_PHY_PORT_SPEED_10000))
                        return false;
                break;
@@ -3474,6 +3481,10 @@ static int xgbe_phy_init(struct xgbe_prv_data *pdata)
                        XGBE_SET_SUP(lks, 1000baseT_Full);
                        phy_data->start_mode = XGBE_MODE_SGMII_1000;
                }
+               if (phy_data->port_speeds & XGBE_PHY_PORT_SPEED_2500) {
+                       XGBE_SET_SUP(lks, 2500baseT_Full);
+                       phy_data->start_mode = XGBE_MODE_KX_2500;
+               }
                if (phy_data->port_speeds & XGBE_PHY_PORT_SPEED_10000) {
                        XGBE_SET_SUP(lks, 10000baseT_Full);
                        phy_data->start_mode = XGBE_MODE_KR;