diff options
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-5000.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-6000.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 62 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 13 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-debugfs.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-eeprom.c | 190 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-eeprom.h | 14 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-shared.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-testmode.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-trans.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-ucode.c | 12 |
13 files changed, 155 insertions, 172 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index 8870370e0da3..056d55242f81 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -126,10 +126,10 @@ static struct iwl_sensitivity_ranges iwl5150_sensitivity = { | |||
126 | 126 | ||
127 | #define IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF (-5) | 127 | #define IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF (-5) |
128 | 128 | ||
129 | static s32 iwl_temp_calib_to_offset(struct iwl_shared *shrd) | 129 | static s32 iwl_temp_calib_to_offset(struct iwl_priv *priv) |
130 | { | 130 | { |
131 | u16 temperature, voltage; | 131 | u16 temperature, voltage; |
132 | __le16 *temp_calib = (__le16 *)iwl_eeprom_query_addr(shrd, | 132 | __le16 *temp_calib = (__le16 *)iwl_eeprom_query_addr(priv, |
133 | EEPROM_KELVIN_TEMPERATURE); | 133 | EEPROM_KELVIN_TEMPERATURE); |
134 | 134 | ||
135 | temperature = le16_to_cpu(temp_calib[0]); | 135 | temperature = le16_to_cpu(temp_calib[0]); |
@@ -143,7 +143,7 @@ static void iwl5150_set_ct_threshold(struct iwl_priv *priv) | |||
143 | { | 143 | { |
144 | const s32 volt2temp_coef = IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF; | 144 | const s32 volt2temp_coef = IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF; |
145 | s32 threshold = (s32)CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY) - | 145 | s32 threshold = (s32)CELSIUS_TO_KELVIN(CT_KILL_THRESHOLD_LEGACY) - |
146 | iwl_temp_calib_to_offset(priv->shrd); | 146 | iwl_temp_calib_to_offset(priv); |
147 | 147 | ||
148 | priv->hw_params.ct_kill_threshold = threshold * volt2temp_coef; | 148 | priv->hw_params.ct_kill_threshold = threshold * volt2temp_coef; |
149 | } | 149 | } |
@@ -189,7 +189,7 @@ static void iwl5150_hw_set_hw_params(struct iwl_priv *priv) | |||
189 | static void iwl5150_temperature(struct iwl_priv *priv) | 189 | static void iwl5150_temperature(struct iwl_priv *priv) |
190 | { | 190 | { |
191 | u32 vt = 0; | 191 | u32 vt = 0; |
192 | s32 offset = iwl_temp_calib_to_offset(priv->shrd); | 192 | s32 offset = iwl_temp_calib_to_offset(priv); |
193 | 193 | ||
194 | vt = le32_to_cpu(priv->statistics.common.temperature); | 194 | vt = le32_to_cpu(priv->statistics.common.temperature); |
195 | vt = vt / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF + offset; | 195 | vt = vt / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF + offset; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index dc07560f6920..5c8987b67f06 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
@@ -81,7 +81,7 @@ static void iwl6000_set_ct_threshold(struct iwl_priv *priv) | |||
81 | static void iwl6050_additional_nic_config(struct iwl_priv *priv) | 81 | static void iwl6050_additional_nic_config(struct iwl_priv *priv) |
82 | { | 82 | { |
83 | /* Indicate calibration version to uCode. */ | 83 | /* Indicate calibration version to uCode. */ |
84 | if (iwl_eeprom_calib_version(priv->shrd) >= 6) | 84 | if (iwl_eeprom_calib_version(priv) >= 6) |
85 | iwl_set_bit(trans(priv), CSR_GP_DRIVER_REG, | 85 | iwl_set_bit(trans(priv), CSR_GP_DRIVER_REG, |
86 | CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); | 86 | CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); |
87 | } | 87 | } |
@@ -89,7 +89,7 @@ static void iwl6050_additional_nic_config(struct iwl_priv *priv) | |||
89 | static void iwl6150_additional_nic_config(struct iwl_priv *priv) | 89 | static void iwl6150_additional_nic_config(struct iwl_priv *priv) |
90 | { | 90 | { |
91 | /* Indicate calibration version to uCode. */ | 91 | /* Indicate calibration version to uCode. */ |
92 | if (iwl_eeprom_calib_version(priv->shrd) >= 6) | 92 | if (iwl_eeprom_calib_version(priv) >= 6) |
93 | iwl_set_bit(trans(priv), CSR_GP_DRIVER_REG, | 93 | iwl_set_bit(trans(priv), CSR_GP_DRIVER_REG, |
94 | CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); | 94 | CSR_GP_DRIVER_REG_BIT_CALIB_VERSION6); |
95 | iwl_set_bit(trans(priv), CSR_GP_DRIVER_REG, | 95 | iwl_set_bit(trans(priv), CSR_GP_DRIVER_REG, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c index da67f908bab2..b5ee99e236b1 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c | |||
@@ -94,68 +94,6 @@ void iwlagn_temperature(struct iwl_priv *priv) | |||
94 | iwl_tt_handler(priv); | 94 | iwl_tt_handler(priv); |
95 | } | 95 | } |
96 | 96 | ||
97 | u16 iwl_eeprom_calib_version(struct iwl_shared *shrd) | ||
98 | { | ||
99 | struct iwl_eeprom_calib_hdr *hdr; | ||
100 | |||
101 | hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(shrd, | ||
102 | EEPROM_CALIB_ALL); | ||
103 | return hdr->version; | ||
104 | |||
105 | } | ||
106 | |||
107 | /* | ||
108 | * EEPROM | ||
109 | */ | ||
110 | static u32 eeprom_indirect_address(const struct iwl_shared *shrd, u32 address) | ||
111 | { | ||
112 | u16 offset = 0; | ||
113 | |||
114 | if ((address & INDIRECT_ADDRESS) == 0) | ||
115 | return address; | ||
116 | |||
117 | switch (address & INDIRECT_TYPE_MSK) { | ||
118 | case INDIRECT_HOST: | ||
119 | offset = iwl_eeprom_query16(shrd, EEPROM_LINK_HOST); | ||
120 | break; | ||
121 | case INDIRECT_GENERAL: | ||
122 | offset = iwl_eeprom_query16(shrd, EEPROM_LINK_GENERAL); | ||
123 | break; | ||
124 | case INDIRECT_REGULATORY: | ||
125 | offset = iwl_eeprom_query16(shrd, EEPROM_LINK_REGULATORY); | ||
126 | break; | ||
127 | case INDIRECT_TXP_LIMIT: | ||
128 | offset = iwl_eeprom_query16(shrd, EEPROM_LINK_TXP_LIMIT); | ||
129 | break; | ||
130 | case INDIRECT_TXP_LIMIT_SIZE: | ||
131 | offset = iwl_eeprom_query16(shrd, EEPROM_LINK_TXP_LIMIT_SIZE); | ||
132 | break; | ||
133 | case INDIRECT_CALIBRATION: | ||
134 | offset = iwl_eeprom_query16(shrd, EEPROM_LINK_CALIBRATION); | ||
135 | break; | ||
136 | case INDIRECT_PROCESS_ADJST: | ||
137 | offset = iwl_eeprom_query16(shrd, EEPROM_LINK_PROCESS_ADJST); | ||
138 | break; | ||
139 | case INDIRECT_OTHERS: | ||
140 | offset = iwl_eeprom_query16(shrd, EEPROM_LINK_OTHERS); | ||
141 | break; | ||
142 | default: | ||
143 | IWL_ERR(shrd->trans, "illegal indirect type: 0x%X\n", | ||
144 | address & INDIRECT_TYPE_MSK); | ||
145 | break; | ||
146 | } | ||
147 | |||
148 | /* translate the offset from words to byte */ | ||
149 | return (address & ADDRESS_MSK) + (offset << 1); | ||
150 | } | ||
151 | |||
152 | const u8 *iwl_eeprom_query_addr(const struct iwl_shared *shrd, size_t offset) | ||
153 | { | ||
154 | u32 address = eeprom_indirect_address(shrd, offset); | ||
155 | BUG_ON(address >= shrd->cfg->base_params->eeprom_size); | ||
156 | return &shrd->eeprom[address]; | ||
157 | } | ||
158 | |||
159 | struct iwl_mod_params iwlagn_mod_params = { | 97 | struct iwl_mod_params iwlagn_mod_params = { |
160 | .amsdu_size_8K = 1, | 98 | .amsdu_size_8K = 1, |
161 | .restart_fw = 1, | 99 | .restart_fw = 1, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 5216713105c6..91b3a420df2a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -1550,11 +1550,8 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, | |||
1550 | if (iwl_trans_start_hw(trans(priv))) | 1550 | if (iwl_trans_start_hw(trans(priv))) |
1551 | goto out_free_traffic_mem; | 1551 | goto out_free_traffic_mem; |
1552 | 1552 | ||
1553 | /***************** | ||
1554 | * 3. Read EEPROM | ||
1555 | *****************/ | ||
1556 | /* Read the EEPROM */ | 1553 | /* Read the EEPROM */ |
1557 | if (iwl_eeprom_init(trans(priv), trans(priv)->hw_rev)) { | 1554 | if (iwl_eeprom_init(priv, trans(priv)->hw_rev)) { |
1558 | IWL_ERR(priv, "Unable to init EEPROM\n"); | 1555 | IWL_ERR(priv, "Unable to init EEPROM\n"); |
1559 | goto out_free_traffic_mem; | 1556 | goto out_free_traffic_mem; |
1560 | } | 1557 | } |
@@ -1568,11 +1565,11 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, | |||
1568 | goto out_free_eeprom; | 1565 | goto out_free_eeprom; |
1569 | 1566 | ||
1570 | /* extract MAC Address */ | 1567 | /* extract MAC Address */ |
1571 | iwl_eeprom_get_mac(priv->shrd, priv->addresses[0].addr); | 1568 | iwl_eeprom_get_mac(priv, priv->addresses[0].addr); |
1572 | IWL_DEBUG_INFO(priv, "MAC address: %pM\n", priv->addresses[0].addr); | 1569 | IWL_DEBUG_INFO(priv, "MAC address: %pM\n", priv->addresses[0].addr); |
1573 | priv->hw->wiphy->addresses = priv->addresses; | 1570 | priv->hw->wiphy->addresses = priv->addresses; |
1574 | priv->hw->wiphy->n_addresses = 1; | 1571 | priv->hw->wiphy->n_addresses = 1; |
1575 | num_mac = iwl_eeprom_query16(priv->shrd, EEPROM_NUM_MAC_ADDRESS); | 1572 | num_mac = iwl_eeprom_query16(priv, EEPROM_NUM_MAC_ADDRESS); |
1576 | if (num_mac > 1) { | 1573 | if (num_mac > 1) { |
1577 | memcpy(priv->addresses[1].addr, priv->addresses[0].addr, | 1574 | memcpy(priv->addresses[1].addr, priv->addresses[0].addr, |
1578 | ETH_ALEN); | 1575 | ETH_ALEN); |
@@ -1670,7 +1667,7 @@ out_destroy_workqueue: | |||
1670 | priv->workqueue = NULL; | 1667 | priv->workqueue = NULL; |
1671 | iwl_uninit_drv(priv); | 1668 | iwl_uninit_drv(priv); |
1672 | out_free_eeprom: | 1669 | out_free_eeprom: |
1673 | iwl_eeprom_free(priv->shrd); | 1670 | iwl_eeprom_free(priv); |
1674 | out_free_traffic_mem: | 1671 | out_free_traffic_mem: |
1675 | iwl_free_traffic_mem(priv); | 1672 | iwl_free_traffic_mem(priv); |
1676 | ieee80211_free_hw(priv->hw); | 1673 | ieee80211_free_hw(priv->hw); |
@@ -1696,7 +1693,7 @@ static void iwl_op_mode_dvm_stop(struct iwl_op_mode *op_mode) | |||
1696 | priv->ucode_loaded = false; | 1693 | priv->ucode_loaded = false; |
1697 | iwl_trans_stop_device(trans(priv)); | 1694 | iwl_trans_stop_device(trans(priv)); |
1698 | 1695 | ||
1699 | iwl_eeprom_free(priv->shrd); | 1696 | iwl_eeprom_free(priv); |
1700 | 1697 | ||
1701 | /*netif_stop_queue(dev); */ | 1698 | /*netif_stop_queue(dev); */ |
1702 | flush_workqueue(priv->workqueue); | 1699 | flush_workqueue(priv->workqueue); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h index da5ea1b87e6b..17b82e5c1f44 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn.h | |||
@@ -138,7 +138,6 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log, | |||
138 | /* lib */ | 138 | /* lib */ |
139 | int iwlagn_send_tx_power(struct iwl_priv *priv); | 139 | int iwlagn_send_tx_power(struct iwl_priv *priv); |
140 | void iwlagn_temperature(struct iwl_priv *priv); | 140 | void iwlagn_temperature(struct iwl_priv *priv); |
141 | u16 iwl_eeprom_calib_version(struct iwl_shared *shrd); | ||
142 | int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control); | 141 | int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control); |
143 | void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control); | 142 | void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control); |
144 | int iwlagn_send_beacon_cmd(struct iwl_priv *priv); | 143 | int iwlagn_send_beacon_cmd(struct iwl_priv *priv); |
@@ -312,9 +311,6 @@ static inline __le32 iwl_hw_set_rate_n_flags(u8 rate, u32 flags) | |||
312 | return cpu_to_le32(flags|(u32)rate); | 311 | return cpu_to_le32(flags|(u32)rate); |
313 | } | 312 | } |
314 | 313 | ||
315 | /* eeprom */ | ||
316 | void iwl_eeprom_get_mac(const struct iwl_shared *shrd, u8 *mac); | ||
317 | |||
318 | extern int iwl_alive_start(struct iwl_priv *priv); | 314 | extern int iwl_alive_start(struct iwl_priv *priv); |
319 | /* svtool */ | 315 | /* svtool */ |
320 | #ifdef CONFIG_IWLWIFI_DEVICE_TESTMODE | 316 | #ifdef CONFIG_IWLWIFI_DEVICE_TESTMODE |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index 2e85edac560c..29a4ccf1743d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -416,7 +416,7 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file, | |||
416 | return -ENODATA; | 416 | return -ENODATA; |
417 | } | 417 | } |
418 | 418 | ||
419 | ptr = priv->shrd->eeprom; | 419 | ptr = priv->eeprom; |
420 | if (!ptr) { | 420 | if (!ptr) { |
421 | IWL_ERR(priv, "Invalid EEPROM/OTP memory\n"); | 421 | IWL_ERR(priv, "Invalid EEPROM/OTP memory\n"); |
422 | return -ENOMEM; | 422 | return -ENOMEM; |
@@ -428,10 +428,10 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file, | |||
428 | IWL_ERR(priv, "Can not allocate Buffer\n"); | 428 | IWL_ERR(priv, "Can not allocate Buffer\n"); |
429 | return -ENOMEM; | 429 | return -ENOMEM; |
430 | } | 430 | } |
431 | eeprom_ver = iwl_eeprom_query16(priv->shrd, EEPROM_VERSION); | 431 | eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION); |
432 | pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s, " | 432 | pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s, " |
433 | "version: 0x%x\n", | 433 | "version: 0x%x\n", |
434 | (trans(priv)->nvm_device_type == NVM_DEVICE_TYPE_OTP) | 434 | (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) |
435 | ? "OTP" : "EEPROM", eeprom_ver); | 435 | ? "OTP" : "EEPROM", eeprom_ver); |
436 | for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) { | 436 | for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) { |
437 | pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs); | 437 | pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 58073da16279..4a24e860fac7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -993,6 +993,10 @@ struct iwl_priv { | |||
993 | void *wowlan_sram; | 993 | void *wowlan_sram; |
994 | #endif /* CONFIG_IWLWIFI_DEBUGFS */ | 994 | #endif /* CONFIG_IWLWIFI_DEBUGFS */ |
995 | 995 | ||
996 | /* eeprom -- this is in the card's little endian byte order */ | ||
997 | u8 *eeprom; | ||
998 | enum iwl_nvm_type nvm_device_type; | ||
999 | |||
996 | struct work_struct txpower_work; | 1000 | struct work_struct txpower_work; |
997 | u32 disable_sens_cal; | 1001 | u32 disable_sens_cal; |
998 | u32 disable_chain_noise_cal; | 1002 | u32 disable_chain_noise_cal; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c index 12744b053bc5..1db98d67706d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c | |||
@@ -187,33 +187,33 @@ static void iwl_eeprom_release_semaphore(struct iwl_trans *trans) | |||
187 | 187 | ||
188 | } | 188 | } |
189 | 189 | ||
190 | static int iwl_eeprom_verify_signature(struct iwl_trans *trans) | 190 | static int iwl_eeprom_verify_signature(struct iwl_priv *priv) |
191 | { | 191 | { |
192 | u32 gp = iwl_read32(trans, CSR_EEPROM_GP) & | 192 | u32 gp = iwl_read32(trans(priv), CSR_EEPROM_GP) & |
193 | CSR_EEPROM_GP_VALID_MSK; | 193 | CSR_EEPROM_GP_VALID_MSK; |
194 | int ret = 0; | 194 | int ret = 0; |
195 | 195 | ||
196 | IWL_DEBUG_EEPROM(trans, "EEPROM signature=0x%08x\n", gp); | 196 | IWL_DEBUG_EEPROM(priv, "EEPROM signature=0x%08x\n", gp); |
197 | switch (gp) { | 197 | switch (gp) { |
198 | case CSR_EEPROM_GP_BAD_SIG_EEP_GOOD_SIG_OTP: | 198 | case CSR_EEPROM_GP_BAD_SIG_EEP_GOOD_SIG_OTP: |
199 | if (trans->nvm_device_type != NVM_DEVICE_TYPE_OTP) { | 199 | if (priv->nvm_device_type != NVM_DEVICE_TYPE_OTP) { |
200 | IWL_ERR(trans, "EEPROM with bad signature: 0x%08x\n", | 200 | IWL_ERR(priv, "EEPROM with bad signature: 0x%08x\n", |
201 | gp); | 201 | gp); |
202 | ret = -ENOENT; | 202 | ret = -ENOENT; |
203 | } | 203 | } |
204 | break; | 204 | break; |
205 | case CSR_EEPROM_GP_GOOD_SIG_EEP_LESS_THAN_4K: | 205 | case CSR_EEPROM_GP_GOOD_SIG_EEP_LESS_THAN_4K: |
206 | case CSR_EEPROM_GP_GOOD_SIG_EEP_MORE_THAN_4K: | 206 | case CSR_EEPROM_GP_GOOD_SIG_EEP_MORE_THAN_4K: |
207 | if (trans->nvm_device_type != NVM_DEVICE_TYPE_EEPROM) { | 207 | if (priv->nvm_device_type != NVM_DEVICE_TYPE_EEPROM) { |
208 | IWL_ERR(trans, "OTP with bad signature: 0x%08x\n", gp); | 208 | IWL_ERR(priv, "OTP with bad signature: 0x%08x\n", gp); |
209 | ret = -ENOENT; | 209 | ret = -ENOENT; |
210 | } | 210 | } |
211 | break; | 211 | break; |
212 | case CSR_EEPROM_GP_BAD_SIGNATURE_BOTH_EEP_AND_OTP: | 212 | case CSR_EEPROM_GP_BAD_SIGNATURE_BOTH_EEP_AND_OTP: |
213 | default: | 213 | default: |
214 | IWL_ERR(trans, "bad EEPROM/OTP signature, type=%s, " | 214 | IWL_ERR(priv, "bad EEPROM/OTP signature, type=%s, " |
215 | "EEPROM_GP=0x%08x\n", | 215 | "EEPROM_GP=0x%08x\n", |
216 | (trans->nvm_device_type == NVM_DEVICE_TYPE_OTP) | 216 | (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) |
217 | ? "OTP" : "EEPROM", gp); | 217 | ? "OTP" : "EEPROM", gp); |
218 | ret = -ENOENT; | 218 | ret = -ENOENT; |
219 | break; | 219 | break; |
@@ -221,11 +221,11 @@ static int iwl_eeprom_verify_signature(struct iwl_trans *trans) | |||
221 | return ret; | 221 | return ret; |
222 | } | 222 | } |
223 | 223 | ||
224 | u16 iwl_eeprom_query16(const struct iwl_shared *shrd, size_t offset) | 224 | u16 iwl_eeprom_query16(struct iwl_priv *priv, size_t offset) |
225 | { | 225 | { |
226 | if (!shrd->eeprom) | 226 | if (!priv->eeprom) |
227 | return 0; | 227 | return 0; |
228 | return (u16)shrd->eeprom[offset] | ((u16)shrd->eeprom[offset + 1] << 8); | 228 | return (u16)priv->eeprom[offset] | ((u16)priv->eeprom[offset + 1] << 8); |
229 | } | 229 | } |
230 | 230 | ||
231 | int iwl_eeprom_check_version(struct iwl_priv *priv) | 231 | int iwl_eeprom_check_version(struct iwl_priv *priv) |
@@ -233,8 +233,8 @@ int iwl_eeprom_check_version(struct iwl_priv *priv) | |||
233 | u16 eeprom_ver; | 233 | u16 eeprom_ver; |
234 | u16 calib_ver; | 234 | u16 calib_ver; |
235 | 235 | ||
236 | eeprom_ver = iwl_eeprom_query16(priv->shrd, EEPROM_VERSION); | 236 | eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION); |
237 | calib_ver = iwl_eeprom_calib_version(priv->shrd); | 237 | calib_ver = iwl_eeprom_calib_version(priv); |
238 | 238 | ||
239 | if (eeprom_ver < cfg(priv)->eeprom_ver || | 239 | if (eeprom_ver < cfg(priv)->eeprom_ver || |
240 | calib_ver < cfg(priv)->eeprom_calib_ver) | 240 | calib_ver < cfg(priv)->eeprom_calib_ver) |
@@ -255,10 +255,9 @@ err: | |||
255 | 255 | ||
256 | int iwl_eeprom_init_hw_params(struct iwl_priv *priv) | 256 | int iwl_eeprom_init_hw_params(struct iwl_priv *priv) |
257 | { | 257 | { |
258 | struct iwl_shared *shrd = priv->shrd; | ||
259 | u16 radio_cfg; | 258 | u16 radio_cfg; |
260 | 259 | ||
261 | priv->hw_params.sku = iwl_eeprom_query16(shrd, EEPROM_SKU_CAP); | 260 | priv->hw_params.sku = iwl_eeprom_query16(priv, EEPROM_SKU_CAP); |
262 | if (priv->hw_params.sku & EEPROM_SKU_CAP_11N_ENABLE && | 261 | if (priv->hw_params.sku & EEPROM_SKU_CAP_11N_ENABLE && |
263 | !cfg(priv)->ht_params) { | 262 | !cfg(priv)->ht_params) { |
264 | IWL_ERR(priv, "Invalid 11n configuration\n"); | 263 | IWL_ERR(priv, "Invalid 11n configuration\n"); |
@@ -272,7 +271,7 @@ int iwl_eeprom_init_hw_params(struct iwl_priv *priv) | |||
272 | 271 | ||
273 | IWL_INFO(priv, "Device SKU: 0x%X\n", priv->hw_params.sku); | 272 | IWL_INFO(priv, "Device SKU: 0x%X\n", priv->hw_params.sku); |
274 | 273 | ||
275 | radio_cfg = iwl_eeprom_query16(shrd, EEPROM_RADIO_CONFIG); | 274 | radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG); |
276 | 275 | ||
277 | priv->hw_params.valid_tx_ant = EEPROM_RF_CFG_TX_ANT_MSK(radio_cfg); | 276 | priv->hw_params.valid_tx_ant = EEPROM_RF_CFG_TX_ANT_MSK(radio_cfg); |
278 | priv->hw_params.valid_rx_ant = EEPROM_RF_CFG_RX_ANT_MSK(radio_cfg); | 277 | priv->hw_params.valid_rx_ant = EEPROM_RF_CFG_RX_ANT_MSK(radio_cfg); |
@@ -296,9 +295,67 @@ int iwl_eeprom_init_hw_params(struct iwl_priv *priv) | |||
296 | return 0; | 295 | return 0; |
297 | } | 296 | } |
298 | 297 | ||
299 | void iwl_eeprom_get_mac(const struct iwl_shared *shrd, u8 *mac) | 298 | u16 iwl_eeprom_calib_version(struct iwl_priv *priv) |
300 | { | 299 | { |
301 | const u8 *addr = iwl_eeprom_query_addr(shrd, | 300 | struct iwl_eeprom_calib_hdr *hdr; |
301 | |||
302 | hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv, | ||
303 | EEPROM_CALIB_ALL); | ||
304 | return hdr->version; | ||
305 | } | ||
306 | |||
307 | static u32 eeprom_indirect_address(struct iwl_priv *priv, u32 address) | ||
308 | { | ||
309 | u16 offset = 0; | ||
310 | |||
311 | if ((address & INDIRECT_ADDRESS) == 0) | ||
312 | return address; | ||
313 | |||
314 | switch (address & INDIRECT_TYPE_MSK) { | ||
315 | case INDIRECT_HOST: | ||
316 | offset = iwl_eeprom_query16(priv, EEPROM_LINK_HOST); | ||
317 | break; | ||
318 | case INDIRECT_GENERAL: | ||
319 | offset = iwl_eeprom_query16(priv, EEPROM_LINK_GENERAL); | ||
320 | break; | ||
321 | case INDIRECT_REGULATORY: | ||
322 | offset = iwl_eeprom_query16(priv, EEPROM_LINK_REGULATORY); | ||
323 | break; | ||
324 | case INDIRECT_TXP_LIMIT: | ||
325 | offset = iwl_eeprom_query16(priv, EEPROM_LINK_TXP_LIMIT); | ||
326 | break; | ||
327 | case INDIRECT_TXP_LIMIT_SIZE: | ||
328 | offset = iwl_eeprom_query16(priv, EEPROM_LINK_TXP_LIMIT_SIZE); | ||
329 | break; | ||
330 | case INDIRECT_CALIBRATION: | ||
331 | offset = iwl_eeprom_query16(priv, EEPROM_LINK_CALIBRATION); | ||
332 | break; | ||
333 | case INDIRECT_PROCESS_ADJST: | ||
334 | offset = iwl_eeprom_query16(priv, EEPROM_LINK_PROCESS_ADJST); | ||
335 | break; | ||
336 | case INDIRECT_OTHERS: | ||
337 | offset = iwl_eeprom_query16(priv, EEPROM_LINK_OTHERS); | ||
338 | break; | ||
339 | default: | ||
340 | IWL_ERR(priv, "illegal indirect type: 0x%X\n", | ||
341 | address & INDIRECT_TYPE_MSK); | ||
342 | break; | ||
343 | } | ||
344 | |||
345 | /* translate the offset from words to byte */ | ||
346 | return (address & ADDRESS_MSK) + (offset << 1); | ||
347 | } | ||
348 | |||
349 | const u8 *iwl_eeprom_query_addr(struct iwl_priv *priv, size_t offset) | ||
350 | { | ||
351 | u32 address = eeprom_indirect_address(priv, offset); | ||
352 | BUG_ON(address >= cfg(priv)->base_params->eeprom_size); | ||
353 | return &priv->eeprom[address]; | ||
354 | } | ||
355 | |||
356 | void iwl_eeprom_get_mac(struct iwl_priv *priv, u8 *mac) | ||
357 | { | ||
358 | const u8 *addr = iwl_eeprom_query_addr(priv, | ||
302 | EEPROM_MAC_ADDRESS); | 359 | EEPROM_MAC_ADDRESS); |
303 | memcpy(mac, addr, ETH_ALEN); | 360 | memcpy(mac, addr, ETH_ALEN); |
304 | } | 361 | } |
@@ -591,7 +648,6 @@ iwl_eeprom_enh_txp_read_element(struct iwl_priv *priv, | |||
591 | 648 | ||
592 | static void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv) | 649 | static void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv) |
593 | { | 650 | { |
594 | struct iwl_shared *shrd = priv->shrd; | ||
595 | struct iwl_eeprom_enhanced_txpwr *txp_array, *txp; | 651 | struct iwl_eeprom_enhanced_txpwr *txp_array, *txp; |
596 | int idx, entries; | 652 | int idx, entries; |
597 | __le16 *txp_len; | 653 | __le16 *txp_len; |
@@ -600,10 +656,10 @@ static void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv) | |||
600 | BUILD_BUG_ON(sizeof(struct iwl_eeprom_enhanced_txpwr) != 8); | 656 | BUILD_BUG_ON(sizeof(struct iwl_eeprom_enhanced_txpwr) != 8); |
601 | 657 | ||
602 | /* the length is in 16-bit words, but we want entries */ | 658 | /* the length is in 16-bit words, but we want entries */ |
603 | txp_len = (__le16 *) iwl_eeprom_query_addr(shrd, EEPROM_TXP_SZ_OFFS); | 659 | txp_len = (__le16 *) iwl_eeprom_query_addr(priv, EEPROM_TXP_SZ_OFFS); |
604 | entries = le16_to_cpup(txp_len) * 2 / EEPROM_TXP_ENTRY_LEN; | 660 | entries = le16_to_cpup(txp_len) * 2 / EEPROM_TXP_ENTRY_LEN; |
605 | 661 | ||
606 | txp_array = (void *) iwl_eeprom_query_addr(shrd, EEPROM_TXP_OFFS); | 662 | txp_array = (void *) iwl_eeprom_query_addr(priv, EEPROM_TXP_OFFS); |
607 | 663 | ||
608 | for (idx = 0; idx < entries; idx++) { | 664 | for (idx = 0; idx < entries; idx++) { |
609 | txp = &txp_array[idx]; | 665 | txp = &txp_array[idx]; |
@@ -656,66 +712,66 @@ static void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv) | |||
656 | /** | 712 | /** |
657 | * iwl_eeprom_init - read EEPROM contents | 713 | * iwl_eeprom_init - read EEPROM contents |
658 | * | 714 | * |
659 | * Load the EEPROM contents from adapter into shrd->eeprom | 715 | * Load the EEPROM contents from adapter into priv->eeprom |
660 | * | 716 | * |
661 | * NOTE: This routine uses the non-debug IO access functions. | 717 | * NOTE: This routine uses the non-debug IO access functions. |
662 | */ | 718 | */ |
663 | int iwl_eeprom_init(struct iwl_trans *trans, u32 hw_rev) | 719 | int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev) |
664 | { | 720 | { |
665 | __le16 *e; | 721 | __le16 *e; |
666 | u32 gp = iwl_read32(trans, CSR_EEPROM_GP); | 722 | u32 gp = iwl_read32(trans(priv), CSR_EEPROM_GP); |
667 | int sz; | 723 | int sz; |
668 | int ret; | 724 | int ret; |
669 | u16 addr; | 725 | u16 addr; |
670 | u16 validblockaddr = 0; | 726 | u16 validblockaddr = 0; |
671 | u16 cache_addr = 0; | 727 | u16 cache_addr = 0; |
672 | 728 | ||
673 | trans->nvm_device_type = iwl_get_nvm_type(trans, hw_rev); | 729 | priv->nvm_device_type = iwl_get_nvm_type(trans(priv), hw_rev); |
674 | if (trans->nvm_device_type == -ENOENT) | 730 | if (priv->nvm_device_type == -ENOENT) |
675 | return -ENOENT; | 731 | return -ENOENT; |
676 | /* allocate eeprom */ | 732 | /* allocate eeprom */ |
677 | sz = cfg(trans)->base_params->eeprom_size; | 733 | sz = cfg(priv)->base_params->eeprom_size; |
678 | IWL_DEBUG_EEPROM(trans, "NVM size = %d\n", sz); | 734 | IWL_DEBUG_EEPROM(priv, "NVM size = %d\n", sz); |
679 | trans->shrd->eeprom = kzalloc(sz, GFP_KERNEL); | 735 | priv->eeprom = kzalloc(sz, GFP_KERNEL); |
680 | if (!trans->shrd->eeprom) { | 736 | if (!priv->eeprom) { |
681 | ret = -ENOMEM; | 737 | ret = -ENOMEM; |
682 | goto alloc_err; | 738 | goto alloc_err; |
683 | } | 739 | } |
684 | e = (__le16 *)trans->shrd->eeprom; | 740 | e = (__le16 *)priv->eeprom; |
685 | 741 | ||
686 | ret = iwl_eeprom_verify_signature(trans); | 742 | ret = iwl_eeprom_verify_signature(priv); |
687 | if (ret < 0) { | 743 | if (ret < 0) { |
688 | IWL_ERR(trans, "EEPROM not found, EEPROM_GP=0x%08x\n", gp); | 744 | IWL_ERR(priv, "EEPROM not found, EEPROM_GP=0x%08x\n", gp); |
689 | ret = -ENOENT; | 745 | ret = -ENOENT; |
690 | goto err; | 746 | goto err; |
691 | } | 747 | } |
692 | 748 | ||
693 | /* Make sure driver (instead of uCode) is allowed to read EEPROM */ | 749 | /* Make sure driver (instead of uCode) is allowed to read EEPROM */ |
694 | ret = iwl_eeprom_acquire_semaphore(trans); | 750 | ret = iwl_eeprom_acquire_semaphore(trans(priv)); |
695 | if (ret < 0) { | 751 | if (ret < 0) { |
696 | IWL_ERR(trans, "Failed to acquire EEPROM semaphore.\n"); | 752 | IWL_ERR(priv, "Failed to acquire EEPROM semaphore.\n"); |
697 | ret = -ENOENT; | 753 | ret = -ENOENT; |
698 | goto err; | 754 | goto err; |
699 | } | 755 | } |
700 | 756 | ||
701 | if (trans->nvm_device_type == NVM_DEVICE_TYPE_OTP) { | 757 | if (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) { |
702 | 758 | ||
703 | ret = iwl_init_otp_access(trans); | 759 | ret = iwl_init_otp_access(trans(priv)); |
704 | if (ret) { | 760 | if (ret) { |
705 | IWL_ERR(trans, "Failed to initialize OTP access.\n"); | 761 | IWL_ERR(priv, "Failed to initialize OTP access.\n"); |
706 | ret = -ENOENT; | 762 | ret = -ENOENT; |
707 | goto done; | 763 | goto done; |
708 | } | 764 | } |
709 | iwl_write32(trans, CSR_EEPROM_GP, | 765 | iwl_write32(trans(priv), CSR_EEPROM_GP, |
710 | iwl_read32(trans, CSR_EEPROM_GP) & | 766 | iwl_read32(trans(priv), CSR_EEPROM_GP) & |
711 | ~CSR_EEPROM_GP_IF_OWNER_MSK); | 767 | ~CSR_EEPROM_GP_IF_OWNER_MSK); |
712 | 768 | ||
713 | iwl_set_bit(trans, CSR_OTP_GP_REG, | 769 | iwl_set_bit(trans(priv), CSR_OTP_GP_REG, |
714 | CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK | | 770 | CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK | |
715 | CSR_OTP_GP_REG_ECC_UNCORR_STATUS_MSK); | 771 | CSR_OTP_GP_REG_ECC_UNCORR_STATUS_MSK); |
716 | /* traversing the linked list if no shadow ram supported */ | 772 | /* traversing the linked list if no shadow ram supported */ |
717 | if (!cfg(trans)->base_params->shadow_ram_support) { | 773 | if (!cfg(priv)->base_params->shadow_ram_support) { |
718 | if (iwl_find_otp_image(trans, &validblockaddr)) { | 774 | if (iwl_find_otp_image(trans(priv), &validblockaddr)) { |
719 | ret = -ENOENT; | 775 | ret = -ENOENT; |
720 | goto done; | 776 | goto done; |
721 | } | 777 | } |
@@ -724,7 +780,8 @@ int iwl_eeprom_init(struct iwl_trans *trans, u32 hw_rev) | |||
724 | addr += sizeof(u16)) { | 780 | addr += sizeof(u16)) { |
725 | __le16 eeprom_data; | 781 | __le16 eeprom_data; |
726 | 782 | ||
727 | ret = iwl_read_otp_word(trans, addr, &eeprom_data); | 783 | ret = iwl_read_otp_word(trans(priv), addr, |
784 | &eeprom_data); | ||
728 | if (ret) | 785 | if (ret) |
729 | goto done; | 786 | goto done; |
730 | e[cache_addr / 2] = eeprom_data; | 787 | e[cache_addr / 2] = eeprom_data; |
@@ -735,94 +792,93 @@ int iwl_eeprom_init(struct iwl_trans *trans, u32 hw_rev) | |||
735 | for (addr = 0; addr < sz; addr += sizeof(u16)) { | 792 | for (addr = 0; addr < sz; addr += sizeof(u16)) { |
736 | u32 r; | 793 | u32 r; |
737 | 794 | ||
738 | iwl_write32(trans, CSR_EEPROM_REG, | 795 | iwl_write32(trans(priv), CSR_EEPROM_REG, |
739 | CSR_EEPROM_REG_MSK_ADDR & (addr << 1)); | 796 | CSR_EEPROM_REG_MSK_ADDR & (addr << 1)); |
740 | 797 | ||
741 | ret = iwl_poll_bit(trans, CSR_EEPROM_REG, | 798 | ret = iwl_poll_bit(trans(priv), CSR_EEPROM_REG, |
742 | CSR_EEPROM_REG_READ_VALID_MSK, | 799 | CSR_EEPROM_REG_READ_VALID_MSK, |
743 | CSR_EEPROM_REG_READ_VALID_MSK, | 800 | CSR_EEPROM_REG_READ_VALID_MSK, |
744 | IWL_EEPROM_ACCESS_TIMEOUT); | 801 | IWL_EEPROM_ACCESS_TIMEOUT); |
745 | if (ret < 0) { | 802 | if (ret < 0) { |
746 | IWL_ERR(trans, | 803 | IWL_ERR(priv, |
747 | "Time out reading EEPROM[%d]\n", addr); | 804 | "Time out reading EEPROM[%d]\n", addr); |
748 | goto done; | 805 | goto done; |
749 | } | 806 | } |
750 | r = iwl_read32(trans, CSR_EEPROM_REG); | 807 | r = iwl_read32(trans(priv), CSR_EEPROM_REG); |
751 | e[addr / 2] = cpu_to_le16(r >> 16); | 808 | e[addr / 2] = cpu_to_le16(r >> 16); |
752 | } | 809 | } |
753 | } | 810 | } |
754 | 811 | ||
755 | IWL_DEBUG_EEPROM(trans, "NVM Type: %s, version: 0x%x\n", | 812 | IWL_DEBUG_EEPROM(priv, "NVM Type: %s, version: 0x%x\n", |
756 | (trans->nvm_device_type == NVM_DEVICE_TYPE_OTP) | 813 | (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) |
757 | ? "OTP" : "EEPROM", | 814 | ? "OTP" : "EEPROM", |
758 | iwl_eeprom_query16(trans->shrd, EEPROM_VERSION)); | 815 | iwl_eeprom_query16(priv, EEPROM_VERSION)); |
759 | 816 | ||
760 | ret = 0; | 817 | ret = 0; |
761 | done: | 818 | done: |
762 | iwl_eeprom_release_semaphore(trans); | 819 | iwl_eeprom_release_semaphore(trans(priv)); |
763 | 820 | ||
764 | err: | 821 | err: |
765 | if (ret) | 822 | if (ret) |
766 | iwl_eeprom_free(trans->shrd); | 823 | iwl_eeprom_free(priv); |
767 | alloc_err: | 824 | alloc_err: |
768 | return ret; | 825 | return ret; |
769 | } | 826 | } |
770 | 827 | ||
771 | void iwl_eeprom_free(struct iwl_shared *shrd) | 828 | void iwl_eeprom_free(struct iwl_priv *priv) |
772 | { | 829 | { |
773 | kfree(shrd->eeprom); | 830 | kfree(priv->eeprom); |
774 | shrd->eeprom = NULL; | 831 | priv->eeprom = NULL; |
775 | } | 832 | } |
776 | 833 | ||
777 | static void iwl_init_band_reference(const struct iwl_priv *priv, | 834 | static void iwl_init_band_reference(struct iwl_priv *priv, |
778 | int eep_band, int *eeprom_ch_count, | 835 | int eep_band, int *eeprom_ch_count, |
779 | const struct iwl_eeprom_channel **eeprom_ch_info, | 836 | const struct iwl_eeprom_channel **eeprom_ch_info, |
780 | const u8 **eeprom_ch_index) | 837 | const u8 **eeprom_ch_index) |
781 | { | 838 | { |
782 | struct iwl_shared *shrd = priv->shrd; | ||
783 | u32 offset = cfg(priv)->lib-> | 839 | u32 offset = cfg(priv)->lib-> |
784 | eeprom_ops.regulatory_bands[eep_band - 1]; | 840 | eeprom_ops.regulatory_bands[eep_band - 1]; |
785 | switch (eep_band) { | 841 | switch (eep_band) { |
786 | case 1: /* 2.4GHz band */ | 842 | case 1: /* 2.4GHz band */ |
787 | *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_1); | 843 | *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_1); |
788 | *eeprom_ch_info = (struct iwl_eeprom_channel *) | 844 | *eeprom_ch_info = (struct iwl_eeprom_channel *) |
789 | iwl_eeprom_query_addr(shrd, offset); | 845 | iwl_eeprom_query_addr(priv, offset); |
790 | *eeprom_ch_index = iwl_eeprom_band_1; | 846 | *eeprom_ch_index = iwl_eeprom_band_1; |
791 | break; | 847 | break; |
792 | case 2: /* 4.9GHz band */ | 848 | case 2: /* 4.9GHz band */ |
793 | *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_2); | 849 | *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_2); |
794 | *eeprom_ch_info = (struct iwl_eeprom_channel *) | 850 | *eeprom_ch_info = (struct iwl_eeprom_channel *) |
795 | iwl_eeprom_query_addr(shrd, offset); | 851 | iwl_eeprom_query_addr(priv, offset); |
796 | *eeprom_ch_index = iwl_eeprom_band_2; | 852 | *eeprom_ch_index = iwl_eeprom_band_2; |
797 | break; | 853 | break; |
798 | case 3: /* 5.2GHz band */ | 854 | case 3: /* 5.2GHz band */ |
799 | *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_3); | 855 | *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_3); |
800 | *eeprom_ch_info = (struct iwl_eeprom_channel *) | 856 | *eeprom_ch_info = (struct iwl_eeprom_channel *) |
801 | iwl_eeprom_query_addr(shrd, offset); | 857 | iwl_eeprom_query_addr(priv, offset); |
802 | *eeprom_ch_index = iwl_eeprom_band_3; | 858 | *eeprom_ch_index = iwl_eeprom_band_3; |
803 | break; | 859 | break; |
804 | case 4: /* 5.5GHz band */ | 860 | case 4: /* 5.5GHz band */ |
805 | *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_4); | 861 | *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_4); |
806 | *eeprom_ch_info = (struct iwl_eeprom_channel *) | 862 | *eeprom_ch_info = (struct iwl_eeprom_channel *) |
807 | iwl_eeprom_query_addr(shrd, offset); | 863 | iwl_eeprom_query_addr(priv, offset); |
808 | *eeprom_ch_index = iwl_eeprom_band_4; | 864 | *eeprom_ch_index = iwl_eeprom_band_4; |
809 | break; | 865 | break; |
810 | case 5: /* 5.7GHz band */ | 866 | case 5: /* 5.7GHz band */ |
811 | *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_5); | 867 | *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_5); |
812 | *eeprom_ch_info = (struct iwl_eeprom_channel *) | 868 | *eeprom_ch_info = (struct iwl_eeprom_channel *) |
813 | iwl_eeprom_query_addr(shrd, offset); | 869 | iwl_eeprom_query_addr(priv, offset); |
814 | *eeprom_ch_index = iwl_eeprom_band_5; | 870 | *eeprom_ch_index = iwl_eeprom_band_5; |
815 | break; | 871 | break; |
816 | case 6: /* 2.4GHz ht40 channels */ | 872 | case 6: /* 2.4GHz ht40 channels */ |
817 | *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_6); | 873 | *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_6); |
818 | *eeprom_ch_info = (struct iwl_eeprom_channel *) | 874 | *eeprom_ch_info = (struct iwl_eeprom_channel *) |
819 | iwl_eeprom_query_addr(shrd, offset); | 875 | iwl_eeprom_query_addr(priv, offset); |
820 | *eeprom_ch_index = iwl_eeprom_band_6; | 876 | *eeprom_ch_index = iwl_eeprom_band_6; |
821 | break; | 877 | break; |
822 | case 7: /* 5 GHz ht40 channels */ | 878 | case 7: /* 5 GHz ht40 channels */ |
823 | *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_7); | 879 | *eeprom_ch_count = ARRAY_SIZE(iwl_eeprom_band_7); |
824 | *eeprom_ch_info = (struct iwl_eeprom_channel *) | 880 | *eeprom_ch_info = (struct iwl_eeprom_channel *) |
825 | iwl_eeprom_query_addr(shrd, offset); | 881 | iwl_eeprom_query_addr(priv, offset); |
826 | *eeprom_ch_index = iwl_eeprom_band_7; | 882 | *eeprom_ch_index = iwl_eeprom_band_7; |
827 | break; | 883 | break; |
828 | default: | 884 | default: |
@@ -1072,7 +1128,7 @@ void iwl_rf_config(struct iwl_priv *priv) | |||
1072 | { | 1128 | { |
1073 | u16 radio_cfg; | 1129 | u16 radio_cfg; |
1074 | 1130 | ||
1075 | radio_cfg = iwl_eeprom_query16(priv->shrd, EEPROM_RADIO_CONFIG); | 1131 | radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG); |
1076 | 1132 | ||
1077 | /* write radio config values to register */ | 1133 | /* write radio config values to register */ |
1078 | if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX) { | 1134 | if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX) { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h index e4a758340996..b3a3b1f0fdc4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h | |||
@@ -66,8 +66,6 @@ | |||
66 | #include <net/mac80211.h> | 66 | #include <net/mac80211.h> |
67 | 67 | ||
68 | struct iwl_priv; | 68 | struct iwl_priv; |
69 | struct iwl_shared; | ||
70 | struct iwl_trans; | ||
71 | 69 | ||
72 | /* | 70 | /* |
73 | * EEPROM access time values: | 71 | * EEPROM access time values: |
@@ -306,12 +304,14 @@ struct iwl_eeprom_ops { | |||
306 | }; | 304 | }; |
307 | 305 | ||
308 | 306 | ||
309 | int iwl_eeprom_init(struct iwl_trans *trans, u32 hw_rev); | 307 | int iwl_eeprom_init(struct iwl_priv *priv, u32 hw_rev); |
310 | void iwl_eeprom_free(struct iwl_shared *shrd); | 308 | void iwl_eeprom_free(struct iwl_priv *priv); |
311 | int iwl_eeprom_check_version(struct iwl_priv *priv); | 309 | int iwl_eeprom_check_version(struct iwl_priv *priv); |
312 | int iwl_eeprom_init_hw_params(struct iwl_priv *priv); | 310 | int iwl_eeprom_init_hw_params(struct iwl_priv *priv); |
313 | const u8 *iwl_eeprom_query_addr(const struct iwl_shared *shrd, size_t offset); | 311 | u16 iwl_eeprom_calib_version(struct iwl_priv *priv); |
314 | u16 iwl_eeprom_query16(const struct iwl_shared *shrd, size_t offset); | 312 | const u8 *iwl_eeprom_query_addr(struct iwl_priv *priv, size_t offset); |
313 | u16 iwl_eeprom_query16(struct iwl_priv *priv, size_t offset); | ||
314 | void iwl_eeprom_get_mac(struct iwl_priv *priv, u8 *mac); | ||
315 | int iwl_init_channel_map(struct iwl_priv *priv); | 315 | int iwl_init_channel_map(struct iwl_priv *priv); |
316 | void iwl_free_channel_map(struct iwl_priv *priv); | 316 | void iwl_free_channel_map(struct iwl_priv *priv); |
317 | const struct iwl_channel_info *iwl_get_channel_info( | 317 | const struct iwl_channel_info *iwl_get_channel_info( |
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h index c6325c5df6c1..ee155e94df84 100644 --- a/drivers/net/wireless/iwlwifi/iwl-shared.h +++ b/drivers/net/wireless/iwlwifi/iwl-shared.h | |||
@@ -313,10 +313,6 @@ struct iwl_shared { | |||
313 | const struct iwl_cfg *cfg; | 313 | const struct iwl_cfg *cfg; |
314 | struct iwl_trans *trans; | 314 | struct iwl_trans *trans; |
315 | void *drv; | 315 | void *drv; |
316 | |||
317 | /* eeprom -- this is in the card's little endian byte order */ | ||
318 | u8 *eeprom; | ||
319 | |||
320 | }; | 316 | }; |
321 | 317 | ||
322 | /*Whatever _m is (iwl_trans, iwl_priv, these macros will work */ | 318 | /*Whatever _m is (iwl_trans, iwl_priv, these macros will work */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-testmode.c b/drivers/net/wireless/iwlwifi/iwl-testmode.c index d65dac88e190..c8e89cac7ea3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-testmode.c +++ b/drivers/net/wireless/iwlwifi/iwl-testmode.c | |||
@@ -532,7 +532,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) | |||
532 | break; | 532 | break; |
533 | 533 | ||
534 | case IWL_TM_CMD_APP2DEV_GET_EEPROM: | 534 | case IWL_TM_CMD_APP2DEV_GET_EEPROM: |
535 | if (priv->shrd->eeprom) { | 535 | if (priv->eeprom) { |
536 | skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, | 536 | skb = cfg80211_testmode_alloc_reply_skb(hw->wiphy, |
537 | cfg(priv)->base_params->eeprom_size + 20); | 537 | cfg(priv)->base_params->eeprom_size + 20); |
538 | if (!skb) { | 538 | if (!skb) { |
@@ -543,7 +543,7 @@ static int iwl_testmode_driver(struct ieee80211_hw *hw, struct nlattr **tb) | |||
543 | IWL_TM_CMD_DEV2APP_EEPROM_RSP); | 543 | IWL_TM_CMD_DEV2APP_EEPROM_RSP); |
544 | NLA_PUT(skb, IWL_TM_ATTR_EEPROM, | 544 | NLA_PUT(skb, IWL_TM_ATTR_EEPROM, |
545 | cfg(priv)->base_params->eeprom_size, | 545 | cfg(priv)->base_params->eeprom_size, |
546 | priv->shrd->eeprom); | 546 | priv->eeprom); |
547 | status = cfg80211_testmode_reply(skb); | 547 | status = cfg80211_testmode_reply(skb); |
548 | if (status < 0) | 548 | if (status < 0) |
549 | IWL_ERR(priv, "Error sending msg : %d\n", | 549 | IWL_ERR(priv, "Error sending msg : %d\n", |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h index a6598a29ef59..d0888cc70075 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans.h +++ b/drivers/net/wireless/iwlwifi/iwl-trans.h | |||
@@ -431,7 +431,6 @@ enum iwl_trans_state { | |||
431 | * @hw_id: a u32 with the ID of the device / subdevice. | 431 | * @hw_id: a u32 with the ID of the device / subdevice. |
432 | * Set during transport allocation. | 432 | * Set during transport allocation. |
433 | * @hw_id_str: a string with info about HW ID. Set during transport allocation. | 433 | * @hw_id_str: a string with info about HW ID. Set during transport allocation. |
434 | * @nvm_device_type: indicates OTP or eeprom | ||
435 | * @pm_support: set to true in start_hw if link pm is supported | 434 | * @pm_support: set to true in start_hw if link pm is supported |
436 | * @wait_command_queue: the wait_queue for SYNC host commands | 435 | * @wait_command_queue: the wait_queue for SYNC host commands |
437 | */ | 436 | */ |
@@ -447,7 +446,6 @@ struct iwl_trans { | |||
447 | u32 hw_id; | 446 | u32 hw_id; |
448 | char hw_id_str[52]; | 447 | char hw_id_str[52]; |
449 | 448 | ||
450 | int nvm_device_type; | ||
451 | bool pm_support; | 449 | bool pm_support; |
452 | 450 | ||
453 | wait_queue_head_t wait_command_queue; | 451 | wait_queue_head_t wait_command_queue; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-ucode.c b/drivers/net/wireless/iwlwifi/iwl-ucode.c index ba7c9f883cb6..e78f20ececc8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-ucode.c +++ b/drivers/net/wireless/iwlwifi/iwl-ucode.c | |||
@@ -62,7 +62,7 @@ static int iwl_set_Xtal_calib(struct iwl_priv *priv) | |||
62 | { | 62 | { |
63 | struct iwl_calib_xtal_freq_cmd cmd; | 63 | struct iwl_calib_xtal_freq_cmd cmd; |
64 | __le16 *xtal_calib = | 64 | __le16 *xtal_calib = |
65 | (__le16 *)iwl_eeprom_query_addr(priv->shrd, EEPROM_XTAL); | 65 | (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_XTAL); |
66 | 66 | ||
67 | iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD); | 67 | iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD); |
68 | cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]); | 68 | cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]); |
@@ -74,8 +74,7 @@ static int iwl_set_temperature_offset_calib(struct iwl_priv *priv) | |||
74 | { | 74 | { |
75 | struct iwl_calib_temperature_offset_cmd cmd; | 75 | struct iwl_calib_temperature_offset_cmd cmd; |
76 | __le16 *offset_calib = | 76 | __le16 *offset_calib = |
77 | (__le16 *)iwl_eeprom_query_addr(priv->shrd, | 77 | (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_RAW_TEMPERATURE); |
78 | EEPROM_RAW_TEMPERATURE); | ||
79 | 78 | ||
80 | memset(&cmd, 0, sizeof(cmd)); | 79 | memset(&cmd, 0, sizeof(cmd)); |
81 | iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD); | 80 | iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD); |
@@ -91,16 +90,15 @@ static int iwl_set_temperature_offset_calib(struct iwl_priv *priv) | |||
91 | static int iwl_set_temperature_offset_calib_v2(struct iwl_priv *priv) | 90 | static int iwl_set_temperature_offset_calib_v2(struct iwl_priv *priv) |
92 | { | 91 | { |
93 | struct iwl_calib_temperature_offset_v2_cmd cmd; | 92 | struct iwl_calib_temperature_offset_v2_cmd cmd; |
94 | __le16 *offset_calib_high = (__le16 *)iwl_eeprom_query_addr(priv->shrd, | 93 | __le16 *offset_calib_high = (__le16 *)iwl_eeprom_query_addr(priv, |
95 | EEPROM_KELVIN_TEMPERATURE); | 94 | EEPROM_KELVIN_TEMPERATURE); |
96 | __le16 *offset_calib_low = | 95 | __le16 *offset_calib_low = |
97 | (__le16 *)iwl_eeprom_query_addr(priv->shrd, | 96 | (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_RAW_TEMPERATURE); |
98 | EEPROM_RAW_TEMPERATURE); | ||
99 | struct iwl_eeprom_calib_hdr *hdr; | 97 | struct iwl_eeprom_calib_hdr *hdr; |
100 | 98 | ||
101 | memset(&cmd, 0, sizeof(cmd)); | 99 | memset(&cmd, 0, sizeof(cmd)); |
102 | iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD); | 100 | iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD); |
103 | hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv->shrd, | 101 | hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv, |
104 | EEPROM_CALIB_ALL); | 102 | EEPROM_CALIB_ALL); |
105 | memcpy(&cmd.radio_sensor_offset_high, offset_calib_high, | 103 | memcpy(&cmd.radio_sensor_offset_high, offset_calib_high, |
106 | sizeof(*offset_calib_high)); | 104 | sizeof(*offset_calib_high)); |