diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2009-02-25 17:52:14 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2009-02-25 17:52:14 +0000 |
commit | 2242545e569b66feabafb3fc3ef41d22f0d3ee13 (patch) | |
tree | fdca15a048853964be8d0a3cbd8bb17b4ea2ba19 /target/linux/ar71xx | |
parent | 8e0e4cb3d8c6a06815404d25625488d2bc019d96 (diff) | |
download | upstream-2242545e569b66feabafb3fc3ef41d22f0d3ee13.tar.gz upstream-2242545e569b66feabafb3fc3ef41d22f0d3ee13.tar.bz2 upstream-2242545e569b66feabafb3fc3ef41d22f0d3ee13.zip |
ag71xx driver: forgot to add a new file
SVN-Revision: 14657
Diffstat (limited to 'target/linux/ar71xx')
-rw-r--r-- | target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar8216.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar8216.c b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar8216.c new file mode 100644 index 0000000000..39221ad62c --- /dev/null +++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_ar8216.c @@ -0,0 +1,53 @@ +/* + * Atheros AR71xx built-in ethernet mac driver + * Special support for the Atheros ar8216 switch chip + * + * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org> + * + * 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) +{ + struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); + + if (!pdata->has_ar8216) + return; + + 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) +{ + struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); + u8 type; + + if (!pdata->has_ar8216) + return 0; + + type = skb->data[1] & AR8216_PACKET_TYPE_MASK; + + switch (type) { + case AR8216_PACKET_TYPE_NORMAL: + skb_pull(skb, AR8216_HEADER_LEN); + break; + default: + return -EINVAL; + } + + return 0; +} |