aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2013-05-08 17:08:22 -0400
committerDavid S. Miller <davem@davemloft.net>2013-05-11 19:12:44 -0400
commit4849625569874d474ce351efd84b1f487ba08c94 (patch)
treee8419c453804898c292107352d0474136399bbca /drivers/net
parent1e9e9901ee13a48e3cbb96ec3631c685590f8aea (diff)
net: fec: enable hardware checksum only on imx6q-fec
Commit 4c09eed (net: fec: Enable imx6 enet checksum acceleration.) enables hardware checksum acceleration unconditionally for all fec variants. This is inappropriate, because some variants like imx5 have no such support on hardware. Consequently, fec is broken on these platforms. Fix it by enabling hardware checksum only on imx6q-fec type of controllers. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Reviewed-by: Jim Baxter <jim_baxter@mentor.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index aff0310a778b..ca9825ca88c9 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -87,6 +87,8 @@
87#define FEC_QUIRK_HAS_GBIT (1 << 3) 87#define FEC_QUIRK_HAS_GBIT (1 << 3)
88/* Controller has extend desc buffer */ 88/* Controller has extend desc buffer */
89#define FEC_QUIRK_HAS_BUFDESC_EX (1 << 4) 89#define FEC_QUIRK_HAS_BUFDESC_EX (1 << 4)
90/* Controller has hardware checksum support */
91#define FEC_QUIRK_HAS_CSUM (1 << 5)
90 92
91static struct platform_device_id fec_devtype[] = { 93static struct platform_device_id fec_devtype[] = {
92 { 94 {
@@ -105,7 +107,7 @@ static struct platform_device_id fec_devtype[] = {
105 }, { 107 }, {
106 .name = "imx6q-fec", 108 .name = "imx6q-fec",
107 .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | 109 .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT |
108 FEC_QUIRK_HAS_BUFDESC_EX, 110 FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM,
109 }, { 111 }, {
110 .name = "mvf-fec", 112 .name = "mvf-fec",
111 .driver_data = FEC_QUIRK_ENET_MAC, 113 .driver_data = FEC_QUIRK_ENET_MAC,
@@ -1744,6 +1746,8 @@ static const struct net_device_ops fec_netdev_ops = {
1744static int fec_enet_init(struct net_device *ndev) 1746static int fec_enet_init(struct net_device *ndev)
1745{ 1747{
1746 struct fec_enet_private *fep = netdev_priv(ndev); 1748 struct fec_enet_private *fep = netdev_priv(ndev);
1749 const struct platform_device_id *id_entry =
1750 platform_get_device_id(fep->pdev);
1747 struct bufdesc *cbd_base; 1751 struct bufdesc *cbd_base;
1748 1752
1749 /* Allocate memory for buffer descriptors. */ 1753 /* Allocate memory for buffer descriptors. */
@@ -1775,12 +1779,14 @@ static int fec_enet_init(struct net_device *ndev)
1775 writel(FEC_RX_DISABLED_IMASK, fep->hwp + FEC_IMASK); 1779 writel(FEC_RX_DISABLED_IMASK, fep->hwp + FEC_IMASK);
1776 netif_napi_add(ndev, &fep->napi, fec_enet_rx_napi, FEC_NAPI_WEIGHT); 1780 netif_napi_add(ndev, &fep->napi, fec_enet_rx_napi, FEC_NAPI_WEIGHT);
1777 1781
1778 /* enable hw accelerator */ 1782 if (id_entry->driver_data & FEC_QUIRK_HAS_CSUM) {
1779 ndev->features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM 1783 /* enable hw accelerator */
1780 | NETIF_F_RXCSUM); 1784 ndev->features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM
1781 ndev->hw_features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM 1785 | NETIF_F_RXCSUM);
1782 | NETIF_F_RXCSUM); 1786 ndev->hw_features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM
1783 fep->csum_flags |= FLAG_RX_CSUM_ENABLED; 1787 | NETIF_F_RXCSUM);
1788 fep->csum_flags |= FLAG_RX_CSUM_ENABLED;
1789 }
1784 1790
1785 fec_restart(ndev, 0); 1791 fec_restart(ndev, 0);
1786 1792