Skip to content

Commit

Permalink
net: pcs: xpcs: Add 2500BASE-X case in get state for XPCS drivers
Browse files Browse the repository at this point in the history
Add DW_2500BASEX case in xpcs_get_state( ) to update speed, duplex and pause

Signed-off-by: Raju Lakkaraju <[email protected]>
Reviewed-by: Serge Semin <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
lakkarajun authored and kuba-moo committed Oct 27, 2023
1 parent 0649776 commit f1c7339
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
29 changes: 29 additions & 0 deletions drivers/net/pcs/pcs-xpcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,28 @@ static int xpcs_get_state_c37_1000basex(struct dw_xpcs *xpcs,
return 0;
}

static int xpcs_get_state_2500basex(struct dw_xpcs *xpcs,
struct phylink_link_state *state)
{
int ret;

ret = xpcs_read(xpcs, MDIO_MMD_VEND2, DW_VR_MII_MMD_STS);
if (ret < 0) {
state->link = 0;
return ret;
}

state->link = !!(ret & DW_VR_MII_MMD_STS_LINK_STS);
if (!state->link)
return 0;

state->speed = SPEED_2500;
state->pause |= MLO_PAUSE_TX | MLO_PAUSE_RX;
state->duplex = DUPLEX_FULL;

return 0;
}

static void xpcs_get_state(struct phylink_pcs *pcs,
struct phylink_link_state *state)
{
Expand Down Expand Up @@ -1127,6 +1149,13 @@ static void xpcs_get_state(struct phylink_pcs *pcs,
ERR_PTR(ret));
}
break;
case DW_2500BASEX:
ret = xpcs_get_state_2500basex(xpcs, state);
if (ret) {
pr_err("xpcs_get_state_2500basex returned %pe\n",
ERR_PTR(ret));
}
break;
default:
return;
}
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/pcs/pcs-xpcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
/* Clause 37 Defines */
/* VR MII MMD registers offsets */
#define DW_VR_MII_MMD_CTRL 0x0000
#define DW_VR_MII_MMD_STS 0x0001
#define DW_VR_MII_MMD_STS_LINK_STS BIT(2)
#define DW_VR_MII_DIG_CTRL1 0x8000
#define DW_VR_MII_AN_CTRL 0x8001
#define DW_VR_MII_AN_INTR_STS 0x8002
Expand Down

0 comments on commit f1c7339

Please sign in to comment.