Commit 21c63214 authored by Maxime Chevallier's avatar Maxime Chevallier Committed by David S. Miller

net: ethernet: fs_enet: use macros for speed and duplex values

The PHY speed and duplex should be manipulated using the SPEED_XXX and
DUPLEX_XXX macros available. Use it in the fcc, fec and scc MAC for
fs_enet.
Acked-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarMaxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6b576b2d
...@@ -360,7 +360,7 @@ static void restart(struct net_device *dev) ...@@ -360,7 +360,7 @@ static void restart(struct net_device *dev)
/* adjust to speed (for RMII mode) */ /* adjust to speed (for RMII mode) */
if (fpi->use_rmii) { if (fpi->use_rmii) {
if (dev->phydev->speed == 100) if (dev->phydev->speed == SPEED_100)
C8(fcccp, fcc_gfemr, 0x20); C8(fcccp, fcc_gfemr, 0x20);
else else
S8(fcccp, fcc_gfemr, 0x20); S8(fcccp, fcc_gfemr, 0x20);
...@@ -386,7 +386,7 @@ static void restart(struct net_device *dev) ...@@ -386,7 +386,7 @@ static void restart(struct net_device *dev)
S32(fccp, fcc_fpsmr, FCC_PSMR_RMII); S32(fccp, fcc_fpsmr, FCC_PSMR_RMII);
/* adjust to duplex mode */ /* adjust to duplex mode */
if (dev->phydev->duplex) if (dev->phydev->duplex == DUPLEX_FULL)
S32(fccp, fcc_fpsmr, FCC_PSMR_FDE | FCC_PSMR_LPB); S32(fccp, fcc_fpsmr, FCC_PSMR_FDE | FCC_PSMR_LPB);
else else
C32(fccp, fcc_fpsmr, FCC_PSMR_FDE | FCC_PSMR_LPB); C32(fccp, fcc_fpsmr, FCC_PSMR_FDE | FCC_PSMR_LPB);
......
...@@ -308,7 +308,7 @@ static void restart(struct net_device *dev) ...@@ -308,7 +308,7 @@ static void restart(struct net_device *dev)
/* /*
* adjust to duplex mode * adjust to duplex mode
*/ */
if (dev->phydev->duplex) { if (dev->phydev->duplex == DUPLEX_FULL) {
FC(fecp, r_cntrl, FEC_RCNTRL_DRT); FC(fecp, r_cntrl, FEC_RCNTRL_DRT);
FS(fecp, x_cntrl, FEC_TCNTRL_FDEN); /* FD enable */ FS(fecp, x_cntrl, FEC_TCNTRL_FDEN); /* FD enable */
} else { } else {
......
...@@ -337,7 +337,7 @@ static void restart(struct net_device *dev) ...@@ -337,7 +337,7 @@ static void restart(struct net_device *dev)
W16(sccp, scc_psmr, SCC_PSMR_ENCRC | SCC_PSMR_NIB22); W16(sccp, scc_psmr, SCC_PSMR_ENCRC | SCC_PSMR_NIB22);
/* Set full duplex mode if needed */ /* Set full duplex mode if needed */
if (dev->phydev->duplex) if (dev->phydev->duplex == DUPLEX_FULL)
S16(sccp, scc_psmr, SCC_PSMR_LPB | SCC_PSMR_FDE); S16(sccp, scc_psmr, SCC_PSMR_LPB | SCC_PSMR_FDE);
/* Restore multicast and promiscuous settings */ /* Restore multicast and promiscuous settings */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment