summaryrefslogtreecommitdiff
path: root/drivers/net/pcs
diff options
context:
space:
mode:
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2022-06-18 13:28:47 +0300
committerDavid S. Miller <davem@davemloft.net>2022-06-19 12:38:26 +0300
commit449b7a15200a15af8affefdd80ac567c40898dce (patch)
tree3bf67116cfa16c369de0bb884b1ad0f490657488 /drivers/net/pcs
parente62dbaff4bc2540393cfc31a7438ed833da7c43c (diff)
downloadlinux-449b7a15200a15af8affefdd80ac567c40898dce.tar.xz
net: pcs: pcs-xpcs: use mii_bmcr_encode_fixed()
Use the newly introduced mii_bmcr_encode_fixed() for the xpcs driver. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/pcs')
-rw-r--r--drivers/net/pcs/pcs-xpcs.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c
index a5d520e34ea3..ab0af1d2531f 100644
--- a/drivers/net/pcs/pcs-xpcs.c
+++ b/drivers/net/pcs/pcs-xpcs.c
@@ -1081,23 +1081,7 @@ static void xpcs_link_up_sgmii(struct dw_xpcs *xpcs, unsigned int mode,
if (phylink_autoneg_inband(mode))
return;
- switch (speed) {
- case SPEED_1000:
- val = BMCR_SPEED1000;
- break;
- case SPEED_100:
- val = BMCR_SPEED100;
- break;
- case SPEED_10:
- val = BMCR_SPEED10;
- break;
- default:
- return;
- }
-
- if (duplex == DUPLEX_FULL)
- val |= BMCR_FULLDPLX;
-
+ val = mii_bmcr_encode_fixed(speed, duplex);
ret = xpcs_write(xpcs, MDIO_MMD_VEND2, MDIO_CTRL1, val);
if (ret)
pr_err("%s: xpcs_write returned %pe\n", __func__, ERR_PTR(ret));