]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
iwlwifi: add iwl_hw_detect function to iwl core
authorTomas Winkler <tomas.winkler@intel.com>
Thu, 24 Apr 2008 00:14:54 +0000 (17:14 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 7 May 2008 19:02:17 +0000 (15:02 -0400)
This patch add iwl_hw_detect function to iwl core

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-4965.c
drivers/net/wireless/iwlwifi/iwl-4965.h
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-core.h
drivers/net/wireless/iwlwifi/iwl-csr.h
drivers/net/wireless/iwlwifi/iwl4965-base.c

index b8c72159b595a31d85cea370f9225260eb86a553..d1ddbf34b7fe5b38cd9189089c1d2a0dffe7ed69 100644 (file)
@@ -739,7 +739,6 @@ int iwl4965_hw_nic_init(struct iwl_priv *priv)
 {
        unsigned long flags;
        struct iwl4965_rx_queue *rxq = &priv->rxq;
-       u8 rev_id;
        u8 val_link;
        u32 val;
        int ret;
@@ -751,18 +750,11 @@ int iwl4965_hw_nic_init(struct iwl_priv *priv)
        iwl_write32(priv, CSR_INT_COALESCING, 512 / 32);
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       /* Determine HW type */
-       ret = pci_read_config_byte(priv->pci_dev, PCI_REVISION_ID, &rev_id);
-       if (ret)
-               return ret;
-
-       IWL_DEBUG_INFO("HW Revision ID = 0x%X\n", rev_id);
-
        ret = priv->cfg->ops->lib->apm_ops.set_pwr_src(priv, IWL_PWR_SRC_VMAIN);
 
        spin_lock_irqsave(&priv->lock, flags);
 
-       if ((rev_id & 0x80) == 0x80 && (rev_id & 0x7f) < 8) {
+       if ((priv->rev_id & 0x80) == 0x80 && (priv->rev_id & 0x7f) < 8) {
                pci_read_config_dword(priv->pci_dev, PCI_REG_WUM8, &val);
                /* Enable No Snoop field */
                pci_write_config_dword(priv->pci_dev, PCI_REG_WUM8,
index 6df51cca22890aaaa2fb6be988188751282d4e81..1ab4e2ecf79a804b0da85d05290574f6f7db9855 100644 (file)
@@ -1003,6 +1003,9 @@ struct iwl_priv {
 
        /* pci hardware address support */
        void __iomem *hw_base;
+       u32  hw_rev;
+       u32  hw_wa_rev;
+       u8   rev_id;
 
        /* uCode images, save to reload in case of failure */
        struct fw_desc ucode_code;      /* runtime inst */
index c336b1991f1ab8e4b49cf3570f435126cdf80070..68de1a4700a6ecf93f354d3f6e78eb03ca89da07 100644 (file)
@@ -36,6 +36,7 @@ struct iwl_priv; /* FIXME: remove */
 #include "iwl-eeprom.h"
 #include "iwl-4965.h" /* FIXME: remove */
 #include "iwl-core.h"
+#include "iwl-io.h"
 #include "iwl-rfkill.h"
 #include "iwl-power.h"
 
@@ -73,6 +74,14 @@ out:
 }
 EXPORT_SYMBOL(iwl_alloc_all);
 
+void iwl_hw_detect(struct iwl_priv *priv)
+{
+       priv->hw_rev = _iwl_read32(priv, CSR_HW_REV);
+       priv->hw_wa_rev = _iwl_read32(priv, CSR_HW_REV_WA_REG);
+       pci_read_config_byte(priv->pci_dev, PCI_REVISION_ID, &priv->rev_id);
+}
+EXPORT_SYMBOL(iwl_hw_detect);
+
 /**
  * iwlcore_clear_stations_table - Clear the driver's station table
  *
index edda2ff92f7b2d03c68ac01b05546fa4186ff44b..eff076e3521ce6d331f3b3ef12f8c38efd13e295 100644 (file)
@@ -159,6 +159,7 @@ struct iwl_cfg {
 
 struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg,
                struct ieee80211_ops *hw_ops);
+void iwl_hw_detect(struct iwl_priv *priv);
 
 void iwlcore_clear_stations_table(struct iwl_priv *priv);
 void iwlcore_reset_qos(struct iwl_priv *priv);
index 82c7445d292754c08f083e5eaf4c0bff6b793f76..df9949ad3f61490b8be8979d4ab48de93dbaa86f 100644 (file)
 #define CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW          (0x08000000)
 
 
+/* HW REV */
+#define CSR_HW_REV_TYPE_MSK            (0x00000F0)
+#define CSR_HW_REV_TYPE_3945           (0x00000D0)
+#define CSR_HW_REV_TYPE_4965           (0x0000000)
+
 /* EEPROM REG */
 #define CSR_EEPROM_REG_READ_VALID_MSK  (0x00000001)
 #define CSR_EEPROM_REG_BIT_CMD         (0x00000002)
index c837503c1e0abc27ffbaeefb33772e1517579afb..368fc9a9c2b0a610dfd7c67170decf4e3c6e8246 100644 (file)
@@ -7459,8 +7459,10 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
                (unsigned long long) pci_resource_len(pdev, 0));
        IWL_DEBUG_INFO("pci_resource_base = %p\n", priv->hw_base);
 
+       iwl_hw_detect(priv);
        printk(KERN_INFO DRV_NAME
-               ": Detected Intel Wireless WiFi Link %s\n", priv->cfg->name);
+               ": Detected Intel Wireless WiFi Link %s REV=0x%X\n",
+               priv->cfg->name, priv->hw_rev);
 
        /* amp init */
        err = priv->cfg->ops->lib->apm_ops.init(priv);