dm9000 trivial annotation
[sfrench/cifs-2.6.git] / drivers / net / au1000_eth.c
index e86b3691765b7721eff0947e91d92d5d396c1c57..504b7ce2747de0c6cf91f6ab945608dd11dcfd76 100644 (file)
 #include <linux/delay.h>
 #include <linux/crc32.h>
 #include <linux/phy.h>
+
+#include <asm/cpu.h>
 #include <asm/mipsregs.h>
 #include <asm/irq.h>
 #include <asm/io.h>
 #include <asm/processor.h>
 
-#include <asm/mach-au1x00/au1000.h>
-#include <asm/cpu.h>
+#include <au1000.h>
+#include <prom.h>
+
 #include "au1000_eth.h"
 
 #ifdef AU1000_ETH_DEBUG
@@ -90,18 +93,12 @@ static int au1000_rx(struct net_device *);
 static irqreturn_t au1000_interrupt(int, void *);
 static void au1000_tx_timeout(struct net_device *);
 static void set_rx_mode(struct net_device *);
-static struct net_device_stats *au1000_get_stats(struct net_device *);
 static int au1000_ioctl(struct net_device *, struct ifreq *, int);
 static int mdio_read(struct net_device *, int, int);
 static void mdio_write(struct net_device *, int, int, u16);
 static void au1000_adjust_link(struct net_device *);
 static void enable_mac(struct net_device *, int);
 
-// externs
-extern int get_ethernet_addr(char *ethernet_addr);
-extern void str2eaddr(unsigned char *ea, unsigned char *str);
-extern char * prom_getcmdline(void);
-
 /*
  * Theory of operation
  *
@@ -545,7 +542,7 @@ static struct {
 static int num_ifs;
 
 /*
- * Setup the base address and interupt of the Au1xxx ethernet macs
+ * Setup the base address and interrupt of the Au1xxx ethernet macs
  * based on cpu type and whether the interface is enabled in sys_pinfunc
  * register. The last interface is enabled if SYS_PF_NI2 (bit 4) is 0.
  */
@@ -620,7 +617,6 @@ static struct net_device * au1000_probe(int port_num)
        struct au1000_private *aup = NULL;
        struct net_device *dev = NULL;
        db_dest_t *pDB, *pDBfree;
-       char *pmac, *argptr;
        char ethaddr[6];
        int irq, i, err;
        u32 base, macen;
@@ -678,21 +674,12 @@ static struct net_device * au1000_probe(int port_num)
        au_macs[port_num] = aup;
 
        if (port_num == 0) {
-               /* Check the environment variables first */
-               if (get_ethernet_addr(ethaddr) == 0)
+               if (prom_get_ethernet_addr(ethaddr) == 0)
                        memcpy(au1000_mac_addr, ethaddr, sizeof(au1000_mac_addr));
                else {
-                       /* Check command line */
-                       argptr = prom_getcmdline();
-                       if ((pmac = strstr(argptr, "ethaddr=")) == NULL)
-                               printk(KERN_INFO "%s: No MAC address found\n",
-                                                dev->name);
+                       printk(KERN_INFO "%s: No MAC address found\n",
+                                        dev->name);
                                /* Use the hard coded MAC addresses */
-                       else {
-                               str2eaddr(ethaddr, pmac + strlen("ethaddr="));
-                               memcpy(au1000_mac_addr, ethaddr,
-                                      sizeof(au1000_mac_addr));
-                       }
                }
 
                setup_hw_rings(aup, MAC0_RX_DMA_ADDR, MAC0_TX_DMA_ADDR);
@@ -772,7 +759,6 @@ static struct net_device * au1000_probe(int port_num)
        dev->open = au1000_open;
        dev->hard_start_xmit = au1000_tx;
        dev->stop = au1000_close;
-       dev->get_stats = au1000_get_stats;
        dev->set_multicast_list = &set_rx_mode;
        dev->do_ioctl = &au1000_ioctl;
        SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops);
@@ -1038,7 +1024,7 @@ static void __exit au1000_cleanup_module(void)
 static void update_tx_stats(struct net_device *dev, u32 status)
 {
        struct au1000_private *aup = (struct au1000_private *) dev->priv;
-       struct net_device_stats *ps = &aup->stats;
+       struct net_device_stats *ps = &dev->stats;
 
        if (status & TX_FRAME_ABORTED) {
                if (!aup->phy_dev || (DUPLEX_FULL == aup->phy_dev->duplex)) {
@@ -1094,7 +1080,7 @@ static void au1000_tx_ack(struct net_device *dev)
 static int au1000_tx(struct sk_buff *skb, struct net_device *dev)
 {
        struct au1000_private *aup = (struct au1000_private *) dev->priv;
-       struct net_device_stats *ps = &aup->stats;
+       struct net_device_stats *ps = &dev->stats;
        volatile tx_dma_t *ptxd;
        u32 buff_stat;
        db_dest_t *pDB;
@@ -1148,7 +1134,7 @@ static int au1000_tx(struct sk_buff *skb, struct net_device *dev)
 static inline void update_rx_stats(struct net_device *dev, u32 status)
 {
        struct au1000_private *aup = (struct au1000_private *) dev->priv;
-       struct net_device_stats *ps = &aup->stats;
+       struct net_device_stats *ps = &dev->stats;
 
        ps->rx_packets++;
        if (status & RX_MCAST_FRAME)
@@ -1201,7 +1187,7 @@ static int au1000_rx(struct net_device *dev)
                                printk(KERN_ERR
                                       "%s: Memory squeeze, dropping packet.\n",
                                       dev->name);
-                               aup->stats.rx_dropped++;
+                               dev->stats.rx_dropped++;
                                continue;
                        }
                        skb_reserve(skb, 2);    /* 16 byte IP header align */
@@ -1324,18 +1310,5 @@ static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
        return phy_mii_ioctl(aup->phy_dev, if_mii(rq), cmd);
 }
 
-static struct net_device_stats *au1000_get_stats(struct net_device *dev)
-{
-       struct au1000_private *aup = (struct au1000_private *) dev->priv;
-
-       if (au1000_debug > 4)
-               printk("%s: au1000_get_stats: dev=%p\n", dev->name, dev);
-
-       if (netif_device_present(dev)) {
-               return &aup->stats;
-       }
-       return 0;
-}
-
 module_init(au1000_init_module);
 module_exit(au1000_cleanup_module);