aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-4965.c
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2008-05-04 22:22:45 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-14 16:29:46 -0400
commitf3ccc08c8cdeb784087348e67f41a779c787fa0e (patch)
treede0c1ebf27ab265613829fb70c8cd6a235b8cec0 /drivers/net/wireless/iwlwifi/iwl-4965.c
parent27aaba0ca099461badb496bf7cde5ab5cdc89b98 (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/iwlwifi/iwl-4965.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c97
1 files changed, 97 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 319ffe747a70..f56b9a91d78a 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 */
234static 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*/
282static 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
317restart:
318 queue_work(priv->workqueue, &priv->restart);
319}
320
225static int is_fat_channel(__le32 rxon_flags) 321static 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,