aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl4965-base.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/iwl4965-base.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/iwl4965-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c101
1 files changed, 1 insertions, 100 deletions
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 */
4175static 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*/
4224static 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