Staging: et131x: eliminate write only registry fields
[safe/jmp/linux-2.6] / drivers / staging / et131x / et131x_config.c
index 0adbaa6..f8273d1 100644 (file)
@@ -2,7 +2,7 @@
  * Agere Systems Inc.
  * 10/100/1000 Base-T Ethernet Driver for the ET1301 and ET131x series MACs
  *
- * Copyright © 2005 Agere Systems Inc.
+ * Copyright Â© 2005 Agere Systems Inc.
  * All rights reserved.
  *   http://www.agere.com
  *
@@ -20,7 +20,7 @@
  * software indicates your acceptance of these terms and conditions.  If you do
  * not agree with these terms and conditions, do not use the software.
  *
- * Copyright © 2005 Agere Systems Inc.
+ * Copyright Â© 2005 Agere Systems Inc.
  * All rights reserved.
  *
  * Redistribution and use in source or binary forms, with or without
@@ -41,7 +41,7 @@
  *
  * Disclaimer
  *
- * THIS SOFTWARE IS PROVIDED \93AS IS\94 AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
  * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  ANY
  * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
 #include <linux/interrupt.h>
 #include <linux/in.h>
 #include <linux/delay.h>
-#include <asm/io.h>
+#include <linux/io.h>
+#include <linux/bitops.h>
+#include <linux/pci.h>
 #include <asm/system.h>
-#include <asm/bitops.h>
 
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
@@ -198,16 +199,16 @@ MODULE_PARM_DESC(et131x_nmi_disable, "Disable NMI (0-2) [0]");
 static u32 et131x_speed_set = PARM_SPEED_DUPLEX_DEF;
 module_param(et131x_speed_set, uint, 0);
 MODULE_PARM_DESC(et131x_speed_set,
-                "Set Link speed and dublex manually (0-5)  [0] \n  1 : 10Mb   Half-Duplex \n  2 : 10Mb   Full-Duplex \n  3 : 100Mb  Half-Duplex \n  4 : 100Mb  Full-Duplex \n  5 : 1000Mb Full-Duplex \n 0 : Auto Speed Auto Dublex");
+               "Set Link speed and dublex manually (0-5)  [0] \n  1 : 10Mb   Half-Duplex \n  2 : 10Mb   Full-Duplex \n  3 : 100Mb  Half-Duplex \n  4 : 100Mb  Full-Duplex \n  5 : 1000Mb Full-Duplex \n 0 : Auto Speed Auto Dublex");
 
 /**
  * et131x_config_parse
- * @pAdapter: pointer to the private adapter struct
+ * @etdev: pointer to the private adapter struct
  *
  * Parses a configuration from some location (module parameters, for example)
  * into the private adapter struct
  */
-void et131x_config_parse(struct et131x_adapter *pAdapter)
+void et131x_config_parse(struct et131x_adapter *etdev)
 {
        uint8_t macAddrDef[] = PARM_MAC_ADDRESS_DEF;
 
@@ -237,87 +238,80 @@ void et131x_config_parse(struct et131x_adapter *pAdapter)
        if (et131x_speed_set != PARM_SPEED_DUPLEX_DEF) {
                DBG_VERBOSE(et131x_dbginfo, "Speed set manually to : %d \n",
                            et131x_speed_set);
-               pAdapter->SpeedDuplex = et131x_speed_set;
+               etdev->SpeedDuplex = et131x_speed_set;
        } else {
-               pAdapter->SpeedDuplex = PARM_SPEED_DUPLEX_DEF;
+               etdev->SpeedDuplex = PARM_SPEED_DUPLEX_DEF;
        }
 
-       //  pAdapter->SpeedDuplex            = PARM_SPEED_DUPLEX_DEF;
-
-       pAdapter->RegistryVlanTag = PARM_VLAN_TAG_DEF;
-       pAdapter->RegistryFlowControl = PARM_FLOW_CTL_DEF;
-       pAdapter->RegistryWOLLink = PARM_WOL_LINK_DEF;
-       pAdapter->RegistryWOLMatch = PARM_WOL_MATCH_DEF;
-       pAdapter->RegistryJumboPacket = PARM_JUMBO_PKT_DEF;
-       pAdapter->RegistryPhyComa = PARM_PHY_COMA_DEF;
-       pAdapter->RegistryRxNumBuffers = PARM_RX_NUM_BUFS_DEF;
-       pAdapter->RegistryRxTimeInterval = PARM_RX_TIME_INT_DEF;
-       pAdapter->RegistryTxNumBuffers = PARM_TX_NUM_BUFS_DEF;
-       pAdapter->RegistryTxTimeInterval = PARM_TX_TIME_INT_DEF;
-       pAdapter->RegistryRxMemEnd = PARM_RX_MEM_END_DEF;
-       pAdapter->RegistryMACStat = PARM_MAC_STAT_DEF;
-       pAdapter->RegistrySCGain = PARM_SC_GAIN_DEF;
-       pAdapter->RegistryPMWOL = PARM_PM_WOL_DEF;
-
-       if (et131x_nmi_disable != PARM_NMI_DISABLE_DEF) {
-               pAdapter->RegistryNMIDisable = et131x_nmi_disable;
-       } else {
-               pAdapter->RegistryNMIDisable = PARM_NMI_DISABLE_DEF;
-       }
+       /*  etdev->SpeedDuplex            = PARM_SPEED_DUPLEX_DEF; */
+
+       etdev->RegistryVlanTag = PARM_VLAN_TAG_DEF;
+       etdev->RegistryFlowControl = PARM_FLOW_CTL_DEF;
+       etdev->RegistryJumboPacket = PARM_JUMBO_PKT_DEF;
+       etdev->RegistryPhyComa = PARM_PHY_COMA_DEF;
+       etdev->RegistryRxNumBuffers = PARM_RX_NUM_BUFS_DEF;
+       etdev->RegistryRxTimeInterval = PARM_RX_TIME_INT_DEF;
+       etdev->RegistryTxNumBuffers = PARM_TX_NUM_BUFS_DEF;
+       etdev->RegistryTxTimeInterval = PARM_TX_TIME_INT_DEF;
+       etdev->RegistryRxMemEnd = PARM_RX_MEM_END_DEF;
+       etdev->RegistryMACStat = PARM_MAC_STAT_DEF;
 
-       pAdapter->RegistryDMACache = PARM_DMA_CACHE_DEF;
-       pAdapter->RegistryPhyLoopbk = PARM_PHY_LOOPBK_DEF;
+       if (et131x_nmi_disable != PARM_NMI_DISABLE_DEF)
+               etdev->RegistryNMIDisable = et131x_nmi_disable;
+       else
+               etdev->RegistryNMIDisable = PARM_NMI_DISABLE_DEF;
+
+       etdev->RegistryPhyLoopbk = PARM_PHY_LOOPBK_DEF;
 
        /* Set the MAC address to a default */
-       memcpy(pAdapter->CurrentAddress, macAddrDef, ETH_ALEN);
-       pAdapter->bOverrideAddress = false;
+       memcpy(etdev->CurrentAddress, macAddrDef, ETH_ALEN);
+       etdev->bOverrideAddress = false;
 
        DBG_TRACE(et131x_dbginfo,
                  "Default MAC Address  : %02x:%02x:%02x:%02x:%02x:%02x\n",
-                 pAdapter->CurrentAddress[0], pAdapter->CurrentAddress[1],
-                 pAdapter->CurrentAddress[2], pAdapter->CurrentAddress[3],
-                 pAdapter->CurrentAddress[4], pAdapter->CurrentAddress[5]);
+                 etdev->CurrentAddress[0], etdev->CurrentAddress[1],
+                 etdev->CurrentAddress[2], etdev->CurrentAddress[3],
+                 etdev->CurrentAddress[4], etdev->CurrentAddress[5]);
 
        /* Decode SpeedDuplex
         *
         * Set up as if we are auto negotiating always and then change if we
         * go into force mode
         */
-       pAdapter->AiForceSpeed = 0;     // Auto speed
-       pAdapter->AiForceDpx = 0;       // Auto FDX
+       etdev->AiForceSpeed = 0;        /* Auto speed */
+       etdev->AiForceDpx = 0;  /* Auto FDX */
 
        /* If we are the 10/100 device, and gigabit is somehow requested then
         * knock it down to 100 full.
         */
-       if ((pAdapter->DeviceID == ET131X_PCI_DEVICE_ID_FAST) &&
-           (pAdapter->SpeedDuplex == 5)) {
-               pAdapter->SpeedDuplex = 4;
-       }
-
-       switch (pAdapter->SpeedDuplex) {
-       case 1:         // 10Mb   Half-Duplex
-               pAdapter->AiForceSpeed = 10;
-               pAdapter->AiForceDpx = 1;
+       if (etdev->pdev->device == ET131X_PCI_DEVICE_ID_FAST &&
+           etdev->SpeedDuplex == 5)
+               etdev->SpeedDuplex = 4;
+
+       switch (etdev->SpeedDuplex) {
+       case 1:         /* 10Mb   Half-Duplex */
+               etdev->AiForceSpeed = 10;
+               etdev->AiForceDpx = 1;
                break;
 
-       case 2:         // 10Mb   Full-Duplex
-               pAdapter->AiForceSpeed = 10;
-               pAdapter->AiForceDpx = 2;
+       case 2:         /* 10Mb   Full-Duplex */
+               etdev->AiForceSpeed = 10;
+               etdev->AiForceDpx = 2;
                break;
 
-       case 3:         // 100Mb  Half-Duplex
-               pAdapter->AiForceSpeed = 100;
-               pAdapter->AiForceDpx = 1;
+       case 3:         /* 100Mb  Half-Duplex */
+               etdev->AiForceSpeed = 100;
+               etdev->AiForceDpx = 1;
                break;
 
-       case 4:         // 100Mb  Full-Duplex
-               pAdapter->AiForceSpeed = 100;
-               pAdapter->AiForceDpx = 2;
+       case 4:         /* 100Mb  Full-Duplex */
+               etdev->AiForceSpeed = 100;
+               etdev->AiForceDpx = 2;
                break;
 
-       case 5:         // 1000Mb Full-Duplex
-               pAdapter->AiForceSpeed = 1000;
-               pAdapter->AiForceDpx = 2;
+       case 5:         /* 1000Mb Full-Duplex */
+               etdev->AiForceSpeed = 1000;
+               etdev->AiForceDpx = 2;
                break;
        }