net: fec: don't access RACC register when not available
Not all silicon implementations of the Freescale FEC hardware module have the RACC (Receive Accelerator Function) register, so we should not be trying to access it on those that don't. Currently none of the ColdFire based parts with a FEC have it. Support for RACC was introduced by commit4c09eed9
("net: fec: Enable imx6 enet checksum acceleration"). A fix was introduced in commitd1391930
("net: fec: Fix build for MCF5272") that disables its use on the ColdFire M5272 part, but it doesn't fix the general case of other ColdFire parts. To fix we create a quirk flag, FEC_QUIRK_HAS_RACC, and check it before working with the RACC register. Signed-off-by: Greg Ungerer <gerg@uclinux.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
eb686231fc
commit
18803495a7
|
@ -428,6 +428,8 @@ struct bufdesc_ex {
|
|||
#define FEC_QUIRK_BUG_CAPTURE (1 << 10)
|
||||
/* Controller has only one MDIO bus */
|
||||
#define FEC_QUIRK_SINGLE_MDIO (1 << 11)
|
||||
/* Controller supports RACC register */
|
||||
#define FEC_QUIRK_HAS_RACC (1 << 12)
|
||||
|
||||
struct fec_enet_priv_tx_q {
|
||||
int index;
|
||||
|
|
|
@ -85,28 +85,30 @@ static struct platform_device_id fec_devtype[] = {
|
|||
.driver_data = 0,
|
||||
}, {
|
||||
.name = "imx25-fec",
|
||||
.driver_data = FEC_QUIRK_USE_GASKET,
|
||||
.driver_data = FEC_QUIRK_USE_GASKET | FEC_QUIRK_HAS_RACC,
|
||||
}, {
|
||||
.name = "imx27-fec",
|
||||
.driver_data = 0,
|
||||
.driver_data = FEC_QUIRK_HAS_RACC,
|
||||
}, {
|
||||
.name = "imx28-fec",
|
||||
.driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME |
|
||||
FEC_QUIRK_SINGLE_MDIO,
|
||||
FEC_QUIRK_SINGLE_MDIO | FEC_QUIRK_HAS_RACC,
|
||||
}, {
|
||||
.name = "imx6q-fec",
|
||||
.driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT |
|
||||
FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM |
|
||||
FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR006358,
|
||||
FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR006358 |
|
||||
FEC_QUIRK_HAS_RACC,
|
||||
}, {
|
||||
.name = "mvf600-fec",
|
||||
.driver_data = FEC_QUIRK_ENET_MAC,
|
||||
.driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_RACC,
|
||||
}, {
|
||||
.name = "imx6sx-fec",
|
||||
.driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT |
|
||||
FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM |
|
||||
FEC_QUIRK_HAS_VLAN | FEC_QUIRK_HAS_AVB |
|
||||
FEC_QUIRK_ERR007885 | FEC_QUIRK_BUG_CAPTURE,
|
||||
FEC_QUIRK_ERR007885 | FEC_QUIRK_BUG_CAPTURE |
|
||||
FEC_QUIRK_HAS_RACC,
|
||||
}, {
|
||||
/* sentinel */
|
||||
}
|
||||
|
@ -970,13 +972,15 @@ fec_restart(struct net_device *ndev)
|
|||
writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
|
||||
|
||||
#if !defined(CONFIG_M5272)
|
||||
/* set RX checksum */
|
||||
val = readl(fep->hwp + FEC_RACC);
|
||||
if (fep->csum_flags & FLAG_RX_CSUM_ENABLED)
|
||||
val |= FEC_RACC_OPTIONS;
|
||||
else
|
||||
val &= ~FEC_RACC_OPTIONS;
|
||||
writel(val, fep->hwp + FEC_RACC);
|
||||
if (fep->quirks & FEC_QUIRK_HAS_RACC) {
|
||||
/* set RX checksum */
|
||||
val = readl(fep->hwp + FEC_RACC);
|
||||
if (fep->csum_flags & FLAG_RX_CSUM_ENABLED)
|
||||
val |= FEC_RACC_OPTIONS;
|
||||
else
|
||||
val &= ~FEC_RACC_OPTIONS;
|
||||
writel(val, fep->hwp + FEC_RACC);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue