1 diff -Nur linux-2.6.17/drivers/net/ar2313/ar2313.c linux-2.6.17-owrt/drivers/net/ar2313/ar2313.c
2 --- linux-2.6.17/drivers/net/ar2313/ar2313.c 1970-01-01 01:00:00.000000000 +0100
3 +++ linux-2.6.17-owrt/drivers/net/ar2313/ar2313.c 2006-06-19 12:57:27.000000000 +0200
6 + * ar2313.c: Linux driver for the Atheros AR2313 Ethernet device.
8 + * Copyright 2004 by Sameer Dekate, <sdekate@arubanetworks.com>.
9 + * Copyright (C) 2006 Imre Kaloz <kaloz@openwrt.org>
11 + * Thanks to Atheros for providing hardware and documentation
12 + * enabling me to write this driver.
14 + * This program is free software; you can redistribute it and/or modify
15 + * it under the terms of the GNU General Public License as published by
16 + * the Free Software Foundation; either version 2 of the License, or
17 + * (at your option) any later version.
19 + * Additional credits:
20 + * This code is taken from John Taylor's Sibyte driver and then
21 + * modified for the AR2313.
24 +#include <linux/config.h>
25 +#include <linux/module.h>
26 +#include <linux/version.h>
27 +#include <linux/types.h>
28 +#include <linux/errno.h>
29 +#include <linux/ioport.h>
30 +#include <linux/pci.h>
31 +#include <linux/netdevice.h>
32 +#include <linux/etherdevice.h>
33 +#include <linux/skbuff.h>
34 +#include <linux/init.h>
35 +#include <linux/delay.h>
36 +#include <linux/mm.h>
37 +#include <linux/highmem.h>
38 +#include <linux/sockios.h>
39 +#include <linux/pkt_sched.h>
40 +#include <linux/compile.h>
41 +#include <linux/mii.h>
42 +#include <linux/ethtool.h>
43 +#include <linux/ctype.h>
45 +#include <net/sock.h>
48 +#include <asm/system.h>
51 +#include <asm/byteorder.h>
52 +#include <asm/uaccess.h>
53 +#include <asm/bootinfo.h>
55 +extern char *getenv(char *e);
71 +#define min(a,b) (((a)<(b))?(a):(b))
74 +#ifndef SMP_CACHE_BYTES
75 +#define SMP_CACHE_BYTES L1_CACHE_BYTES
78 +#ifndef SET_MODULE_OWNER
79 +#define SET_MODULE_OWNER(dev) {do{} while(0);}
80 +#define AR2313_MOD_INC_USE_COUNT MOD_INC_USE_COUNT
81 +#define AR2313_MOD_DEC_USE_COUNT MOD_DEC_USE_COUNT
83 +#define AR2313_MOD_INC_USE_COUNT {do{} while(0);}
84 +#define AR2313_MOD_DEC_USE_COUNT {do{} while(0);}
87 +#define PHYSADDR(a) ((_ACAST32_ (a)) & 0x1fffffff)
89 +static char ethaddr[18] = "00:00:00:00:00:00";
90 +static char ifname[5] = "bond";
92 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,52)
93 +module_param_string(ethaddr, ethaddr, 18, 0);
94 +module_param_string(ifname, ifname, 5, 0);
96 +MODULE_PARM(ethaddr, "c18");
97 +MODULE_PARM(ifname, "c5");
100 +#define AR2313_MBOX_SET_BIT 0x8
102 +#define BOARD_IDX_STATIC 0
103 +#define BOARD_IDX_OVERFLOW -1
105 +/* margot includes */
106 +#include <asm/idt-boards/rc32434/rc32434.h>
108 +#include "ar2313_msg.h"
109 +#include "platform.h"
114 + * New interrupt handler strategy:
116 + * An old interrupt handler worked using the traditional method of
117 + * replacing an skbuff with a new one when a packet arrives. However
118 + * the rx rings do not need to contain a static number of buffer
119 + * descriptors, thus it makes sense to move the memory allocation out
120 + * of the main interrupt handler and do it in a bottom half handler
121 + * and only allocate new buffers when the number of buffers in the
122 + * ring is below a certain threshold. In order to avoid starving the
123 + * NIC under heavy load it is however necessary to force allocation
124 + * when hitting a minimum threshold. The strategy for alloction is as
127 + * RX_LOW_BUF_THRES - allocate buffers in the bottom half
128 + * RX_PANIC_LOW_THRES - we are very low on buffers, allocate
129 + * the buffers in the interrupt handler
130 + * RX_RING_THRES - maximum number of buffers in the rx ring
132 + * One advantagous side effect of this allocation approach is that the
133 + * entire rx processing can be done without holding any spin lock
134 + * since the rx rings and registers are totally independent of the tx
135 + * ring and its registers. This of course includes the kmalloc's of
136 + * new skb's. Thus start_xmit can run in parallel with rx processing
137 + * and the memory allocation on SMP systems.
139 + * Note that running the skb reallocation in a bottom half opens up
140 + * another can of races which needs to be handled properly. In
141 + * particular it can happen that the interrupt handler tries to run
142 + * the reallocation while the bottom half is either running on another
143 + * CPU or was interrupted on the same CPU. To get around this the
144 + * driver uses bitops to prevent the reallocation routines from being
147 + * TX handling can also be done without holding any spin lock, wheee
148 + * this is fun! since tx_csm is only written to by the interrupt
153 + * Threshold values for RX buffer allocation - the low water marks for
154 + * when to start refilling the rings are set to 75% of the ring
155 + * sizes. It seems to make sense to refill the rings entirely from the
156 + * intrrupt handler once it gets below the panic threshold, that way
157 + * we don't risk that the refilling is moved to another CPU when the
158 + * one running the interrupt handler just got the slab code hot in its
161 +#define RX_RING_SIZE AR2313_DESCR_ENTRIES
162 +#define RX_PANIC_THRES (RX_RING_SIZE/4)
163 +#define RX_LOW_THRES ((3*RX_RING_SIZE)/4)
167 +#define AR2313_BUFSIZE (AR2313_MTU + ETH_HLEN + CRC_LEN + RX_OFFSET)
170 +MODULE_AUTHOR("Sameer Dekate<sdekate@arubanetworks.com>");
171 +MODULE_DESCRIPTION("AR2313 Ethernet driver");
175 +static char version[] __initdata =
176 + "ar2313.c: v0.02 2006/06/19 sdekate@arubanetworks.com\n";
179 +#define virt_to_phys(x) ((u32)(x) & 0x1fffffff)
182 +static short armiiread(short phy, short reg);
183 +static void armiiwrite(short phy, short reg, short data);
185 +static void ar2313_tx_timeout(struct net_device *dev);
187 +static void ar2313_halt(struct net_device *dev);
188 +static void rx_tasklet_func(unsigned long data);
189 +static void ar2313_multicast_list(struct net_device *dev);
191 +static struct net_device *root_dev;
192 +static int probed __initdata = 0;
193 +static unsigned long ar_eth_base;
194 +static unsigned long ar_dma_base;
195 +static unsigned long ar_int_base;
196 +static unsigned long ar_int_mac_mask;
197 +static unsigned long ar_int_phy_mask;
200 +#define ERR(fmt, args...) printk("%s: " fmt, __func__, ##args)
203 +static int parse_mac_addr(struct net_device *dev, char* macstr){
205 + unsigned char result, value;
207 + for (i=0; i<6; i++) {
209 + if (i != 5 && *(macstr+2) != ':') {
210 + ERR("invalid mac address format: %d %c\n",
214 + for (j=0; j<2; j++) {
215 + if (isxdigit(*macstr) && (value = isdigit(*macstr) ? *macstr-'0' :
216 + toupper(*macstr)-'A'+10) < 16)
218 + result = result*16 + value;
222 + ERR("invalid mac address "
223 + "character: %c\n", *macstr);
229 + dev->dev_addr[i] = result;
236 +int __init ar2313_probe(void)
238 + struct net_device *dev;
239 + struct ar2313_private *sp;
248 + sprintf(name, "%s%%d", ifname) ;
249 + dev = alloc_etherdev(sizeof(struct ar2313_private));
252 + printk(KERN_ERR "ar2313: Unable to allocate net_device structure!\n");
256 + SET_MODULE_OWNER(dev);
261 + switch (mips_machtype) {
262 + case MACH_ARUBA_AP60:
263 + ar_eth_base = 0xb8100000;
264 + ar_dma_base = ar_eth_base + 0x1000;
265 + ar_int_base = 0x1C003020;
266 + ar_int_mac_mask = RESET_ENET0|RESET_ENET1;
267 + ar_int_phy_mask = RESET_EPHY0|RESET_EPHY1;
273 + case MACH_ARUBA_AP40:
274 + ar_eth_base = 0xb0500000;
275 + ar_dma_base = ar_eth_base + 0x1000;
276 + ar_int_base = 0x11000004;
277 + ar_int_mac_mask = 0x800;
278 + ar_int_phy_mask = 0x400;
284 + case MACH_ARUBA_AP65:
285 + ar_eth_base = 0xb8100000;
286 + ar_dma_base = ar_eth_base + 0x1000;
287 + ar_int_base = 0x1C003020;
288 + ar_int_mac_mask = RESET_ENET0|RESET_ENET1;
289 + ar_int_phy_mask = RESET_EPHY0|RESET_EPHY1;
292 + // commented out, for now
294 + if (mips_machtype == MACH_ARUBA_SAMSUNG) {
306 + printk("%s: unsupported mips_machtype=0x%lx\n",
307 + __FUNCTION__, mips_machtype) ;
311 + spin_lock_init(&sp->lock);
313 + /* initialize func pointers */
314 + dev->open = &ar2313_open;
315 + dev->stop = &ar2313_close;
316 + dev->hard_start_xmit = &ar2313_start_xmit;
318 + dev->get_stats = &ar2313_get_stats;
319 + dev->set_multicast_list = &ar2313_multicast_list;
321 + dev->tx_timeout = ar2313_tx_timeout;
322 + dev->watchdog_timeo = AR2313_TX_TIMEOUT;
324 + dev->do_ioctl = &ar2313_ioctl;
326 + // SAMEER: do we need this?
327 + dev->features |= NETIF_F_SG | NETIF_F_HIGHDMA;
329 + tasklet_init(&sp->rx_tasklet, rx_tasklet_func, (unsigned long) dev);
330 + tasklet_disable(&sp->rx_tasklet);
332 + /* display version info if adapter is found */
333 + if (!version_disp) {
334 + /* set display flag to TRUE so that */
335 + /* we only display this string ONCE */
342 + request_region(PHYSADDR(ETHERNET_BASE), ETHERNET_SIZE*ETHERNET_MACS,
345 + sp->eth_regs = ioremap_nocache(PHYSADDR(ETHERNET_BASE + ETHERNET_SIZE*sp->mac),
346 + sizeof(*sp->eth_regs));
347 + if (!sp->eth_regs) {
348 + printk("Can't remap eth registers\n");
352 + sp->dma_regs = ioremap_nocache(PHYSADDR(DMA_BASE + DMA_SIZE*sp->mac),
353 + sizeof(*sp->dma_regs));
354 + dev->base_addr = (unsigned int) sp->dma_regs;
355 + if (!sp->dma_regs) {
356 + printk("Can't remap DMA registers\n");
360 + sp->int_regs = ioremap_nocache(PHYSADDR(INTERRUPT_BASE),
361 + sizeof(*sp->int_regs));
362 + if (!sp->int_regs) {
363 + printk("Can't remap INTERRUPT registers\n");
367 + strncpy(sp->name, "Atheros AR2313", sizeof (sp->name) - 1);
368 + sp->name [sizeof (sp->name) - 1] = '\0';
372 + extern char *getenv(char *e);
373 + unsigned char def_mac[6] = {0, 0x0b, 0x86, 0xba, 0xdb, 0xad};
374 + memset(mac, 0, 32);
375 + memcpy(mac, getenv("ethaddr"), 17);
376 + if (parse_mac_addr(dev, mac)){
377 + printk("%s: MAC address not found, using default\n", __func__);
378 + memcpy(dev->dev_addr, def_mac, 6);
382 + sp->board_idx = BOARD_IDX_STATIC;
384 + if (ar2313_init(dev)) {
386 + * ar2313_init() calls ar2313_init_cleanup() on error.
392 + if (register_netdev(dev)){
393 + printk("%s: register_netdev failed\n", __func__);
397 + printk("%s: %s: %02x:%02x:%02x:%02x:%02x:%02x, irq %d\n",
398 + dev->name, sp->name,
399 + dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
400 + dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5],
403 + /* start link poll timer */
404 + ar2313_setup_timer(dev);
407 + * Register the device
415 +static void ar2313_dump_regs(struct net_device *dev)
417 + unsigned int *ptr, i;
418 + struct ar2313_private *sp = (struct ar2313_private *)dev->priv;
420 + ptr = (unsigned int *)sp->eth_regs;
421 + for(i=0; i< (sizeof(ETHERNET_STRUCT)/ sizeof(unsigned int)); i++, ptr++) {
422 + printk("ENET: %08x = %08x\n", (int)ptr, *ptr);
425 + ptr = (unsigned int *)sp->dma_regs;
426 + for(i=0; i< (sizeof(DMA)/ sizeof(unsigned int)); i++, ptr++) {
427 + printk("DMA: %08x = %08x\n", (int)ptr, *ptr);
430 + ptr = (unsigned int *)sp->int_regs;
431 + for(i=0; i< (sizeof(INTERRUPT)/ sizeof(unsigned int)); i++, ptr++){
432 + printk("INT: %08x = %08x\n", (int)ptr, *ptr);
435 + for (i = 0; i < AR2313_DESCR_ENTRIES; i++) {
436 + ar2313_descr_t *td = &sp->tx_ring[i];
437 + printk("Tx desc %2d: %08x %08x %08x %08x\n", i,
438 + td->status, td->devcs, td->addr, td->descr);
445 +ar2313_tx_timeout(struct net_device *dev)
447 + struct ar2313_private *sp = (struct ar2313_private *)dev->priv;
448 + unsigned long flags;
451 + printk("Tx timeout\n");
453 + spin_lock_irqsave(&sp->lock, flags);
454 + ar2313_restart(dev);
455 + spin_unlock_irqrestore(&sp->lock, flags);
461 +printMcList(struct net_device *dev)
463 + struct dev_mc_list *list = dev->mc_list;
466 + printk("%d MC ADDR ", num);
467 + for(i=0;i<list->dmi_addrlen;i++) {
468 + printk(":%02x", list->dmi_addr[i]);
477 + * Set or clear the multicast filter for this adaptor.
478 + * THIS IS ABSOLUTE CRAP, disabled
481 +ar2313_multicast_list(struct net_device *dev)
484 + * Always listen to broadcasts and
485 + * treat IFF bits independently
487 + struct ar2313_private *sp = (struct ar2313_private *)dev->priv;
488 + unsigned int recognise;
490 + recognise = sp->eth_regs->mac_control;
492 + if (dev->flags & IFF_PROMISC) { /* set promiscuous mode */
493 + recognise |= MAC_CONTROL_PR;
495 + recognise &= ~MAC_CONTROL_PR;
498 + if ((dev->flags & IFF_ALLMULTI) || (dev->mc_count > 15)) {
501 + printk("%s: all MULTICAST mc_count %d\n", __FUNCTION__, dev->mc_count);
503 + recognise |= MAC_CONTROL_PM;/* all multicast */
504 + } else if (dev->mc_count > 0) {
507 + printk("%s: mc_count %d\n", __FUNCTION__, dev->mc_count);
509 + recognise |= MAC_CONTROL_PM; /* for the time being */
512 + printk("%s: setting %08x to %08x\n", __FUNCTION__, (int)sp->eth_regs, recognise);
515 + sp->eth_regs->mac_control = recognise;
518 +static void rx_tasklet_cleanup(struct net_device *dev)
520 + struct ar2313_private *sp = dev->priv;
523 + * Tasklet may be scheduled. Need to get it removed from the list
524 + * since we're about to free the struct.
528 + tasklet_enable(&sp->rx_tasklet);
529 + tasklet_kill(&sp->rx_tasklet);
532 +static void __exit ar2313_module_cleanup(void)
534 + rx_tasklet_cleanup(root_dev);
535 + ar2313_init_cleanup(root_dev);
536 + unregister_netdev(root_dev);
538 + release_region(PHYSADDR(ETHERNET_BASE), ETHERNET_SIZE*ETHERNET_MACS);
543 + * Restart the AR2313 ethernet controller.
545 +static int ar2313_restart(struct net_device *dev)
547 + /* disable interrupts */
548 + disable_irq(dev->irq);
556 + /* enable interrupts */
557 + enable_irq(dev->irq);
562 +extern unsigned long mips_machtype;
564 +int __init ar2313_module_init(void)
567 + switch (mips_machtype){
568 + case MACH_ARUBA_AP60:
569 + case MACH_ARUBA_AP65:
570 + case MACH_ARUBA_AP40:
572 + status = ar2313_probe();
579 +module_init(ar2313_module_init);
580 +module_exit(ar2313_module_cleanup);
583 +static void ar2313_free_descriptors(struct net_device *dev)
585 + struct ar2313_private *sp = dev->priv;
586 + if (sp->rx_ring != NULL) {
587 + kfree((void*)KSEG0ADDR(sp->rx_ring));
588 + sp->rx_ring = NULL;
589 + sp->tx_ring = NULL;
594 +static int ar2313_allocate_descriptors(struct net_device *dev)
596 + struct ar2313_private *sp = dev->priv;
599 + ar2313_descr_t *space;
601 + if(sp->rx_ring != NULL){
602 + printk("%s: already done.\n", __FUNCTION__);
606 + size = (sizeof(ar2313_descr_t) * (AR2313_DESCR_ENTRIES * AR2313_QUEUES));
607 + space = kmalloc(size, GFP_KERNEL);
611 + /* invalidate caches */
612 + dma_cache_inv((unsigned int)space, size);
614 + /* now convert pointer to KSEG1 */
615 + space = (ar2313_descr_t *)KSEG1ADDR(space);
617 + memset((void *)space, 0, size);
619 + sp->rx_ring = space;
620 + space += AR2313_DESCR_ENTRIES;
622 + sp->tx_ring = space;
623 + space += AR2313_DESCR_ENTRIES;
625 + /* Initialize the transmit Descriptors */
626 + for (j = 0; j < AR2313_DESCR_ENTRIES; j++) {
627 + ar2313_descr_t *td = &sp->tx_ring[j];
629 + td->devcs = DMA_TX1_CHAINED;
631 + td->descr = K1_TO_PHYS(&sp->tx_ring[(j+1) & (AR2313_DESCR_ENTRIES-1)]);
639 + * Generic cleanup handling data allocated during init. Used when the
640 + * module is unloaded or if an error occurs during initialization
642 +static void ar2313_init_cleanup(struct net_device *dev)
644 + struct ar2313_private *sp = dev->priv;
645 + struct sk_buff *skb;
648 + ar2313_free_descriptors(dev);
650 + if (sp->eth_regs) iounmap((void*)sp->eth_regs);
651 + if (sp->dma_regs) iounmap((void*)sp->dma_regs);
654 + for (j = 0; j < AR2313_DESCR_ENTRIES; j++) {
655 + skb = sp->rx_skb[j];
657 + sp->rx_skb[j] = NULL;
658 + dev_kfree_skb(skb);
666 + for (j = 0; j < AR2313_DESCR_ENTRIES; j++) {
667 + skb = sp->tx_skb[j];
669 + sp->tx_skb[j] = NULL;
670 + dev_kfree_skb(skb);
678 +static int ar2313_setup_timer(struct net_device *dev)
680 + struct ar2313_private *sp = dev->priv;
682 + init_timer(&sp->link_timer);
684 + sp->link_timer.function = ar2313_link_timer_fn;
685 + sp->link_timer.data = (int) dev;
686 + sp->link_timer.expires = jiffies + HZ;
688 + add_timer(&sp->link_timer);
693 +static void ar2313_link_timer_fn(unsigned long data)
695 + struct net_device *dev = (struct net_device *) data;
696 + struct ar2313_private *sp = dev->priv;
698 + // see if the link status changed
699 + // This was needed to make sure we set the PHY to the
700 + // autonegotiated value of half or full duplex.
701 + ar2313_check_link(dev);
703 + // Loop faster when we don't have link.
704 + // This was needed to speed up the AP bootstrap time.
705 + if(sp->link == 0) {
706 + mod_timer(&sp->link_timer, jiffies + HZ/2);
708 + mod_timer(&sp->link_timer, jiffies + LINK_TIMER);
712 +static void ar2313_check_link(struct net_device *dev)
714 + struct ar2313_private *sp = dev->priv;
717 + phyData = armiiread(sp->phy, MII_BMSR);
718 + if (sp->phyData != phyData) {
719 + if (phyData & BMSR_LSTATUS) {
720 + /* link is present, ready link partner ability to deterine duplexity */
725 + reg = armiiread(sp->phy, MII_BMCR);
726 + if (reg & BMCR_ANENABLE) {
727 + /* auto neg enabled */
728 + reg = armiiread(sp->phy, MII_LPA);
729 + duplex = (reg & (LPA_100FULL|LPA_10FULL))? 1:0;
731 + /* no auto neg, just read duplex config */
732 + duplex = (reg & BMCR_FULLDPLX)? 1:0;
735 + printk(KERN_INFO "%s: Configuring MAC for %s duplex\n", dev->name,
736 + (duplex)? "full":"half");
740 + sp->eth_regs->mac_control = ((sp->eth_regs->mac_control | MAC_CONTROL_F) &
744 + sp->eth_regs->mac_control = ((sp->eth_regs->mac_control | MAC_CONTROL_DRO) &
751 + sp->phyData = phyData;
756 +ar2313_reset_reg(struct net_device *dev)
758 + struct ar2313_private *sp = (struct ar2313_private *)dev->priv;
759 + unsigned int ethsal, ethsah;
760 + unsigned int flags;
762 + *sp->int_regs |= ar_int_mac_mask;
764 + *sp->int_regs &= ~ar_int_mac_mask;
766 + *sp->int_regs |= ar_int_phy_mask;
768 + *sp->int_regs &= ~ar_int_phy_mask;
771 + sp->dma_regs->bus_mode = (DMA_BUS_MODE_SWR);
773 + sp->dma_regs->bus_mode = ((32 << DMA_BUS_MODE_PBL_SHIFT) | DMA_BUS_MODE_BLE);
775 + /* enable interrupts */
776 + sp->dma_regs->intr_ena = (DMA_STATUS_AIS |
781 + sp->dma_regs->xmt_base = K1_TO_PHYS(sp->tx_ring);
782 + sp->dma_regs->rcv_base = K1_TO_PHYS(sp->rx_ring);
783 + sp->dma_regs->control = (DMA_CONTROL_SR | DMA_CONTROL_ST | DMA_CONTROL_SF);
785 + sp->eth_regs->flow_control = (FLOW_CONTROL_FCE);
786 + sp->eth_regs->vlan_tag = (0x8100);
788 + /* Enable Ethernet Interface */
789 + flags = (MAC_CONTROL_TE | /* transmit enable */
790 + MAC_CONTROL_PM | /* pass mcast */
791 + MAC_CONTROL_F | /* full duplex */
792 + MAC_CONTROL_HBD); /* heart beat disabled */
794 + if (dev->flags & IFF_PROMISC) { /* set promiscuous mode */
795 + flags |= MAC_CONTROL_PR;
797 + sp->eth_regs->mac_control = flags;
799 + /* Set all Ethernet station address registers to their initial values */
800 + ethsah = ((((u_int)(dev->dev_addr[5]) << 8) & (u_int)0x0000FF00) |
801 + (((u_int)(dev->dev_addr[4]) << 0) & (u_int)0x000000FF));
803 + ethsal = ((((u_int)(dev->dev_addr[3]) << 24) & (u_int)0xFF000000) |
804 + (((u_int)(dev->dev_addr[2]) << 16) & (u_int)0x00FF0000) |
805 + (((u_int)(dev->dev_addr[1]) << 8) & (u_int)0x0000FF00) |
806 + (((u_int)(dev->dev_addr[0]) << 0) & (u_int)0x000000FF) );
808 + sp->eth_regs->mac_addr[0] = ethsah;
809 + sp->eth_regs->mac_addr[1] = ethsal;
817 +static int ar2313_init(struct net_device *dev)
819 + struct ar2313_private *sp = dev->priv;
823 + * Allocate descriptors
825 + if (ar2313_allocate_descriptors(dev)) {
826 + printk("%s: %s: ar2313_allocate_descriptors failed\n",
827 + dev->name, __FUNCTION__);
833 + * Get the memory for the skb rings.
835 + if(sp->rx_skb == NULL) {
836 + sp->rx_skb = kmalloc(sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES, GFP_KERNEL);
837 + if (!(sp->rx_skb)) {
838 + printk("%s: %s: rx_skb kmalloc failed\n",
839 + dev->name, __FUNCTION__);
844 + memset(sp->rx_skb, 0, sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES);
846 + if(sp->tx_skb == NULL) {
847 + sp->tx_skb = kmalloc(sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES, GFP_KERNEL);
848 + if (!(sp->tx_skb)) {
849 + printk("%s: %s: tx_skb kmalloc failed\n",
850 + dev->name, __FUNCTION__);
855 + memset(sp->tx_skb, 0, sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES);
858 + * Set tx_csm before we start receiving interrupts, otherwise
859 + * the interrupt handler might think it is supposed to process
860 + * tx ints before we are up and running, which may cause a null
861 + * pointer access in the int handler.
869 + * Zero the stats before starting the interface
871 + memset(&sp->stats, 0, sizeof(sp->stats));
874 + * We load the ring here as there seem to be no way to tell the
875 + * firmware to wipe the ring without re-initializing it.
877 + ar2313_load_rx_ring(dev, RX_RING_SIZE);
882 + ar2313_reset_reg(dev);
887 + ecode = request_irq(dev->irq, &ar2313_interrupt, SA_SHIRQ | SA_INTERRUPT, dev->name, dev);
889 + printk(KERN_WARNING "%s: %s: Requested IRQ %d is busy\n",
890 + dev->name, __FUNCTION__, dev->irq);
895 + // commented out, for now
897 + if(mips_machtype == MACH_ARUBA_SAMSUNG) {
899 + /* configure Marvell 88E6060 */
901 + armiiwrite(0x1f, 0xa, 0xa130);
904 + i = armiiread(sp->phy, 0xa);
905 + } while (i & 0x8000);
907 + /* configure MAC address */
908 + armiiwrite(sp->phy, 0x1, dev->dev_addr[0] << 8 | dev->dev_addr[1]);
909 + armiiwrite(sp->phy, 0x2, dev->dev_addr[2] << 8 | dev->dev_addr[3]);
910 + armiiwrite(sp->phy, 0x3, dev->dev_addr[4] << 8 | dev->dev_addr[5]);
912 + /* set ports to forwarding */
913 + armiiwrite(0x18, 0x4, 0x3);
914 + armiiwrite(0x1c, 0x4, 0x3);
915 + armiiwrite(0x1d, 0x4, 0x3);
919 + tasklet_enable(&sp->rx_tasklet);
924 + ar2313_init_cleanup(dev);
929 + * Load the rx ring.
931 + * Loading rings is safe without holding the spin lock since this is
932 + * done only before the device is enabled, thus no interrupts are
933 + * generated and by the interrupt handler/tasklet handler.
935 +static void ar2313_load_rx_ring(struct net_device *dev, int nr_bufs)
938 + struct ar2313_private *sp = ((struct net_device *)dev)->priv;
941 + idx = sp->rx_skbprd;
943 + for (i = 0; i < nr_bufs; i++) {
944 + struct sk_buff *skb;
945 + ar2313_descr_t *rd;
947 + if (sp->rx_skb[idx]) {
949 + printk(KERN_INFO "ar2313 rx refill full\n");
954 + // partha: create additional room for the second GRE fragment
955 + skb = alloc_skb(AR2313_BUFSIZE+128, GFP_ATOMIC);
957 + printk("\n\n\n\n %s: No memory in system\n\n\n\n", __FUNCTION__);
960 + // partha: create additional room in the front for tx pkt capture
961 + skb_reserve(skb, 32);
964 + * Make sure IP header starts on a fresh cache line.
967 + skb_reserve(skb, RX_OFFSET);
968 + sp->rx_skb[idx] = skb;
970 + rd = (ar2313_descr_t *) &sp->rx_ring[idx];
972 + /* initialize dma descriptor */
973 + rd->devcs = ((AR2313_BUFSIZE << DMA_RX1_BSIZE_SHIFT) |
975 + rd->addr = virt_to_phys(skb->data);
976 + rd->descr = virt_to_phys(&sp->rx_ring[(idx+1) & (AR2313_DESCR_ENTRIES-1)]);
977 + rd->status = DMA_RX_OWN;
979 + idx = DSC_NEXT(idx);
984 + printk(KERN_INFO "Out of memory when allocating standard receive buffers\n");
987 + sp->rx_skbprd = idx;
993 +#define AR2313_MAX_PKTS_PER_CALL 64
995 +static int ar2313_rx_int(struct net_device *dev)
997 + struct ar2313_private *sp = dev->priv;
998 + struct sk_buff *skb, *skb_new;
999 + ar2313_descr_t *rxdesc;
1000 + unsigned int status;
1007 + /* process at most the entire ring and then wait for another interrupt */
1010 + rxdesc = &sp->rx_ring[idx];
1011 + status = rxdesc->status;
1012 + if (status & DMA_RX_OWN) {
1013 + /* SiByte owns descriptor or descr not yet filled in */
1018 + if (++pkts > AR2313_MAX_PKTS_PER_CALL) {
1024 + printk("index %d\n", idx);
1025 + printk("RX status %08x\n", rxdesc->status);
1026 + printk("RX devcs %08x\n", rxdesc->devcs );
1027 + printk("RX addr %08x\n", rxdesc->addr );
1028 + printk("RX descr %08x\n", rxdesc->descr );
1031 + if ((status & (DMA_RX_ERROR|DMA_RX_ERR_LENGTH)) &&
1032 + (!(status & DMA_RX_LONG))){
1034 + printk("%s: rx ERROR %08x\n", __FUNCTION__, status);
1036 + sp->stats.rx_errors++;
1037 + sp->stats.rx_dropped++;
1039 + /* add statistics counters */
1040 + if (status & DMA_RX_ERR_CRC) sp->stats.rx_crc_errors++;
1041 + if (status & DMA_RX_ERR_COL) sp->stats.rx_over_errors++;
1042 + if (status & DMA_RX_ERR_LENGTH)
1043 + sp->stats.rx_length_errors++;
1044 + if (status & DMA_RX_ERR_RUNT) sp->stats.rx_over_errors++;
1045 + if (status & DMA_RX_ERR_DESC) sp->stats.rx_over_errors++;
1048 + /* alloc new buffer. */
1049 + skb_new = dev_alloc_skb(AR2313_BUFSIZE + RX_OFFSET + 128);
1050 + if (skb_new != NULL) {
1052 + skb = sp->rx_skb[idx];
1054 + skb_put(skb, ((status >> DMA_RX_LEN_SHIFT) & 0x3fff) - CRC_LEN);
1056 +#ifdef CONFIG_MERLOT
1057 + if ((dev->am_pkt_handler == NULL) ||
1058 + (dev->am_pkt_handler(skb, dev) == 0)) {
1060 + sp->stats.rx_bytes += skb->len;
1061 + skb->protocol = eth_type_trans(skb, dev);
1062 + /* pass the packet to upper layers */
1064 +#ifdef CONFIG_MERLOT
1065 + if (dev->asap_netif_rx)
1066 + dev->asap_netif_rx(skb);
1070 +#ifdef CONFIG_MERLOT
1073 + skb_new->dev = dev;
1074 + /* 16 bit align */
1075 + skb_reserve(skb_new, RX_OFFSET+32);
1076 + /* reset descriptor's curr_addr */
1077 + rxdesc->addr = virt_to_phys(skb_new->data);
1079 + sp->stats.rx_packets++;
1080 + sp->rx_skb[idx] = skb_new;
1083 + sp->stats.rx_dropped++;
1087 + rxdesc->devcs = ((AR2313_BUFSIZE << DMA_RX1_BSIZE_SHIFT) |
1089 + rxdesc->status = DMA_RX_OWN;
1091 + idx = DSC_NEXT(idx);
1100 +static void ar2313_tx_int(struct net_device *dev)
1102 + struct ar2313_private *sp = dev->priv;
1104 + struct sk_buff *skb;
1105 + ar2313_descr_t *txdesc;
1106 + unsigned int status=0;
1110 + while (idx != sp->tx_prd) {
1112 + txdesc = &sp->tx_ring[idx];
1115 + printk("%s: TXINT: csm=%d idx=%d prd=%d status=%x devcs=%x addr=%08x descr=%x\n",
1116 + dev->name, sp->tx_csm, idx, sp->tx_prd,
1117 + txdesc->status, txdesc->devcs, txdesc->addr, txdesc->descr);
1120 + if ((status = txdesc->status) & DMA_TX_OWN) {
1121 + /* ar2313 dma still owns descr */
1124 + /* done with this descriptor */
1125 + txdesc->status = 0;
1127 + if (status & DMA_TX_ERROR){
1128 + sp->stats.tx_errors++;
1129 + sp->stats.tx_dropped++;
1130 + if(status & DMA_TX_ERR_UNDER)
1131 + sp->stats.tx_fifo_errors++;
1132 + if(status & DMA_TX_ERR_HB)
1133 + sp->stats.tx_heartbeat_errors++;
1134 + if(status & (DMA_TX_ERR_LOSS |
1136 + sp->stats.tx_carrier_errors++;
1137 + if (status & (DMA_TX_ERR_LATE|
1139 + DMA_TX_ERR_JABBER |
1140 + DMA_TX_ERR_DEFER))
1141 + sp->stats.tx_aborted_errors++;
1144 + sp->stats.tx_packets++;
1147 + skb = sp->tx_skb[idx];
1148 + sp->tx_skb[idx] = NULL;
1149 + idx = DSC_NEXT(idx);
1150 + sp->stats.tx_bytes += skb->len;
1151 + dev_kfree_skb_irq(skb);
1161 +rx_tasklet_func(unsigned long data)
1163 + struct net_device *dev = (struct net_device *) data;
1164 + struct ar2313_private *sp = dev->priv;
1166 + if (sp->unloading) {
1170 + if (ar2313_rx_int(dev)) {
1171 + tasklet_hi_schedule(&sp->rx_tasklet);
1174 + unsigned long flags;
1175 + spin_lock_irqsave(&sp->lock, flags);
1176 + sp->dma_regs->intr_ena |= DMA_STATUS_RI;
1177 + spin_unlock_irqrestore(&sp->lock, flags);
1182 +rx_schedule(struct net_device *dev)
1184 + struct ar2313_private *sp = dev->priv;
1186 + sp->dma_regs->intr_ena &= ~DMA_STATUS_RI;
1188 + tasklet_hi_schedule(&sp->rx_tasklet);
1191 +static irqreturn_t ar2313_interrupt(int irq, void *dev_id, struct pt_regs *ptregs)
1193 + struct net_device *dev = (struct net_device *)dev_id;
1194 + struct ar2313_private *sp = dev->priv;
1195 + unsigned int status, enabled;
1197 + /* clear interrupt */
1199 + * Don't clear RI bit if currently disabled.
1201 + status = sp->dma_regs->status;
1202 + enabled = sp->dma_regs->intr_ena;
1203 + sp->dma_regs->status = status & enabled;
1205 + if (status & DMA_STATUS_NIS) {
1206 + /* normal status */
1208 + * Don't schedule rx processing if interrupt
1209 + * is already disabled.
1211 + if (status & enabled & DMA_STATUS_RI) {
1212 + /* receive interrupt */
1215 + if (status & DMA_STATUS_TI) {
1216 + /* transmit interrupt */
1217 + ar2313_tx_int(dev);
1221 + if (status & DMA_STATUS_AIS) {
1223 + printk("%s: AIS set %08x & %x\n", __FUNCTION__,
1224 + status, (DMA_STATUS_FBE | DMA_STATUS_TPS));
1226 + /* abnormal status */
1227 + if (status & (DMA_STATUS_FBE | DMA_STATUS_TPS)) {
1228 + ar2313_restart(dev);
1231 + return IRQ_HANDLED;
1235 +static int ar2313_open(struct net_device *dev)
1237 + struct ar2313_private *sp;
1242 + netif_start_queue(dev);
1244 + sp->eth_regs->mac_control |= MAC_CONTROL_RE;
1246 + AR2313_MOD_INC_USE_COUNT;
1251 +static void ar2313_halt(struct net_device *dev)
1253 + struct ar2313_private *sp = dev->priv;
1256 + tasklet_disable(&sp->rx_tasklet);
1258 + /* kill the MAC */
1259 + sp->eth_regs->mac_control &= ~(MAC_CONTROL_RE | /* disable Receives */
1260 + MAC_CONTROL_TE); /* disable Transmits */
1262 + sp->dma_regs->control = 0;
1263 + sp->dma_regs->bus_mode = DMA_BUS_MODE_SWR;
1265 + /* place phy and MAC in reset */
1266 + *sp->int_regs |= (ar_int_mac_mask | ar_int_phy_mask);
1268 + /* free buffers on tx ring */
1269 + for (j = 0; j < AR2313_DESCR_ENTRIES; j++) {
1270 + struct sk_buff *skb;
1271 + ar2313_descr_t *txdesc;
1273 + txdesc = &sp->tx_ring[j];
1274 + txdesc->descr = 0;
1276 + skb = sp->tx_skb[j];
1278 + dev_kfree_skb(skb);
1279 + sp->tx_skb[j] = NULL;
1285 + * close should do nothing. Here's why. It's called when
1286 + * 'ifconfig bond0 down' is run. If it calls free_irq then
1287 + * the irq is gone forever ! When bond0 is made 'up' again,
1288 + * the ar2313_open () does not call request_irq (). Worse,
1289 + * the call to ar2313_halt() generates a WDOG reset due to
1290 + * the write to 'sp->int_regs' and the box reboots.
1291 + * Commenting this out is good since it allows the
1292 + * system to resume when bond0 is made up again.
1294 +static int ar2313_close(struct net_device *dev)
1298 + * Disable interrupts
1300 + disable_irq(dev->irq);
1303 + * Without (or before) releasing irq and stopping hardware, this
1304 + * is an absolute non-sense, by the way. It will be reset instantly
1305 + * by the first irq.
1307 + netif_stop_queue(dev);
1309 + /* stop the MAC and DMA engines */
1312 + /* release the interrupt */
1313 + free_irq(dev->irq, dev);
1316 + AR2313_MOD_DEC_USE_COUNT;
1320 +static int ar2313_start_xmit(struct sk_buff *skb, struct net_device *dev)
1322 + struct ar2313_private *sp = dev->priv;
1323 + ar2313_descr_t *td;
1327 + td = &sp->tx_ring[idx];
1329 + if (td->status & DMA_TX_OWN) {
1331 + printk("%s: No space left to Tx\n", __FUNCTION__);
1333 + /* free skbuf and lie to the caller that we sent it out */
1334 + sp->stats.tx_dropped++;
1335 + dev_kfree_skb(skb);
1337 + /* restart transmitter in case locked */
1338 + sp->dma_regs->xmt_poll = 0;
1342 + /* Setup the transmit descriptor. */
1343 + td->devcs = ((skb->len << DMA_TX1_BSIZE_SHIFT) |
1344 + (DMA_TX1_LS|DMA_TX1_IC|DMA_TX1_CHAINED));
1345 + td->addr = virt_to_phys(skb->data);
1346 + td->status = DMA_TX_OWN;
1348 + /* kick transmitter last */
1349 + sp->dma_regs->xmt_poll = 0;
1352 + printk("index %d\n", idx);
1353 + printk("TX status %08x\n", td->status);
1354 + printk("TX devcs %08x\n", td->devcs );
1355 + printk("TX addr %08x\n", td->addr );
1356 + printk("TX descr %08x\n", td->descr );
1359 + sp->tx_skb[idx] = skb;
1360 + idx = DSC_NEXT(idx);
1363 + //dev->trans_start = jiffies;
1368 +static int netdev_get_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
1370 + struct ar2313_private *np = dev->priv;
1374 + (SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full |
1375 + SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full |
1376 + SUPPORTED_Autoneg | SUPPORTED_TP | SUPPORTED_MII);
1378 + ecmd->port = PORT_TP;
1379 + /* only supports internal transceiver */
1380 + ecmd->transceiver = XCVR_INTERNAL;
1381 + /* not sure what this is for */
1382 + ecmd->phy_address = 1;
1384 + ecmd->advertising = ADVERTISED_MII;
1385 + tmp = armiiread(np->phy, MII_ADVERTISE);
1386 + if (tmp & ADVERTISE_10HALF)
1387 + ecmd->advertising |= ADVERTISED_10baseT_Half;
1388 + if (tmp & ADVERTISE_10FULL)
1389 + ecmd->advertising |= ADVERTISED_10baseT_Full;
1390 + if (tmp & ADVERTISE_100HALF)
1391 + ecmd->advertising |= ADVERTISED_100baseT_Half;
1392 + if (tmp & ADVERTISE_100FULL)
1393 + ecmd->advertising |= ADVERTISED_100baseT_Full;
1395 + tmp = armiiread(np->phy, MII_BMCR);
1396 + if (tmp & BMCR_ANENABLE) {
1397 + ecmd->advertising |= ADVERTISED_Autoneg;
1398 + ecmd->autoneg = AUTONEG_ENABLE;
1400 + ecmd->autoneg = AUTONEG_DISABLE;
1403 + if (ecmd->autoneg == AUTONEG_ENABLE) {
1404 + tmp = armiiread(np->phy, MII_LPA);
1405 + if (tmp & (LPA_100FULL|LPA_10FULL)) {
1406 + ecmd->duplex = DUPLEX_FULL;
1408 + ecmd->duplex = DUPLEX_HALF;
1410 + if (tmp & (LPA_100FULL|LPA_100HALF)) {
1411 + ecmd->speed = SPEED_100;
1413 + ecmd->speed = SPEED_10;
1416 + if (tmp & BMCR_FULLDPLX) {
1417 + ecmd->duplex = DUPLEX_FULL;
1419 + ecmd->duplex = DUPLEX_HALF;
1421 + if (tmp & BMCR_SPEED100) {
1422 + ecmd->speed = SPEED_100;
1424 + ecmd->speed = SPEED_10;
1428 + /* ignore maxtxpkt, maxrxpkt for now */
1433 +static int netdev_set_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
1435 + struct ar2313_private *np = dev->priv;
1438 + if (ecmd->speed != SPEED_10 && ecmd->speed != SPEED_100)
1440 + if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL)
1442 + if (ecmd->port != PORT_TP)
1444 + if (ecmd->transceiver != XCVR_INTERNAL)
1446 + if (ecmd->autoneg != AUTONEG_DISABLE && ecmd->autoneg != AUTONEG_ENABLE)
1448 + /* ignore phy_address, maxtxpkt, maxrxpkt for now */
1450 + /* WHEW! now lets bang some bits */
1452 + tmp = armiiread(np->phy, MII_BMCR);
1453 + if (ecmd->autoneg == AUTONEG_ENABLE) {
1454 + /* turn on autonegotiation */
1455 + tmp |= BMCR_ANENABLE;
1456 + printk("%s: Enabling auto-neg\n", dev->name);
1458 + /* turn off auto negotiation, set speed and duplexity */
1459 + tmp &= ~(BMCR_ANENABLE | BMCR_SPEED100 | BMCR_FULLDPLX);
1460 + if (ecmd->speed == SPEED_100)
1461 + tmp |= BMCR_SPEED100;
1462 + if (ecmd->duplex == DUPLEX_FULL)
1463 + tmp |= BMCR_FULLDPLX;
1464 + printk("%s: Hard coding %d/%s\n", dev->name,
1465 + (ecmd->speed == SPEED_100)? 100:10,
1466 + (ecmd->duplex == DUPLEX_FULL)? "full":"half");
1468 + armiiwrite(np->phy, MII_BMCR, tmp);
1473 +static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
1475 + struct ar2313_private *np = dev->priv;
1478 + if (get_user(cmd, (u32 *)useraddr))
1482 + /* get settings */
1483 + case ETHTOOL_GSET: {
1484 + struct ethtool_cmd ecmd = { ETHTOOL_GSET };
1485 + spin_lock_irq(&np->lock);
1486 + netdev_get_ecmd(dev, &ecmd);
1487 + spin_unlock_irq(&np->lock);
1488 + if (copy_to_user(useraddr, &ecmd, sizeof(ecmd)))
1492 + /* set settings */
1493 + case ETHTOOL_SSET: {
1494 + struct ethtool_cmd ecmd;
1496 + if (copy_from_user(&ecmd, useraddr, sizeof(ecmd)))
1498 + spin_lock_irq(&np->lock);
1499 + r = netdev_set_ecmd(dev, &ecmd);
1500 + spin_unlock_irq(&np->lock);
1503 + /* restart autonegotiation */
1504 + case ETHTOOL_NWAY_RST: {
1507 + /* if autoneg is off, it's an error */
1508 + tmp = armiiread(np->phy, MII_BMCR);
1509 + if (tmp & BMCR_ANENABLE) {
1510 + tmp |= (BMCR_ANRESTART);
1511 + armiiwrite(np->phy, MII_BMCR, tmp);
1516 + /* get link status */
1517 + case ETHTOOL_GLINK: {
1518 + struct ethtool_value edata = {ETHTOOL_GLINK};
1519 + edata.data = (armiiread(np->phy, MII_BMSR)&BMSR_LSTATUS) ? 1:0;
1520 + if (copy_to_user(useraddr, &edata, sizeof(edata)))
1526 + return -EOPNOTSUPP;
1529 +static int ar2313_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1531 + struct mii_ioctl_data *data = (struct mii_ioctl_data *)&ifr->ifr_data;
1534 + case SIOCDEVPRIVATE: {
1535 + struct ar2313_cmd scmd;
1537 + if (copy_from_user(&scmd, ifr->ifr_data, sizeof(scmd)))
1541 + printk("%s: ioctl devprivate c=%d a=%x l=%d m=%d d=%x,%x\n",
1542 + dev->name, scmd.cmd,
1543 + scmd.address, scmd.length,
1544 + scmd.mailbox, scmd.data[0], scmd.data[1]);
1547 + switch (scmd.cmd) {
1548 + case AR2313_READ_DATA:
1549 + if(scmd.length==4){
1550 + scmd.data[0] = *((u32*)scmd.address);
1551 + } else if(scmd.length==2) {
1552 + scmd.data[0] = *((u16*)scmd.address);
1553 + } else if (scmd.length==1) {
1554 + scmd.data[0] = *((u8*)scmd.address);
1556 + return -EOPNOTSUPP;
1558 + if(copy_to_user(ifr->ifr_data, &scmd, sizeof(scmd)))
1562 + case AR2313_WRITE_DATA:
1563 + if(scmd.length==4){
1564 + *((u32*)scmd.address) = scmd.data[0];
1565 + } else if(scmd.length==2) {
1566 + *((u16*)scmd.address) = scmd.data[0];
1567 + } else if (scmd.length==1) {
1568 + *((u8*)scmd.address) = scmd.data[0];
1570 + return -EOPNOTSUPP;
1574 + case AR2313_GET_VERSION:
1575 + // SAMEER: sprintf((char*) &scmd, "%s", ARUBA_VERSION);
1576 + if(copy_to_user(ifr->ifr_data, &scmd, sizeof(scmd)))
1581 + return -EOPNOTSUPP;
1587 + return netdev_ethtool_ioctl(dev, (void *) ifr->ifr_data);
1589 + case SIOCGMIIPHY: /* Get address of MII PHY in use. */
1591 + /* Fall Through */
1593 + case SIOCGMIIREG: /* Read MII PHY register. */
1594 + case SIOCDEVPRIVATE+1: /* for binary compat, remove in 2.5 */
1595 + data->val_out = armiiread(data->phy_id & 0x1f,
1596 + data->reg_num & 0x1f);
1598 + case SIOCSMIIREG: /* Write MII PHY register. */
1599 + case SIOCDEVPRIVATE+2: /* for binary compat, remove in 2.5 */
1600 + if (!capable(CAP_NET_ADMIN))
1602 + armiiwrite(data->phy_id & 0x1f,
1603 + data->reg_num & 0x1f, data->val_in);
1606 + case SIOCSIFHWADDR:
1607 + if (copy_from_user(dev->dev_addr, ifr->ifr_data, sizeof(dev->dev_addr)))
1611 + case SIOCGIFHWADDR:
1612 + if (copy_to_user(ifr->ifr_data, dev->dev_addr, sizeof(dev->dev_addr)))
1620 + return -EOPNOTSUPP;
1623 +static struct net_device_stats *ar2313_get_stats(struct net_device *dev)
1625 + struct ar2313_private *sp = dev->priv;
1626 + return &sp->stats;
1630 +armiiread(short phy, short reg)
1632 + volatile ETHERNET_STRUCT * ethernet;
1634 + ethernet = (volatile ETHERNET_STRUCT *)ETHERNET_BASE; /* always MAC 0 */
1635 + ethernet->mii_addr = ((reg << MII_ADDR_REG_SHIFT) |
1636 + (phy << MII_ADDR_PHY_SHIFT));
1637 + while (ethernet->mii_addr & MII_ADDR_BUSY);
1638 + return (ethernet->mii_data >> MII_DATA_SHIFT);
1642 +armiiwrite(short phy, short reg, short data)
1644 + volatile ETHERNET_STRUCT * ethernet;
1646 + ethernet = (volatile ETHERNET_STRUCT *)ETHERNET_BASE; /* always MAC 0 */
1647 + while (ethernet->mii_addr & MII_ADDR_BUSY);
1648 + ethernet->mii_data = data << MII_DATA_SHIFT;
1649 + ethernet->mii_addr = ((reg << MII_ADDR_REG_SHIFT) |
1650 + (phy << MII_ADDR_PHY_SHIFT) |
1654 diff -Nur linux-2.6.17/drivers/net/ar2313/ar2313.h linux-2.6.17-owrt/drivers/net/ar2313/ar2313.h
1655 --- linux-2.6.17/drivers/net/ar2313/ar2313.h 1970-01-01 01:00:00.000000000 +0100
1656 +++ linux-2.6.17-owrt/drivers/net/ar2313/ar2313.h 2006-06-19 12:05:29.000000000 +0200
1661 +#include <linux/config.h>
1662 +#include <asm/bootinfo.h>
1663 +#include "platform.h"
1665 +extern unsigned long mips_machtype;
1667 +#undef ETHERNET_BASE
1668 +#define ETHERNET_BASE ar_eth_base
1669 +#define ETHERNET_SIZE 0x00100000
1670 +#define ETHERNET_MACS 2
1673 +#define DMA_BASE ar_dma_base
1674 +#define DMA_SIZE 0x00100000
1678 + * probe link timer - 5 secs
1680 +#define LINK_TIMER (5*HZ)
1683 + * Interrupt register base address
1685 +#define INTERRUPT_BASE PHYS_TO_K1(ar_int_base)
1690 +#define AR531X_RESET (AR531X_RESETTMR + 0x0020)
1691 +#define RESET_SYSTEM 0x00000001 /* cold reset full system */
1692 +#define RESET_PROC 0x00000002 /* cold reset MIPS core */
1693 +#define RESET_WLAN0 0x00000004 /* cold reset WLAN MAC and BB */
1694 +#define RESET_EPHY0 0x00000008 /* cold reset ENET0 phy */
1695 +#define RESET_EPHY1 0x00000010 /* cold reset ENET1 phy */
1696 +#define RESET_ENET0 0x00000020 /* cold reset ENET0 mac */
1697 +#define RESET_ENET1 0x00000040 /* cold reset ENET1 mac */
1699 +#define IS_DMA_TX_INT(X) (((X) & (DMA_STATUS_TI)) != 0)
1700 +#define IS_DMA_RX_INT(X) (((X) & (DMA_STATUS_RI)) != 0)
1701 +#define IS_DRIVER_OWNED(X) (((X) & (DMA_TX_OWN)) == 0)
1705 +#define K1_TO_PHYS(x) (((unsigned int)(x)) & 0x1FFFFFFF) /* kseg1 to physical */
1710 +#define PHYS_TO_K1(x) (((unsigned int)(x)) | 0xA0000000) /* physical to kseg1 */
1713 +#define AR2313_TX_TIMEOUT (HZ/4)
1718 +#define DSC_RING_ENTRIES_SIZE (AR2313_DESCR_ENTRIES * sizeof(struct desc))
1719 +#define DSC_NEXT(idx) ((idx + 1) & (AR2313_DESCR_ENTRIES - 1))
1721 +static inline int tx_space (u32 csm, u32 prd)
1723 + return (csm - prd - 1) & (AR2313_DESCR_ENTRIES - 1);
1727 +#define TX_RESERVED (MAX_SKB_FRAGS+1) /* +1 for message header */
1728 +#define tx_ring_full(csm, prd) (tx_space(csm, prd) <= TX_RESERVED)
1730 +#define tx_ring_full 0
1733 +#define AR2313_MBGET 2
1734 +#define AR2313_MBSET 3
1735 +#define AR2313_PCI_RECONFIG 4
1736 +#define AR2313_PCI_DUMP 5
1737 +#define AR2313_TEST_PANIC 6
1738 +#define AR2313_TEST_NULLPTR 7
1739 +#define AR2313_READ_DATA 8
1740 +#define AR2313_WRITE_DATA 9
1741 +#define AR2313_GET_VERSION 10
1742 +#define AR2313_TEST_HANG 11
1743 +#define AR2313_SYNC 12
1746 +struct ar2313_cmd {
1748 + u32 address; /* virtual address of image */
1749 + u32 length; /* size of image to download */
1750 + u32 mailbox; /* mailbox to get/set */
1751 + u32 data[2]; /* contents of mailbox to read/write */
1756 + * Struct private for the Sibyte.
1758 + * Elements are grouped so variables used by the tx handling goes
1759 + * together, and will go into the same cache lines etc. in order to
1760 + * avoid cache line contention between the rx and tx handling on SMP.
1762 + * Frequently accessed variables are put at the beginning of the
1763 + * struct to help the compiler generate better/shorter code.
1765 +struct ar2313_private
1770 + volatile ETHERNET_STRUCT *eth_regs;
1771 + volatile DMA *dma_regs;
1772 + volatile u32 *int_regs;
1774 + spinlock_t lock; /* Serialise access to device */
1777 + * RX and TX descriptors, must be adjacent
1779 + ar2313_descr_t *rx_ring;
1780 + ar2313_descr_t *tx_ring;
1783 + struct sk_buff **rx_skb;
1784 + struct sk_buff **tx_skb;
1803 + struct net_device_stats stats;
1811 + struct timer_list link_timer;
1812 + unsigned short phy; /* merlot phy = 1, samsung phy = 0x1f */
1813 + unsigned short mac;
1814 + unsigned short link; /* 0 - link down, 1 - link up */
1817 + struct tasklet_struct rx_tasklet;
1825 +static int ar2313_init(struct net_device *dev);
1827 +static void ar2313_tx_timeout(struct net_device *dev);
1830 +static void ar2313_multicast_list(struct net_device *dev);
1832 +static int ar2313_restart(struct net_device *dev);
1834 +static void ar2313_dump_regs(struct net_device *dev);
1836 +static void ar2313_load_rx_ring(struct net_device *dev, int bufs);
1837 +static irqreturn_t ar2313_interrupt(int irq, void *dev_id, struct pt_regs *regs);
1838 +static int ar2313_open(struct net_device *dev);
1839 +static int ar2313_start_xmit(struct sk_buff *skb, struct net_device *dev);
1840 +static int ar2313_close(struct net_device *dev);
1841 +static int ar2313_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
1842 +static void ar2313_init_cleanup(struct net_device *dev);
1843 +static int ar2313_setup_timer(struct net_device *dev);
1844 +static void ar2313_link_timer_fn(unsigned long data);
1845 +static void ar2313_check_link(struct net_device *dev);
1846 +static struct net_device_stats *ar2313_get_stats(struct net_device *dev);
1847 +#endif /* _AR2313_H_ */
1848 diff -Nur linux-2.6.17/drivers/net/ar2313/ar2313_msg.h linux-2.6.17-owrt/drivers/net/ar2313/ar2313_msg.h
1849 --- linux-2.6.17/drivers/net/ar2313/ar2313_msg.h 1970-01-01 01:00:00.000000000 +0100
1850 +++ linux-2.6.17-owrt/drivers/net/ar2313/ar2313_msg.h 2006-06-19 12:05:29.000000000 +0200
1852 +#ifndef _AR2313_MSG_H_
1853 +#define _AR2313_MSG_H_
1855 +#define AR2313_MTU 1692
1856 +#define AR2313_PRIOS 1
1857 +#define AR2313_QUEUES (2*AR2313_PRIOS)
1859 +#define AR2313_DESCR_ENTRIES 64
1862 + volatile unsigned int status; // OWN, Device control and status.
1863 + volatile unsigned int devcs; // pkt Control bits + Length
1864 + volatile unsigned int addr; // Current Address.
1865 + volatile unsigned int descr; // Next descriptor in chain.
1868 +#endif /* _AR2313_MSG_H_ */
1869 diff -Nur linux-2.6.17/drivers/net/ar2313/dma.h linux-2.6.17-owrt/drivers/net/ar2313/dma.h
1870 --- linux-2.6.17/drivers/net/ar2313/dma.h 1970-01-01 01:00:00.000000000 +0100
1871 +++ linux-2.6.17-owrt/drivers/net/ar2313/dma.h 2006-06-19 12:05:29.000000000 +0200
1873 +#ifndef __ARUBA_DMA_H__
1874 +#define __ARUBA_DMA_H__
1876 +/*******************************************************************************
1878 + * Copyright 2002 Integrated Device Technology, Inc.
1879 + * All rights reserved.
1881 + * DMA register definition.
1883 + * File : $Id: dma.h,v 1.3 2002/06/06 18:34:03 astichte Exp $
1885 + * Author : ryan.holmQVist@idt.com
1889 + * Revision 1.3 2002/06/06 18:34:03 astichte
1890 + * Added XXX_PhysicalAddress and XXX_VirtualAddress
1892 + * Revision 1.2 2002/06/05 18:30:46 astichte
1893 + * Removed IDTField
1895 + * Revision 1.1 2002/05/29 17:33:21 sysarch
1896 + * jba File moved from vcode/include/idt/acacia
1899 + ******************************************************************************/
1901 +#define AR_BIT(x) (1 << (x))
1902 +#define DMA_RX_ERR_CRC AR_BIT(1)
1903 +#define DMA_RX_ERR_DRIB AR_BIT(2)
1904 +#define DMA_RX_ERR_MII AR_BIT(3)
1905 +#define DMA_RX_EV2 AR_BIT(5)
1906 +#define DMA_RX_ERR_COL AR_BIT(6)
1907 +#define DMA_RX_LONG AR_BIT(7)
1908 +#define DMA_RX_LS AR_BIT(8) /* last descriptor */
1909 +#define DMA_RX_FS AR_BIT(9) /* first descriptor */
1910 +#define DMA_RX_MF AR_BIT(10) /* multicast frame */
1911 +#define DMA_RX_ERR_RUNT AR_BIT(11) /* runt frame */
1912 +#define DMA_RX_ERR_LENGTH AR_BIT(12) /* length error */
1913 +#define DMA_RX_ERR_DESC AR_BIT(14) /* descriptor error */
1914 +#define DMA_RX_ERROR AR_BIT(15) /* error summary */
1915 +#define DMA_RX_LEN_MASK 0x3fff0000
1916 +#define DMA_RX_LEN_SHIFT 16
1917 +#define DMA_RX_FILT AR_BIT(30)
1918 +#define DMA_RX_OWN AR_BIT(31) /* desc owned by DMA controller */
1920 +#define DMA_RX1_BSIZE_MASK 0x000007ff
1921 +#define DMA_RX1_BSIZE_SHIFT 0
1922 +#define DMA_RX1_CHAINED AR_BIT(24)
1923 +#define DMA_RX1_RER AR_BIT(25)
1925 +#define DMA_TX_ERR_UNDER AR_BIT(1) /* underflow error */
1926 +#define DMA_TX_ERR_DEFER AR_BIT(2) /* excessive deferral */
1927 +#define DMA_TX_COL_MASK 0x78
1928 +#define DMA_TX_COL_SHIFT 3
1929 +#define DMA_TX_ERR_HB AR_BIT(7) /* hearbeat failure */
1930 +#define DMA_TX_ERR_COL AR_BIT(8) /* excessive collisions */
1931 +#define DMA_TX_ERR_LATE AR_BIT(9) /* late collision */
1932 +#define DMA_TX_ERR_LINK AR_BIT(10) /* no carrier */
1933 +#define DMA_TX_ERR_LOSS AR_BIT(11) /* loss of carrier */
1934 +#define DMA_TX_ERR_JABBER AR_BIT(14) /* transmit jabber timeout */
1935 +#define DMA_TX_ERROR AR_BIT(15) /* frame aborted */
1936 +#define DMA_TX_OWN AR_BIT(31) /* descr owned by DMA controller */
1938 +#define DMA_TX1_BSIZE_MASK 0x000007ff
1939 +#define DMA_TX1_BSIZE_SHIFT 0
1940 +#define DMA_TX1_CHAINED AR_BIT(24) /* chained descriptors */
1941 +#define DMA_TX1_TER AR_BIT(25) /* transmit end of ring */
1942 +#define DMA_TX1_FS AR_BIT(29) /* first segment */
1943 +#define DMA_TX1_LS AR_BIT(30) /* last segment */
1944 +#define DMA_TX1_IC AR_BIT(31) /* interrupt on completion */
1946 +#define RCVPKT_LENGTH(X) (X >> 16) /* Received pkt Length */
1948 +#define MAC_CONTROL_RE AR_BIT(2) /* receive enable */
1949 +#define MAC_CONTROL_TE AR_BIT(3) /* transmit enable */
1950 +#define MAC_CONTROL_DC AR_BIT(5) /* Deferral check*/
1951 +#define MAC_CONTROL_ASTP AR_BIT(8) /* Auto pad strip */
1952 +#define MAC_CONTROL_DRTY AR_BIT(10) /* Disable retry */
1953 +#define MAC_CONTROL_DBF AR_BIT(11) /* Disable bcast frames */
1954 +#define MAC_CONTROL_LCC AR_BIT(12) /* late collision ctrl */
1955 +#define MAC_CONTROL_HP AR_BIT(13) /* Hash Perfect filtering */
1956 +#define MAC_CONTROL_HASH AR_BIT(14) /* Unicast hash filtering */
1957 +#define MAC_CONTROL_HO AR_BIT(15) /* Hash only filtering */
1958 +#define MAC_CONTROL_PB AR_BIT(16) /* Pass Bad frames */
1959 +#define MAC_CONTROL_IF AR_BIT(17) /* Inverse filtering */
1960 +#define MAC_CONTROL_PR AR_BIT(18) /* promiscuous mode (valid frames only) */
1961 +#define MAC_CONTROL_PM AR_BIT(19) /* pass multicast */
1962 +#define MAC_CONTROL_F AR_BIT(20) /* full-duplex */
1963 +#define MAC_CONTROL_DRO AR_BIT(23) /* Disable Receive Own */
1964 +#define MAC_CONTROL_HBD AR_BIT(28) /* heart-beat disabled (MUST BE SET) */
1965 +#define MAC_CONTROL_BLE AR_BIT(30) /* big endian mode */
1966 +#define MAC_CONTROL_RA AR_BIT(31) /* receive all (valid and invalid frames) */
1968 +#define MII_ADDR_BUSY AR_BIT(0)
1969 +#define MII_ADDR_WRITE AR_BIT(1)
1970 +#define MII_ADDR_REG_SHIFT 6
1971 +#define MII_ADDR_PHY_SHIFT 11
1972 +#define MII_DATA_SHIFT 0
1974 +#define FLOW_CONTROL_FCE AR_BIT(1)
1976 +#define DMA_BUS_MODE_SWR AR_BIT(0) /* software reset */
1977 +#define DMA_BUS_MODE_BLE AR_BIT(7) /* big endian mode */
1978 +#define DMA_BUS_MODE_PBL_SHIFT 8 /* programmable burst length 32 */
1979 +#define DMA_BUS_MODE_DBO AR_BIT(20) /* big-endian descriptors */
1981 +#define DMA_STATUS_TI AR_BIT(0) /* transmit interrupt */
1982 +#define DMA_STATUS_TPS AR_BIT(1) /* transmit process stopped */
1983 +#define DMA_STATUS_TU AR_BIT(2) /* transmit buffer unavailable */
1984 +#define DMA_STATUS_TJT AR_BIT(3) /* transmit buffer timeout */
1985 +#define DMA_STATUS_UNF AR_BIT(5) /* transmit underflow */
1986 +#define DMA_STATUS_RI AR_BIT(6) /* receive interrupt */
1987 +#define DMA_STATUS_RU AR_BIT(7) /* receive buffer unavailable */
1988 +#define DMA_STATUS_RPS AR_BIT(8) /* receive process stopped */
1989 +#define DMA_STATUS_ETI AR_BIT(10) /* early transmit interrupt */
1990 +#define DMA_STATUS_FBE AR_BIT(13) /* fatal bus interrupt */
1991 +#define DMA_STATUS_ERI AR_BIT(14) /* early receive interrupt */
1992 +#define DMA_STATUS_AIS AR_BIT(15) /* abnormal interrupt summary */
1993 +#define DMA_STATUS_NIS AR_BIT(16) /* normal interrupt summary */
1994 +#define DMA_STATUS_RS_SHIFT 17 /* receive process state */
1995 +#define DMA_STATUS_TS_SHIFT 20 /* transmit process state */
1996 +#define DMA_STATUS_EB_SHIFT 23 /* error bits */
1998 +#define DMA_CONTROL_SR AR_BIT(1) /* start receive */
1999 +#define DMA_CONTROL_ST AR_BIT(13) /* start transmit */
2000 +#define DMA_CONTROL_SF AR_BIT(21) /* store and forward */
2002 +#endif // __ARUBA_DMA_H__
2008 diff -Nur linux-2.6.17/drivers/net/ar2313/Makefile linux-2.6.17-owrt/drivers/net/ar2313/Makefile
2009 --- linux-2.6.17/drivers/net/ar2313/Makefile 1970-01-01 01:00:00.000000000 +0100
2010 +++ linux-2.6.17-owrt/drivers/net/ar2313/Makefile 2006-06-19 12:25:58.000000000 +0200
2013 +# Makefile for the AR2313 ethernet driver
2016 +obj-$(CONFIG_AR2313) += ar2313.o
2017 diff -Nur linux-2.6.17/drivers/net/ar2313/platform.h linux-2.6.17-owrt/drivers/net/ar2313/platform.h
2018 --- linux-2.6.17/drivers/net/ar2313/platform.h 1970-01-01 01:00:00.000000000 +0100
2019 +++ linux-2.6.17-owrt/drivers/net/ar2313/platform.h 2006-06-19 12:05:29.000000000 +0200
2021 +/********************************************************************************
2022 + Title: $Source: platform.h,v $
2024 + Author: Dan Steinberg
2025 + Copyright Integrated Device Technology 2001
2027 + Purpose: AR2313 Register/Bit Definitions
2030 + $Log: platform.h,v $
2032 + Notes: See Merlot architecture spec for complete details. Note, all
2033 + addresses are virtual addresses in kseg1 (Uncached, Unmapped).
2035 +********************************************************************************/
2040 +#define BIT(x) (1 << (x))
2042 +#define RESET_BASE 0xBC003020
2043 +#define RESET_VALUE 0x00000001
2045 +/********************************************************************
2046 + * Device controller
2047 + ********************************************************************/
2049 + volatile unsigned int flash0;
2052 +#define device (*((volatile DEVICE *) DEV_CTL_BASE))
2055 +#define DEV_WP (1<<26)
2057 +/********************************************************************
2059 + ********************************************************************/
2061 + volatile unsigned int ddrc0;
2062 + volatile unsigned int ddrc1;
2063 + volatile unsigned int ddrrefresh;
2066 +#define ddr (*((volatile DDR *) DDR_BASE))
2069 +#define DDRC_CS(i) ((i&0x3)<<0)
2070 +#define DDRC_WE (1<<2)
2072 +/********************************************************************
2073 + * Ethernet interfaces
2074 + ********************************************************************/
2075 +#define ETHERNET_BASE 0xB8200000
2078 +// New Combo structure for Both Eth0 AND eth1
2081 + volatile unsigned int mac_control; /* 0x00 */
2082 + volatile unsigned int mac_addr[2]; /* 0x04 - 0x08*/
2083 + volatile unsigned int mcast_table[2]; /* 0x0c - 0x10 */
2084 + volatile unsigned int mii_addr; /* 0x14 */
2085 + volatile unsigned int mii_data; /* 0x18 */
2086 + volatile unsigned int flow_control; /* 0x1c */
2087 + volatile unsigned int vlan_tag; /* 0x20 */
2088 + volatile unsigned int pad[7]; /* 0x24 - 0x3c */
2089 + volatile unsigned int ucast_table[8]; /* 0x40-0x5c */
2093 +/********************************************************************
2094 + * Interrupt controller
2095 + ********************************************************************/
2098 + volatile unsigned int wdog_control; /* 0x08 */
2099 + volatile unsigned int wdog_timer; /* 0x0c */
2100 + volatile unsigned int misc_status; /* 0x10 */
2101 + volatile unsigned int misc_mask; /* 0x14 */
2102 + volatile unsigned int global_status; /* 0x18 */
2103 + volatile unsigned int reserved; /* 0x1c */
2104 + volatile unsigned int reset_control; /* 0x20 */
2107 +#define interrupt (*((volatile INTERRUPT *) INTERRUPT_BASE))
2109 +#define INTERRUPT_MISC_TIMER BIT(0)
2110 +#define INTERRUPT_MISC_AHBPROC BIT(1)
2111 +#define INTERRUPT_MISC_AHBDMA BIT(2)
2112 +#define INTERRUPT_MISC_GPIO BIT(3)
2113 +#define INTERRUPT_MISC_UART BIT(4)
2114 +#define INTERRUPT_MISC_UARTDMA BIT(5)
2115 +#define INTERRUPT_MISC_WATCHDOG BIT(6)
2116 +#define INTERRUPT_MISC_LOCAL BIT(7)
2118 +#define INTERRUPT_GLOBAL_ETH BIT(2)
2119 +#define INTERRUPT_GLOBAL_WLAN BIT(3)
2120 +#define INTERRUPT_GLOBAL_MISC BIT(4)
2121 +#define INTERRUPT_GLOBAL_ITIMER BIT(5)
2123 +/********************************************************************
2125 + ********************************************************************/
2126 +#define DMA_BASE 0xB8201000
2129 + volatile unsigned int bus_mode; /* 0x00 (CSR0) */
2130 + volatile unsigned int xmt_poll; /* 0x04 (CSR1) */
2131 + volatile unsigned int rcv_poll; /* 0x08 (CSR2) */
2132 + volatile unsigned int rcv_base; /* 0x0c (CSR3) */
2133 + volatile unsigned int xmt_base; /* 0x10 (CSR4) */
2134 + volatile unsigned int status; /* 0x14 (CSR5) */
2135 + volatile unsigned int control; /* 0x18 (CSR6) */
2136 + volatile unsigned int intr_ena; /* 0x1c (CSR7) */
2137 + volatile unsigned int rcv_missed; /* 0x20 (CSR8) */
2138 + volatile unsigned int reserved[11]; /* 0x24-0x4c (CSR9-19) */
2139 + volatile unsigned int cur_tx_buf_addr; /* 0x50 (CSR20) */
2140 + volatile unsigned int cur_rx_buf_addr; /* 0x50 (CSR21) */
2143 +#define dma (*((volatile DMA *) DMA_BASE))
2145 +// macro to convert from virtual to physical address
2146 +#define phys_addr(x) (x & 0x1fffffff)
2148 +#endif /* PLATFORM_H */
2149 diff -Nur linux-2.6.17/drivers/net/Kconfig linux-2.6.17-owrt/drivers/net/Kconfig
2150 --- linux-2.6.17/drivers/net/Kconfig 2006-06-19 12:05:01.000000000 +0200
2151 +++ linux-2.6.17-owrt/drivers/net/Kconfig 2006-06-19 12:26:35.000000000 +0200
2152 @@ -310,6 +310,12 @@
2154 source "drivers/net/arm/Kconfig"
2157 + tristate "AR2313 Ethernet support"
2158 + depends on NET_ETHERNET && MACH_ARUBA
2160 + Support for the AR2313 Ethernet part on Aruba AP60/61
2162 config IDT_RC32434_ETH
2163 tristate "IDT RC32434 Local Ethernet support"
2164 depends on NET_ETHERNET
2165 diff -Nur linux-2.6.17/drivers/net/Makefile linux-2.6.17-owrt/drivers/net/Makefile
2166 --- linux-2.6.17/drivers/net/Makefile 2006-06-19 12:05:01.000000000 +0200
2167 +++ linux-2.6.17-owrt/drivers/net/Makefile 2006-06-19 12:27:02.000000000 +0200
2169 obj-$(CONFIG_CHELSIO_T1) += chelsio/
2170 obj-$(CONFIG_BONDING) += bonding/
2171 obj-$(CONFIG_GIANFAR) += gianfar_driver.o
2172 +obj-$(CONFIG_AR2313) += ar2313/
2174 gianfar_driver-objs := gianfar.o \