Commit ec20a63a authored by Fugang Duan's avatar Fugang Duan Committed by David S. Miller

net: fec: don't dump RX FIFO register when not available

Commit db65f35f ("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: default avatarFugang Duan <fugang.duan@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fbe1222c
...@@ -452,6 +452,10 @@ struct bufdesc_ex { ...@@ -452,6 +452,10 @@ struct bufdesc_ex {
* initialisation. * initialisation.
*/ */
#define FEC_QUIRK_MIB_CLEAR (1 << 15) #define FEC_QUIRK_MIB_CLEAR (1 << 15)
/* Only i.MX25/i.MX27/i.MX28 controller supports FRBR,FRSR registers,
* those FIFO receive registers are resolved in other platforms.
*/
#define FEC_QUIRK_HAS_FRREG (1 << 16)
struct bufdesc_prop { struct bufdesc_prop {
int qid; int qid;
......
...@@ -91,14 +91,16 @@ static struct platform_device_id fec_devtype[] = { ...@@ -91,14 +91,16 @@ static struct platform_device_id fec_devtype[] = {
.driver_data = 0, .driver_data = 0,
}, { }, {
.name = "imx25-fec", .name = "imx25-fec",
.driver_data = FEC_QUIRK_USE_GASKET | FEC_QUIRK_MIB_CLEAR, .driver_data = FEC_QUIRK_USE_GASKET | FEC_QUIRK_MIB_CLEAR |
FEC_QUIRK_HAS_FRREG,
}, { }, {
.name = "imx27-fec", .name = "imx27-fec",
.driver_data = FEC_QUIRK_MIB_CLEAR, .driver_data = FEC_QUIRK_MIB_CLEAR | FEC_QUIRK_HAS_FRREG,
}, { }, {
.name = "imx28-fec", .name = "imx28-fec",
.driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME |
FEC_QUIRK_SINGLE_MDIO | FEC_QUIRK_HAS_RACC, FEC_QUIRK_SINGLE_MDIO | FEC_QUIRK_HAS_RACC |
FEC_QUIRK_HAS_FRREG,
}, { }, {
.name = "imx6q-fec", .name = "imx6q-fec",
.driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT |
...@@ -2164,7 +2166,13 @@ static void fec_enet_get_regs(struct net_device *ndev, ...@@ -2164,7 +2166,13 @@ static void fec_enet_get_regs(struct net_device *ndev,
memset(buf, 0, regs->len); memset(buf, 0, regs->len);
for (i = 0; i < ARRAY_SIZE(fec_enet_register_offset); i++) { for (i = 0; i < ARRAY_SIZE(fec_enet_register_offset); i++) {
off = fec_enet_register_offset[i] / 4; off = fec_enet_register_offset[i];
if ((off == FEC_R_BOUND || off == FEC_R_FSTART) &&
!(fep->quirks & FEC_QUIRK_HAS_FRREG))
continue;
off >>= 2;
buf[off] = readl(&theregs[off]); buf[off] = readl(&theregs[off]);
} }
} }
......
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