Skip to content

Commit f1c7339

Browse files
Raju Lakkarajukuba-moo
authored andcommitted
net: pcs: xpcs: Add 2500BASE-X case in get state for XPCS drivers
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]>
1 parent 0649776 commit f1c7339

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

drivers/net/pcs/pcs-xpcs.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,28 @@ static int xpcs_get_state_c37_1000basex(struct dw_xpcs *xpcs,
10901090
return 0;
10911091
}
10921092

1093+
static int xpcs_get_state_2500basex(struct dw_xpcs *xpcs,
1094+
struct phylink_link_state *state)
1095+
{
1096+
int ret;
1097+
1098+
ret = xpcs_read(xpcs, MDIO_MMD_VEND2, DW_VR_MII_MMD_STS);
1099+
if (ret < 0) {
1100+
state->link = 0;
1101+
return ret;
1102+
}
1103+
1104+
state->link = !!(ret & DW_VR_MII_MMD_STS_LINK_STS);
1105+
if (!state->link)
1106+
return 0;
1107+
1108+
state->speed = SPEED_2500;
1109+
state->pause |= MLO_PAUSE_TX | MLO_PAUSE_RX;
1110+
state->duplex = DUPLEX_FULL;
1111+
1112+
return 0;
1113+
}
1114+
10931115
static void xpcs_get_state(struct phylink_pcs *pcs,
10941116
struct phylink_link_state *state)
10951117
{
@@ -1127,6 +1149,13 @@ static void xpcs_get_state(struct phylink_pcs *pcs,
11271149
ERR_PTR(ret));
11281150
}
11291151
break;
1152+
case DW_2500BASEX:
1153+
ret = xpcs_get_state_2500basex(xpcs, state);
1154+
if (ret) {
1155+
pr_err("xpcs_get_state_2500basex returned %pe\n",
1156+
ERR_PTR(ret));
1157+
}
1158+
break;
11301159
default:
11311160
return;
11321161
}

drivers/net/pcs/pcs-xpcs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
/* Clause 37 Defines */
5656
/* VR MII MMD registers offsets */
5757
#define DW_VR_MII_MMD_CTRL 0x0000
58+
#define DW_VR_MII_MMD_STS 0x0001
59+
#define DW_VR_MII_MMD_STS_LINK_STS BIT(2)
5860
#define DW_VR_MII_DIG_CTRL1 0x8000
5961
#define DW_VR_MII_AN_CTRL 0x8001
6062
#define DW_VR_MII_AN_INTR_STS 0x8002

0 commit comments

Comments
 (0)