fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / net / arm / etherh.c
index 6a93b66..f3faa4f 100644 (file)
 #include <linux/device.h>
 #include <linux/init.h>
 #include <linux/bitops.h>
+#include <linux/jiffies.h>
 
 #include <asm/system.h>
 #include <asm/ecard.h>
 #include <asm/io.h>
 
-#include "../8390.h"
+#define EI_SHIFT(x)    (ei_local->reg_offset[x])
+
+#define ei_inb(_p)      readb((void __iomem *)_p)
+#define ei_outb(_v,_p)  writeb(_v,(void __iomem *)_p)
+#define ei_inb_p(_p)    readb((void __iomem *)_p)
+#define ei_outb_p(_v,_p) writeb(_v,(void __iomem *)_p)
 
 #define NET_DEBUG  0
 #define DEBUG_INIT 2
 #define DRV_NAME       "etherh"
 #define DRV_VERSION    "1.11"
 
+static char version[] __initdata =
+       "EtherH/EtherM Driver (c) 2002-2004 Russell King " DRV_VERSION "\n";
+
+#include "../lib8390.c"
+
 static unsigned int net_debug = NET_DEBUG;
 
 struct etherh_priv {
@@ -86,9 +97,6 @@ MODULE_AUTHOR("Russell King");
 MODULE_DESCRIPTION("EtherH/EtherM driver");
 MODULE_LICENSE("GPL");
 
-static char version[] __initdata =
-       "EtherH/EtherM Driver (c) 2002-2004 Russell King " DRV_VERSION "\n";
-
 #define ETHERH500_DATAPORT     0x800   /* MEMC */
 #define ETHERH500_NS8390       0x000   /* MEMC */
 #define ETHERH500_CTRLPORT     0x800   /* IOC  */
@@ -176,7 +184,7 @@ etherh_setif(struct net_device *dev)
        switch (etherh_priv(dev)->id) {
        case PROD_I3_ETHERLAN600:
        case PROD_I3_ETHERLAN600A:
-               addr = (void *)dev->base_addr + EN0_RCNTHI;
+               addr = (void __iomem *)dev->base_addr + EN0_RCNTHI;
 
                switch (dev->if_port) {
                case IF_PORT_10BASE2:
@@ -217,7 +225,7 @@ etherh_getifstat(struct net_device *dev)
        switch (etherh_priv(dev)->id) {
        case PROD_I3_ETHERLAN600:
        case PROD_I3_ETHERLAN600A:
-               addr = (void *)dev->base_addr + EN0_RCNTHI;
+               addr = (void __iomem *)dev->base_addr + EN0_RCNTHI;
                switch (dev->if_port) {
                case IF_PORT_10BASE2:
                        stat = 1;
@@ -280,7 +288,7 @@ static void
 etherh_reset(struct net_device *dev)
 {
        struct ei_device *ei_local = netdev_priv(dev);
-       void __iomem *addr = (void *)dev->base_addr;
+       void __iomem *addr = (void __iomem *)dev->base_addr;
 
        writeb(E8390_NODMA+E8390_PAGE0+E8390_STOP, addr);
 
@@ -326,7 +334,7 @@ etherh_block_output (struct net_device *dev, int count, const unsigned char *buf
 
        ei_local->dmaing = 1;
 
-       addr = (void *)dev->base_addr;
+       addr = (void __iomem *)dev->base_addr;
        dma_base = etherh_priv(dev)->dma_base;
 
        count = (count + 1) & ~1;
@@ -355,11 +363,11 @@ etherh_block_output (struct net_device *dev, int count, const unsigned char *buf
        dma_start = jiffies;
 
        while ((readb (addr + EN0_ISR) & ENISR_RDC) == 0)
-               if (jiffies - dma_start > 2*HZ/100) { /* 20ms */
+               if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */
                        printk(KERN_ERR "%s: timeout waiting for TX RDC\n",
                                dev->name);
                        etherh_reset (dev);
-                       NS8390_init (dev, 1);
+                       __NS8390_init (dev, 1);
                        break;
                }
 
@@ -386,7 +394,7 @@ etherh_block_input (struct net_device *dev, int count, struct sk_buff *skb, int
 
        ei_local->dmaing = 1;
 
-       addr = (void *)dev->base_addr;
+       addr = (void __iomem *)dev->base_addr;
        dma_base = etherh_priv(dev)->dma_base;
 
        buf = skb->data;
@@ -426,7 +434,7 @@ etherh_get_header (struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_p
 
        ei_local->dmaing = 1;
 
-       addr = (void *)dev->base_addr;
+       addr = (void __iomem *)dev->base_addr;
        dma_base = etherh_priv(dev)->dma_base;
 
        writeb (E8390_NODMA | E8390_PAGE0 | E8390_START, addr + E8390_CMD);
@@ -464,7 +472,7 @@ etherh_open(struct net_device *dev)
                return -EINVAL;
        }
 
-       if (request_irq(dev->irq, ei_interrupt, 0, dev->name, dev))
+       if (request_irq(dev->irq, __ei_interrupt, 0, dev->name, dev))
                return -EAGAIN;
 
        /*
@@ -490,7 +498,7 @@ etherh_open(struct net_device *dev)
                etherh_setif(dev);
 
        etherh_reset(dev);
-       ei_open(dev);
+       __ei_open(dev);
 
        return 0;
 }
@@ -501,7 +509,7 @@ etherh_open(struct net_device *dev)
 static int
 etherh_close(struct net_device *dev)
 {
-       ei_close (dev);
+       __ei_close (dev);
        free_irq (dev->irq, dev);
        return 0;
 }
@@ -625,7 +633,7 @@ static int etherh_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
        return 0;
 }
 
-static struct ethtool_ops etherh_ethtool_ops = {
+static const struct ethtool_ops etherh_ethtool_ops = {
        .get_settings   = etherh_get_settings,
        .set_settings   = etherh_set_settings,
        .get_drvinfo    = etherh_get_drvinfo,
@@ -649,7 +657,7 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
        if (ret)
                goto out;
 
-       dev = __alloc_ei_netdev(sizeof(struct etherh_priv));
+       dev = ____alloc_ei_netdev(sizeof(struct etherh_priv));
        if (!dev) {
                ret = -ENOMEM;
                goto release;
@@ -735,7 +743,7 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
        ei_local->interface_num = 0;
 
        etherh_reset(dev);
-       NS8390_init(dev, 0);
+       __NS8390_init(dev, 0);
 
        ret = register_netdev(dev);
        if (ret)