Skip to content

Commit ec20a63

Browse files
fugangduandavem330
authored andcommitted
net: fec: don't dump RX FIFO register when not available
Commit db65f35 ("net: fec: add support of ethtool get_regs") introduce ethool "--register-dump" interface to dump all FEC registers. But not all silicon implementations of the Freescale FEC hardware module have the FRBR (FIFO Receive Bound Register) and FRSR (FIFO Receive Start Register) register, so we should not be trying to dump them on those that don't. To fix it we create a quirk flag, FEC_QUIRK_HAS_RFREG, and check it before dump those RX FIFO registers. Signed-off-by: Fugang Duan <fugang.duan@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent fbe1222 commit ec20a63

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

‎drivers/net/ethernet/freescale/fec.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,10 @@ struct bufdesc_ex {
452452
* initialisation.
453453
*/
454454
#define FEC_QUIRK_MIB_CLEAR (1 << 15)
455+
/* Only i.MX25/i.MX27/i.MX28 controller supports FRBR,FRSR registers,
456+
* those FIFO receive registers are resolved in other platforms.
457+
*/
458+
#define FEC_QUIRK_HAS_FRREG (1 << 16)
455459

456460
struct bufdesc_prop {
457461
int qid;

‎drivers/net/ethernet/freescale/fec_main.c‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,16 @@ static struct platform_device_id fec_devtype[] = {
9191
.driver_data = 0,
9292
}, {
9393
.name = "imx25-fec",
94-
.driver_data = FEC_QUIRK_USE_GASKET | FEC_QUIRK_MIB_CLEAR,
94+
.driver_data = FEC_QUIRK_USE_GASKET | FEC_QUIRK_MIB_CLEAR |
95+
FEC_QUIRK_HAS_FRREG,
9596
}, {
9697
.name = "imx27-fec",
97-
.driver_data = FEC_QUIRK_MIB_CLEAR,
98+
.driver_data = FEC_QUIRK_MIB_CLEAR | FEC_QUIRK_HAS_FRREG,
9899
}, {
99100
.name = "imx28-fec",
100101
.driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME |
101-
FEC_QUIRK_SINGLE_MDIO | FEC_QUIRK_HAS_RACC,
102+
FEC_QUIRK_SINGLE_MDIO | FEC_QUIRK_HAS_RACC |
103+
FEC_QUIRK_HAS_FRREG,
102104
}, {
103105
.name = "imx6q-fec",
104106
.driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT |
@@ -2164,7 +2166,13 @@ static void fec_enet_get_regs(struct net_device *ndev,
21642166
memset(buf, 0, regs->len);
21652167

21662168
for (i = 0; i < ARRAY_SIZE(fec_enet_register_offset); i++) {
2167-
off = fec_enet_register_offset[i] / 4;
2169+
off = fec_enet_register_offset[i];
2170+
2171+
if ((off == FEC_R_BOUND || off == FEC_R_FSTART) &&
2172+
!(fep->quirks & FEC_QUIRK_HAS_FRREG))
2173+
continue;
2174+
2175+
off >>= 2;
21682176
buf[off] = readl(&theregs[off]);
21692177
}
21702178
}

0 commit comments

Comments
 (0)