diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-04-23 20:14:54 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-05-07 15:02:17 -0400 |
commit | b661c8190e91c0baeebf813fec7ff8e99e155a54 (patch) | |
tree | 9b0e754ad7972e41980f6299b96b64f2b88accb4 /drivers/net | |
parent | 91238714affef7603446207ad03a594d95d2eb9d (diff) |
iwlwifi: add iwl_hw_detect function to iwl core
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>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 10 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.c | 9 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-csr.h | 5 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 4 |
6 files changed, 22 insertions, 10 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index b8c72159b59..d1ddbf34b7f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -739,7 +739,6 @@ int iwl4965_hw_nic_init(struct iwl_priv *priv) | |||
739 | { | 739 | { |
740 | unsigned long flags; | 740 | unsigned long flags; |
741 | struct iwl4965_rx_queue *rxq = &priv->rxq; | 741 | struct iwl4965_rx_queue *rxq = &priv->rxq; |
742 | u8 rev_id; | ||
743 | u8 val_link; | 742 | u8 val_link; |
744 | u32 val; | 743 | u32 val; |
745 | int ret; | 744 | int ret; |
@@ -751,18 +750,11 @@ int iwl4965_hw_nic_init(struct iwl_priv *priv) | |||
751 | iwl_write32(priv, CSR_INT_COALESCING, 512 / 32); | 750 | iwl_write32(priv, CSR_INT_COALESCING, 512 / 32); |
752 | spin_unlock_irqrestore(&priv->lock, flags); | 751 | spin_unlock_irqrestore(&priv->lock, flags); |
753 | 752 | ||
754 | /* Determine HW type */ | ||
755 | ret = pci_read_config_byte(priv->pci_dev, PCI_REVISION_ID, &rev_id); | ||
756 | if (ret) | ||
757 | return ret; | ||
758 | |||
759 | IWL_DEBUG_INFO("HW Revision ID = 0x%X\n", rev_id); | ||
760 | |||
761 | ret = priv->cfg->ops->lib->apm_ops.set_pwr_src(priv, IWL_PWR_SRC_VMAIN); | 753 | ret = priv->cfg->ops->lib->apm_ops.set_pwr_src(priv, IWL_PWR_SRC_VMAIN); |
762 | 754 | ||
763 | spin_lock_irqsave(&priv->lock, flags); | 755 | spin_lock_irqsave(&priv->lock, flags); |
764 | 756 | ||
765 | if ((rev_id & 0x80) == 0x80 && (rev_id & 0x7f) < 8) { | 757 | if ((priv->rev_id & 0x80) == 0x80 && (priv->rev_id & 0x7f) < 8) { |
766 | pci_read_config_dword(priv->pci_dev, PCI_REG_WUM8, &val); | 758 | pci_read_config_dword(priv->pci_dev, PCI_REG_WUM8, &val); |
767 | /* Enable No Snoop field */ | 759 | /* Enable No Snoop field */ |
768 | pci_write_config_dword(priv->pci_dev, PCI_REG_WUM8, | 760 | pci_write_config_dword(priv->pci_dev, PCI_REG_WUM8, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index 6df51cca228..1ab4e2ecf79 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h | |||
@@ -1003,6 +1003,9 @@ struct iwl_priv { | |||
1003 | 1003 | ||
1004 | /* pci hardware address support */ | 1004 | /* pci hardware address support */ |
1005 | void __iomem *hw_base; | 1005 | void __iomem *hw_base; |
1006 | u32 hw_rev; | ||
1007 | u32 hw_wa_rev; | ||
1008 | u8 rev_id; | ||
1006 | 1009 | ||
1007 | /* uCode images, save to reload in case of failure */ | 1010 | /* uCode images, save to reload in case of failure */ |
1008 | struct fw_desc ucode_code; /* runtime inst */ | 1011 | struct fw_desc ucode_code; /* runtime inst */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index c336b1991f1..68de1a4700a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -36,6 +36,7 @@ struct iwl_priv; /* FIXME: remove */ | |||
36 | #include "iwl-eeprom.h" | 36 | #include "iwl-eeprom.h" |
37 | #include "iwl-4965.h" /* FIXME: remove */ | 37 | #include "iwl-4965.h" /* FIXME: remove */ |
38 | #include "iwl-core.h" | 38 | #include "iwl-core.h" |
39 | #include "iwl-io.h" | ||
39 | #include "iwl-rfkill.h" | 40 | #include "iwl-rfkill.h" |
40 | #include "iwl-power.h" | 41 | #include "iwl-power.h" |
41 | 42 | ||
@@ -73,6 +74,14 @@ out: | |||
73 | } | 74 | } |
74 | EXPORT_SYMBOL(iwl_alloc_all); | 75 | EXPORT_SYMBOL(iwl_alloc_all); |
75 | 76 | ||
77 | void iwl_hw_detect(struct iwl_priv *priv) | ||
78 | { | ||
79 | priv->hw_rev = _iwl_read32(priv, CSR_HW_REV); | ||
80 | priv->hw_wa_rev = _iwl_read32(priv, CSR_HW_REV_WA_REG); | ||
81 | pci_read_config_byte(priv->pci_dev, PCI_REVISION_ID, &priv->rev_id); | ||
82 | } | ||
83 | EXPORT_SYMBOL(iwl_hw_detect); | ||
84 | |||
76 | /** | 85 | /** |
77 | * iwlcore_clear_stations_table - Clear the driver's station table | 86 | * iwlcore_clear_stations_table - Clear the driver's station table |
78 | * | 87 | * |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index edda2ff92f7..eff076e3521 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -159,6 +159,7 @@ struct iwl_cfg { | |||
159 | 159 | ||
160 | struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg, | 160 | struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg, |
161 | struct ieee80211_ops *hw_ops); | 161 | struct ieee80211_ops *hw_ops); |
162 | void iwl_hw_detect(struct iwl_priv *priv); | ||
162 | 163 | ||
163 | void iwlcore_clear_stations_table(struct iwl_priv *priv); | 164 | void iwlcore_clear_stations_table(struct iwl_priv *priv); |
164 | void iwlcore_reset_qos(struct iwl_priv *priv); | 165 | void iwlcore_reset_qos(struct iwl_priv *priv); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-csr.h b/drivers/net/wireless/iwlwifi/iwl-csr.h index 82c7445d292..df9949ad3f6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-csr.h +++ b/drivers/net/wireless/iwlwifi/iwl-csr.h | |||
@@ -194,6 +194,11 @@ | |||
194 | #define CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW (0x08000000) | 194 | #define CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW (0x08000000) |
195 | 195 | ||
196 | 196 | ||
197 | /* HW REV */ | ||
198 | #define CSR_HW_REV_TYPE_MSK (0x00000F0) | ||
199 | #define CSR_HW_REV_TYPE_3945 (0x00000D0) | ||
200 | #define CSR_HW_REV_TYPE_4965 (0x0000000) | ||
201 | |||
197 | /* EEPROM REG */ | 202 | /* EEPROM REG */ |
198 | #define CSR_EEPROM_REG_READ_VALID_MSK (0x00000001) | 203 | #define CSR_EEPROM_REG_READ_VALID_MSK (0x00000001) |
199 | #define CSR_EEPROM_REG_BIT_CMD (0x00000002) | 204 | #define CSR_EEPROM_REG_BIT_CMD (0x00000002) |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index c837503c1e0..368fc9a9c2b 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -7459,8 +7459,10 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
7459 | (unsigned long long) pci_resource_len(pdev, 0)); | 7459 | (unsigned long long) pci_resource_len(pdev, 0)); |
7460 | IWL_DEBUG_INFO("pci_resource_base = %p\n", priv->hw_base); | 7460 | IWL_DEBUG_INFO("pci_resource_base = %p\n", priv->hw_base); |
7461 | 7461 | ||
7462 | iwl_hw_detect(priv); | ||
7462 | printk(KERN_INFO DRV_NAME | 7463 | printk(KERN_INFO DRV_NAME |
7463 | ": Detected Intel Wireless WiFi Link %s\n", priv->cfg->name); | 7464 | ": Detected Intel Wireless WiFi Link %s REV=0x%X\n", |
7465 | priv->cfg->name, priv->hw_rev); | ||
7464 | 7466 | ||
7465 | /* amp init */ | 7467 | /* amp init */ |
7466 | err = priv->cfg->ops->lib->apm_ops.init(priv); | 7468 | err = priv->cfg->ops->lib->apm_ops.init(priv); |