net/sfc/base: support new link modes
authorAndy Moreton <amoreton@solarflare.com>
Tue, 20 Feb 2018 07:33:50 +0000 (07:33 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 30 Mar 2018 12:08:42 +0000 (14:08 +0200)
Add basic support for new link modes for Medford2.

Signed-off-by: Andy Moreton <amoreton@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
drivers/net/sfc/base/ef10_phy.c
drivers/net/sfc/base/efx.h

index e47ca22..e05fe2b 100644 (file)
@@ -16,6 +16,26 @@ mcdi_phy_decode_cap(
 {
        uint32_t mask;
 
+#define        CHECK_CAP(_cap) \
+       EFX_STATIC_ASSERT(EFX_PHY_CAP_##_cap == MC_CMD_PHY_CAP_##_cap##_LBN)
+
+       CHECK_CAP(10HDX);
+       CHECK_CAP(10FDX);
+       CHECK_CAP(100HDX);
+       CHECK_CAP(100FDX);
+       CHECK_CAP(1000HDX);
+       CHECK_CAP(1000FDX);
+       CHECK_CAP(10000FDX);
+       CHECK_CAP(25000FDX);
+       CHECK_CAP(40000FDX);
+       CHECK_CAP(50000FDX);
+       CHECK_CAP(100000FDX);
+       CHECK_CAP(PAUSE);
+       CHECK_CAP(ASYM);
+       CHECK_CAP(AN);
+       CHECK_CAP(DDM);
+#undef CHECK_CAP
+
        mask = 0;
        if (mcdi_cap & (1 << MC_CMD_PHY_CAP_10HDX_LBN))
                mask |= (1 << EFX_PHY_CAP_10HDX);
@@ -31,8 +51,15 @@ mcdi_phy_decode_cap(
                mask |= (1 << EFX_PHY_CAP_1000FDX);
        if (mcdi_cap & (1 << MC_CMD_PHY_CAP_10000FDX_LBN))
                mask |= (1 << EFX_PHY_CAP_10000FDX);
+       if (mcdi_cap & (1 << MC_CMD_PHY_CAP_25000FDX_LBN))
+               mask |= (1 << EFX_PHY_CAP_25000FDX);
        if (mcdi_cap & (1 << MC_CMD_PHY_CAP_40000FDX_LBN))
                mask |= (1 << EFX_PHY_CAP_40000FDX);
+       if (mcdi_cap & (1 << MC_CMD_PHY_CAP_50000FDX_LBN))
+               mask |= (1 << EFX_PHY_CAP_50000FDX);
+       if (mcdi_cap & (1 << MC_CMD_PHY_CAP_100000FDX_LBN))
+               mask |= (1 << EFX_PHY_CAP_100000FDX);
+
        if (mcdi_cap & (1 << MC_CMD_PHY_CAP_PAUSE_LBN))
                mask |= (1 << EFX_PHY_CAP_PAUSE);
        if (mcdi_cap & (1 << MC_CMD_PHY_CAP_ASYM_LBN))
@@ -61,8 +88,14 @@ mcdi_phy_decode_link_mode(
 
        if (!up)
                *link_modep = EFX_LINK_DOWN;
+       else if (speed == 100000 && fd)
+               *link_modep = EFX_LINK_100000FDX;
+       else if (speed == 50000 && fd)
+               *link_modep = EFX_LINK_50000FDX;
        else if (speed == 40000 && fd)
                *link_modep = EFX_LINK_40000FDX;
+       else if (speed == 25000 && fd)
+               *link_modep = EFX_LINK_25000FDX;
        else if (speed == 10000 && fd)
                *link_modep = EFX_LINK_10000FDX;
        else if (speed == 1000)
@@ -272,8 +305,14 @@ ef10_phy_reconfigure(
                PHY_CAP_ASYM, (cap_mask >> EFX_PHY_CAP_ASYM) & 0x1,
                PHY_CAP_AN, (cap_mask >> EFX_PHY_CAP_AN) & 0x1);
        /* Too many fields for for POPULATE macros, so insert this afterwards */
+       MCDI_IN_SET_DWORD_FIELD(req, SET_LINK_IN_CAP,
+           PHY_CAP_25000FDX, (cap_mask >> EFX_PHY_CAP_25000FDX) & 0x1);
        MCDI_IN_SET_DWORD_FIELD(req, SET_LINK_IN_CAP,
            PHY_CAP_40000FDX, (cap_mask >> EFX_PHY_CAP_40000FDX) & 0x1);
+       MCDI_IN_SET_DWORD_FIELD(req, SET_LINK_IN_CAP,
+           PHY_CAP_50000FDX, (cap_mask >> EFX_PHY_CAP_50000FDX) & 0x1);
+       MCDI_IN_SET_DWORD_FIELD(req, SET_LINK_IN_CAP,
+           PHY_CAP_100000FDX, (cap_mask >> EFX_PHY_CAP_100000FDX) & 0x1);
 
 #if EFSYS_OPT_LOOPBACK
        MCDI_IN_SET_DWORD(req, SET_LINK_IN_LOOPBACK_MODE,
@@ -288,9 +327,18 @@ ef10_phy_reconfigure(
        case EFX_LINK_10000FDX:
                speed = 10000;
                break;
+       case EFX_LINK_25000FDX:
+               speed = 25000;
+               break;
        case EFX_LINK_40000FDX:
                speed = 40000;
                break;
+       case EFX_LINK_50000FDX:
+               speed = 50000;
+               break;
+       case EFX_LINK_100000FDX:
+               speed = 100000;
+               break;
        default:
                speed = 0;
        }
index 6149abf..1b92027 100644 (file)
@@ -424,6 +424,9 @@ typedef enum efx_link_mode_e {
        EFX_LINK_1000FDX,
        EFX_LINK_10000FDX,
        EFX_LINK_40000FDX,
+       EFX_LINK_25000FDX,
+       EFX_LINK_50000FDX,
+       EFX_LINK_100000FDX,
        EFX_LINK_NMODES
 } efx_link_mode_t;
 
@@ -861,6 +864,10 @@ typedef enum efx_phy_cap_type_e {
        EFX_PHY_CAP_ASYM,
        EFX_PHY_CAP_AN,
        EFX_PHY_CAP_40000FDX,
+       EFX_PHY_CAP_DDM,
+       EFX_PHY_CAP_100000FDX,
+       EFX_PHY_CAP_25000FDX,
+       EFX_PHY_CAP_50000FDX,
        EFX_PHY_CAP_NTYPES
 } efx_phy_cap_type_t;