aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2009-02-25 16:47:11 +0000
committerGabor Juhos <juhosg@openwrt.org>2009-02-25 16:47:11 +0000
commit0e8a23d053a4cf9f5d452e9decf2bf1dbf891dc2 (patch)
tree25cf6cdc1e77e971d6ed7b17059bcb3bab405a0c /target
parent9da4abfe58715c6b435fe22ddb52bacbb8464c61 (diff)
downloadupstream-0e8a23d053a4cf9f5d452e9decf2bf1dbf891dc2.tar.gz
upstream-0e8a23d053a4cf9f5d452e9decf2bf1dbf891dc2.tar.bz2
upstream-0e8a23d053a4cf9f5d452e9decf2bf1dbf891dc2.zip
ag71xx driver: add a workaround for the ar8216 chip, until we get a suitable switch driver
SVN-Revision: 14655
Diffstat (limited to 'target')
-rw-r--r--target/linux/ar71xx/config-2.6.281
-rw-r--r--target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/platform.h1
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/Kconfig9
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/Makefile8
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h18
-rw-r--r--target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c13
6 files changed, 45 insertions, 5 deletions
diff --git a/target/linux/ar71xx/config-2.6.28 b/target/linux/ar71xx/config-2.6.28
index f2fcc47d8d..17d7c0b441 100644
--- a/target/linux/ar71xx/config-2.6.28
+++ b/target/linux/ar71xx/config-2.6.28
@@ -4,6 +4,7 @@ CONFIG_32BIT=y
CONFIG_ADM6996_PHY=y
CONFIG_AG71XX=y
# CONFIG_AG71XX_DEBUG is not set
+CONFIG_AG71XX_AR8216_SUPPORT=y
# CONFIG_AR71XX_EARLY_SERIAL is not set
CONFIG_AR71XX_MACH_AP83=y
CONFIG_AR71XX_MACH_AW_NR580=y
diff --git a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/platform.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/platform.h
index a3448f5a8b..672da31c83 100644
--- a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/platform.h
+++ b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/platform.h
@@ -28,6 +28,7 @@ struct ag71xx_platform_data {
u8 has_gbit:1;
u8 is_ar91xx:1;
+ u8 has_ar8216:1;
void (* ddr_flush)(void);
void (* set_pll)(u32 pll);
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/Kconfig b/target/linux/ar71xx/files/drivers/net/ag71xx/Kconfig
index 18be11593c..56a59648cf 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/Kconfig
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/Kconfig
@@ -12,3 +12,12 @@ config AG71XX_DEBUG
default n
help
Atheros AR71xx built-in ethernet driver debugging messages.
+
+config AG71XX_AR8216_SUPPORT
+ bool "special support for the Atheros AR8216 switch"
+ depends on AG71XX
+ default n
+ default y if AR71XX_MACH_WNR2000 || AR71XX_MACH_MZK_W04NU
+ help
+ Say 'y' here if you want to enable special support for the
+ Atheros AR8216 switch found on some boards.
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/Makefile b/target/linux/ar71xx/files/drivers/net/ag71xx/Makefile
index 37c98d22a3..aa1798d195 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/Makefile
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/Makefile
@@ -2,6 +2,12 @@
# Makefile for the Atheros AR71xx built-in ethernet macs
#
+ag71xx-y += ag71xx_main.o
+ag71xx-y += ag71xx_ethtool.o
+ag71xx-y += ag71xx_phy.o
+ag71xx-y += ag71xx_mdio.o
+
+ag71xx-$(CONFIG_AG71XX_AR8216_SUPPORT) += ag71xx_ar8216.o
+
obj-$(CONFIG_AG71XX) += ag71xx.o
-ag71xx-objs := ag71xx_main.o ag71xx_ethtool.o ag71xx_phy.o ag71xx_mdio.o
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
index 3dbb453fc5..1d22453a97 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
@@ -38,7 +38,7 @@
#define ETH_FCS_LEN 4
#define AG71XX_DRV_NAME "ag71xx"
-#define AG71XX_DRV_VERSION "0.5.20"
+#define AG71XX_DRV_VERSION "0.5.21"
#define AG71XX_NAPI_WEIGHT 64
#define AG71XX_OOM_REFILL (1 + HZ/10)
@@ -430,4 +430,20 @@ static void inline ag71xx_mii_ctrl_set_speed(struct ag71xx *ag,
ag71xx_mii_ctrl_wr(ag, t);
}
+#ifdef CONFIG_AG71XX_AR8216_SUPPORT
+void ag71xx_add_ar8216_header(struct ag71xx *ag, struct sk_buff *skb);
+int ag71xx_remove_ar8216_header(struct ag71xx *ag, struct sk_buff *skb);
+#else
+static inline void ag71xx_add_ar8216_header(struct ag71xx *ag,
+ struct sk_buff *skb)
+{
+}
+
+static inline int ag71xx_remove_ar8216_header(struct ag71xx *ag,
+ struct sk_buff *skb)
+{
+ return 0;
+}
+#endif
+
#endif /* _AG71XX_H */
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c
index 01834887c5..e5eced2286 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c
@@ -473,6 +473,8 @@ static int ag71xx_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (!ag71xx_desc_empty(desc))
goto err_drop;
+ ag71xx_add_ar8216_header(ag, skb);
+
if (skb->len <= 0) {
DBG("%s: packet len is too small\n", ag->dev->name);
goto err_drop;
@@ -647,15 +649,20 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit)
skb_put(skb, pktlen);
skb->dev = dev;
- skb->protocol = eth_type_trans(skb, dev);
skb->ip_summed = CHECKSUM_NONE;
- netif_receive_skb(skb);
-
dev->last_rx = jiffies;
dev->stats.rx_packets++;
dev->stats.rx_bytes += pktlen;
+ if (ag71xx_remove_ar8216_header(ag, skb) != 0) {
+ dev->stats.rx_dropped++;
+ kfree_skb(skb);
+ } else {
+ skb->protocol = eth_type_trans(skb, dev);
+ netif_receive_skb(skb);
+ }
+
ring->buf[i].skb = NULL;
done++;