diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2008-05-04 22:22:45 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-05-14 16:29:46 -0400 |
commit | f3ccc08c8cdeb784087348e67f41a779c787fa0e (patch) | |
tree | de0c1ebf27ab265613829fb70c8cd6a235b8cec0 /drivers/net/wireless | |
parent | 27aaba0ca099461badb496bf7cde5ab5cdc89b98 (diff) |
iwlwifi: move iwl4965_init_alive_start to iwl-4965.c
This patch moves iwl_4965_init_alive_start to iwl-4965.c.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 97 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 101 |
3 files changed, 100 insertions, 100 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 319ffe747a7..f56b9a91d78 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -222,6 +222,102 @@ static int iwl4965_load_bsm(struct iwl_priv *priv) | |||
222 | return 0; | 222 | return 0; |
223 | } | 223 | } |
224 | 224 | ||
225 | /** | ||
226 | * iwl4965_set_ucode_ptrs - Set uCode address location | ||
227 | * | ||
228 | * Tell initialization uCode where to find runtime uCode. | ||
229 | * | ||
230 | * BSM registers initially contain pointers to initialization uCode. | ||
231 | * We need to replace them to load runtime uCode inst and data, | ||
232 | * and to save runtime data when powering down. | ||
233 | */ | ||
234 | static int iwl4965_set_ucode_ptrs(struct iwl_priv *priv) | ||
235 | { | ||
236 | dma_addr_t pinst; | ||
237 | dma_addr_t pdata; | ||
238 | unsigned long flags; | ||
239 | int ret = 0; | ||
240 | |||
241 | /* bits 35:4 for 4965 */ | ||
242 | pinst = priv->ucode_code.p_addr >> 4; | ||
243 | pdata = priv->ucode_data_backup.p_addr >> 4; | ||
244 | |||
245 | spin_lock_irqsave(&priv->lock, flags); | ||
246 | ret = iwl_grab_nic_access(priv); | ||
247 | if (ret) { | ||
248 | spin_unlock_irqrestore(&priv->lock, flags); | ||
249 | return ret; | ||
250 | } | ||
251 | |||
252 | /* Tell bootstrap uCode where to find image to load */ | ||
253 | iwl_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); | ||
254 | iwl_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); | ||
255 | iwl_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, | ||
256 | priv->ucode_data.len); | ||
257 | |||
258 | /* Inst bytecount must be last to set up, bit 31 signals uCode | ||
259 | * that all new ptr/size info is in place */ | ||
260 | iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, | ||
261 | priv->ucode_code.len | BSM_DRAM_INST_LOAD); | ||
262 | iwl_release_nic_access(priv); | ||
263 | |||
264 | spin_unlock_irqrestore(&priv->lock, flags); | ||
265 | |||
266 | IWL_DEBUG_INFO("Runtime uCode pointers are set.\n"); | ||
267 | |||
268 | return ret; | ||
269 | } | ||
270 | |||
271 | /** | ||
272 | * iwl4965_init_alive_start - Called after REPLY_ALIVE notification received | ||
273 | * | ||
274 | * Called after REPLY_ALIVE notification received from "initialize" uCode. | ||
275 | * | ||
276 | * The 4965 "initialize" ALIVE reply contains calibration data for: | ||
277 | * Voltage, temperature, and MIMO tx gain correction, now stored in priv | ||
278 | * (3945 does not contain this data). | ||
279 | * | ||
280 | * Tell "initialize" uCode to go ahead and load the runtime uCode. | ||
281 | */ | ||
282 | static void iwl4965_init_alive_start(struct iwl_priv *priv) | ||
283 | { | ||
284 | /* Check alive response for "valid" sign from uCode */ | ||
285 | if (priv->card_alive_init.is_valid != UCODE_VALID_OK) { | ||
286 | /* We had an error bringing up the hardware, so take it | ||
287 | * all the way back down so we can try again */ | ||
288 | IWL_DEBUG_INFO("Initialize Alive failed.\n"); | ||
289 | goto restart; | ||
290 | } | ||
291 | |||
292 | /* Bootstrap uCode has loaded initialize uCode ... verify inst image. | ||
293 | * This is a paranoid check, because we would not have gotten the | ||
294 | * "initialize" alive if code weren't properly loaded. */ | ||
295 | if (iwl_verify_ucode(priv)) { | ||
296 | /* Runtime instruction load was bad; | ||
297 | * take it all the way back down so we can try again */ | ||
298 | IWL_DEBUG_INFO("Bad \"initialize\" uCode load.\n"); | ||
299 | goto restart; | ||
300 | } | ||
301 | |||
302 | /* Calculate temperature */ | ||
303 | priv->temperature = iwl4965_get_temperature(priv); | ||
304 | |||
305 | /* Send pointers to protocol/runtime uCode image ... init code will | ||
306 | * load and launch runtime uCode, which will send us another "Alive" | ||
307 | * notification. */ | ||
308 | IWL_DEBUG_INFO("Initialization Alive received.\n"); | ||
309 | if (iwl4965_set_ucode_ptrs(priv)) { | ||
310 | /* Runtime instruction load won't happen; | ||
311 | * take it all the way back down so we can try again */ | ||
312 | IWL_DEBUG_INFO("Couldn't set up uCode pointers.\n"); | ||
313 | goto restart; | ||
314 | } | ||
315 | return; | ||
316 | |||
317 | restart: | ||
318 | queue_work(priv->workqueue, &priv->restart); | ||
319 | } | ||
320 | |||
225 | static int is_fat_channel(__le32 rxon_flags) | 321 | static int is_fat_channel(__le32 rxon_flags) |
226 | { | 322 | { |
227 | return (rxon_flags & RXON_FLG_CHANNEL_MODE_PURE_40_MSK) || | 323 | return (rxon_flags & RXON_FLG_CHANNEL_MODE_PURE_40_MSK) || |
@@ -3724,6 +3820,7 @@ static struct iwl_lib_ops iwl4965_lib = { | |||
3724 | .rx_handler_setup = iwl4965_rx_handler_setup, | 3820 | .rx_handler_setup = iwl4965_rx_handler_setup, |
3725 | .is_valid_rtc_data_addr = iwl4965_hw_valid_rtc_data_addr, | 3821 | .is_valid_rtc_data_addr = iwl4965_hw_valid_rtc_data_addr, |
3726 | .alive_notify = iwl4965_alive_notify, | 3822 | .alive_notify = iwl4965_alive_notify, |
3823 | .init_alive_start = iwl4965_init_alive_start, | ||
3727 | .load_ucode = iwl4965_load_bsm, | 3824 | .load_ucode = iwl4965_load_bsm, |
3728 | .apm_ops = { | 3825 | .apm_ops = { |
3729 | .init = iwl4965_apm_init, | 3826 | .init = iwl4965_apm_init, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 3a75dc6e35a..08eccdefd72 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -110,6 +110,8 @@ struct iwl_lib_ops { | |||
110 | void (*rx_handler_setup)(struct iwl_priv *priv); | 110 | void (*rx_handler_setup)(struct iwl_priv *priv); |
111 | /* nic Tx fifo handling */ | 111 | /* nic Tx fifo handling */ |
112 | int (*disable_tx_fifo)(struct iwl_priv *priv); | 112 | int (*disable_tx_fifo)(struct iwl_priv *priv); |
113 | /* alive notification after init uCode load */ | ||
114 | void (*init_alive_start)(struct iwl_priv *priv); | ||
113 | /* alive notification */ | 115 | /* alive notification */ |
114 | int (*alive_notify)(struct iwl_priv *priv); | 116 | int (*alive_notify)(struct iwl_priv *priv); |
115 | /* check validity of rtc data address */ | 117 | /* check validity of rtc data address */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 8d06cf1a319..2e976c3881e 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -4162,105 +4162,6 @@ static int iwl4965_read_ucode(struct iwl_priv *priv) | |||
4162 | return ret; | 4162 | return ret; |
4163 | } | 4163 | } |
4164 | 4164 | ||
4165 | |||
4166 | /** | ||
4167 | * iwl4965_set_ucode_ptrs - Set uCode address location | ||
4168 | * | ||
4169 | * Tell initialization uCode where to find runtime uCode. | ||
4170 | * | ||
4171 | * BSM registers initially contain pointers to initialization uCode. | ||
4172 | * We need to replace them to load runtime uCode inst and data, | ||
4173 | * and to save runtime data when powering down. | ||
4174 | */ | ||
4175 | static int iwl4965_set_ucode_ptrs(struct iwl_priv *priv) | ||
4176 | { | ||
4177 | dma_addr_t pinst; | ||
4178 | dma_addr_t pdata; | ||
4179 | int rc = 0; | ||
4180 | unsigned long flags; | ||
4181 | |||
4182 | /* bits 35:4 for 4965 */ | ||
4183 | pinst = priv->ucode_code.p_addr >> 4; | ||
4184 | pdata = priv->ucode_data_backup.p_addr >> 4; | ||
4185 | |||
4186 | spin_lock_irqsave(&priv->lock, flags); | ||
4187 | rc = iwl_grab_nic_access(priv); | ||
4188 | if (rc) { | ||
4189 | spin_unlock_irqrestore(&priv->lock, flags); | ||
4190 | return rc; | ||
4191 | } | ||
4192 | |||
4193 | /* Tell bootstrap uCode where to find image to load */ | ||
4194 | iwl_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst); | ||
4195 | iwl_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata); | ||
4196 | iwl_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, | ||
4197 | priv->ucode_data.len); | ||
4198 | |||
4199 | /* Inst bytecount must be last to set up, bit 31 signals uCode | ||
4200 | * that all new ptr/size info is in place */ | ||
4201 | iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, | ||
4202 | priv->ucode_code.len | BSM_DRAM_INST_LOAD); | ||
4203 | |||
4204 | iwl_release_nic_access(priv); | ||
4205 | |||
4206 | spin_unlock_irqrestore(&priv->lock, flags); | ||
4207 | |||
4208 | IWL_DEBUG_INFO("Runtime uCode pointers are set.\n"); | ||
4209 | |||
4210 | return rc; | ||
4211 | } | ||
4212 | |||
4213 | /** | ||
4214 | * iwl4965_init_alive_start - Called after REPLY_ALIVE notification received | ||
4215 | * | ||
4216 | * Called after REPLY_ALIVE notification received from "initialize" uCode. | ||
4217 | * | ||
4218 | * The 4965 "initialize" ALIVE reply contains calibration data for: | ||
4219 | * Voltage, temperature, and MIMO tx gain correction, now stored in priv | ||
4220 | * (3945 does not contain this data). | ||
4221 | * | ||
4222 | * Tell "initialize" uCode to go ahead and load the runtime uCode. | ||
4223 | */ | ||
4224 | static void iwl4965_init_alive_start(struct iwl_priv *priv) | ||
4225 | { | ||
4226 | /* Check alive response for "valid" sign from uCode */ | ||
4227 | if (priv->card_alive_init.is_valid != UCODE_VALID_OK) { | ||
4228 | /* We had an error bringing up the hardware, so take it | ||
4229 | * all the way back down so we can try again */ | ||
4230 | IWL_DEBUG_INFO("Initialize Alive failed.\n"); | ||
4231 | goto restart; | ||
4232 | } | ||
4233 | |||
4234 | /* Bootstrap uCode has loaded initialize uCode ... verify inst image. | ||
4235 | * This is a paranoid check, because we would not have gotten the | ||
4236 | * "initialize" alive if code weren't properly loaded. */ | ||
4237 | if (iwl_verify_ucode(priv)) { | ||
4238 | /* Runtime instruction load was bad; | ||
4239 | * take it all the way back down so we can try again */ | ||
4240 | IWL_DEBUG_INFO("Bad \"initialize\" uCode load.\n"); | ||
4241 | goto restart; | ||
4242 | } | ||
4243 | |||
4244 | /* Calculate temperature */ | ||
4245 | priv->temperature = iwl4965_get_temperature(priv); | ||
4246 | |||
4247 | /* Send pointers to protocol/runtime uCode image ... init code will | ||
4248 | * load and launch runtime uCode, which will send us another "Alive" | ||
4249 | * notification. */ | ||
4250 | IWL_DEBUG_INFO("Initialization Alive received.\n"); | ||
4251 | if (iwl4965_set_ucode_ptrs(priv)) { | ||
4252 | /* Runtime instruction load won't happen; | ||
4253 | * take it all the way back down so we can try again */ | ||
4254 | IWL_DEBUG_INFO("Couldn't set up uCode pointers.\n"); | ||
4255 | goto restart; | ||
4256 | } | ||
4257 | return; | ||
4258 | |||
4259 | restart: | ||
4260 | queue_work(priv->workqueue, &priv->restart); | ||
4261 | } | ||
4262 | |||
4263 | |||
4264 | /** | 4165 | /** |
4265 | * iwl4965_alive_start - called after REPLY_ALIVE notification received | 4166 | * iwl4965_alive_start - called after REPLY_ALIVE notification received |
4266 | * from protocol/runtime uCode (initialization uCode's | 4167 | * from protocol/runtime uCode (initialization uCode's |
@@ -4586,7 +4487,7 @@ static void iwl4965_bg_init_alive_start(struct work_struct *data) | |||
4586 | return; | 4487 | return; |
4587 | 4488 | ||
4588 | mutex_lock(&priv->mutex); | 4489 | mutex_lock(&priv->mutex); |
4589 | iwl4965_init_alive_start(priv); | 4490 | priv->cfg->ops->lib->init_alive_start(priv); |
4590 | mutex_unlock(&priv->mutex); | 4491 | mutex_unlock(&priv->mutex); |
4591 | } | 4492 | } |
4592 | 4493 | ||