+obj-$(CONFIG_NET_AR231X) += ar231x.o
--- /dev/null
+++ b/drivers/net/ethernet/atheros/ar231x/ar231x.c
-@@ -0,0 +1,1250 @@
+@@ -0,0 +1,1218 @@
+/*
+ * ar231x.c: Linux driver for the Atheros AR231x Ethernet device.
+ *
+ */
+
+#include <linux/module.h>
-+#include <linux/version.h>
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/ioport.h>
-+#include <linux/pci.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/interrupt.h>
-+#include <linux/hardirq.h>
+#include <linux/skbuff.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/mm.h>
-+#include <linux/highmem.h>
-+#include <linux/sockios.h>
-+#include <linux/pkt_sched.h>
+#include <linux/mii.h>
+#include <linux/phy.h>
-+#include <linux/ethtool.h>
-+#include <linux/ctype.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
-+#include <linux/uaccess.h>
-+
-+#include <net/sock.h>
-+#include <net/ip.h>
+
+#define AR2313_MTU 1692
+#define AR2313_PRIOS 1
+#define AR2313_QUEUES (2*AR2313_PRIOS)
+#define AR2313_DESCR_ENTRIES 64
+
-+
+#ifndef min
+#define min(a, b) (((a) < (b)) ? (a) : (b))
+#endif
+{
+ struct net_device *dev = platform_get_drvdata(pdev);
+ struct ar231x_private *sp = netdev_priv(dev);
++
+ rx_tasklet_cleanup(dev);
+ ar231x_init_cleanup(dev);
+ unregister_netdev(dev);
+static void ar231x_free_descriptors(struct net_device *dev)
+{
+ struct ar231x_private *sp = netdev_priv(dev);
++
+ if (sp->rx_ring != NULL) {
+ kfree((void *)KSEG0ADDR(sp->rx_ring));
+ sp->rx_ring = NULL;
+ /* Initialize the transmit Descriptors */
+ for (j = 0; j < AR2313_DESCR_ENTRIES; j++) {
+ ar231x_descr_t *td = &sp->tx_ring[j];
++
+ td->status = 0;
+ td->devcs = DMA_TX1_CHAINED;
+ td->addr = 0;
+
+ if (i)
+ sp->rx_skbprd = idx;
-+
-+ return;
+}
+
+#define AR2313_MAX_PKTS_PER_CALL 64
+ }
+
+ sp->tx_csm = idx;
-+
-+ return;
+}
+
+
+ tasklet_hi_schedule(&sp->rx_tasklet);
+ } else {
+ unsigned long flags;
++
+ spin_lock_irqsave(&sp->lock, flags);
+ sp->dma_regs->intr_ena |= DMA_STATUS_RI;
+ spin_unlock_irqrestore(&sp->lock, flags);
+static int ar231x_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+{
+ struct ar231x_private *sp = netdev_priv(dev);
-+ int ret;
+
+ switch (cmd) {
-+ case SIOCETHTOOL:
-+ spin_lock_irq(&sp->lock);
-+ ret = phy_ethtool_ioctl(sp->phy_dev, (void *)ifr->ifr_data);
-+ spin_unlock_irq(&sp->lock);
-+ return ret;
-+
-+ case SIOCSIFHWADDR:
-+ if (copy_from_user
-+ (dev->dev_addr, ifr->ifr_data, sizeof(dev->dev_addr)))
-+ return -EFAULT;
-+ return 0;
-+
-+ case SIOCGIFHWADDR:
-+ if (copy_to_user
-+ (ifr->ifr_data, dev->dev_addr, sizeof(dev->dev_addr)))
-+ return -EFAULT;
-+ return 0;
-+
+ case SIOCGMIIPHY:
+ case SIOCGMIIREG:
+ case SIOCSMIIREG: