Skip to content

Commit d55595f

Browse files
Jiawen Wudavem330
authored andcommitted
net: pcs: xpcs: add specific vendor supoprt for Wangxun 10Gb NICs
Since Wangxun 10Gb NICs require some special configuration on the IP of Synopsys Designware XPCS, introduce dev_flag for different vendors. Read OUI from device identifier registers, to detect Wangxun devices. And xpcs_soft_reset() is skipped to avoid the reset of device identifier registers. Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 1355fe1 commit d55595f

File tree

2 files changed

+39
-3
lines changed

2 files changed

+39
-3
lines changed

drivers/net/pcs/pcs-xpcs.c

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,29 @@ static int xpcs_write_vpcs(struct dw_xpcs *xpcs, int reg, u16 val)
238238
return xpcs_write_vendor(xpcs, MDIO_MMD_PCS, reg, val);
239239
}
240240

241+
static int xpcs_dev_flag(struct dw_xpcs *xpcs)
242+
{
243+
int ret, oui;
244+
245+
ret = xpcs_read(xpcs, MDIO_MMD_PMAPMD, MDIO_DEVID1);
246+
if (ret < 0)
247+
return ret;
248+
249+
oui = ret;
250+
251+
ret = xpcs_read(xpcs, MDIO_MMD_PMAPMD, MDIO_DEVID2);
252+
if (ret < 0)
253+
return ret;
254+
255+
ret = (ret >> 10) & 0x3F;
256+
oui |= ret << 16;
257+
258+
if (oui == DW_OUI_WX)
259+
xpcs->dev_flag = DW_DEV_TXGBE;
260+
261+
return 0;
262+
}
263+
241264
static int xpcs_poll_reset(struct dw_xpcs *xpcs, int dev)
242265
{
243266
/* Poll until the reset bit clears (50ms per retry == 0.6 sec) */
@@ -1284,16 +1307,22 @@ static struct dw_xpcs *xpcs_create(struct mdio_device *mdiodev,
12841307
goto out;
12851308
}
12861309

1310+
ret = xpcs_dev_flag(xpcs);
1311+
if (ret)
1312+
goto out;
1313+
12871314
xpcs->pcs.ops = &xpcs_phylink_ops;
12881315
xpcs->pcs.neg_mode = true;
12891316
if (compat->an_mode == DW_10GBASER)
12901317
return xpcs;
12911318

12921319
xpcs->pcs.poll = true;
12931320

1294-
ret = xpcs_soft_reset(xpcs, compat);
1295-
if (ret)
1296-
goto out;
1321+
if (xpcs->dev_flag != DW_DEV_TXGBE) {
1322+
ret = xpcs_soft_reset(xpcs, compat);
1323+
if (ret)
1324+
goto out;
1325+
}
12971326

12981327
return xpcs;
12991328
}

include/linux/pcs/pcs-xpcs.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,19 @@
2020
#define DW_AN_C37_1000BASEX 4
2121
#define DW_10GBASER 5
2222

23+
/* device vendor OUI */
24+
#define DW_OUI_WX 0x0018fc80
25+
26+
/* dev_flag */
27+
#define DW_DEV_TXGBE BIT(0)
28+
2329
struct xpcs_id;
2430

2531
struct dw_xpcs {
2632
struct mdio_device *mdiodev;
2733
const struct xpcs_id *id;
2834
struct phylink_pcs pcs;
35+
int dev_flag;
2936
};
3037

3138
int xpcs_get_an_mode(struct dw_xpcs *xpcs, phy_interface_t interface);

0 commit comments

Comments
 (0)