We now have a working AR8216 driver that can handle this itself.

Signed-off-by: Jonas Gorski <[email protected]>
---
 target/linux/ar71xx/config-2.6.39                  |    1 -
 .../arch/mips/include/asm/mach-ar71xx/platform.h   |    1 -
 .../linux/ar71xx/files/drivers/net/ag71xx/Kconfig  |    8 ----
 .../linux/ar71xx/files/drivers/net/ag71xx/Makefile |    1 -
 .../linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h |   26 ------------
 .../files/drivers/net/ag71xx/ag71xx_ar8216.c       |   44 --------------------
 .../ar71xx/files/drivers/net/ag71xx/ag71xx_main.c  |   27 +++---------
 7 files changed, 7 insertions(+), 101 deletions(-)
 delete mode 100644 target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar8216.c

diff --git a/target/linux/ar71xx/config-2.6.39 
b/target/linux/ar71xx/config-2.6.39
index fa9aa98..9efbd1a 100644
--- a/target/linux/ar71xx/config-2.6.39
+++ b/target/linux/ar71xx/config-2.6.39
@@ -1,5 +1,4 @@
 CONFIG_AG71XX=y
-# CONFIG_AG71XX_AR8216_SUPPORT is not set
 # CONFIG_AG71XX_DEBUG is not set
 # CONFIG_AG71XX_DEBUG_FS is not set
 CONFIG_AR71XX_DEV_AP91_PCI=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 b0eb228..60649d5 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
@@ -30,7 +30,6 @@ struct ag71xx_platform_data {
        u8              has_gbit:1;
        u8              is_ar91xx:1;
        u8              is_ar724x:1;
-       u8              has_ar8216:1;
        u8              has_ar7240_switch:1;
 
        void            (*ddr_flush)(void);
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/Kconfig 
b/target/linux/ar71xx/files/drivers/net/ag71xx/Kconfig
index 7db779e..fff31c0 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/Kconfig
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/Kconfig
@@ -22,12 +22,4 @@ config AG71XX_DEBUG_FS
          Say Y, if you need access to various statistics provided by
          the ag71xx driver.
 
-config AG71XX_AR8216_SUPPORT
-       bool "special support for the Atheros AR8216 switch"
-       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.
-
 endif
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/Makefile 
b/target/linux/ar71xx/files/drivers/net/ag71xx/Makefile
index b3ec408..7f396ad 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/Makefile
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/Makefile
@@ -9,7 +9,6 @@ ag71xx-y        += ag71xx_mdio.o
 ag71xx-y       += ag71xx_ar7240.o
 
 ag71xx-$(CONFIG_AG71XX_DEBUG_FS)       += ag71xx_debugfs.o
-ag71xx-$(CONFIG_AG71XX_AR8216_SUPPORT) += ag71xx_ar8216.o
 
 obj-$(CONFIG_AG71XX)   += ag71xx.o
 
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h 
b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
index 1025bb4..be559ae 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
@@ -450,32 +450,6 @@ static inline void 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,
-                               int pktlen);
-static inline int ag71xx_has_ar8216(struct ag71xx *ag)
-{
-       return ag71xx_get_pdata(ag)->has_ar8216;
-}
-#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,
-                                             int pktlen)
-{
-       return 0;
-}
-static inline int ag71xx_has_ar8216(struct ag71xx *ag)
-{
-       return 0;
-}
-#endif
-
 #ifdef CONFIG_AG71XX_DEBUG_FS
 int ag71xx_debugfs_root_init(void);
 void ag71xx_debugfs_root_exit(void);
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar8216.c 
b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar8216.c
deleted file mode 100644
index 7ec43b7..0000000
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar8216.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Atheros AR71xx built-in ethernet mac driver
- *  Special support for the Atheros ar8216 switch chip
- *
- *  Copyright (C) 2009-2010 Gabor Juhos <[email protected]>
- *
- *  Based on Atheros' AG7100 driver
- *
- *  This program is free software; you can redistribute it and/or modify it
- *  under the terms of the GNU General Public License version 2 as published
- *  by the Free Software Foundation.
- */
-
-#include "ag71xx.h"
-
-#define AR8216_PACKET_TYPE_MASK                0xf
-#define AR8216_PACKET_TYPE_NORMAL      0
-
-#define AR8216_HEADER_LEN      2
-
-void ag71xx_add_ar8216_header(struct ag71xx *ag, struct sk_buff *skb)
-{
-       skb_push(skb, AR8216_HEADER_LEN);
-       skb->data[0] = 0x10;
-       skb->data[1] = 0x80;
-}
-
-int ag71xx_remove_ar8216_header(struct ag71xx *ag, struct sk_buff *skb,
-                               int pktlen)
-{
-       u8 type;
-
-       type = skb->data[1] & AR8216_PACKET_TYPE_MASK;
-       switch (type) {
-       case AR8216_PACKET_TYPE_NORMAL:
-               break;
-
-       default:
-               return -EINVAL;
-       }
-
-       skb_pull(skb, AR8216_HEADER_LEN);
-       return 0;
-}
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 ce2af53..eb2b2df 100644
--- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c
+++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c
@@ -197,8 +197,7 @@ static int ag71xx_rx_reserve(struct ag71xx *ag)
        int reserve = 0;
 
        if (ag71xx_get_pdata(ag)->is_ar724x) {
-               if (!ag71xx_has_ar8216(ag))
-                       reserve = 2;
+               reserve = 2;
 
                if (ag->phy_dev)
                        reserve += 4 - (ag->phy_dev->pkt_align % 4);
@@ -650,9 +649,6 @@ static netdev_tx_t ag71xx_hard_start_xmit(struct sk_buff 
*skb,
        if (!ag71xx_desc_empty(desc))
                goto err_drop;
 
-       if (ag71xx_has_ar8216(ag))
-               ag71xx_add_ar8216_header(ag, skb);
-
        if (skb->len <= 0) {
                DBG("%s: packet len is too small\n", ag->dev->name);
                goto err_drop;
@@ -809,7 +805,6 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit)
                struct ag71xx_desc *desc = ring->buf[i].desc;
                struct sk_buff *skb;
                int pktlen;
-               int err = 0;
 
                if (ag71xx_desc_empty(desc))
                        break;
@@ -833,21 +828,13 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit)
                dev->stats.rx_bytes += pktlen;
 
                skb_put(skb, pktlen);
-               if (ag71xx_has_ar8216(ag))
-                       err = ag71xx_remove_ar8216_header(ag, skb, pktlen);
-
-               if (err) {
-                       dev->stats.rx_dropped++;
-                       kfree_skb(skb);
+               skb->dev = dev;
+               skb->ip_summed = CHECKSUM_NONE;
+               if (ag->phy_dev) {
+                       ag->phy_dev->netif_receive_skb(skb);
                } else {
-                       skb->dev = dev;
-                       skb->ip_summed = CHECKSUM_NONE;
-                       if (ag->phy_dev) {
-                               ag->phy_dev->netif_receive_skb(skb);
-                       } else {
-                               skb->protocol = eth_type_trans(skb, dev);
-                               netif_receive_skb(skb);
-                       }
+                       skb->protocol = eth_type_trans(skb, dev);
+                       netif_receive_skb(skb);
                }
 
                ring->buf[i].skb = NULL;
-- 
1.7.2.5

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to