diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2009-02-10 18:19:02 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-13 13:46:04 -0500 |
commit | 3fdb68de22c9881691c485b05ed3204bdc431a18 (patch) | |
tree | 6a898270c086aa90c7f9716504a73376c811c63b /drivers/net | |
parent | fe3d2c3fe32dd4d0a421ba39caba1cf87402314e (diff) |
iwlwifi: use pci registers defined in pci_regs.h
This patch replaces where possible usage of pci register
defined in the driver by ones defined in pci_regs.h
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-3945-hw.h | 6 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945.c | 19 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965-hw.h | 7 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 23 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-5000.c | 13 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.h | 8 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-power.c | 6 |
8 files changed, 40 insertions, 48 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h index 1327b2ac1c53..205603d082aa 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h | |||
@@ -229,12 +229,6 @@ struct iwl3945_eeprom { | |||
229 | 229 | ||
230 | /* End of EEPROM */ | 230 | /* End of EEPROM */ |
231 | 231 | ||
232 | |||
233 | #define PCI_LINK_CTRL 0x0F0 | ||
234 | #define PCI_POWER_SOURCE 0x0C8 | ||
235 | #define PCI_REG_WUM8 0x0E8 | ||
236 | #define PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT (0x80000000) | ||
237 | |||
238 | #define PCI_CFG_REV_ID_BIT_BASIC_SKU (0x40) /* bit 6 */ | 232 | #define PCI_CFG_REV_ID_BIT_BASIC_SKU (0x40) /* bit 6 */ |
239 | #define PCI_CFG_REV_ID_BIT_RTP (0x80) /* bit 7 */ | 233 | #define PCI_CFG_REV_ID_BIT_RTP (0x80) /* bit 7 */ |
240 | 234 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index cb6db4525dc3..d2df4945ca6a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -905,22 +905,18 @@ u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate, u8 flags) | |||
905 | 905 | ||
906 | static int iwl3945_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src) | 906 | static int iwl3945_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src) |
907 | { | 907 | { |
908 | int rc; | 908 | int ret; |
909 | unsigned long flags; | 909 | unsigned long flags; |
910 | 910 | ||
911 | spin_lock_irqsave(&priv->lock, flags); | 911 | spin_lock_irqsave(&priv->lock, flags); |
912 | rc = iwl_grab_nic_access(priv); | 912 | ret = iwl_grab_nic_access(priv); |
913 | if (rc) { | 913 | if (ret) { |
914 | spin_unlock_irqrestore(&priv->lock, flags); | 914 | spin_unlock_irqrestore(&priv->lock, flags); |
915 | return rc; | 915 | return ret; |
916 | } | 916 | } |
917 | 917 | ||
918 | if (src == IWL_PWR_SRC_VAUX) { | 918 | if (src == IWL_PWR_SRC_VAUX) { |
919 | u32 val; | 919 | if (pci_pme_capable(priv->pci_dev, PCI_D3cold)) { |
920 | |||
921 | rc = pci_read_config_dword(priv->pci_dev, | ||
922 | PCI_POWER_SOURCE, &val); | ||
923 | if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) { | ||
924 | iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, | 920 | iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, |
925 | APMG_PS_CTRL_VAL_PWR_SRC_VAUX, | 921 | APMG_PS_CTRL_VAL_PWR_SRC_VAUX, |
926 | ~APMG_PS_CTRL_MSK_PWR_SRC); | 922 | ~APMG_PS_CTRL_MSK_PWR_SRC); |
@@ -929,8 +925,9 @@ static int iwl3945_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src) | |||
929 | iwl_poll_bit(priv, CSR_GPIO_IN, | 925 | iwl_poll_bit(priv, CSR_GPIO_IN, |
930 | CSR_GPIO_IN_VAL_VAUX_PWR_SRC, | 926 | CSR_GPIO_IN_VAL_VAUX_PWR_SRC, |
931 | CSR_GPIO_IN_BIT_AUX_POWER, 5000); | 927 | CSR_GPIO_IN_BIT_AUX_POWER, 5000); |
932 | } else | 928 | } else { |
933 | iwl_release_nic_access(priv); | 929 | iwl_release_nic_access(priv); |
930 | } | ||
934 | } else { | 931 | } else { |
935 | iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, | 932 | iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, |
936 | APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, | 933 | APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, |
@@ -942,7 +939,7 @@ static int iwl3945_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src) | |||
942 | } | 939 | } |
943 | spin_unlock_irqrestore(&priv->lock, flags); | 940 | spin_unlock_irqrestore(&priv->lock, flags); |
944 | 941 | ||
945 | return rc; | 942 | return ret; |
946 | } | 943 | } |
947 | 944 | ||
948 | static int iwl3945_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | 945 | static int iwl3945_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h index af4c1bb0de14..a71a489096ff 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h | |||
@@ -92,19 +92,12 @@ | |||
92 | #define IWL49_RSSI_OFFSET 44 | 92 | #define IWL49_RSSI_OFFSET 44 |
93 | 93 | ||
94 | 94 | ||
95 | |||
96 | /* PCI registers */ | 95 | /* PCI registers */ |
97 | #define PCI_CFG_RETRY_TIMEOUT 0x041 | 96 | #define PCI_CFG_RETRY_TIMEOUT 0x041 |
98 | #define PCI_CFG_POWER_SOURCE 0x0C8 | ||
99 | #define PCI_REG_WUM8 0x0E8 | ||
100 | #define PCI_CFG_LINK_CTRL 0x0F0 | ||
101 | 97 | ||
102 | /* PCI register values */ | 98 | /* PCI register values */ |
103 | #define PCI_CFG_LINK_CTRL_VAL_L0S_EN 0x01 | 99 | #define PCI_CFG_LINK_CTRL_VAL_L0S_EN 0x01 |
104 | #define PCI_CFG_LINK_CTRL_VAL_L1_EN 0x02 | 100 | #define PCI_CFG_LINK_CTRL_VAL_L1_EN 0x02 |
105 | #define PCI_CFG_CMD_REG_INT_DIS_MSK 0x04 | ||
106 | #define PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT (0x80000000) | ||
107 | |||
108 | 101 | ||
109 | #define IWL_NUM_SCAN_RATES (2) | 102 | #define IWL_NUM_SCAN_RATES (2) |
110 | 103 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 0638f3e37602..ead947b4d303 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -381,27 +381,30 @@ out: | |||
381 | static void iwl4965_nic_config(struct iwl_priv *priv) | 381 | static void iwl4965_nic_config(struct iwl_priv *priv) |
382 | { | 382 | { |
383 | unsigned long flags; | 383 | unsigned long flags; |
384 | u32 val; | 384 | u16 dctl; |
385 | u16 radio_cfg; | 385 | u16 radio_cfg; |
386 | u16 link; | 386 | u16 lctl; |
387 | 387 | ||
388 | spin_lock_irqsave(&priv->lock, flags); | 388 | spin_lock_irqsave(&priv->lock, flags); |
389 | 389 | ||
390 | if ((priv->rev_id & 0x80) == 0x80 && (priv->rev_id & 0x7f) < 8) { | 390 | if ((priv->rev_id & 0x80) == 0x80 && (priv->rev_id & 0x7f) < 8) { |
391 | pci_read_config_dword(priv->pci_dev, PCI_REG_WUM8, &val); | 391 | int pos = pci_find_capability(priv->pci_dev, PCI_CAP_ID_EXP); |
392 | pci_read_config_word(priv->pci_dev, pos + PCI_EXP_DEVCTL, &dctl); | ||
393 | |||
392 | /* Enable No Snoop field */ | 394 | /* Enable No Snoop field */ |
393 | pci_write_config_dword(priv->pci_dev, PCI_REG_WUM8, | 395 | pci_write_config_word(priv->pci_dev, pos + PCI_EXP_DEVCTL, |
394 | val & ~(1 << 11)); | 396 | dctl & ~PCI_EXP_DEVCTL_NOSNOOP_EN); |
395 | } | 397 | } |
396 | 398 | ||
397 | pci_read_config_word(priv->pci_dev, PCI_CFG_LINK_CTRL, &link); | 399 | lctl = iwl_pcie_link_ctl(priv); |
398 | 400 | ||
399 | /* L1 is enabled by BIOS */ | 401 | /* HW bug W/A - negligible power consumption */ |
400 | if ((link & PCI_CFG_LINK_CTRL_VAL_L1_EN) == PCI_CFG_LINK_CTRL_VAL_L1_EN) | 402 | /* L1-ASPM is enabled by BIOS */ |
401 | /* disable L0S disabled L1A enabled */ | 403 | if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) == PCI_CFG_LINK_CTRL_VAL_L1_EN) |
404 | /* L1-ASPM enabled: disable L0S */ | ||
402 | iwl_set_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); | 405 | iwl_set_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); |
403 | else | 406 | else |
404 | /* L0S enabled L1A disabled */ | 407 | /* L1-ASPM disabled: enable L0S */ |
405 | iwl_clear_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); | 408 | iwl_clear_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); |
406 | 409 | ||
407 | radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG); | 410 | radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index e3cba61d1543..ab39f4ae8e32 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -219,18 +219,19 @@ static void iwl5000_nic_config(struct iwl_priv *priv) | |||
219 | { | 219 | { |
220 | unsigned long flags; | 220 | unsigned long flags; |
221 | u16 radio_cfg; | 221 | u16 radio_cfg; |
222 | u16 link; | 222 | u16 lctl; |
223 | 223 | ||
224 | spin_lock_irqsave(&priv->lock, flags); | 224 | spin_lock_irqsave(&priv->lock, flags); |
225 | 225 | ||
226 | pci_read_config_word(priv->pci_dev, PCI_CFG_LINK_CTRL, &link); | 226 | lctl = iwl_pcie_link_ctl(priv); |
227 | 227 | ||
228 | /* L1 is enabled by BIOS */ | 228 | /* HW bug W/A */ |
229 | if ((link & PCI_CFG_LINK_CTRL_VAL_L1_EN) == PCI_CFG_LINK_CTRL_VAL_L1_EN) | 229 | /* L1-ASPM is enabled by BIOS */ |
230 | /* disable L0S disabled L1A enabled */ | 230 | if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) == PCI_CFG_LINK_CTRL_VAL_L1_EN) |
231 | /* L1-APSM enabled: disable L0S */ | ||
231 | iwl_set_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); | 232 | iwl_set_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); |
232 | else | 233 | else |
233 | /* L0S enabled L1A disabled */ | 234 | /* L1-ASPM disabled: enable L0S */ |
234 | iwl_clear_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); | 235 | iwl_clear_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); |
235 | 236 | ||
236 | radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG); | 237 | radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 539960da7e13..397577c06c92 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -940,11 +940,7 @@ int iwl_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src) | |||
940 | goto err; | 940 | goto err; |
941 | 941 | ||
942 | if (src == IWL_PWR_SRC_VAUX) { | 942 | if (src == IWL_PWR_SRC_VAUX) { |
943 | u32 val; | 943 | if (pci_pme_capable(priv->pci_dev, PCI_D3cold)) |
944 | ret = pci_read_config_dword(priv->pci_dev, PCI_CFG_POWER_SOURCE, | ||
945 | &val); | ||
946 | |||
947 | if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) | ||
948 | iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, | 944 | iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG, |
949 | APMG_PS_CTRL_VAL_PWR_SRC_VAUX, | 945 | APMG_PS_CTRL_VAL_PWR_SRC_VAUX, |
950 | ~APMG_PS_CTRL_MSK_PWR_SRC); | 946 | ~APMG_PS_CTRL_MSK_PWR_SRC); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index d79912ba6a2f..9d464ec99dd5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -410,6 +410,14 @@ int iwl_send_card_state(struct iwl_priv *priv, u32 flags, | |||
410 | *****************************************************/ | 410 | *****************************************************/ |
411 | void iwl_disable_interrupts(struct iwl_priv *priv); | 411 | void iwl_disable_interrupts(struct iwl_priv *priv); |
412 | void iwl_enable_interrupts(struct iwl_priv *priv); | 412 | void iwl_enable_interrupts(struct iwl_priv *priv); |
413 | static inline u16 iwl_pcie_link_ctl(struct iwl_priv *priv) | ||
414 | { | ||
415 | int pos; | ||
416 | u16 pci_lnk_ctl; | ||
417 | pos = pci_find_capability(priv->pci_dev, PCI_CAP_ID_EXP); | ||
418 | pci_read_config_word(priv->pci_dev, pos + PCI_EXP_LNKCTL, &pci_lnk_ctl); | ||
419 | return pci_lnk_ctl; | ||
420 | } | ||
413 | 421 | ||
414 | /***************************************************** | 422 | /***************************************************** |
415 | * Error Handling Debugging | 423 | * Error Handling Debugging |
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c index 4c5a775f48b7..18b7e4195ea1 100644 --- a/drivers/net/wireless/iwlwifi/iwl-power.c +++ b/drivers/net/wireless/iwlwifi/iwl-power.c | |||
@@ -141,7 +141,7 @@ static void iwl_power_init_handle(struct iwl_priv *priv) | |||
141 | int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_MAX; | 141 | int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_MAX; |
142 | struct iwl_powertable_cmd *cmd; | 142 | struct iwl_powertable_cmd *cmd; |
143 | int i; | 143 | int i; |
144 | u16 pci_pm; | 144 | u16 lctl; |
145 | 145 | ||
146 | IWL_DEBUG_POWER(priv, "Initialize power \n"); | 146 | IWL_DEBUG_POWER(priv, "Initialize power \n"); |
147 | 147 | ||
@@ -153,14 +153,14 @@ static void iwl_power_init_handle(struct iwl_priv *priv) | |||
153 | memcpy(&pow_data->pwr_range_1[0], &range_1[0], size); | 153 | memcpy(&pow_data->pwr_range_1[0], &range_1[0], size); |
154 | memcpy(&pow_data->pwr_range_2[0], &range_2[0], size); | 154 | memcpy(&pow_data->pwr_range_2[0], &range_2[0], size); |
155 | 155 | ||
156 | pci_read_config_word(priv->pci_dev, PCI_CFG_LINK_CTRL, &pci_pm); | 156 | lctl = iwl_pcie_link_ctl(priv); |
157 | 157 | ||
158 | IWL_DEBUG_POWER(priv, "adjust power command flags\n"); | 158 | IWL_DEBUG_POWER(priv, "adjust power command flags\n"); |
159 | 159 | ||
160 | for (i = 0; i < IWL_POWER_MAX; i++) { | 160 | for (i = 0; i < IWL_POWER_MAX; i++) { |
161 | cmd = &pow_data->pwr_range_0[i].cmd; | 161 | cmd = &pow_data->pwr_range_0[i].cmd; |
162 | 162 | ||
163 | if (pci_pm & PCI_CFG_LINK_CTRL_VAL_L0S_EN) | 163 | if (lctl & PCI_CFG_LINK_CTRL_VAL_L0S_EN) |
164 | cmd->flags &= ~IWL_POWER_PCI_PM_MSK; | 164 | cmd->flags &= ~IWL_POWER_PCI_PM_MSK; |
165 | else | 165 | else |
166 | cmd->flags |= IWL_POWER_PCI_PM_MSK; | 166 | cmd->flags |= IWL_POWER_PCI_PM_MSK; |