Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-nmw
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / iwl-pci.c
index 0c16efebf93d0fd1ffaed8d75a6003829e5b2190..c5e339ee918b03bb49c689eca7f33b0fc7ad592a 100644 (file)
 #include <linux/pci.h>
 #include <linux/pci-aspm.h>
 
-#include "iwl-bus.h"
 #include "iwl-io.h"
 #include "iwl-shared.h"
 #include "iwl-trans.h"
 #include "iwl-csr.h"
 #include "iwl-cfg.h"
-
-/* PCI registers */
-#define PCI_CFG_RETRY_TIMEOUT  0x041
-#define PCI_CFG_LINK_CTRL_VAL_L0S_EN   0x01
-#define PCI_CFG_LINK_CTRL_VAL_L1_EN    0x02
-
-struct iwl_pci_bus {
-       /* basic pci-network driver stuff */
-       struct pci_dev *pci_dev;
-};
-
-#define IWL_BUS_GET_PCI_BUS(_iwl_bus) \
-                       ((struct iwl_pci_bus *) ((_iwl_bus)->bus_specific))
-
-#define IWL_BUS_GET_PCI_DEV(_iwl_bus) \
-                       ((IWL_BUS_GET_PCI_BUS(_iwl_bus))->pci_dev)
-
-static void iwl_pci_get_hw_id_string(struct iwl_bus *bus, char buf[],
-                             int buf_len)
-{
-       struct pci_dev *pci_dev = IWL_BUS_GET_PCI_DEV(bus);
-
-       snprintf(buf, buf_len, "PCI ID: 0x%04X:0x%04X", pci_dev->device,
-                pci_dev->subsystem_device);
-}
-
-static u32 iwl_pci_get_hw_id(struct iwl_bus *bus)
-{
-       struct pci_dev *pci_dev = IWL_BUS_GET_PCI_DEV(bus);
-
-       return (pci_dev->device << 16) + pci_dev->subsystem_device;
-}
-
-static const struct iwl_bus_ops bus_ops_pci = {
-       .get_hw_id_string = iwl_pci_get_hw_id_string,
-       .get_hw_id = iwl_pci_get_hw_id,
-};
+#include "iwl-drv.h"
+#include "iwl-trans.h"
 
 #define IWL_PCI_DEVICE(dev, subdev, cfg) \
        .vendor = PCI_VENDOR_ID_INTEL,  .device = (dev), \
@@ -194,9 +158,9 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = {
        {IWL_PCI_DEVICE(0x0085, 0x1316, iwl6005_2abg_cfg)},
        {IWL_PCI_DEVICE(0x0082, 0xC020, iwl6005_2agn_sff_cfg)},
        {IWL_PCI_DEVICE(0x0085, 0xC220, iwl6005_2agn_sff_cfg)},
-       {IWL_PCI_DEVICE(0x0082, 0x1341, iwl6005_2agn_d_cfg)},
-       {IWL_PCI_DEVICE(0x0082, 0x1304, iwl6005_2agn_cfg)},/* low 5GHz active */
-       {IWL_PCI_DEVICE(0x0082, 0x1305, iwl6005_2agn_cfg)},/* high 5GHz active */
+       {IWL_PCI_DEVICE(0x0082, 0x4820, iwl6005_2agn_d_cfg)},
+       {IWL_PCI_DEVICE(0x0082, 0x1304, iwl6005_2agn_mow1_cfg)},/* low 5GHz active */
+       {IWL_PCI_DEVICE(0x0082, 0x1305, iwl6005_2agn_mow2_cfg)},/* high 5GHz active */
 
 /* 6x30 Series */
        {IWL_PCI_DEVICE(0x008A, 0x5305, iwl1030_bgn_cfg)},
@@ -277,6 +241,7 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = {
        {IWL_PCI_DEVICE(0x088E, 0x4060, iwl6035_2agn_cfg)},
        {IWL_PCI_DEVICE(0x088F, 0x4260, iwl6035_2agn_cfg)},
        {IWL_PCI_DEVICE(0x088E, 0x4460, iwl6035_2agn_cfg)},
+       {IWL_PCI_DEVICE(0x088E, 0x4860, iwl6035_2agn_cfg)},
 
 /* 105 Series */
        {IWL_PCI_DEVICE(0x0894, 0x0022, iwl105_bgn_cfg)},
@@ -293,79 +258,62 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = {
 };
 MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids);
 
+/* PCI registers */
+#define PCI_CFG_RETRY_TIMEOUT  0x041
+
 static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
-       struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data);
-       struct iwl_bus *bus;
-       struct iwl_pci_bus *pci_bus;
+       const struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data);
+       struct iwl_shared *shrd;
+       struct iwl_trans *iwl_trans;
        int err;
 
-       bus = kzalloc(sizeof(*bus) + sizeof(*pci_bus), GFP_KERNEL);
-       if (!bus) {
-               dev_printk(KERN_ERR, &pdev->dev,
-                          "Couldn't allocate iwl_pci_bus");
-               return -ENOMEM;
-       }
-
-       bus->shrd = kzalloc(sizeof(*bus->shrd), GFP_KERNEL);
-       if (!bus->shrd) {
+       shrd = kzalloc(sizeof(*iwl_trans->shrd), GFP_KERNEL);
+       if (!shrd) {
                dev_printk(KERN_ERR, &pdev->dev,
                           "Couldn't allocate iwl_shared");
                err = -ENOMEM;
                goto out_free_bus;
        }
 
-       bus->shrd->bus = bus;
-       pci_bus = IWL_BUS_GET_PCI_BUS(bus);
-       pci_bus->pci_dev = pdev;
-
-       pci_set_drvdata(pdev, bus);
-
-       bus->ops = &bus_ops_pci;
-
 #ifdef CONFIG_IWLWIFI_IDI
-       trans(bus) = iwl_trans_idi_alloc(bus->shrd, pdev, ent);
-       if (trans(bus) == NULL) {
-               err = -ENOMEM;
-               goto out_free_bus;
-       }
-
-       err = iwl_probe(bus, &trans_ops_idi, cfg);
+       iwl_trans = iwl_trans_idi_alloc(shrd, pdev, ent);
 #else
-       trans(bus) = iwl_trans_pcie_alloc(bus->shrd, pdev, ent);
-       if (trans(bus) == NULL) {
+       iwl_trans = iwl_trans_pcie_alloc(shrd, pdev, ent);
+#endif
+       if (iwl_trans == NULL) {
                err = -ENOMEM;
                goto out_free_bus;
        }
 
-       err = iwl_probe(bus, &trans_ops_pcie, cfg);
-#endif
+       shrd->trans = iwl_trans;
+       pci_set_drvdata(pdev, iwl_trans);
+
+       err = iwl_drv_start(shrd, iwl_trans, cfg);
        if (err)
                goto out_free_trans;
 
        return 0;
 
 out_free_trans:
-       iwl_trans_free(trans(bus));
+       iwl_trans_free(iwl_trans);
        pci_set_drvdata(pdev, NULL);
 out_free_bus:
-       kfree(bus->shrd);
-       kfree(bus);
+       kfree(shrd);
        return err;
 }
 
 static void __devexit iwl_pci_remove(struct pci_dev *pdev)
 {
-       struct iwl_bus *bus = pci_get_drvdata(pdev);
-       struct iwl_shared *shrd = bus->shrd;
+       struct iwl_trans *iwl_trans = pci_get_drvdata(pdev);
+       struct iwl_shared *shrd = iwl_trans->shrd;
 
-       iwl_remove(shrd->priv);
+       iwl_drv_stop(shrd);
        iwl_trans_free(shrd->trans);
 
        pci_set_drvdata(pdev, NULL);
 
-       kfree(bus->shrd);
-       kfree(bus);
+       kfree(shrd);
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -373,22 +321,20 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)
 static int iwl_pci_suspend(struct device *device)
 {
        struct pci_dev *pdev = to_pci_dev(device);
-       struct iwl_bus *bus = pci_get_drvdata(pdev);
-       struct iwl_shared *shrd = bus->shrd;
+       struct iwl_trans *iwl_trans = pci_get_drvdata(pdev);
 
        /* Before you put code here, think about WoWLAN. You cannot check here
         * whether WoWLAN is enabled or not, and your code will run even if
         * WoWLAN is enabled - don't kill the NIC, someone may need it in Sx.
         */
 
-       return iwl_trans_suspend(shrd->trans);
+       return iwl_trans_suspend(iwl_trans);
 }
 
 static int iwl_pci_resume(struct device *device)
 {
        struct pci_dev *pdev = to_pci_dev(device);
-       struct iwl_bus *bus = pci_get_drvdata(pdev);
-       struct iwl_shared *shrd = bus->shrd;
+       struct iwl_trans *iwl_trans = pci_get_drvdata(pdev);
 
        /* Before you put code here, think about WoWLAN. You cannot check here
         * whether WoWLAN is enabled or not, and your code will run even if
@@ -401,7 +347,7 @@ static int iwl_pci_resume(struct device *device)
         */
        pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00);
 
-       return iwl_trans_resume(shrd->trans);
+       return iwl_trans_resume(iwl_trans);
 }
 
 static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume);
This page took 0.040498 seconds and 5 git commands to generate.