fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / net / 3c59x.c
index 7f47124..80bdcf8 100644 (file)
        410 Severn Ave., Suite 210
        Annapolis MD 21403
 
-       Linux Kernel Additions:
-       
-       0.99H+lk0.9 - David S. Miller - softnet, PCI DMA updates
-       0.99H+lk1.0 - Jeff Garzik <jgarzik@pobox.com>
-               Remove compatibility defines for kernel versions < 2.2.x.
-               Update for new 2.3.x module interface
-       LK1.1.2 (March 19, 2000)
-       * New PCI interface (jgarzik)
-
-    LK1.1.3 25 April 2000, Andrew Morton <andrewm@uow.edu.au>
-    - Merged with 3c575_cb.c
-    - Don't set RxComplete in boomerang interrupt enable reg
-    - spinlock in vortex_timer to protect mdio functions
-    - disable local interrupts around call to vortex_interrupt in
-      vortex_tx_timeout() (So vortex_interrupt can use spin_lock())
-    - Select window 3 in vortex_timer()'s write to Wn3_MAC_Ctrl
-    - In vortex_start_xmit(), move the lock to _after_ we've altered
-      vp->cur_tx and vp->tx_full.  This defeats the race between
-      vortex_start_xmit() and vortex_interrupt which was identified
-      by Bogdan Costescu.
-    - Merged back support for six new cards from various sources
-    - Set vortex_have_pci if pci_module_init returns zero (fixes cardbus
-      insertion oops)
-    - Tell it that 3c905C has NWAY for 100bT autoneg
-    - Fix handling of SetStatusEnd in 'Too much work..' code, as
-      per 2.3.99's 3c575_cb (Dave Hinds).
-    - Split ISR into two for vortex & boomerang
-    - Fix MOD_INC/DEC races
-    - Handle resource allocation failures.
-    - Fix 3CCFE575CT LED polarity
-    - Make tx_interrupt_mitigation the default
-
-    LK1.1.4 25 April 2000, Andrew Morton <andrewm@uow.edu.au>    
-    - Add extra TxReset to vortex_up() to fix 575_cb hotplug initialisation probs.
-    - Put vortex_info_tbl into __devinitdata
-    - In the vortex_error StatsFull HACK, disable stats in vp->intr_enable as well
-      as in the hardware.
-    - Increased the loop counter in issue_and_wait from 2,000 to 4,000.
-
-    LK1.1.5 28 April 2000, andrewm
-    - Added powerpc defines (John Daniel <jdaniel@etresoft.com> said these work...)
-    - Some extra diagnostics
-    - In vortex_error(), reset the Tx on maxCollisions.  Otherwise most
-      chips usually get a Tx timeout.
-    - Added extra_reset module parm
-    - Replaced some inline timer manip with mod_timer
-      (Franois romieu <Francois.Romieu@nic.fr>)
-    - In vortex_up(), don't make Wn3_config initialisation dependent upon has_nway
-      (this came across from 3c575_cb).
-
-    LK1.1.6 06 Jun 2000, andrewm
-    - Backed out the PPC defines.
-    - Use del_timer_sync(), mod_timer().
-    - Fix wrapped ulong comparison in boomerang_rx()
-    - Add IS_TORNADO, use it to suppress 3c905C checksum error msg
-      (Donald Becker, I Lee Hetherington <ilh@sls.lcs.mit.edu>)
-    - Replace union wn3_config with BFINS/BFEXT manipulation for
-      sparc64 (Pete Zaitcev, Peter Jones)
-    - In vortex_error, do_tx_reset and vortex_tx_timeout(Vortex):
-      do a netif_wake_queue() to better recover from errors. (Anders Pedersen,
-      Donald Becker)
-    - Print a warning on out-of-memory (rate limited to 1 per 10 secs)
-    - Added two more Cardbus 575 NICs: 5b57 and 6564 (Paul Wagland)
-
-    LK1.1.7 2 Jul 2000 andrewm
-    - Better handling of shared IRQs
-    - Reset the transmitter on a Tx reclaim error
-    - Fixed crash under OOM during vortex_open() (Mark Hemment)
-    - Fix Rx cessation problem during OOM (help from Mark Hemment)
-    - The spinlocks around the mdio access were blocking interrupts for 300uS.
-      Fix all this to use spin_lock_bh() within mdio_read/write
-    - Only write to TxFreeThreshold if it's a boomerang - other NICs don't
-      have one.
-    - Added 802.3x MAC-layer flow control support
-
-   LK1.1.8 13 Aug 2000 andrewm
-    - Ignore request_region() return value - already reserved if Cardbus.
-    - Merged some additional Cardbus flags from Don's 0.99Qk
-    - Some fixes for 3c556 (Fred Maciel)
-    - Fix for EISA initialisation (Jan Rekorajski)
-    - Renamed MII_XCVR_PWR and EEPROM_230 to align with 3c575_cb and D. Becker's drivers
-    - Fixed MII_XCVR_PWR for 3CCFE575CT
-    - Added INVERT_LED_PWR, used it.
-    - Backed out the extra_reset stuff
-
-   LK1.1.9 12 Sep 2000 andrewm
-    - Backed out the tx_reset_resume flags.  It was a no-op.
-    - In vortex_error, don't reset the Tx on txReclaim errors
-    - In vortex_error, don't reset the Tx on maxCollisions errors.
-      Hence backed out all the DownListPtr logic here.
-    - In vortex_error, give Tornado cards a partial TxReset on
-      maxCollisions (David Hinds).  Defined MAX_COLLISION_RESET for this.
-    - Redid some driver flags and device names based on pcmcia_cs-3.1.20.
-    - Fixed a bug where, if vp->tx_full is set when the interface
-      is downed, it remains set when the interface is upped.  Bad
-      things happen.
-
-   LK1.1.10 17 Sep 2000 andrewm
-    - Added EEPROM_8BIT for 3c555 (Fred Maciel)
-    - Added experimental support for the 3c556B Laptop Hurricane (Louis Gerbarg)
-    - Add HAS_NWAY to "3c900 Cyclone 10Mbps TPO"
-
-   LK1.1.11 13 Nov 2000 andrewm
-    - Dump MOD_INC/DEC_USE_COUNT, use SET_MODULE_OWNER
-
-   LK1.1.12 1 Jan 2001 andrewm (2.4.0-pre1)
-    - Call pci_enable_device before we request our IRQ (Tobias Ringstrom)
-    - Add 3c590 PCI latency timer hack to vortex_probe1 (from 0.99Ra)
-    - Added extended issue_and_wait for the 3c905CX.
-    - Look for an MII on PHY index 24 first (3c905CX oddity).
-    - Add HAS_NWAY to 3cSOHO100-TX (Brett Frankenberger)
-    - Don't free skbs we don't own on oom path in vortex_open().
-
-   LK1.1.13 27 Jan 2001
-    - Added explicit `medialock' flag so we can truly
-      lock the media type down with `options'.
-    - "check ioremap return and some tidbits" (Arnaldo Carvalho de Melo <acme@conectiva.com.br>)
-    - Added and used EEPROM_NORESET for 3c556B PM resumes.
-    - Fixed leakage of vp->rx_ring.
-    - Break out separate HAS_HWCKSM device capability flag.
-    - Kill vp->tx_full (ANK)
-    - Merge zerocopy fragment handling (ANK?)
-
-   LK1.1.14 15 Feb 2001
-    - Enable WOL.  Can be turned on with `enable_wol' module option.
-    - EISA and PCI initialisation fixes (jgarzik, Manfred Spraul)
-    - If a device's internalconfig register reports it has NWAY,
-      use it, even if autoselect is enabled.
-
-   LK1.1.15 6 June 2001 akpm
-    - Prevent double counting of received bytes (Lars Christensen)
-    - Add ethtool support (jgarzik)
-    - Add module parm descriptions (Andrzej M. Krzysztofowicz)
-    - Implemented alloc_etherdev() API
-    - Special-case the 'Tx error 82' message.
-
-   LK1.1.16 18 July 2001 akpm
-    - Make NETIF_F_SG dependent upon nr_free_highpages(), not on CONFIG_HIGHMEM
-    - Lessen verbosity of bootup messages
-    - Fix WOL - use new PM API functions.
-    - Use netif_running() instead of vp->open in suspend/resume.
-    - Don't reset the interface logic on open/close/rmmod.  It upsets
-      autonegotiation, and hence DHCP (from 0.99T).
-    - Back out EEPROM_NORESET flag because of the above (we do it for all
-      NICs).
-    - Correct 3c982 identification string
-    - Rename wait_for_completion() to issue_and_wait() to avoid completion.h
-      clash.
-
-   LK1.1.17 18Dec01 akpm
-    - PCI ID 9805 is a Python-T, not a dual-port Cyclone.  Apparently.
-      And it has NWAY.
-    - Mask our advertised modes (vp->advertising) with our capabilities
-         (MII reg5) when deciding which duplex mode to use.
-    - Add `global_options' as default for options[].  Ditto global_enable_wol,
-      global_full_duplex.
-
-   LK1.1.18 01Jul02 akpm
-    - Fix for undocumented transceiver power-up bit on some 3c566B's
-      (Donald Becker, Rahul Karnik)
-
-    - See http://www.zip.com.au/~akpm/linux/#3c59x-2.3 for more details.
-    - Also see Documentation/networking/vortex.txt
-
-   LK1.1.19 10Nov02 Marc Zyngier <maz@wild-wind.fr.eu.org>
-    - EISA sysfs integration.
 */
 
 /*
 
 
 #define DRV_NAME       "3c59x"
-#define DRV_VERSION    "LK1.1.19"
-#define DRV_RELDATE    "10 Nov 2002"
 
 
 
@@ -238,7 +70,6 @@ static int vortex_debug = VORTEX_DEBUG;
 static int vortex_debug = 1;
 #endif
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
@@ -258,6 +89,7 @@ static int vortex_debug = 1;
 #include <linux/highmem.h>
 #include <linux/eisa.h>
 #include <linux/bitops.h>
+#include <linux/jiffies.h>
 #include <asm/irq.h>                   /* For NR_IRQS only. */
 #include <asm/io.h>
 #include <asm/uaccess.h>
@@ -274,10 +106,8 @@ static char version[] __devinitdata =
 DRV_NAME ": Donald Becker and others. www.scyld.com/network/vortex.html\n";
 
 MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
-MODULE_DESCRIPTION("3Com 3c59x/3c9xx ethernet driver "
-                                       DRV_VERSION " " DRV_RELDATE);
+MODULE_DESCRIPTION("3Com 3c59x/3c9xx ethernet driver ");
 MODULE_LICENSE("GPL");
-MODULE_VERSION(DRV_VERSION);
 
 
 /* Operational parameter that usually are not changed. */
@@ -378,8 +208,7 @@ limit of 4K.
    of the drivers, and will likely be provided by some future kernel.
 */
 enum pci_flags_bit {
-       PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4,
-       PCI_ADDR0=0x10<<0, PCI_ADDR1=0x10<<1, PCI_ADDR2=0x10<<2, PCI_ADDR3=0x10<<3,
+       PCI_USES_MASTER=4,
 };
 
 enum { IS_VORTEX=1, IS_BOOMERANG=2, IS_CYCLONE=4, IS_TORNADO=8,
@@ -449,95 +278,95 @@ static struct vortex_chip_info {
        int io_size;
 } vortex_info_tbl[] __devinitdata = {
        {"3c590 Vortex 10Mbps",
-        PCI_USES_IO|PCI_USES_MASTER, IS_VORTEX, 32, },
+        PCI_USES_MASTER, IS_VORTEX, 32, },
        {"3c592 EISA 10Mbps Demon/Vortex",                                      /* AKPM: from Don's 3c59x_cb.c 0.49H */
-        PCI_USES_IO|PCI_USES_MASTER, IS_VORTEX, 32, },
+        PCI_USES_MASTER, IS_VORTEX, 32, },
        {"3c597 EISA Fast Demon/Vortex",                                        /* AKPM: from Don's 3c59x_cb.c 0.49H */
-        PCI_USES_IO|PCI_USES_MASTER, IS_VORTEX, 32, },
+        PCI_USES_MASTER, IS_VORTEX, 32, },
        {"3c595 Vortex 100baseTx",
-        PCI_USES_IO|PCI_USES_MASTER, IS_VORTEX, 32, },
+        PCI_USES_MASTER, IS_VORTEX, 32, },
        {"3c595 Vortex 100baseT4",
-        PCI_USES_IO|PCI_USES_MASTER, IS_VORTEX, 32, },
+        PCI_USES_MASTER, IS_VORTEX, 32, },
 
        {"3c595 Vortex 100base-MII",
-        PCI_USES_IO|PCI_USES_MASTER, IS_VORTEX, 32, },
+        PCI_USES_MASTER, IS_VORTEX, 32, },
        {"3c900 Boomerang 10baseT",
-        PCI_USES_IO|PCI_USES_MASTER, IS_BOOMERANG|EEPROM_RESET, 64, },
+        PCI_USES_MASTER, IS_BOOMERANG|EEPROM_RESET, 64, },
        {"3c900 Boomerang 10Mbps Combo",
-        PCI_USES_IO|PCI_USES_MASTER, IS_BOOMERANG|EEPROM_RESET, 64, },
+        PCI_USES_MASTER, IS_BOOMERANG|EEPROM_RESET, 64, },
        {"3c900 Cyclone 10Mbps TPO",                                            /* AKPM: from Don's 0.99M */
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
        {"3c900 Cyclone 10Mbps Combo",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
 
        {"3c900 Cyclone 10Mbps TPC",                                            /* AKPM: from Don's 0.99M */
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
        {"3c900B-FL Cyclone 10base-FL",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
        {"3c905 Boomerang 100baseTx",
-        PCI_USES_IO|PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, },
+        PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, },
        {"3c905 Boomerang 100baseT4",
-        PCI_USES_IO|PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, },
+        PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, },
        {"3c905B Cyclone 100baseTx",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
 
        {"3c905B Cyclone 10/100/BNC",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM, 128, },
        {"3c905B-FX Cyclone 100baseFx",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
        {"3c905C Tornado",
-       PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
+       PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
        {"3c920B-EMB-WNM (ATI Radeon 9100 IGP)",
-        PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_MII|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_TORNADO|HAS_MII|HAS_HWCKSM, 128, },
        {"3c980 Cyclone",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
 
        {"3c980C Python-T",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM, 128, },
        {"3cSOHO100-TX Hurricane",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM, 128, },
        {"3c555 Laptop Hurricane",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|EEPROM_8BIT|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|EEPROM_8BIT|HAS_HWCKSM, 128, },
        {"3c556 Laptop Tornado",
-        PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|EEPROM_8BIT|HAS_CB_FNS|INVERT_MII_PWR|
+        PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|EEPROM_8BIT|HAS_CB_FNS|INVERT_MII_PWR|
                                                                        HAS_HWCKSM, 128, },
        {"3c556B Laptop Hurricane",
-        PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|EEPROM_OFFSET|HAS_CB_FNS|INVERT_MII_PWR|
+        PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|EEPROM_OFFSET|HAS_CB_FNS|INVERT_MII_PWR|
                                        WNO_XCVR_PWR|HAS_HWCKSM, 128, },
 
        {"3c575 [Megahertz] 10/100 LAN  CardBus",
-       PCI_USES_IO|PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_8BIT, 128, },
+       PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_8BIT, 128, },
        {"3c575 Boomerang CardBus",
-        PCI_USES_IO|PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_8BIT, 128, },
+        PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_8BIT, 128, },
        {"3CCFE575BT Cyclone CardBus",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|
+        PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|
                                                                        INVERT_LED_PWR|HAS_HWCKSM, 128, },
        {"3CCFE575CT Tornado CardBus",
-        PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
+        PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
                                                                        MAX_COLLISION_RESET|HAS_HWCKSM, 128, },
        {"3CCFE656 Cyclone CardBus",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
+        PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
                                                                        INVERT_LED_PWR|HAS_HWCKSM, 128, },
 
        {"3CCFEM656B Cyclone+Winmodem CardBus",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
+        PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
                                                                        INVERT_LED_PWR|HAS_HWCKSM, 128, },
        {"3CXFEM656C Tornado+Winmodem CardBus",                 /* From pcmcia-cs-3.1.5 */
-        PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
+        PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
                                                                        MAX_COLLISION_RESET|HAS_HWCKSM, 128, },
        {"3c450 HomePNA Tornado",                                               /* AKPM: from Don's 0.99Q */
-        PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, },
        {"3c920 Tornado",
-        PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, },
        {"3c982 Hydra Dual Port A",
-        PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_HWCKSM|HAS_NWAY, 128, },
+        PCI_USES_MASTER, IS_TORNADO|HAS_HWCKSM|HAS_NWAY, 128, },
 
        {"3c982 Hydra Dual Port B",
-        PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_HWCKSM|HAS_NWAY, 128, },
+        PCI_USES_MASTER, IS_TORNADO|HAS_HWCKSM|HAS_NWAY, 128, },
        {"3c905B-T4",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
        {"3c920B-EMB-WNM Tornado",
-        PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, },
 
        {NULL,}, /* NULL terminated list. */
 };
@@ -791,7 +620,7 @@ struct vortex_private {
        int options;                                            /* User-settable misc. driver options. */
        unsigned int media_override:4,          /* Passed-in media type. */
                default_media:4,                                /* Read from the EEPROM/Wn3_Config. */
-               full_duplex:1, force_fd:1, autoselect:1,
+               full_duplex:1, autoselect:1,
                bus_master:1,                                   /* Vortex can only do a fragment bus-m. */
                full_bus_master_tx:1, full_bus_master_rx:2, /* Boomerang  */
                flow_ctrl:1,                                    /* Use 802.3x flow control (PAUSE only) */
@@ -841,7 +670,7 @@ enum xcvr_types {
        XCVR_100baseFx, XCVR_MII=6, XCVR_NWAY=8, XCVR_ExtMII=9, XCVR_Default=10,
 };
 
-static struct media_table {
+static const struct media_table {
        char *name;
        unsigned int media_bits:16,             /* Bits to set in Wn4_Media register. */
                mask:8,                                         /* The transceiver-present bit in Wn3_Config.*/
@@ -888,8 +717,8 @@ static int vortex_start_xmit(struct sk_buff *skb, struct net_device *dev);
 static int boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev);
 static int vortex_rx(struct net_device *dev);
 static int boomerang_rx(struct net_device *dev);
-static irqreturn_t vortex_interrupt(int irq, void *dev_id, struct pt_regs *regs);
-static irqreturn_t boomerang_interrupt(int irq, void *dev_id, struct pt_regs *regs);
+static irqreturn_t vortex_interrupt(int irq, void *dev_id);
+static irqreturn_t boomerang_interrupt(int irq, void *dev_id);
 static int vortex_close(struct net_device *dev);
 static void dump_tx_ring(struct net_device *dev);
 static void update_stats(void __iomem *ioaddr, struct net_device *dev);
@@ -900,10 +729,9 @@ static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
 #endif
 static void vortex_tx_timeout(struct net_device *dev);
 static void acpi_set_WOL(struct net_device *dev);
-static struct ethtool_ops vortex_ethtool_ops;
+static const struct ethtool_ops vortex_ethtool_ops;
 static void set_8021q_mode(struct net_device *dev, int enable);
 
-\f
 /* This driver uses 'options' to pass the media type, full-duplex flag, etc. */
 /* Option count limit only -- unlimited interfaces are supported. */
 #define MAX_UNITS 8
@@ -918,8 +746,6 @@ static int global_full_duplex = -1;
 static int global_enable_wol = -1;
 static int global_use_mmio = -1;
 
-/* #define dev_alloc_skb dev_alloc_skb_debug */
-
 /* Variables to work-around the Compaq PCI BIOS32 problem. */
 static int compaq_ioaddr, compaq_irq, compaq_device_id = 0x5900;
 static struct net_device *compaq_net_device;
@@ -968,14 +794,14 @@ static void poll_vortex(struct net_device *dev)
        unsigned long flags;
        local_save_flags(flags);
        local_irq_disable();
-       (vp->full_bus_master_rx ? boomerang_interrupt:vortex_interrupt)(dev->irq,dev,NULL);
+       (vp->full_bus_master_rx ? boomerang_interrupt:vortex_interrupt)(dev->irq,dev);
        local_irq_restore(flags);
-} 
+}
 #endif
 
 #ifdef CONFIG_PM
 
-static int vortex_suspend (struct pci_dev *pdev, pm_message_t state)
+static int vortex_suspend(struct pci_dev *pdev, pm_message_t state)
 {
        struct net_device *dev = pci_get_drvdata(pdev);
 
@@ -993,7 +819,7 @@ static int vortex_suspend (struct pci_dev *pdev, pm_message_t state)
        return 0;
 }
 
-static int vortex_resume (struct pci_dev *pdev)
+static int vortex_resume(struct pci_dev *pdev)
 {
        struct net_device *dev = pci_get_drvdata(pdev);
        struct vortex_private *vp = netdev_priv(dev);
@@ -1004,7 +830,7 @@ static int vortex_resume (struct pci_dev *pdev)
                pci_enable_device(pdev);
                pci_set_master(pdev);
                if (request_irq(dev->irq, vp->full_bus_master_rx ?
-                               &boomerang_interrupt : &vortex_interrupt, SA_SHIRQ, dev->name, dev)) {
+                               &boomerang_interrupt : &vortex_interrupt, IRQF_SHARED, dev->name, dev)) {
                        printk(KERN_WARNING "%s: Could not reserve IRQ %d\n", dev->name, dev->irq);
                        pci_disable_device(pdev);
                        return -EBUSY;
@@ -1025,9 +851,10 @@ static struct eisa_device_id vortex_eisa_ids[] = {
        { "TCM5970", CH_3C597 },
        { "" }
 };
+MODULE_DEVICE_TABLE(eisa, vortex_eisa_ids);
 
-static int vortex_eisa_probe (struct device *device);
-static int vortex_eisa_remove (struct device *device);
+static int vortex_eisa_probe(struct device *device);
+static int vortex_eisa_remove(struct device *device);
 
 static struct eisa_driver vortex_eisa_driver = {
        .id_table = vortex_eisa_ids,
@@ -1038,12 +865,12 @@ static struct eisa_driver vortex_eisa_driver = {
        }
 };
 
-static int vortex_eisa_probe (struct device *device)
+static int vortex_eisa_probe(struct device *device)
 {
        void __iomem *ioaddr;
        struct eisa_device *edev;
 
-       edev = to_eisa_device (device);
+       edev = to_eisa_device(device);
 
        if (!request_region(edev->base_addr, VORTEX_TOTAL_SIZE, DRV_NAME))
                return -EBUSY;
@@ -1052,7 +879,7 @@ static int vortex_eisa_probe (struct device *device)
 
        if (vortex_probe1(device, ioaddr, ioread16(ioaddr + 0xC88) >> 12,
                                          edev->id.driver_data, vortex_cards_found)) {
-               release_region (edev->base_addr, VORTEX_TOTAL_SIZE);
+               release_region(edev->base_addr, VORTEX_TOTAL_SIZE);
                return -ENODEV;
        }
 
@@ -1061,15 +888,15 @@ static int vortex_eisa_probe (struct device *device)
        return 0;
 }
 
-static int vortex_eisa_remove (struct device *device)
+static int vortex_eisa_remove(struct device *device)
 {
        struct eisa_device *edev;
        struct net_device *dev;
        struct vortex_private *vp;
        void __iomem *ioaddr;
 
-       edev = to_eisa_device (device);
-       dev = eisa_get_drvdata (edev);
+       edev = to_eisa_device(device);
+       dev = eisa_get_drvdata(edev);
 
        if (!dev) {
                printk("vortex_eisa_remove called for Compaq device!\n");
@@ -1078,34 +905,38 @@ static int vortex_eisa_remove (struct device *device)
 
        vp = netdev_priv(dev);
        ioaddr = vp->ioaddr;
-       
-       unregister_netdev (dev);
-       iowrite16 (TotalReset|0x14, ioaddr + EL3_CMD);
-       release_region (dev->base_addr, VORTEX_TOTAL_SIZE);
 
-       free_netdev (dev);
+       unregister_netdev(dev);
+       iowrite16(TotalReset|0x14, ioaddr + EL3_CMD);
+       release_region(dev->base_addr, VORTEX_TOTAL_SIZE);
+
+       free_netdev(dev);
        return 0;
 }
 #endif
 
 /* returns count found (>= 0), or negative on error */
-static int __init vortex_eisa_init (void)
+static int __init vortex_eisa_init(void)
 {
        int eisa_found = 0;
        int orig_cards_found = vortex_cards_found;
 
 #ifdef CONFIG_EISA
-       if (eisa_driver_register (&vortex_eisa_driver) >= 0) {
-                       /* Because of the way EISA bus is probed, we cannot assume
-                        * any device have been found when we exit from
-                        * eisa_driver_register (the bus root driver may not be
-                        * initialized yet). So we blindly assume something was
-                        * found, and let the sysfs magic happend... */
-                       
-                       eisa_found = 1;
+       int err;
+
+       err = eisa_driver_register (&vortex_eisa_driver);
+       if (!err) {
+               /*
+                * Because of the way EISA bus is probed, we cannot assume
+                * any device have been found when we exit from
+                * eisa_driver_register (the bus root driver may not be
+                * initialized yet). So we blindly assume something was
+                * found, and let the sysfs magic happend...
+                */
+               eisa_found = 1;
        }
 #endif
-       
+
        /* Special code to work-around the Compaq PCI BIOS32 problem. */
        if (compaq_ioaddr) {
                vortex_probe1(NULL, ioport_map(compaq_ioaddr, VORTEX_TOTAL_SIZE),
@@ -1116,15 +947,15 @@ static int __init vortex_eisa_init (void)
 }
 
 /* returns count (>= 0), or negative on error */
-static int __devinit vortex_init_one (struct pci_dev *pdev,
+static int __devinit vortex_init_one(struct pci_dev *pdev,
                                      const struct pci_device_id *ent)
 {
        int rc, unit, pci_bar;
        struct vortex_chip_info *vci;
        void __iomem *ioaddr;
 
-       /* wake up and enable device */         
-       rc = pci_enable_device (pdev);
+       /* wake up and enable device */
+       rc = pci_enable_device(pdev);
        if (rc < 0)
                goto out;
 
@@ -1146,7 +977,7 @@ static int __devinit vortex_init_one (struct pci_dev *pdev,
        rc = vortex_probe1(&pdev->dev, ioaddr, pdev->irq,
                           ent->driver_data, unit);
        if (rc < 0) {
-               pci_disable_device (pdev);
+               pci_disable_device(pdev);
                goto out;
        }
 
@@ -1231,7 +1062,7 @@ static int __devinit vortex_probe1(struct device *gendev,
        if (print_info)
                printk (KERN_INFO "See Documentation/networking/vortex.txt\n");
 
-       printk(KERN_INFO "%s: 3Com %s %s at %p. Vers " DRV_VERSION "\n",
+       printk(KERN_INFO "%s: 3Com %s %s at %p.\n",
               print_name,
               pdev ? "PCI" : "EISA",
               vci->name,
@@ -1259,9 +1090,9 @@ static int __devinit vortex_probe1(struct device *gendev,
                if (request_region(dev->base_addr, vci->io_size, print_name) != NULL)
                        vp->must_free_region = 1;
 
-               /* enable bus-mastering if necessary */         
+               /* enable bus-mastering if necessary */
                if (vci->flags & PCI_USES_MASTER)
-                       pci_set_master (pdev);
+                       pci_set_master(pdev);
 
                if (vci->drv_flags & IS_VORTEX) {
                        u8 pci_latency;
@@ -1301,11 +1132,11 @@ static int __devinit vortex_probe1(struct device *gendev,
        vp->tx_ring_dma = vp->rx_ring_dma + sizeof(struct boom_rx_desc) * RX_RING_SIZE;
 
        /* if we are a PCI driver, we store info in pdev->driver_data
-        * instead of a module list */  
+        * instead of a module list */
        if (pdev)
                pci_set_drvdata(pdev, dev);
        if (edev)
-               eisa_set_drvdata (edev, dev);
+               eisa_set_drvdata(edev, dev);
 
        vp->media_override = 7;
        if (option >= 0) {
@@ -1330,7 +1161,7 @@ static int __devinit vortex_probe1(struct device *gendev,
                        vp->enable_wol = 1;
        }
 
-       vp->force_fd = vp->full_duplex;
+       vp->mii.force_media = vp->full_duplex;
        vp->options = option;
        /* Read the station address from the EEPROM. */
        EL3WINDOW(0);
@@ -1384,17 +1215,12 @@ static int __devinit vortex_probe1(struct device *gendev,
        for (i = 0; i < 6; i++)
                iowrite8(dev->dev_addr[i], ioaddr + i);
 
-#ifdef __sparc__
-       if (print_info)
-               printk(", IRQ %s\n", __irq_itoa(dev->irq));
-#else
        if (print_info)
                printk(", IRQ %d\n", dev->irq);
        /* Tell them about an invalid IRQ. */
        if (dev->irq <= 0 || dev->irq >= NR_IRQS)
                printk(KERN_WARNING " *** Warning: IRQ %d is unlikely to work! ***\n",
                           dev->irq);
-#endif
 
        EL3WINDOW(4);
        step = (ioread8(ioaddr + Wn4_NetDiag) & 0x1e) >> 1;
@@ -1415,8 +1241,10 @@ static int __devinit vortex_probe1(struct device *gendev,
                }
 
                if (print_info) {
-                       printk(KERN_INFO "%s: CardBus functions mapped %8.8lx->%p\n",
-                               print_name, pci_resource_start(pdev, 2),
+                       printk(KERN_INFO "%s: CardBus functions mapped "
+                               "%16.16llx->%p\n",
+                               print_name,
+                               (unsigned long long)pci_resource_start(pdev, 2),
                                vp->cb_fn_base);
                }
                EL3WINDOW(2);
@@ -1445,7 +1273,7 @@ static int __devinit vortex_probe1(struct device *gendev,
        }
 
        {
-               static const char * ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
+               static const char * const ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
                unsigned int config;
                EL3WINDOW(3);
                vp->available_media = ioread16(ioaddr + Wn3_Options);
@@ -1566,7 +1394,7 @@ static int __devinit vortex_probe1(struct device *gendev,
        dev->tx_timeout = vortex_tx_timeout;
        dev->watchdog_timeo = (watchdog * HZ) / 1000;
 #ifdef CONFIG_NET_POLL_CONTROLLER
-       dev->poll_controller = poll_vortex; 
+       dev->poll_controller = poll_vortex;
 #endif
        if (pdev) {
                vp->pm_state_valid = 1;
@@ -1619,13 +1447,47 @@ issue_and_wait(struct net_device *dev, int cmd)
                           dev->name, cmd, ioread16(ioaddr + EL3_STATUS));
 }
 
+static void
+vortex_set_duplex(struct net_device *dev)
+{
+       struct vortex_private *vp = netdev_priv(dev);
+       void __iomem *ioaddr = vp->ioaddr;
+
+       printk(KERN_INFO "%s:  setting %s-duplex.\n",
+               dev->name, (vp->full_duplex) ? "full" : "half");
+
+       EL3WINDOW(3);
+       /* Set the full-duplex bit. */
+       iowrite16(((vp->info1 & 0x8000) || vp->full_duplex ? 0x20 : 0) |
+                       (vp->large_frames ? 0x40 : 0) |
+                       ((vp->full_duplex && vp->flow_ctrl && vp->partner_flow_ctrl) ?
+                                       0x100 : 0),
+                       ioaddr + Wn3_MAC_Ctrl);
+}
+
+static void vortex_check_media(struct net_device *dev, unsigned int init)
+{
+       struct vortex_private *vp = netdev_priv(dev);
+       unsigned int ok_to_print = 0;
+
+       if (vortex_debug > 3)
+               ok_to_print = 1;
+
+       if (mii_check_media(&vp->mii, ok_to_print, init)) {
+               vp->full_duplex = vp->mii.full_duplex;
+               vortex_set_duplex(dev);
+       } else if (init) {
+               vortex_set_duplex(dev);
+       }
+}
+
 static void
 vortex_up(struct net_device *dev)
 {
        struct vortex_private *vp = netdev_priv(dev);
        void __iomem *ioaddr = vp->ioaddr;
        unsigned int config;
-       int i;
+       int i, mii_reg1, mii_reg5;
 
        if (VORTEX_PCI(vp)) {
                pci_set_power_state(VORTEX_PCI(vp), PCI_D0);    /* Go active */
@@ -1679,47 +1541,22 @@ vortex_up(struct net_device *dev)
                printk(KERN_DEBUG "%s: Initial media type %s.\n",
                           dev->name, media_tbl[dev->if_port].name);
 
-       vp->full_duplex = vp->force_fd;
+       vp->full_duplex = vp->mii.force_media;
        config = BFINS(config, dev->if_port, 20, 4);
        if (vortex_debug > 6)
                printk(KERN_DEBUG "vortex_up(): writing 0x%x to InternalConfig\n", config);
        iowrite32(config, ioaddr + Wn3_Config);
 
        if (dev->if_port == XCVR_MII || dev->if_port == XCVR_NWAY) {
-               int mii_reg1, mii_reg5;
                EL3WINDOW(4);
-               /* Read BMSR (reg1) only to clear old status. */
                mii_reg1 = mdio_read(dev, vp->phys[0], MII_BMSR);
                mii_reg5 = mdio_read(dev, vp->phys[0], MII_LPA);
-               if (mii_reg5 == 0xffff  ||  mii_reg5 == 0x0000) {
-                       netif_carrier_off(dev); /* No MII device or no link partner report */
-               } else {
-                       mii_reg5 &= vp->advertising;
-                       if ((mii_reg5 & 0x0100) != 0    /* 100baseTx-FD */
-                                || (mii_reg5 & 0x00C0) == 0x0040) /* 10T-FD, but not 100-HD */
-                       vp->full_duplex = 1;
-                       netif_carrier_on(dev);
-               }
                vp->partner_flow_ctrl = ((mii_reg5 & 0x0400) != 0);
-               if (vortex_debug > 1)
-                       printk(KERN_INFO "%s: MII #%d status %4.4x, link partner capability %4.4x,"
-                                  " info1 %04x, setting %s-duplex.\n",
-                                       dev->name, vp->phys[0],
-                                       mii_reg1, mii_reg5,
-                                       vp->info1, ((vp->info1 & 0x8000) || vp->full_duplex) ? "full" : "half");
-               EL3WINDOW(3);
-       }
-
-       /* Set the full-duplex bit. */
-       iowrite16(      ((vp->info1 & 0x8000) || vp->full_duplex ? 0x20 : 0) |
-                       (vp->large_frames ? 0x40 : 0) |
-                       ((vp->full_duplex && vp->flow_ctrl && vp->partner_flow_ctrl) ? 0x100 : 0),
-                       ioaddr + Wn3_MAC_Ctrl);
 
-       if (vortex_debug > 1) {
-               printk(KERN_DEBUG "%s: vortex_up() InternalConfig %8.8x.\n",
-                       dev->name, config);
+               vortex_check_media(dev, 1);
        }
+       else
+               vortex_set_duplex(dev);
 
        issue_and_wait(dev, TxReset);
        /*
@@ -1727,6 +1564,7 @@ vortex_up(struct net_device *dev)
         */
        issue_and_wait(dev, RxReset|0x04);
 
+
        iowrite16(SetStatusEnb | 0x00, ioaddr + EL3_CMD);
 
        if (vortex_debug > 1) {
@@ -1800,7 +1638,6 @@ vortex_up(struct net_device *dev)
        set_8021q_mode(dev, 1);
        iowrite16(StatsEnable, ioaddr + EL3_CMD); /* Turn on statistics. */
 
-//     issue_and_wait(dev, SetTxStart|0x07ff);
        iowrite16(RxEnable, ioaddr + EL3_CMD); /* Enable the receiver. */
        iowrite16(TxEnable, ioaddr + EL3_CMD); /* Enable transmitter. */
        /* Allow status bits to be seen. */
@@ -1831,7 +1668,7 @@ vortex_open(struct net_device *dev)
 
        /* Use the now-standard shared IRQ implementation. */
        if ((retval = request_irq(dev->irq, vp->full_bus_master_rx ?
-                               &boomerang_interrupt : &vortex_interrupt, SA_SHIRQ, dev->name, dev))) {
+                               &boomerang_interrupt : &vortex_interrupt, IRQF_SHARED, dev->name, dev))) {
                printk(KERN_ERR "%s: Could not reserve IRQ %d\n", dev->name, dev->irq);
                goto out;
        }
@@ -1887,7 +1724,7 @@ vortex_timer(unsigned long data)
        void __iomem *ioaddr = vp->ioaddr;
        int next_tick = 60*HZ;
        int ok = 0;
-       int media_status, mii_status, old_window;
+       int media_status, old_window;
 
        if (vortex_debug > 2) {
                printk(KERN_DEBUG "%s: Media selection timer tick happened, %s.\n",
@@ -1895,9 +1732,7 @@ vortex_timer(unsigned long data)
                printk(KERN_DEBUG "dev->watchdog_timeo=%d\n", dev->watchdog_timeo);
        }
 
-       if (vp->medialock)
-               goto leave_media_alone;
-       disable_irq(dev->irq);
+       disable_irq_lockdep(dev->irq);
        old_window = ioread16(ioaddr + EL3_CMD) >> 13;
        EL3WINDOW(4);
        media_status = ioread16(ioaddr + Wn4_Media);
@@ -1919,44 +1754,9 @@ vortex_timer(unsigned long data)
                break;
        case XCVR_MII: case XCVR_NWAY:
                {
-                       spin_lock_bh(&vp->lock);
-                       mii_status = mdio_read(dev, vp->phys[0], MII_BMSR);
-                       if (!(mii_status & BMSR_LSTATUS)) {
-                               /* Re-read to get actual link status */
-                               mii_status = mdio_read(dev, vp->phys[0], MII_BMSR);
-                       }
                        ok = 1;
-                       if (vortex_debug > 2)
-                               printk(KERN_DEBUG "%s: MII transceiver has status %4.4x.\n",
-                                       dev->name, mii_status);
-                       if (mii_status & BMSR_LSTATUS) {
-                               int mii_reg5 = mdio_read(dev, vp->phys[0], MII_LPA);
-                               if (! vp->force_fd  &&  mii_reg5 != 0xffff) {
-                                       int duplex;
-
-                                       mii_reg5 &= vp->advertising;
-                                       duplex = (mii_reg5&0x0100) || (mii_reg5 & 0x01C0) == 0x0040;
-                                       if (vp->full_duplex != duplex) {
-                                               vp->full_duplex = duplex;
-                                               printk(KERN_INFO "%s: Setting %s-duplex based on MII "
-                                                       "#%d link partner capability of %4.4x.\n",
-                                                       dev->name, vp->full_duplex ? "full" : "half",
-                                                       vp->phys[0], mii_reg5);
-                                               /* Set the full-duplex bit. */
-                                               EL3WINDOW(3);
-                                               iowrite16(      (vp->full_duplex ? 0x20 : 0) |
-                                                               (vp->large_frames ? 0x40 : 0) |
-                                                               ((vp->full_duplex && vp->flow_ctrl && vp->partner_flow_ctrl) ? 0x100 : 0),
-                                                               ioaddr + Wn3_MAC_Ctrl);
-                                               if (vortex_debug > 1)
-                                                       printk(KERN_DEBUG "Setting duplex in Wn3_MAC_Ctrl\n");
-                                               /* AKPM: bug: should reset Tx and Rx after setting Duplex.  Page 180 */
-                                       }
-                               }
-                               netif_carrier_on(dev);
-                       } else {
-                               netif_carrier_off(dev);
-                       }
+                       spin_lock_bh(&vp->lock);
+                       vortex_check_media(dev, 0);
                        spin_unlock_bh(&vp->lock);
                }
                break;
@@ -1966,7 +1766,14 @@ vortex_timer(unsigned long data)
                                 dev->name, media_tbl[dev->if_port].name, media_status);
                ok = 1;
        }
-       if ( ! ok) {
+
+       if (!netif_carrier_ok(dev))
+               next_tick = 5*HZ;
+
+       if (vp->medialock)
+               goto leave_media_alone;
+
+       if (!ok) {
                unsigned int config;
 
                do {
@@ -1999,14 +1806,14 @@ vortex_timer(unsigned long data)
                        printk(KERN_DEBUG "wrote 0x%08x to Wn3_Config\n", config);
                /* AKPM: FIXME: Should reset Rx & Tx here.  P60 of 3c90xc.pdf */
        }
-       EL3WINDOW(old_window);
-       enable_irq(dev->irq);
 
 leave_media_alone:
        if (vortex_debug > 2)
          printk(KERN_DEBUG "%s: Media selection timer finished, %s.\n",
                         dev->name, media_tbl[dev->if_port].name);
 
+       EL3WINDOW(old_window);
+       enable_irq_lockdep(dev->irq);
        mod_timer(&vp->timer, RUN_AT(next_tick));
        if (vp->deferred)
                iowrite16(FakeIntr, ioaddr + EL3_CMD);
@@ -2042,9 +1849,9 @@ static void vortex_tx_timeout(struct net_device *dev)
                        unsigned long flags;
                        local_irq_save(flags);
                        if (vp->full_bus_master_tx)
-                               boomerang_interrupt(dev->irq, dev, NULL);
+                               boomerang_interrupt(dev->irq, dev);
                        else
-                               vortex_interrupt(dev->irq, dev, NULL);
+                               vortex_interrupt(dev->irq, dev);
                        local_irq_restore(flags);
                }
        }
@@ -2069,11 +1876,11 @@ static void vortex_tx_timeout(struct net_device *dev)
                vp->stats.tx_dropped++;
                netif_wake_queue(dev);
        }
-       
+
        /* Issue Tx Enable */
        iowrite16(TxEnable, ioaddr + EL3_CMD);
        dev->trans_start = jiffies;
-       
+
        /* Switch to register set 7 for normal use. */
        EL3WINDOW(7);
 }
@@ -2109,16 +1916,14 @@ vortex_error(struct net_device *dev, int status)
                }
                if (tx_status & 0x14)  vp->stats.tx_fifo_errors++;
                if (tx_status & 0x38)  vp->stats.tx_aborted_errors++;
+               if (tx_status & 0x08)  vp->xstats.tx_max_collisions++;
                iowrite8(0, ioaddr + TxStatus);
                if (tx_status & 0x30) {                 /* txJabber or txUnderrun */
                        do_tx_reset = 1;
-               } else if (tx_status & 0x08) {  /* maxCollisions */
-                       vp->xstats.tx_max_collisions++;
-                       if (vp->drv_flags & MAX_COLLISION_RESET) {
-                               do_tx_reset = 1;
-                               reset_mask = 0x0108;            /* Reset interface logic, but not download logic */
-                       }
-               } else {                                                /* Merely re-enable the transmitter. */
+               } else if ((tx_status & 0x08) && (vp->drv_flags & MAX_COLLISION_RESET))  {      /* maxCollisions */
+                       do_tx_reset = 1;
+                       reset_mask = 0x0108;            /* Reset interface logic, but not download logic */
+               } else {                                /* Merely re-enable the transmitter. */
                        iowrite16(TxEnable, ioaddr + EL3_CMD);
                }
        }
@@ -2201,7 +2006,7 @@ vortex_start_xmit(struct sk_buff *skb, struct net_device *dev)
        if (vp->bus_master) {
                /* Set the bus-master controller to transfer the packet. */
                int len = (skb->len + 3) & ~3;
-               iowrite32(      vp->tx_skb_dma = pci_map_single(VORTEX_PCI(vp), skb->data, len, PCI_DMA_TODEVICE),
+               iowrite32(vp->tx_skb_dma = pci_map_single(VORTEX_PCI(vp), skb->data, len, PCI_DMA_TODEVICE),
                                ioaddr + Wn7_MasterAddr);
                iowrite16(len, ioaddr + Wn7_MasterLen);
                vp->tx_skb = skb;
@@ -2273,7 +2078,7 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        vp->tx_ring[entry].next = 0;
 #if DO_ZEROCOPY
-       if (skb->ip_summed != CHECKSUM_HW)
+       if (skb->ip_summed != CHECKSUM_PARTIAL)
                        vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded);
        else
                        vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded | AddTCPChksum | AddUDPChksum);
@@ -2344,7 +2149,7 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev)
  */
 
 static irqreturn_t
-vortex_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+vortex_interrupt(int irq, void *dev_id)
 {
        struct net_device *dev = dev_id;
        struct vortex_private *vp = netdev_priv(dev);
@@ -2449,7 +2254,7 @@ handler_exit:
  */
 
 static irqreturn_t
-boomerang_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+boomerang_interrupt(int irq, void *dev_id)
 {
        struct net_device *dev = dev_id;
        struct vortex_private *vp = netdev_priv(dev);
@@ -2512,10 +2317,10 @@ boomerang_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                                if ((vp->tx_ring[entry].status & DN_COMPLETE) == 0)
                                        break;                  /* It still hasn't been processed. */
 #endif
-                                       
+
                                if (vp->tx_skbuff[entry]) {
                                        struct sk_buff *skb = vp->tx_skbuff[entry];
-#if DO_ZEROCOPY                                        
+#if DO_ZEROCOPY
                                        int i;
                                        for (i=0; i<=skb_shinfo(skb)->nr_frags; i++)
                                                        pci_unmap_single(VORTEX_PCI(vp),
@@ -2724,7 +2529,7 @@ boomerang_rx(struct net_device *dev)
                        skb = dev_alloc_skb(PKT_BUF_SZ);
                        if (skb == NULL) {
                                static unsigned long last_jif;
-                               if ((jiffies - last_jif) > 10 * HZ) {
+                               if (time_after(jiffies, last_jif + 10 * HZ)) {
                                        printk(KERN_WARNING "%s: memory shortage\n", dev->name);
                                        last_jif = jiffies;
                                }
@@ -2829,7 +2634,7 @@ vortex_close(struct net_device *dev)
                                                "not using them!\n", dev->name);
        }
 #endif
-               
+
        free_irq(dev->irq, dev);
 
        if (vp->full_bus_master_rx) { /* Free Boomerang bus master Rx buffers. */
@@ -2871,7 +2676,7 @@ dump_tx_ring(struct net_device *dev)
        if (vortex_debug > 0) {
        struct vortex_private *vp = netdev_priv(dev);
                void __iomem *ioaddr = vp->ioaddr;
-               
+
                if (vp->full_bus_master_tx) {
                        int i;
                        int stalled = ioread32(ioaddr + PktStatus) & 0x04;      /* Possible racy. But it's only debug stuff */
@@ -2978,20 +2783,6 @@ static int vortex_nway_reset(struct net_device *dev)
        return rc;
 }
 
-static u32 vortex_get_link(struct net_device *dev)
-{
-       struct vortex_private *vp = netdev_priv(dev);
-       void __iomem *ioaddr = vp->ioaddr;
-       unsigned long flags;
-       int rc;
-
-       spin_lock_irqsave(&vp->lock, flags);
-       EL3WINDOW(4);
-       rc = mii_link_ok(&vp->mii);
-       spin_unlock_irqrestore(&vp->lock, flags);
-       return rc;
-}
-
 static int vortex_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
        struct vortex_private *vp = netdev_priv(dev);
@@ -3072,7 +2863,6 @@ static void vortex_get_drvinfo(struct net_device *dev,
        struct vortex_private *vp = netdev_priv(dev);
 
        strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
        if (VORTEX_PCI(vp)) {
                strcpy(info->bus_info, pci_name(VORTEX_PCI(vp)));
        } else {
@@ -3084,7 +2874,7 @@ static void vortex_get_drvinfo(struct net_device *dev,
        }
 }
 
-static struct ethtool_ops vortex_ethtool_ops = {
+static const struct ethtool_ops vortex_ethtool_ops = {
        .get_drvinfo            = vortex_get_drvinfo,
        .get_strings            = vortex_get_strings,
        .get_msglevel           = vortex_get_msglevel,
@@ -3093,9 +2883,9 @@ static struct ethtool_ops vortex_ethtool_ops = {
        .get_stats_count        = vortex_get_stats_count,
        .get_settings           = vortex_get_settings,
        .set_settings           = vortex_set_settings,
-       .get_link               = vortex_get_link,
+       .get_link               = ethtool_op_get_link,
        .nway_reset             = vortex_nway_reset,
-       .get_perm_addr                  = ethtool_op_get_perm_addr,
+       .get_perm_addr          = ethtool_op_get_perm_addr,
 };
 
 #ifdef CONFIG_PCI
@@ -3139,7 +2929,7 @@ static void set_rx_mode(struct net_device *dev)
        int new_mode;
 
        if (dev->flags & IFF_PROMISC) {
-               if (vortex_debug > 0)
+               if (vortex_debug > 3)
                        printk(KERN_NOTICE "%s: Setting promiscuous mode.\n", dev->name);
                new_mode = SetRxFilter|RxStation|RxMulticast|RxBroadcast|RxProm;
        } else  if ((dev->mc_list)  ||  (dev->flags & IFF_ALLMULTI)) {
@@ -3296,7 +3086,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val
        }
        return;
 }
-\f
+
 /* ACPI: Advanced Configuration and Power Interface. */
 /* Set Wake-On-LAN mode and put the board into D3 (power-down) state. */
 static void acpi_set_WOL(struct net_device *dev)
@@ -3320,7 +3110,7 @@ static void acpi_set_WOL(struct net_device *dev)
 }
 
 
-static void __devexit vortex_remove_one (struct pci_dev *pdev)
+static void __devexit vortex_remove_one(struct pci_dev *pdev)
 {
        struct net_device *dev = pci_get_drvdata(pdev);
        struct vortex_private *vp;
@@ -3376,11 +3166,11 @@ static int vortex_have_pci;
 static int vortex_have_eisa;
 
 
-static int __init vortex_init (void)
+static int __init vortex_init(void)
 {
        int pci_rc, eisa_rc;
 
-       pci_rc = pci_module_init(&vortex_driver);
+       pci_rc = pci_register_driver(&vortex_driver);
        eisa_rc = vortex_eisa_init();
 
        if (pci_rc == 0)
@@ -3392,48 +3182,39 @@ static int __init vortex_init (void)
 }
 
 
-static void __exit vortex_eisa_cleanup (void)
+static void __exit vortex_eisa_cleanup(void)
 {
        struct vortex_private *vp;
        void __iomem *ioaddr;
 
 #ifdef CONFIG_EISA
        /* Take care of the EISA devices */
-       eisa_driver_unregister (&vortex_eisa_driver);
+       eisa_driver_unregister(&vortex_eisa_driver);
 #endif
-       
+
        if (compaq_net_device) {
                vp = compaq_net_device->priv;
                ioaddr = ioport_map(compaq_net_device->base_addr,
                                    VORTEX_TOTAL_SIZE);
 
-               unregister_netdev (compaq_net_device);
-               iowrite16 (TotalReset, ioaddr + EL3_CMD);
+               unregister_netdev(compaq_net_device);
+               iowrite16(TotalReset, ioaddr + EL3_CMD);
                release_region(compaq_net_device->base_addr,
                               VORTEX_TOTAL_SIZE);
 
-               free_netdev (compaq_net_device);
+               free_netdev(compaq_net_device);
        }
 }
 
 
-static void __exit vortex_cleanup (void)
+static void __exit vortex_cleanup(void)
 {
        if (vortex_have_pci)
-               pci_unregister_driver (&vortex_driver);
+               pci_unregister_driver(&vortex_driver);
        if (vortex_have_eisa)
-               vortex_eisa_cleanup ();
+               vortex_eisa_cleanup();
 }
 
 
 module_init(vortex_init);
 module_exit(vortex_cleanup);
-
-\f
-/*
- * Local variables:
- *  c-indent-level: 4
- *  c-basic-offset: 4
- *  tab-width: 4
- * End:
- */