Skip to content

Commit 2d33dc6

Browse files
Wei Fangkuba-moo
authored andcommitted
net: fec: add more macros for bits of FEC_ECR
There are also some RCR bits that are not defined but are used by the driver, so add macro definitions for these bits to improve readability and maintainability. In addition, although FEC_RCR_HALFDPX has been defined, it is not used in the driver. According to the description of FEC_RCR[1] in RM, it is used to disable receive on transmit. Therefore, it is more appropriate to redefine FEC_RCR[1] as FEC_RCR_DRT. Signed-off-by: Wei Fang <wei.fang@nxp.com> Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Link: https://patch.msgid.link/20250711091639.1374411-3-wei.fang@nxp.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 893bb0b commit 2d33dc6

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

drivers/net/ethernet/freescale/fec_main.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,15 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
279279
#define FEC_ECR_BYTESWP BIT(8)
280280
/* FEC RCR bits definition */
281281
#define FEC_RCR_LOOP BIT(0)
282-
#define FEC_RCR_HALFDPX BIT(1)
282+
#define FEC_RCR_DRT BIT(1)
283283
#define FEC_RCR_MII BIT(2)
284284
#define FEC_RCR_PROMISC BIT(3)
285285
#define FEC_RCR_BC_REJ BIT(4)
286286
#define FEC_RCR_FLOWCTL BIT(5)
287+
#define FEC_RCR_RGMII BIT(6)
287288
#define FEC_RCR_RMII BIT(8)
288289
#define FEC_RCR_10BASET BIT(9)
290+
#define FEC_RCR_NLC BIT(30)
289291
/* TX WMARK bits */
290292
#define FEC_TXWMRK_STRFWD BIT(8)
291293

@@ -1131,7 +1133,7 @@ fec_restart(struct net_device *ndev)
11311133
{
11321134
struct fec_enet_private *fep = netdev_priv(ndev);
11331135
u32 temp_mac[2];
1134-
u32 rcntl = OPT_FRAME_SIZE | 0x04;
1136+
u32 rcntl = OPT_FRAME_SIZE | FEC_RCR_MII;
11351137
u32 ecntl = FEC_ECR_ETHEREN;
11361138

11371139
if (fep->bufdesc_ex)
@@ -1162,7 +1164,7 @@ fec_restart(struct net_device *ndev)
11621164
writel(0x04, fep->hwp + FEC_X_CNTRL);
11631165
} else {
11641166
/* No Rcv on Xmit */
1165-
rcntl |= 0x02;
1167+
rcntl |= FEC_RCR_DRT;
11661168
writel(0x0, fep->hwp + FEC_X_CNTRL);
11671169
}
11681170

@@ -1191,11 +1193,11 @@ fec_restart(struct net_device *ndev)
11911193
*/
11921194
if (fep->quirks & FEC_QUIRK_ENET_MAC) {
11931195
/* Enable flow control and length check */
1194-
rcntl |= 0x40000000 | 0x00000020;
1196+
rcntl |= FEC_RCR_NLC | FEC_RCR_FLOWCTL;
11951197

11961198
/* RGMII, RMII or MII */
11971199
if (phy_interface_mode_is_rgmii(fep->phy_interface))
1198-
rcntl |= (1 << 6);
1200+
rcntl |= FEC_RCR_RGMII;
11991201
else if (fep->phy_interface == PHY_INTERFACE_MODE_RMII)
12001202
rcntl |= FEC_RCR_RMII;
12011203
else

0 commit comments

Comments
 (0)