VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / drivers / net / wireless / prism54 / islpci_hotplug.c
index 34b3b59..11b315b 100644 (file)
 #include <linux/delay.h>
 #include <linux/init.h> /* For __init, __exit */
 
+#include "prismcompat.h"
 #include "islpci_dev.h"
 #include "islpci_mgt.h"                /* for pc_debug */
 #include "isl_oid.h"
 
 #define DRV_NAME       "prism54"
-#define DRV_VERSION    "1.1"
+#define DRV_VERSION    "1.2"
 
 MODULE_AUTHOR("[Intersil] R.Bastings and W.Termorshuizen, The prism54.org Development Team <prism54-devel@prism54.org>");
 MODULE_DESCRIPTION("The Prism54 802.11 Wireless LAN adapter");
 MODULE_LICENSE("GPL");
 
+static int     init_pcitm = 0;
+module_param(init_pcitm, int, 0);
+
 /* In this order: vendor, device, subvendor, subdevice, class, class_mask,
  * driver_data 
- * Note: for driver_data we put the device's name 
  * If you have an update for this please contact prism54-devel@prism54.org 
  * The latest list can be found at http://prism54.org/supported_cards.php */
 static const struct pci_device_id prism54_id_tbl[] = {
+       /* Intersil PRISM Duette/Prism GT Wireless LAN adapter */
        {
-        PCIVENDOR_3COM, PCIDEVICE_3COM6001,
-        PCIVENDOR_3COM, PCIDEVICE_3COM6001,
-        0, 0,
-        (unsigned long) "3COM 3CRWE154G72 Wireless LAN adapter"},
-       {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
-        PCIVENDOR_DLINK, 0x3202UL, 
-        0, 0,
-        (unsigned long) "D-Link Air Plus Xtreme G A1 - DWL-g650 A1"},
-       {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
-        PCIVENDOR_IODATA, 0xd019UL, 
-        0, 0,
-        (unsigned long) "I-O Data WN-G54/CB - WN-G54/CB"},
-       {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
-        PCIVENDOR_NETGEAR, 0x4800UL,
-        0, 0,
-        (unsigned long) "Netgear WG511"},
-       {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
-        PCIVENDOR_I4, 0x0020UL,
-        0, 0,
-        (unsigned long) "PLANEX GW-DS54G"},
-       {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
-        PCIVENDOR_SMC, 0x2802UL,
-        0, 0,
-        (unsigned long) "EZ Connect g 2.4GHz 54 Mbps Wireless PCI Card - SMC2802W"},
-       {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
-        PCIVENDOR_SMC, 0x2835UL,
-        0, 0,
-        (unsigned long) "EZ Connect g 2.4GHz 54 Mbps Wireless Cardbus Adapter - SMC2835W"},
-       {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
-        PCIVENDOR_INTERSIL, 0x0000UL, /* This was probably a bogus reading... */
-        0, 0,
-        (unsigned long) "SparkLAN WL-850F"},
-       {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
-        PCIVENDOR_I4, 0x0014UL,
-        0, 0,
-        (unsigned long) "I4 Z-Com XG-600"},
-       {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
-        PCIVENDOR_I4, 0x0020UL,
-        0, 0,
-        (unsigned long) "I4 Z-Com XG-900/PLANEX GW-DS54G"},
-       {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
-        PCIVENDOR_ACCTON, 0xee03UL,
-        0, 0,
-        (unsigned long) "SMC 2802Wv2"},
+        0x1260, 0x3890,
+        PCI_ANY_ID, PCI_ANY_ID,
+        0, 0, 0
+       },
+
+       /* 3COM 3CRWE154G72 Wireless LAN adapter */
        {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
-        PCIVENDOR_SMC, 0xa835UL,
-        0, 0,
-        (unsigned long) "SMC 2835Wv2"},
+        0x10b7, 0x6001,
+        PCI_ANY_ID, PCI_ANY_ID,
+        0, 0, 0
+       },
+
+       /* Intersil PRISM Indigo Wireless LAN adapter */
        {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3877,
+        0x1260, 0x3877,
         PCI_ANY_ID, PCI_ANY_ID,
-        0, 0,
-        (unsigned long) "Intersil PRISM Indigo Wireless LAN adapter"},
-       { /* Default */
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
+        0, 0, 0
+       },
+
+       /* Intersil PRISM Javelin/Xbow Wireless LAN adapter */
+       {
+        0x1260, 0x3886,
         PCI_ANY_ID, PCI_ANY_ID,
-        0, 0,
-        (unsigned long) "Intersil PRISM Duette/Prism GT Wireless LAN adapter"},
-       {0,}
+        0, 0, 0
+       },
+
+       /* End of list */
+       {0,0,0,0,0,0,0}
 };
 
 /* register the device with the Hotplug facilities of the kernel */
@@ -132,69 +94,6 @@ static struct pci_driver prism54_driver = {
        /* .enable_wake ; we don't support this yet */
 };
 
-static void
-prism54_get_card_model(struct net_device *ndev)
-{
-       islpci_private  *priv;
-       char            *modelp;
-
-       priv = netdev_priv(ndev);
-       switch (priv->pdev->subsystem_device) {
-       case PCIDEVICE_ISL3877:
-               modelp = "PRISM Indigo";
-               break;
-       case PCIDEVICE_3COM6001:
-               modelp = "3COM 3CRWE154G72";
-               break;
-       case 0x3202UL:
-               modelp = "D-Link DWL-g650 A1";
-               break;
-       case 0xd019UL:
-               modelp = "WN-G54/CB";
-               break;
-       case 0x4800UL:
-               modelp = "Netgear WG511";
-               break;
-       case 0x2802UL:
-               modelp = "SMC2802W";
-               break;
-       case 0xee03UL:
-               modelp = "SMC2802W V2";
-               break;
-       case 0x2835UL:
-               modelp = "SMC2835W";
-               break;
-       case 0xa835UL:
-               modelp = "SMC2835W V2";
-               break;
-       /* Let's leave this one out for now since it seems bogus/wrong 
-        * Even if the manufacturer did use 0x0000UL it may not be correct
-        * by their part, therefore deserving no name ;) */
-       /*      case 0x0000UL: 
-        *              modelp = "SparkLAN WL-850F";
-        *              break;*/
-
-       /* We have two reported for the one below :( */
-       case 0x0014UL:
-               modelp = "XG-600";
-               break;
-       case 0x0020UL:
-               modelp = "XG-900/GW-DS54G";
-               break;
-/* Default it */
-/*
-       case PCIDEVICE_ISL3890:
-               modelp = "PRISM Duette/GT";
-               break;
-*/
-       default:
-               modelp = "PRISM Duette/GT";
-       }
-       printk(KERN_DEBUG "%s: %s driver detected card model: %s\n",
-                       ndev->name, DRV_NAME, modelp);
-       return;
-}
-
 /******************************************************************************
     Module initialization functions
 ******************************************************************************/
@@ -245,9 +144,14 @@ prism54_probe(struct pci_dev *pdev, const struct pci_device_id *id)
         *
         *      Writing zero to both these two registers will disable both timeouts and
         *      *can* solve problems caused by devices that are slow to respond.
+        *      Make this configurable - MSW
         */
-       pci_write_config_byte(pdev, 0x40, 0);
-       pci_write_config_byte(pdev, 0x41, 0);
+       if ( init_pcitm >= 0 ) {
+               pci_write_config_byte(pdev, 0x40, (u8)init_pcitm);
+               pci_write_config_byte(pdev, 0x41, (u8)init_pcitm);
+       } else {
+               printk(KERN_INFO "PCI TRDY/RETRY unchanged\n");
+       }
 
        /* request the pci device I/O regions */
        rvalue = pci_request_regions(pdev, DRV_NAME);
@@ -269,6 +173,9 @@ prism54_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        DEBUG(SHOW_TRACING, "%s: pci_set_master(pdev)\n", DRV_NAME);
        pci_set_master(pdev);
 
+       /* enable MWI */
+       pci_set_mwi(pdev);
+
        /* setup the network device interface and its structure */
        if (!(ndev = islpci_setup(pdev))) {
                /* error configuring the driver as a network device */
@@ -296,17 +203,14 @@ prism54_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
        /* firmware upload is triggered in islpci_open */
 
-       /* Pretty card model discovery output */
-       prism54_get_card_model(ndev);
-
        return 0;
 
       do_unregister_netdev:
        unregister_netdev(ndev);
        islpci_free_memory(priv);
-       pci_set_drvdata(pdev, 0);
+       pci_set_drvdata(pdev, NULL);
        free_netdev(ndev);
-       priv = 0;
+       priv = NULL;
       do_pci_release_regions:
        pci_release_regions(pdev);
       do_pci_disable_device:
@@ -322,7 +226,7 @@ void
 prism54_remove(struct pci_dev *pdev)
 {
        struct net_device *ndev = pci_get_drvdata(pdev);
-       islpci_private *priv = ndev ? netdev_priv(ndev) : 0;
+       islpci_private *priv = ndev ? netdev_priv(ndev) : NULL;
        BUG_ON(!priv);
 
        if (!__in_cleanup_module) {
@@ -350,9 +254,9 @@ prism54_remove(struct pci_dev *pdev)
        /* free the PCI memory and unmap the remapped page */
        islpci_free_memory(priv);
 
-       pci_set_drvdata(pdev, 0);
+       pci_set_drvdata(pdev, NULL);
        free_netdev(ndev);
-       priv = 0;
+       priv = NULL;
 
        pci_release_regions(pdev);
 
@@ -363,7 +267,7 @@ int
 prism54_suspend(struct pci_dev *pdev, u32 state)
 {
        struct net_device *ndev = pci_get_drvdata(pdev);
-       islpci_private *priv = ndev ? netdev_priv(ndev) : 0;
+       islpci_private *priv = ndev ? netdev_priv(ndev) : NULL;
        BUG_ON(!priv);
 
        printk(KERN_NOTICE "%s: got suspend request (state %d)\n",
@@ -388,7 +292,7 @@ int
 prism54_resume(struct pci_dev *pdev)
 {
        struct net_device *ndev = pci_get_drvdata(pdev);
-       islpci_private *priv = ndev ? netdev_priv(ndev) : 0;
+       islpci_private *priv = ndev ? netdev_priv(ndev) : NULL;
        BUG_ON(!priv);
 
        printk(KERN_NOTICE "%s: got resume request\n", ndev->name);