|
@@ -222,6 +222,102 @@ static int iwl4965_load_bsm(struct iwl_priv *priv)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * iwl4965_set_ucode_ptrs - Set uCode address location
|
|
|
+ *
|
|
|
+ * Tell initialization uCode where to find runtime uCode.
|
|
|
+ *
|
|
|
+ * BSM registers initially contain pointers to initialization uCode.
|
|
|
+ * We need to replace them to load runtime uCode inst and data,
|
|
|
+ * and to save runtime data when powering down.
|
|
|
+ */
|
|
|
+static int iwl4965_set_ucode_ptrs(struct iwl_priv *priv)
|
|
|
+{
|
|
|
+ dma_addr_t pinst;
|
|
|
+ dma_addr_t pdata;
|
|
|
+ unsigned long flags;
|
|
|
+ int ret = 0;
|
|
|
+
|
|
|
+ /* bits 35:4 for 4965 */
|
|
|
+ pinst = priv->ucode_code.p_addr >> 4;
|
|
|
+ pdata = priv->ucode_data_backup.p_addr >> 4;
|
|
|
+
|
|
|
+ spin_lock_irqsave(&priv->lock, flags);
|
|
|
+ ret = iwl_grab_nic_access(priv);
|
|
|
+ if (ret) {
|
|
|
+ spin_unlock_irqrestore(&priv->lock, flags);
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* Tell bootstrap uCode where to find image to load */
|
|
|
+ iwl_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst);
|
|
|
+ iwl_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata);
|
|
|
+ iwl_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG,
|
|
|
+ priv->ucode_data.len);
|
|
|
+
|
|
|
+ /* Inst bytecount must be last to set up, bit 31 signals uCode
|
|
|
+ * that all new ptr/size info is in place */
|
|
|
+ iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG,
|
|
|
+ priv->ucode_code.len | BSM_DRAM_INST_LOAD);
|
|
|
+ iwl_release_nic_access(priv);
|
|
|
+
|
|
|
+ spin_unlock_irqrestore(&priv->lock, flags);
|
|
|
+
|
|
|
+ IWL_DEBUG_INFO("Runtime uCode pointers are set.\n");
|
|
|
+
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * iwl4965_init_alive_start - Called after REPLY_ALIVE notification received
|
|
|
+ *
|
|
|
+ * Called after REPLY_ALIVE notification received from "initialize" uCode.
|
|
|
+ *
|
|
|
+ * The 4965 "initialize" ALIVE reply contains calibration data for:
|
|
|
+ * Voltage, temperature, and MIMO tx gain correction, now stored in priv
|
|
|
+ * (3945 does not contain this data).
|
|
|
+ *
|
|
|
+ * Tell "initialize" uCode to go ahead and load the runtime uCode.
|
|
|
+*/
|
|
|
+static void iwl4965_init_alive_start(struct iwl_priv *priv)
|
|
|
+{
|
|
|
+ /* Check alive response for "valid" sign from uCode */
|
|
|
+ if (priv->card_alive_init.is_valid != UCODE_VALID_OK) {
|
|
|
+ /* We had an error bringing up the hardware, so take it
|
|
|
+ * all the way back down so we can try again */
|
|
|
+ IWL_DEBUG_INFO("Initialize Alive failed.\n");
|
|
|
+ goto restart;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* Bootstrap uCode has loaded initialize uCode ... verify inst image.
|
|
|
+ * This is a paranoid check, because we would not have gotten the
|
|
|
+ * "initialize" alive if code weren't properly loaded. */
|
|
|
+ if (iwl_verify_ucode(priv)) {
|
|
|
+ /* Runtime instruction load was bad;
|
|
|
+ * take it all the way back down so we can try again */
|
|
|
+ IWL_DEBUG_INFO("Bad \"initialize\" uCode load.\n");
|
|
|
+ goto restart;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* Calculate temperature */
|
|
|
+ priv->temperature = iwl4965_get_temperature(priv);
|
|
|
+
|
|
|
+ /* Send pointers to protocol/runtime uCode image ... init code will
|
|
|
+ * load and launch runtime uCode, which will send us another "Alive"
|
|
|
+ * notification. */
|
|
|
+ IWL_DEBUG_INFO("Initialization Alive received.\n");
|
|
|
+ if (iwl4965_set_ucode_ptrs(priv)) {
|
|
|
+ /* Runtime instruction load won't happen;
|
|
|
+ * take it all the way back down so we can try again */
|
|
|
+ IWL_DEBUG_INFO("Couldn't set up uCode pointers.\n");
|
|
|
+ goto restart;
|
|
|
+ }
|
|
|
+ return;
|
|
|
+
|
|
|
+restart:
|
|
|
+ queue_work(priv->workqueue, &priv->restart);
|
|
|
+}
|
|
|
+
|
|
|
static int is_fat_channel(__le32 rxon_flags)
|
|
|
{
|
|
|
return (rxon_flags & RXON_FLG_CHANNEL_MODE_PURE_40_MSK) ||
|
|
@@ -3724,6 +3820,7 @@ static struct iwl_lib_ops iwl4965_lib = {
|
|
|
.rx_handler_setup = iwl4965_rx_handler_setup,
|
|
|
.is_valid_rtc_data_addr = iwl4965_hw_valid_rtc_data_addr,
|
|
|
.alive_notify = iwl4965_alive_notify,
|
|
|
+ .init_alive_start = iwl4965_init_alive_start,
|
|
|
.load_ucode = iwl4965_load_bsm,
|
|
|
.apm_ops = {
|
|
|
.init = iwl4965_apm_init,
|