fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / net / macsonic.c
index 02d5c68..393d995 100644 (file)
  *
  * Based on code
  * (C) 1996 by Thomas Bogendoerfer (tsbogend@bigbug.franken.de)
- * 
+ *
  * This driver is based on work from Andreas Busse, but most of
  * the code is rewritten.
- * 
+ *
  * (C) 1995 by Andreas Busse (andy@waldorf-gmbh.de)
  *
  * A driver for the Mac onboard Sonic ethernet chip.
  *
- * 98/12/21 MSch: judged from tests on Q800, it's basically working, 
+ * 98/12/21 MSch: judged from tests on Q800, it's basically working,
  *               but eating up both receive and transmit resources
  *               and duplicating packets. Needs more testing.
  *
  * 99/01/03 MSch: upgraded to version 0.92 of the core driver, fixed.
- * 
+ *
  * 00/10/31 sammy@oh.verio.com: Updated driver for 2.4 kernels, fixed problems
  *          on centris.
  */
@@ -76,7 +76,7 @@ static struct platform_device *mac_sonic_device;
 /* use 0 for production, 1 for verification, >1 for debug */
 #ifdef SONIC_DEBUG
 static unsigned int sonic_debug = SONIC_DEBUG;
-#else 
+#else
 static unsigned int sonic_debug = 1;
 #endif
 
@@ -129,7 +129,7 @@ static inline void bit_reverse_addr(unsigned char addr[6])
        int i;
 
        for(i = 0; i < 6; i++)
-               addr[i] = ((nibbletab[addr[i] & 0xf] << 4) | 
+               addr[i] = ((nibbletab[addr[i] & 0xf] << 4) |
                           nibbletab[(addr[i] >> 4) &0xf]);
 }
 
@@ -215,7 +215,7 @@ int __init mac_onboard_sonic_ethernet_addr(struct net_device* dev)
                unsigned short val;
 
                printk(KERN_INFO "macsonic: PROM seems to be wrong, trying CAM entry 15\n");
-               
+
                SONIC_WRITE(SONIC_CMD, SONIC_CR_RST);
                SONIC_WRITE(SONIC_CEP, 15);
 
@@ -228,7 +228,7 @@ int __init mac_onboard_sonic_ethernet_addr(struct net_device* dev)
                val = SONIC_READ(SONIC_CAP0);
                dev->dev_addr[1] = val >> 8;
                dev->dev_addr[0] = val & 0xff;
-               
+
                printk(KERN_INFO "HW Address from CAM 15: ");
                for (i = 0; i < 6; i++) {
                        printk("%2.2x", dev->dev_addr[i]);
@@ -258,7 +258,7 @@ int __init mac_onboard_sonic_probe(struct net_device* dev)
        struct sonic_local* lp = netdev_priv(dev);
        int sr;
        int commslot = 0;
-       
+
        if (once_is_more_than_enough)
                return -ENODEV;
        once_is_more_than_enough = 1;
@@ -268,9 +268,9 @@ int __init mac_onboard_sonic_probe(struct net_device* dev)
 
        if (macintosh_config->ether_type != MAC_ETHER_SONIC)
                return -ENODEV;
-       
+
        printk(KERN_INFO "Checking for internal Macintosh ethernet (SONIC).. ");
-       
+
        /* Bogus probing, on the models which may or may not have
           Ethernet (BTW, the Ethernet *is* always at the same
           address, and nothing else lives there, at least if Apple's
@@ -293,7 +293,7 @@ int __init mac_onboard_sonic_probe(struct net_device* dev)
                commslot = 1;
        }
 
-       printk("yes\n");        
+       printk("yes\n");
 
        /* Danger!  My arms are flailing wildly!  You *must* set lp->reg_offset
         * and dev->base_addr before using SONIC_READ() or SONIC_WRITE() */
@@ -325,7 +325,7 @@ int __init mac_onboard_sonic_probe(struct net_device* dev)
                lp->dma_bitmode = SONIC_BITMODE16;
 
                sr = SONIC_READ(SONIC_SR);
-               if (sr == 0x0004 || sr == 0x0006 || sr == 0x0100 || sr == 0x0101) 
+               if (sr == 0x0004 || sr == 0x0006 || sr == 0x0100 || sr == 0x0101)
                        /* 83932 is 0x0004 or 0x0006, 83934 is 0x0100 or 0x0101 */
                        lp->dma_bitmode = SONIC_BITMODE32;
                else {
@@ -389,7 +389,7 @@ int __init mac_nubus_sonic_ethernet_addr(struct net_device* dev,
 
 int __init macsonic_ident(struct nubus_dev* ndev)
 {
-       if (ndev->dr_hw == NUBUS_DRHW_ASANTE_LC && 
+       if (ndev->dr_hw == NUBUS_DRHW_ASANTE_LC &&
            ndev->dr_sw == NUBUS_DRSW_SONIC_LC)
                return MACSONIC_DAYNALINK;
        if (ndev->dr_hw == NUBUS_DRHW_SONIC &&
@@ -400,11 +400,11 @@ int __init macsonic_ident(struct nubus_dev* ndev)
                else
                        return MACSONIC_APPLE;
        }
-       
+
        if (ndev->dr_hw == NUBUS_DRHW_SMC9194 &&
            ndev->dr_sw == NUBUS_DRSW_DAYNA)
                return MACSONIC_DAYNA;
-       
+
        if (ndev->dr_hw == NUBUS_DRHW_SONIC_LC &&
            ndev->dr_sw == 0) { /* huh? */
                return MACSONIC_APPLE16;
@@ -421,7 +421,7 @@ int __init mac_nubus_sonic_probe(struct net_device* dev)
        u16 sonic_dcr;
        int id = -1;
        int reg_offset, dma_bitmode;
-       
+
        /* Find the first SONIC that hasn't been initialized already */
        while ((ndev = nubus_find_type(NUBUS_CAT_NETWORK,
                                       NUBUS_TYPE_ETHERNET, ndev)) != NULL)
@@ -459,7 +459,7 @@ int __init mac_nubus_sonic_probe(struct net_device* dev)
                base_addr = ndev->board->slot_addr + APPLE_SONIC_REGISTERS;
                prom_addr = ndev->board->slot_addr + APPLE_SONIC_PROM_BASE;
                sonic_dcr = SONIC_DCR_EXBUS | SONIC_DCR_RFT1 | SONIC_DCR_TFT0 |
-                           SONIC_DCR_PO1 | SONIC_DCR_BMS; 
+                           SONIC_DCR_PO1 | SONIC_DCR_BMS;
                reg_offset = 0;
                dma_bitmode = SONIC_BITMODE16;
                break;
@@ -467,7 +467,7 @@ int __init mac_nubus_sonic_probe(struct net_device* dev)
                base_addr = ndev->board->slot_addr + APPLE_SONIC_REGISTERS;
                prom_addr = ndev->board->slot_addr + DAYNALINK_PROM_BASE;
                sonic_dcr = SONIC_DCR_RFT1 | SONIC_DCR_TFT0 |
-                           SONIC_DCR_PO1 | SONIC_DCR_BMS; 
+                           SONIC_DCR_PO1 | SONIC_DCR_BMS;
                reg_offset = 0;
                dma_bitmode = SONIC_BITMODE16;
                break;
@@ -622,7 +622,7 @@ static int __init mac_sonic_init_module(void)
        return 0;
 
 out_unregister:
-       driver_unregister(&mac_sonic_driver);
+       platform_driver_unregister(&mac_sonic_driver);
 
        return -ENOMEM;
 }