ath9k_hw: move the RF claim stuff to AR9002 hardware family
[safe/jmp/linux-2.6] / drivers / net / tulip / timer.c
index f75bc5e..36c2725 100644 (file)
@@ -1,7 +1,6 @@
 /*
        drivers/net/tulip/timer.c
 
-       Maintained by Valerie Henson <val_henson@linux.intel.com>
        Copyright 2000,2001  The Linux Kernel Team
        Written/copyright 1994-2001 by Donald Becker.
 
@@ -9,29 +8,31 @@
        of the GNU General Public License, incorporated herein by reference.
 
        Please refer to Documentation/DocBook/tulip-user.{pdf,ps,html}
-       for more information on this driver, or visit the project
-       Web page at http://sourceforge.net/projects/tulip/
+       for more information on this driver.
 
+       Please submit bugs to http://bugzilla.kernel.org/ .
 */
 
-#include <linux/pci.h>
+
 #include "tulip.h"
 
 
-void tulip_timer(unsigned long data)
+void tulip_media_task(struct work_struct *work)
 {
-       struct net_device *dev = (struct net_device *)data;
-       struct tulip_private *tp = netdev_priv(dev);
+       struct tulip_private *tp =
+               container_of(work, struct tulip_private, media_work);
+       struct net_device *dev = tp->dev;
        void __iomem *ioaddr = tp->base_addr;
        u32 csr12 = ioread32(ioaddr + CSR12);
        int next_tick = 2*HZ;
+       unsigned long flags;
 
        if (tulip_debug > 2) {
-               printk(KERN_DEBUG "%s: Media selection tick, %s, status %8.8x mode"
-                          " %8.8x SIA %8.8x %8.8x %8.8x %8.8x.\n",
-                          dev->name, medianame[dev->if_port], ioread32(ioaddr + CSR5),
-                          ioread32(ioaddr + CSR6), csr12, ioread32(ioaddr + CSR13),
-                          ioread32(ioaddr + CSR14), ioread32(ioaddr + CSR15));
+               printk(KERN_DEBUG "%s: Media selection tick, %s, status %08x mode %08x SIA %08x %08x %08x %08x\n",
+                      dev->name, medianame[dev->if_port],
+                      ioread32(ioaddr + CSR5), ioread32(ioaddr + CSR6),
+                      csr12, ioread32(ioaddr + CSR13),
+                      ioread32(ioaddr + CSR14), ioread32(ioaddr + CSR15));
        }
        switch (tp->chip_id) {
        case DC21140:
@@ -47,9 +48,9 @@ void tulip_timer(unsigned long data)
                           Assume this a generic MII or SYM transceiver. */
                        next_tick = 60*HZ;
                        if (tulip_debug > 2)
-                               printk(KERN_DEBUG "%s: network media monitor CSR6 %8.8x "
-                                          "CSR12 0x%2.2x.\n",
-                                          dev->name, ioread32(ioaddr + CSR6), csr12 & 0xff);
+                               printk(KERN_DEBUG "%s: network media monitor CSR6 %08x CSR12 0x%02x\n",
+                                      dev->name,
+                                      ioread32(ioaddr + CSR6), csr12 & 0xff);
                        break;
                }
                mleaf = &tp->mtable->mleaf[tp->cur_index];
@@ -61,9 +62,8 @@ void tulip_timer(unsigned long data)
                        s8 bitnum = p[offset];
                        if (p[offset+1] & 0x80) {
                                if (tulip_debug > 1)
-                                       printk(KERN_DEBUG"%s: Transceiver monitor tick "
-                                                  "CSR12=%#2.2x, no media sense.\n",
-                                                  dev->name, csr12);
+                                       printk(KERN_DEBUG "%s: Transceiver monitor tick CSR12=%#02x, no media sense\n",
+                                              dev->name, csr12);
                                if (mleaf->type == 4) {
                                        if (mleaf->media == 3 && (csr12 & 0x02))
                                                goto select_next_media;
@@ -71,16 +71,16 @@ void tulip_timer(unsigned long data)
                                break;
                        }
                        if (tulip_debug > 2)
-                               printk(KERN_DEBUG "%s: Transceiver monitor tick: CSR12=%#2.2x"
-                                          " bit %d is %d, expecting %d.\n",
-                                          dev->name, csr12, (bitnum >> 1) & 7,
-                                          (csr12 & (1 << ((bitnum >> 1) & 7))) != 0,
-                                          (bitnum >= 0));
+                               printk(KERN_DEBUG "%s: Transceiver monitor tick: CSR12=%#02x bit %d is %d, expecting %d\n",
+                                      dev->name, csr12, (bitnum >> 1) & 7,
+                                      (csr12 & (1 << ((bitnum >> 1) & 7))) != 0,
+                                      (bitnum >= 0));
                        /* Check that the specified bit has the proper value. */
                        if ((bitnum < 0) !=
                                ((csr12 & (1 << ((bitnum >> 1) & 7))) != 0)) {
                                if (tulip_debug > 2)
-                                       printk(KERN_DEBUG "%s: Link beat detected for %s.\n", dev->name,
+                                       printk(KERN_DEBUG "%s: Link beat detected for %s\n",
+                                              dev->name,
                                               medianame[mleaf->media & MEDIA_MASK]);
                                if ((p[2] & 0x61) == 0x01)      /* Bogus Znyx board. */
                                        goto actually_mii;
@@ -99,9 +99,9 @@ void tulip_timer(unsigned long data)
                        if (tulip_media_cap[dev->if_port] & MediaIsFD)
                                goto select_next_media; /* Skip FD entries. */
                        if (tulip_debug > 1)
-                               printk(KERN_DEBUG "%s: No link beat on media %s,"
-                                      " trying transceiver type %s.\n",
-                                      dev->name, medianame[mleaf->media & MEDIA_MASK],
+                               printk(KERN_DEBUG "%s: No link beat on media %s, trying transceiver type %s\n",
+                                      dev->name,
+                                      medianame[mleaf->media & MEDIA_MASK],
                                       medianame[tp->mtable->mleaf[tp->cur_index].media]);
                        tulip_select_media(dev, 0);
                        /* Restart the transmit process. */
@@ -126,6 +126,15 @@ void tulip_timer(unsigned long data)
        }
        break;
        }
+
+
+       spin_lock_irqsave(&tp->lock, flags);
+       if (tp->timeout_recovery) {
+               tulip_tx_timeout_complete(tp, ioaddr);
+               tp->timeout_recovery = 0;
+       }
+       spin_unlock_irqrestore(&tp->lock, flags);
+
        /* mod_timer synchronizes us with potential add_timer calls
         * from interrupts.
         */
@@ -141,8 +150,8 @@ void mxic_timer(unsigned long data)
        int next_tick = 60*HZ;
 
        if (tulip_debug > 3) {
-               printk(KERN_INFO"%s: MXIC negotiation status %8.8x.\n", dev->name,
-                          ioread32(ioaddr + CSR12));
+               dev_info(&dev->dev, "MXIC negotiation status %08x\n",
+                        ioread32(ioaddr + CSR12));
        }
        if (next_tick) {
                mod_timer(&tp->timer, RUN_AT(next_tick));
@@ -157,11 +166,10 @@ void comet_timer(unsigned long data)
        int next_tick = 60*HZ;
 
        if (tulip_debug > 1)
-               printk(KERN_DEBUG "%s: Comet link status %4.4x partner capability "
-                          "%4.4x.\n",
-                          dev->name,
-                          tulip_mdio_read(dev, tp->phys[0], 1),
-                          tulip_mdio_read(dev, tp->phys[0], 5));
+               printk(KERN_DEBUG "%s: Comet link status %04x partner capability %04x\n",
+                      dev->name,
+                      tulip_mdio_read(dev, tp->phys[0], 1),
+                      tulip_mdio_read(dev, tp->phys[0], 5));
        /* mod_timer synchronizes us with potential add_timer calls
         * from interrupts.
         */