]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/net/pcmcia/axnet_cs.c
Merge branch 'master' into tk71
[mv-sheeva.git] / drivers / net / pcmcia / axnet_cs.c
index 5f05ffb240cc899eb79537ffe8074ceb97d3da11..d3cb772058633cdb98f9c69a64aac18e53912725 100644 (file)
@@ -24,6 +24,8 @@
 
 ======================================================================*/
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/timer.h>
 #include <linux/delay.h>
 #include <linux/spinlock.h>
-#include <linux/ethtool.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/crc32.h>
 #include <linux/mii.h>
 #include "../8390.h"
 
-#include <pcmcia/cs.h>
 #include <pcmcia/cistpl.h>
 #include <pcmcia/ciscode.h>
 #include <pcmcia/ds.h>
@@ -86,7 +86,6 @@ static netdev_tx_t axnet_start_xmit(struct sk_buff *skb,
 static struct net_device_stats *get_stats(struct net_device *dev);
 static void set_multicast_list(struct net_device *dev);
 static void axnet_tx_timeout(struct net_device *dev);
-static const struct ethtool_ops netdev_ethtool_ops;
 static irqreturn_t ei_irq_wrapper(int irq, void *dev_id);
 static void ei_watchdog(u_long arg);
 static void axnet_reset_8390(struct net_device *dev);
@@ -112,13 +111,14 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id);
 
 typedef struct axnet_dev_t {
        struct pcmcia_device    *p_dev;
-    caddr_t            base;
-    struct timer_list  watchdog;
-    int                        stale, fast_poll;
-    u_short            link_status;
-    u_char             duplex_flag;
-    int                        phy_id;
-    int                        flags;
+       caddr_t base;
+       struct timer_list       watchdog;
+       int     stale, fast_poll;
+       u_short link_status;
+       u_char  duplex_flag;
+       int     phy_id;
+       int     flags;
+       int     active_low;
 } axnet_dev_t;
 
 static inline axnet_dev_t *PRIV(struct net_device *dev)
@@ -140,14 +140,6 @@ static const struct net_device_ops axnet_netdev_ops = {
        .ndo_validate_addr      = eth_validate_addr,
 };
 
-/*======================================================================
-
-    axnet_attach() creates an "instance" of the driver, allocating
-    local data structures for one device.  The device is registered
-    with Card Services.
-
-======================================================================*/
-
 static int axnet_probe(struct pcmcia_device *link)
 {
     axnet_dev_t *info;
@@ -166,26 +158,15 @@ static int axnet_probe(struct pcmcia_device *link)
     info = PRIV(dev);
     info->p_dev = link;
     link->priv = dev;
-    link->conf.Attributes = CONF_ENABLE_IRQ;
-    link->conf.IntType = INT_MEMORY_AND_IO;
+    link->config_flags |= CONF_ENABLE_IRQ;
 
     dev->netdev_ops = &axnet_netdev_ops;
 
-    SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
     dev->watchdog_timeo = TX_TIMEOUT;
 
     return axnet_config(link);
 } /* axnet_attach */
 
-/*======================================================================
-
-    This deletes a driver "instance".  The device is de-registered
-    with Card Services.  If it has been released, all local data
-    structures are freed.  Otherwise, the structures will be freed
-    when the device is released.
-
-======================================================================*/
-
 static void axnet_detach(struct pcmcia_device *link)
 {
     struct net_device *dev = link->priv;
@@ -231,7 +212,7 @@ static int get_prom(struct pcmcia_device *link)
     };
 
     /* Not much of a test, but the alternatives are messy */
-    if (link->conf.ConfigBase != 0x03c0)
+    if (link->config_base != 0x03c0)
        return 0;
 
     axnet_reset_8390(dev);
@@ -248,14 +229,6 @@ static int get_prom(struct pcmcia_device *link)
     return 1;
 } /* get_prom */
 
-/*======================================================================
-
-    axnet_config() is scheduled to run after a CARD_INSERTION event
-    is received, to configure the PCMCIA socket, and to make the
-    ethernet device available to the system.
-
-======================================================================*/
-
 static int try_io_port(struct pcmcia_device *link)
 {
     int j, ret;
@@ -286,35 +259,16 @@ static int try_io_port(struct pcmcia_device *link)
     }
 }
 
-static int axnet_configcheck(struct pcmcia_device *p_dev,
-                            cistpl_cftable_entry_t *cfg,
-                            cistpl_cftable_entry_t *dflt,
-                            unsigned int vcc,
-                            void *priv_data)
+static int axnet_configcheck(struct pcmcia_device *p_dev, void *priv_data)
 {
-       int i;
-       cistpl_io_t *io = &cfg->io;
+       if (p_dev->config_index == 0)
+               return -EINVAL;
 
-       if (cfg->index == 0 || cfg->io.nwin == 0)
+       p_dev->config_index = 0x05;
+       if (p_dev->resource[0]->end + p_dev->resource[1]->end < 32)
                return -ENODEV;
 
-       p_dev->conf.ConfigIndex = 0x05;
-       /* For multifunction cards, by convention, we configure the
-          network function with window 0, and serial with window 1 */
-       if (io->nwin > 1) {
-               i = (io->win[1].len > io->win[0].len);
-               p_dev->resource[1]->start = io->win[1-i].base;
-               p_dev->resource[1]->end = io->win[1-i].len;
-       } else {
-               i = p_dev->resource[1]->end = 0;
-       }
-       p_dev->resource[0]->start = io->win[i].base;
-       p_dev->resource[0]->end = io->win[i].len;
-       p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
-       if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32)
-               return try_io_port(p_dev);
-
-       return -ENODEV;
+       return try_io_port(p_dev);
 }
 
 static int axnet_config(struct pcmcia_device *link)
@@ -326,20 +280,19 @@ static int axnet_config(struct pcmcia_device *link)
     dev_dbg(&link->dev, "axnet_config(0x%p)\n", link);
 
     /* don't trust the CIS on this; Linksys got it wrong */
-    link->conf.Present = 0x63;
+    link->config_regs = 0x63;
+    link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
     ret = pcmcia_loop_config(link, axnet_configcheck, NULL);
     if (ret != 0)
        goto failed;
 
     if (!link->irq)
            goto failed;
+
+    if (resource_size(link->resource[1]) == 8)
+       link->config_flags |= CONF_ENABLE_SPKR;
     
-    if (resource_size(link->resource[1]) == 8) {
-       link->conf.Attributes |= CONF_ENABLE_SPKR;
-       link->conf.Status = CCSR_AUDIO_ENA;
-    }
-    
-    ret = pcmcia_request_configuration(link, &link->conf);
+    ret = pcmcia_enable_device(link);
     if (ret)
            goto failed;
 
@@ -347,8 +300,8 @@ static int axnet_config(struct pcmcia_device *link)
     dev->base_addr = link->resource[0]->start;
 
     if (!get_prom(link)) {
-       printk(KERN_NOTICE "axnet_cs: this is not an AX88190 card!\n");
-       printk(KERN_NOTICE "axnet_cs: use pcnet_cs instead.\n");
+       pr_notice("this is not an AX88190 card!\n");
+       pr_notice("use pcnet_cs instead.\n");
        goto failed;
     }
 
@@ -357,10 +310,10 @@ static int axnet_config(struct pcmcia_device *link)
     ei_status.tx_start_page = AXNET_START_PG;
     ei_status.rx_start_page = AXNET_START_PG + TX_PAGES;
     ei_status.stop_page = AXNET_STOP_PG;
-    ei_status.reset_8390 = &axnet_reset_8390;
-    ei_status.get_8390_hdr = &get_8390_hdr;
-    ei_status.block_input = &block_input;
-    ei_status.block_output = &block_output;
+    ei_status.reset_8390 = axnet_reset_8390;
+    ei_status.get_8390_hdr = get_8390_hdr;
+    ei_status.block_input = block_input;
+    ei_status.block_output = block_output;
 
     if (inb(dev->base_addr + AXNET_TEST) != 0)
        info->flags |= IS_AX88790;
@@ -370,6 +323,8 @@ static int axnet_config(struct pcmcia_device *link)
     if (info->flags & IS_AX88790)
        outb(0x10, dev->base_addr + AXNET_GPIO);  /* select Internal PHY */
 
+    info->active_low = 0;
+
     for (i = 0; i < 32; i++) {
        j = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 1);
        j2 = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 2);
@@ -377,15 +332,18 @@ static int axnet_config(struct pcmcia_device *link)
        if ((j != 0) && (j != 0xffff)) break;
     }
 
-    /* Maybe PHY is in power down mode. (PPD_SET = 1) 
-       Bit 2 of CCSR is active low. */ 
     if (i == 32) {
+       /* Maybe PHY is in power down mode. (PPD_SET = 1)
+          Bit 2 of CCSR is active low. */
        pcmcia_write_config_byte(link, CISREG_CCSR, 0x04);
        for (i = 0; i < 32; i++) {
            j = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 1);
            j2 = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 2);
            if (j == j2) continue;
-           if ((j != 0) && (j != 0xffff)) break;
+           if ((j != 0) && (j != 0xffff)) {
+               info->active_low = 1;
+               break;
+           }
        }
     }
 
@@ -393,19 +351,18 @@ static int axnet_config(struct pcmcia_device *link)
     SET_NETDEV_DEV(dev, &link->dev);
 
     if (register_netdev(dev) != 0) {
-       printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n");
+       pr_notice("register_netdev() failed\n");
        goto failed;
     }
 
-    printk(KERN_INFO "%s: Asix AX88%d90: io %#3lx, irq %d, "
-          "hw_addr %pM\n",
-          dev->name, ((info->flags & IS_AX88790) ? 7 : 1),
-          dev->base_addr, dev->irq,
-          dev->dev_addr);
+    netdev_info(dev, "Asix AX88%d90: io %#3lx, irq %d, hw_addr %pM\n",
+               ((info->flags & IS_AX88790) ? 7 : 1),
+               dev->base_addr, dev->irq, dev->dev_addr);
     if (info->phy_id != -1) {
-       dev_dbg(&link->dev, "  MII transceiver at index %d, status %x.\n", info->phy_id, j);
+       netdev_dbg(dev, "  MII transceiver at index %d, status %x\n",
+                  info->phy_id, j);
     } else {
-       printk(KERN_NOTICE "  No MII transceivers found!\n");
+       netdev_notice(dev, "  No MII transceivers found!\n");
     }
     return 0;
 
@@ -414,14 +371,6 @@ failed:
     return -ENODEV;
 } /* axnet_config */
 
-/*======================================================================
-
-    After a card is removed, axnet_release() will unregister the net
-    device, and release the PCMCIA configuration.  If the device is
-    still open, this will be postponed until it is closed.
-
-======================================================================*/
-
 static void axnet_release(struct pcmcia_device *link)
 {
        pcmcia_disable_device(link);
@@ -440,8 +389,12 @@ static int axnet_suspend(struct pcmcia_device *link)
 static int axnet_resume(struct pcmcia_device *link)
 {
        struct net_device *dev = link->priv;
+       axnet_dev_t *info = PRIV(dev);
 
        if (link->open) {
+               if (info->active_low == 1)
+                       pcmcia_write_config_byte(link, CISREG_CCSR, 0x04);
+
                axnet_reset_8390(dev);
                AX88190_init(dev, 1);
                netif_device_attach(dev);
@@ -532,7 +485,7 @@ static int axnet_open(struct net_device *dev)
 
     info->link_status = 0x00;
     init_timer(&info->watchdog);
-    info->watchdog.function = &ei_watchdog;
+    info->watchdog.function = ei_watchdog;
     info->watchdog.data = (u_long)dev;
     info->watchdog.expires = jiffies + HZ;
     add_timer(&info->watchdog);
@@ -585,8 +538,7 @@ static void axnet_reset_8390(struct net_device *dev)
     outb_p(ENISR_RESET, nic_base + EN0_ISR); /* Ack intr. */
     
     if (i == 100)
-       printk(KERN_ERR "%s: axnet_reset_8390() did not complete.\n",
-              dev->name);
+       netdev_err(dev, "axnet_reset_8390() did not complete\n");
     
 } /* axnet_reset_8390 */
 
@@ -613,7 +565,7 @@ static void ei_watchdog(u_long arg)
        this, we can limp along even if the interrupt is blocked */
     if (info->stale++ && (inb_p(nic_base + EN0_ISR) & ENISR_ALL)) {
        if (!info->fast_poll)
-           printk(KERN_INFO "%s: interrupt(s) dropped!\n", dev->name);
+           netdev_info(dev, "interrupt(s) dropped!\n");
        ei_irq_wrapper(dev->irq, dev);
        info->fast_poll = HZ;
     }
@@ -628,7 +580,7 @@ static void ei_watchdog(u_long arg)
        goto reschedule;
     link = mdio_read(mii_addr, info->phy_id, 1);
     if (!link || (link == 0xffff)) {
-       printk(KERN_INFO "%s: MII is missing!\n", dev->name);
+       netdev_info(dev, "MII is missing!\n");
        info->phy_id = -1;
        goto reschedule;
     }
@@ -636,18 +588,14 @@ static void ei_watchdog(u_long arg)
     link &= 0x0004;
     if (link != info->link_status) {
        u_short p = mdio_read(mii_addr, info->phy_id, 5);
-       printk(KERN_INFO "%s: %s link beat\n", dev->name,
-              (link) ? "found" : "lost");
+       netdev_info(dev, "%s link beat\n", link ? "found" : "lost");
        if (link) {
            info->duplex_flag = (p & 0x0140) ? 0x80 : 0x00;
            if (p)
-               printk(KERN_INFO "%s: autonegotiation complete: "
-                      "%sbaseT-%cD selected\n", dev->name,
-                      ((p & 0x0180) ? "100" : "10"),
-                      ((p & 0x0140) ? 'F' : 'H'));
+               netdev_info(dev, "autonegotiation complete: %dbaseT-%cD selected\n",
+                           (p & 0x0180) ? 100 : 10, (p & 0x0140) ? 'F' : 'H');
            else
-               printk(KERN_INFO "%s: link partner did not autonegotiate\n",
-                      dev->name);
+               netdev_info(dev, "link partner did not autonegotiate\n");
            AX88190_init(dev, 1);
        }
        info->link_status = link;
@@ -658,16 +606,6 @@ reschedule:
     add_timer(&info->watchdog);
 }
 
-static void netdev_get_drvinfo(struct net_device *dev,
-                              struct ethtool_drvinfo *info)
-{
-       strcpy(info->driver, "axnet_cs");
-}
-
-static const struct ethtool_ops netdev_ethtool_ops = {
-       .get_drvinfo            = netdev_get_drvinfo,
-};
-
 /*====================================================================*/
 
 static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
@@ -752,6 +690,7 @@ static void block_output(struct net_device *dev, int count,
 static struct pcmcia_device_id axnet_ids[] = {
        PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x016c, 0x0081),
        PCMCIA_DEVICE_MANF_CARD(0x018a, 0x0301),
+       PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x2328),
        PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0301),
        PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0303),
        PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0309),
@@ -783,9 +722,7 @@ MODULE_DEVICE_TABLE(pcmcia, axnet_ids);
 
 static struct pcmcia_driver axnet_cs_driver = {
        .owner          = THIS_MODULE,
-       .drv            = {
-               .name   = "axnet_cs",
-       },
+       .name           = "axnet_cs",
        .probe          = axnet_probe,
        .remove         = axnet_detach,
        .id_table       = axnet_ids,
@@ -855,9 +792,6 @@ module_exit(exit_axnet_cs);
 
   */
 
-static const char version_8390[] = KERN_INFO \
-    "8390.c:v1.10cvs 9/23/94 Donald Becker (becker@scyld.com)\n";
-
 #include <linux/bitops.h>
 #include <asm/irq.h>
 #include <linux/fcntl.h>
@@ -942,7 +876,7 @@ static void do_set_multicast_list(struct net_device *dev);
 static int ax_open(struct net_device *dev)
 {
        unsigned long flags;
-       struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
+       struct ei_device *ei_local = netdev_priv(dev);
 
        /*
         *      Grab the page lock so we own the register set, then call
@@ -993,7 +927,7 @@ static int ax_close(struct net_device *dev)
 static void axnet_tx_timeout(struct net_device *dev)
 {
        long e8390_base = dev->base_addr;
-       struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
+       struct ei_device *ei_local = netdev_priv(dev);
        int txsr, isr, tickssofar = jiffies - dev_trans_start(dev);
        unsigned long flags;
 
@@ -1004,9 +938,11 @@ static void axnet_tx_timeout(struct net_device *dev)
        isr = inb(e8390_base+EN0_ISR);
        spin_unlock_irqrestore(&ei_local->page_lock, flags);
 
-       printk(KERN_DEBUG "%s: Tx timed out, %s TSR=%#2x, ISR=%#2x, t=%d.\n",
-               dev->name, (txsr & ENTSR_ABT) ? "excess collisions." :
-               (isr) ? "lost interrupt?" : "cable problem?", txsr, isr, tickssofar);
+       netdev_printk(KERN_DEBUG, dev,
+                     "Tx timed out, %s TSR=%#2x, ISR=%#2x, t=%d.\n",
+                     (txsr & ENTSR_ABT) ? "excess collisions." :
+                     (isr) ? "lost interrupt?" : "cable problem?",
+                     txsr, isr, tickssofar);
 
        if (!isr && !dev->stats.tx_packets) 
        {
@@ -1038,7 +974,7 @@ static netdev_tx_t axnet_start_xmit(struct sk_buff *skb,
                                          struct net_device *dev)
 {
        long e8390_base = dev->base_addr;
-       struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
+       struct ei_device *ei_local = netdev_priv(dev);
        int length, send_length, output_page;
        unsigned long flags;
        u8 packet[ETH_ZLEN];
@@ -1076,22 +1012,28 @@ static netdev_tx_t axnet_start_xmit(struct sk_buff *skb,
                output_page = ei_local->tx_start_page;
                ei_local->tx1 = send_length;
                if (ei_debug  &&  ei_local->tx2 > 0)
-                       printk(KERN_DEBUG "%s: idle transmitter tx2=%d, lasttx=%d, txing=%d.\n",
-                               dev->name, ei_local->tx2, ei_local->lasttx, ei_local->txing);
+                       netdev_printk(KERN_DEBUG, dev,
+                                     "idle transmitter tx2=%d, lasttx=%d, txing=%d\n",
+                                     ei_local->tx2, ei_local->lasttx,
+                                     ei_local->txing);
        }
        else if (ei_local->tx2 == 0) 
        {
                output_page = ei_local->tx_start_page + TX_PAGES/2;
                ei_local->tx2 = send_length;
                if (ei_debug  &&  ei_local->tx1 > 0)
-                       printk(KERN_DEBUG "%s: idle transmitter, tx1=%d, lasttx=%d, txing=%d.\n",
-                               dev->name, ei_local->tx1, ei_local->lasttx, ei_local->txing);
+                       netdev_printk(KERN_DEBUG, dev,
+                                     "idle transmitter, tx1=%d, lasttx=%d, txing=%d\n",
+                                     ei_local->tx1, ei_local->lasttx,
+                                     ei_local->txing);
        }
        else
        {       /* We should never get here. */
                if (ei_debug)
-                       printk(KERN_DEBUG "%s: No Tx buffers free! tx1=%d tx2=%d last=%d\n",
-                               dev->name, ei_local->tx1, ei_local->tx2, ei_local->lasttx);
+                       netdev_printk(KERN_DEBUG, dev,
+                                     "No Tx buffers free! tx1=%d tx2=%d last=%d\n",
+                                     ei_local->tx1, ei_local->tx2,
+                                     ei_local->lasttx);
                ei_local->irqlock = 0;
                netif_stop_queue(dev);
                outb_p(ENISR_ALL, e8390_base + EN0_IMR);
@@ -1179,23 +1121,26 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id)
         
        spin_lock_irqsave(&ei_local->page_lock, flags);
 
-       if (ei_local->irqlock) 
-       {
+       if (ei_local->irqlock) {
 #if 1 /* This might just be an interrupt for a PCI device sharing this line */
+               const char *msg;
                /* The "irqlock" check is only for testing. */
-               printk(ei_local->irqlock
-                          ? "%s: Interrupted while interrupts are masked! isr=%#2x imr=%#2x.\n"
-                          : "%s: Reentering the interrupt handler! isr=%#2x imr=%#2x.\n",
-                          dev->name, inb_p(e8390_base + EN0_ISR),
-                          inb_p(e8390_base + EN0_IMR));
+               if (ei_local->irqlock)
+                       msg = "Interrupted while interrupts are masked!";
+               else
+                       msg = "Reentering the interrupt handler!";
+               netdev_info(dev, "%s, isr=%#2x imr=%#2x\n",
+                           msg,
+                           inb_p(e8390_base + EN0_ISR),
+                           inb_p(e8390_base + EN0_IMR));
 #endif
                spin_unlock_irqrestore(&ei_local->page_lock, flags);
                return IRQ_NONE;
        }
     
        if (ei_debug > 3)
-               printk(KERN_DEBUG "%s: interrupt(isr=%#2.2x).\n", dev->name,
-                          inb_p(e8390_base + EN0_ISR));
+               netdev_printk(KERN_DEBUG, dev, "interrupt(isr=%#2.2x)\n",
+                             inb_p(e8390_base + EN0_ISR));
 
        outb_p(0x00, e8390_base + EN0_ISR);
        ei_local->irqlock = 1;
@@ -1206,7 +1151,8 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id)
        {
                if (!netif_running(dev) || (interrupts == 0xff)) {
                        if (ei_debug > 1)
-                               printk(KERN_WARNING "%s: interrupt from stopped card\n", dev->name);
+                               netdev_warn(dev,
+                                           "interrupt from stopped card\n");
                        outb_p(interrupts, e8390_base + EN0_ISR);
                        interrupts = 0;
                        break;
@@ -1249,11 +1195,12 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id)
                {
                        /* 0xFF is valid for a card removal */
                        if(interrupts!=0xFF)
-                               printk(KERN_WARNING "%s: Too much work at interrupt, status %#2.2x\n",
-                                  dev->name, interrupts);
+                               netdev_warn(dev, "Too much work at interrupt, status %#2.2x\n",
+                                           interrupts);
                        outb_p(ENISR_ALL, e8390_base + EN0_ISR); /* Ack. most intrs. */
                } else {
-                       printk(KERN_WARNING "%s: unknown interrupt %#2x\n", dev->name, interrupts);
+                       netdev_warn(dev, "unknown interrupt %#2x\n",
+                                   interrupts);
                        outb_p(0xff, e8390_base + EN0_ISR); /* Ack. all intrs. */
                }
        }
@@ -1287,18 +1234,19 @@ static void ei_tx_err(struct net_device *dev)
        unsigned char tx_was_aborted = txsr & (ENTSR_ABT+ENTSR_FU);
 
 #ifdef VERBOSE_ERROR_DUMP
-       printk(KERN_DEBUG "%s: transmitter error (%#2x): ", dev->name, txsr);
+       netdev_printk(KERN_DEBUG, dev,
+                     "transmitter error (%#2x):", txsr);
        if (txsr & ENTSR_ABT)
-               printk("excess-collisions ");
+               pr_cont(" excess-collisions");
        if (txsr & ENTSR_ND)
-               printk("non-deferral ");
+               pr_cont(" non-deferral");
        if (txsr & ENTSR_CRS)
-               printk("lost-carrier ");
+               pr_cont(" lost-carrier");
        if (txsr & ENTSR_FU)
-               printk("FIFO-underrun ");
+               pr_cont(" FIFO-underrun");
        if (txsr & ENTSR_CDH)
-               printk("lost-heartbeat ");
-       printk("\n");
+               pr_cont(" lost-heartbeat");
+       pr_cont("\n");
 #endif
 
        if (tx_was_aborted)
@@ -1323,7 +1271,7 @@ static void ei_tx_err(struct net_device *dev)
 static void ei_tx_intr(struct net_device *dev)
 {
        long e8390_base = dev->base_addr;
-       struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
+       struct ei_device *ei_local = netdev_priv(dev);
        int status = inb(e8390_base + EN0_TSR);
     
        /*
@@ -1335,8 +1283,9 @@ static void ei_tx_intr(struct net_device *dev)
        if (ei_local->tx1 < 0) 
        {
                if (ei_local->lasttx != 1 && ei_local->lasttx != -1)
-                       printk(KERN_ERR "%s: bogus last_tx_buffer %d, tx1=%d.\n",
-                               ei_local->name, ei_local->lasttx, ei_local->tx1);
+                       netdev_err(dev, "%s: bogus last_tx_buffer %d, tx1=%d\n",
+                                  ei_local->name, ei_local->lasttx,
+                                  ei_local->tx1);
                ei_local->tx1 = 0;
                if (ei_local->tx2 > 0) 
                {
@@ -1351,8 +1300,9 @@ static void ei_tx_intr(struct net_device *dev)
        else if (ei_local->tx2 < 0) 
        {
                if (ei_local->lasttx != 2  &&  ei_local->lasttx != -2)
-                       printk("%s: bogus last_tx_buffer %d, tx2=%d.\n",
-                               ei_local->name, ei_local->lasttx, ei_local->tx2);
+                       netdev_info(dev, "%s: bogus last_tx_buffer %d, tx2=%d\n",
+                                   ei_local->name, ei_local->lasttx,
+                                   ei_local->tx2);
                ei_local->tx2 = 0;
                if (ei_local->tx1 > 0) 
                {
@@ -1365,8 +1315,9 @@ static void ei_tx_intr(struct net_device *dev)
                else
                        ei_local->lasttx = 10, ei_local->txing = 0;
        }
-//     else printk(KERN_WARNING "%s: unexpected TX-done interrupt, lasttx=%d.\n",
-//                     dev->name, ei_local->lasttx);
+//     else
+//             netdev_warn(dev, "unexpected TX-done interrupt, lasttx=%d\n",
+//                         ei_local->lasttx);
 
        /* Minimize Tx latency: update the statistics after we restart TXing. */
        if (status & ENTSR_COL)
@@ -1404,7 +1355,7 @@ static void ei_tx_intr(struct net_device *dev)
 static void ei_receive(struct net_device *dev)
 {
        long e8390_base = dev->base_addr;
-       struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
+       struct ei_device *ei_local = netdev_priv(dev);
        unsigned char rxing_page, this_frame, next_frame;
        unsigned short current_offset;
        int rx_pkt_count = 0;
@@ -1429,8 +1380,8 @@ static void ei_receive(struct net_device *dev)
                   is that some clones crash in roughly the same way.
                 */
                if (ei_debug > 0  &&  this_frame != ei_local->current_page && (this_frame!=0x0 || rxing_page!=0xFF))
-                       printk(KERN_ERR "%s: mismatched read page pointers %2x vs %2x.\n",
-                                  dev->name, this_frame, ei_local->current_page);
+                   netdev_err(dev, "mismatched read page pointers %2x vs %2x\n",
+                              this_frame, ei_local->current_page);
                
                if (this_frame == rxing_page)   /* Read all the frames? */
                        break;                          /* Done for now */
@@ -1446,9 +1397,10 @@ static void ei_receive(struct net_device *dev)
                if (pkt_len < 60  ||  pkt_len > 1518) 
                {
                        if (ei_debug)
-                               printk(KERN_DEBUG "%s: bogus packet size: %d, status=%#2x nxpg=%#2x.\n",
-                                          dev->name, rx_frame.count, rx_frame.status,
-                                          rx_frame.next);
+                               netdev_printk(KERN_DEBUG, dev,
+                                             "bogus packet size: %d, status=%#2x nxpg=%#2x\n",
+                                             rx_frame.count, rx_frame.status,
+                                             rx_frame.next);
                        dev->stats.rx_errors++;
                        dev->stats.rx_length_errors++;
                }
@@ -1460,8 +1412,9 @@ static void ei_receive(struct net_device *dev)
                        if (skb == NULL) 
                        {
                                if (ei_debug > 1)
-                                       printk(KERN_DEBUG "%s: Couldn't allocate a sk_buff of size %d.\n",
-                                                  dev->name, pkt_len);
+                                       netdev_printk(KERN_DEBUG, dev,
+                                                     "Couldn't allocate a sk_buff of size %d\n",
+                                                     pkt_len);
                                dev->stats.rx_dropped++;
                                break;
                        }
@@ -1481,9 +1434,10 @@ static void ei_receive(struct net_device *dev)
                else 
                {
                        if (ei_debug)
-                               printk(KERN_DEBUG "%s: bogus packet: status=%#2x nxpg=%#2x size=%d\n",
-                                          dev->name, rx_frame.status, rx_frame.next,
-                                          rx_frame.count);
+                               netdev_printk(KERN_DEBUG, dev,
+                                             "bogus packet: status=%#2x nxpg=%#2x size=%d\n",
+                                             rx_frame.status, rx_frame.next,
+                                             rx_frame.count);
                        dev->stats.rx_errors++;
                        /* NB: The NIC counts CRC, frame and missed errors. */
                        if (pkt_stat & ENRSR_FO)
@@ -1493,8 +1447,8 @@ static void ei_receive(struct net_device *dev)
                
                /* This _should_ never happen: it's here for avoiding bad clones. */
                if (next_frame >= ei_local->stop_page) {
-                       printk("%s: next frame inconsistency, %#2x\n", dev->name,
-                                  next_frame);
+                       netdev_info(dev, "next frame inconsistency, %#2x\n",
+                                   next_frame);
                        next_frame = ei_local->rx_start_page;
                }
                ei_local->current_page = next_frame;
@@ -1529,17 +1483,15 @@ static void ei_rx_overrun(struct net_device *dev)
        outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, e8390_base+E8390_CMD);
     
        if (ei_debug > 1)
-               printk(KERN_DEBUG "%s: Receiver overrun.\n", dev->name);
+               netdev_printk(KERN_DEBUG, dev, "Receiver overrun\n");
        dev->stats.rx_over_errors++;
     
        /* 
         * Wait a full Tx time (1.2ms) + some guard time, NS says 1.6ms total.
-        * Early datasheets said to poll the reset bit, but now they say that
-        * it "is not a reliable indicator and subsequently should be ignored."
-        * We wait at least 10ms.
+        * We wait at least 2ms.
         */
 
-       mdelay(10);
+       mdelay(2);
 
        /*
         * Reset RBCR[01] back to zero as per magic incantation.
@@ -1586,7 +1538,7 @@ static void ei_rx_overrun(struct net_device *dev)
 static struct net_device_stats *get_stats(struct net_device *dev)
 {
        long ioaddr = dev->base_addr;
-       struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
+       struct ei_device *ei_local = netdev_priv(dev);
        unsigned long flags;
     
        /* If the card is stopped, just return the present stats. */
@@ -1635,7 +1587,7 @@ static void do_set_multicast_list(struct net_device *dev)
 {
        long e8390_base = dev->base_addr;
        int i;
-       struct ei_device *ei_local = (struct ei_device*)netdev_priv(dev);
+       struct ei_device *ei_local = netdev_priv(dev);
 
        if (!(dev->flags&(IFF_PROMISC|IFF_ALLMULTI))) {
                memset(ei_local->mcfilter, 0, 8);
@@ -1693,7 +1645,7 @@ static void AX88190_init(struct net_device *dev, int startp)
 {
        axnet_dev_t *info = PRIV(dev);
        long e8390_base = dev->base_addr;
-       struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
+       struct ei_device *ei_local = netdev_priv(dev);
        int i;
        int endcfg = ei_local->word16 ? (0x48 | ENDCFG_WTS) : 0x48;
     
@@ -1726,7 +1678,7 @@ static void AX88190_init(struct net_device *dev, int startp)
        {
                outb_p(dev->dev_addr[i], e8390_base + EN1_PHYS_SHIFT(i));
                if(inb_p(e8390_base + EN1_PHYS_SHIFT(i))!=dev->dev_addr[i])
-                       printk(KERN_ERR "Hw. address read/write mismap %d\n",i);
+                       netdev_err(dev, "Hw. address read/write mismap %d\n", i);
        }
 
        outb_p(ei_local->rx_start_page, e8390_base + EN1_CURPAG);
@@ -1759,12 +1711,11 @@ static void NS8390_trigger_send(struct net_device *dev, unsigned int length,
                                                                int start_page)
 {
        long e8390_base = dev->base_addr;
-       struct ei_device *ei_local __attribute((unused)) = (struct ei_device *) netdev_priv(dev);
+       struct ei_device *ei_local __attribute((unused)) = netdev_priv(dev);
     
        if (inb_p(e8390_base) & E8390_TRANS) 
        {
-               printk(KERN_WARNING "%s: trigger_send() called with the transmitter busy.\n",
-                       dev->name);
+               netdev_warn(dev, "trigger_send() called with the transmitter busy\n");
                return;
        }
        outb_p(length & 0xff, e8390_base + EN0_TCNTLO);