iwlwifi: update copyright year to 2009
[pandora-kernel.git] / drivers / net / wireless / iwlwifi / iwl-4965.c
index 5a72bc0..6171ba5 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -85,7 +85,7 @@ static int iwl4965_verify_bsm(struct iwl_priv *priv)
             reg += sizeof(u32), image++) {
                val = iwl_read_prph(priv, reg);
                if (val != le32_to_cpu(*image)) {
-                       IWL_ERROR("BSM uCode verification failed at "
+                       IWL_ERR(priv, "BSM uCode verification failed at "
                                  "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n",
                                  BSM_SRAM_LOWER_BOUND,
                                  reg - BSM_SRAM_LOWER_BOUND, len,
@@ -149,7 +149,7 @@ static int iwl4965_load_bsm(struct iwl_priv *priv)
        priv->ucode_type = UCODE_RT;
 
        /* make sure bootstrap program is no larger than BSM's SRAM size */
-       if (len > IWL_MAX_BSM_SIZE)
+       if (len > IWL49_MAX_BSM_SIZE)
                return -EINVAL;
 
        /* Tell bootstrap uCode where to find the "Initialize" uCode
@@ -186,7 +186,7 @@ static int iwl4965_load_bsm(struct iwl_priv *priv)
 
        /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */
        iwl_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0);
-       iwl_write_prph(priv, BSM_WR_MEM_DST_REG, RTC_INST_LOWER_BOUND);
+       iwl_write_prph(priv, BSM_WR_MEM_DST_REG, IWL49_RTC_INST_LOWER_BOUND);
        iwl_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32));
 
        /* Load bootstrap code into instruction SRAM now,
@@ -203,7 +203,7 @@ static int iwl4965_load_bsm(struct iwl_priv *priv)
        if (i < 100)
                IWL_DEBUG_INFO("BSM write complete, poll %d iterations\n", i);
        else {
-               IWL_ERROR("BSM write did not complete!\n");
+               IWL_ERR(priv, "BSM write did not complete!\n");
                return -EIO;
        }
 
@@ -523,7 +523,8 @@ static void iwl4965_chain_noise_reset(struct iwl_priv *priv)
                cmd.diff_gain_c = 0;
                if (iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
                                 sizeof(cmd), &cmd))
-                       IWL_ERROR("Could not send REPLY_PHY_CALIBRATION_CMD\n");
+                       IWL_ERR(priv,
+                               "Could not send REPLY_PHY_CALIBRATION_CMD\n");
                data->state = IWL_CHAIN_NOISE_ACCUMULATE;
                IWL_DEBUG_CALIB("Run chain_noise_calibrate\n");
        }
@@ -804,8 +805,9 @@ static int iwl4965_hw_set_hw_params(struct iwl_priv *priv)
 
        if ((priv->cfg->mod_params->num_of_queues > IWL49_NUM_QUEUES) ||
            (priv->cfg->mod_params->num_of_queues < IWL_MIN_NUM_QUEUES)) {
-               IWL_ERROR("invalid queues_num, should be between %d and %d\n",
-                         IWL_MIN_NUM_QUEUES, IWL49_NUM_QUEUES);
+               IWL_ERR(priv,
+                       "invalid queues_num, should be between %d and %d\n",
+                       IWL_MIN_NUM_QUEUES, IWL49_NUM_QUEUES);
                return -EINVAL;
        }
 
@@ -820,6 +822,8 @@ static int iwl4965_hw_set_hw_params(struct iwl_priv *priv)
        priv->hw_params.max_bsm_size = BSM_SRAM_SIZE;
        priv->hw_params.fat_channel = BIT(IEEE80211_BAND_5GHZ);
 
+       priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
+
        priv->hw_params.tx_chains_num = 2;
        priv->hw_params.rx_chains_num = 2;
        priv->hw_params.valid_tx_ant = ANT_A | ANT_B;
@@ -902,7 +906,6 @@ static s32 iwl4965_get_tx_atten_grp(u16 channel)
            channel <= CALIB_IWL_TX_ATTEN_GR4_LCH)
                return CALIB_CH_GROUP_4;
 
-       IWL_ERROR("Can't find txatten group for channel %d.\n", channel);
        return -1;
 }
 
@@ -956,7 +959,7 @@ static int iwl4965_interpolate_chan(struct iwl_priv *priv, u32 channel,
 
        s = iwl4965_get_sub_band(priv, channel);
        if (s >= EEPROM_TX_POWER_BANDS) {
-               IWL_ERROR("Tx Power can not find channel %d\n", channel);
+               IWL_ERR(priv, "Tx Power can not find channel %d\n", channel);
                return -1;
        }
 
@@ -1319,8 +1322,11 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
        /* get txatten group, used to select 1) thermal txpower adjustment
         *   and 2) mimo txpower balance between Tx chains. */
        txatten_grp = iwl4965_get_tx_atten_grp(channel);
-       if (txatten_grp < 0)
+       if (txatten_grp < 0) {
+               IWL_ERR(priv, "Can't find txatten group for channel %d.\n",
+                         channel);
                return -EINVAL;
+       }
 
        IWL_DEBUG_TXPOWER("channel %d belongs to txatten group %d\n",
                          channel, txatten_grp);
@@ -1483,12 +1489,12 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
 
                        /* stay within the table! */
                        if (power_index > 107) {
-                               IWL_WARNING("txpower index %d > 107\n",
+                               IWL_WARN(priv, "txpower index %d > 107\n",
                                            power_index);
                                power_index = 107;
                        }
                        if (power_index < 0) {
-                               IWL_WARNING("txpower index %d < 0\n",
+                               IWL_WARN(priv, "txpower index %d < 0\n",
                                            power_index);
                                power_index = 0;
                        }
@@ -1531,7 +1537,7 @@ static int iwl4965_send_tx_power(struct iwl_priv *priv)
                /* If this gets hit a lot, switch it to a BUG() and catch
                 * the stack trace to find out who is calling this during
                 * a scan. */
-               IWL_WARNING("TX Power requested while scanning!\n");
+               IWL_WARN(priv, "TX Power requested while scanning!\n");
                return -EAGAIN;
        }
 
@@ -1725,7 +1731,7 @@ static int iwl4965_hw_get_temperature(const struct iwl_priv *priv)
        IWL_DEBUG_TEMP("Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt);
 
        if (R3 == R1) {
-               IWL_ERROR("Calibration conflict R1 == R3\n");
+               IWL_ERR(priv, "Calibration conflict R1 == R3\n");
                return -1;
        }
 
@@ -1837,7 +1843,8 @@ static int iwl4965_txq_agg_disable(struct iwl_priv *priv, u16 txq_id,
 
        if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) ||
            (IWL49_FIRST_AMPDU_QUEUE + IWL49_NUM_AMPDU_QUEUES <= txq_id)) {
-               IWL_WARNING("queue number out of range: %d, must be %d to %d\n",
+               IWL_WARN(priv,
+                       "queue number out of range: %d, must be %d to %d\n",
                        txq_id, IWL49_FIRST_AMPDU_QUEUE,
                        IWL49_FIRST_AMPDU_QUEUE + IWL49_NUM_AMPDU_QUEUES - 1);
                return -EINVAL;
@@ -1908,7 +1915,8 @@ static int iwl4965_txq_agg_enable(struct iwl_priv *priv, int txq_id,
 
        if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) ||
            (IWL49_FIRST_AMPDU_QUEUE + IWL49_NUM_AMPDU_QUEUES <= txq_id)) {
-               IWL_WARNING("queue number out of range: %d, must be %d to %d\n",
+               IWL_WARN(priv,
+                       "queue number out of range: %d, must be %d to %d\n",
                        txq_id, IWL49_FIRST_AMPDU_QUEUE,
                        IWL49_FIRST_AMPDU_QUEUE + IWL49_NUM_AMPDU_QUEUES - 1);
                return -EINVAL;
@@ -2067,10 +2075,10 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
 
                        sc = le16_to_cpu(hdr->seq_ctrl);
                        if (idx != (SEQ_TO_SN(sc) & 0xff)) {
-                               IWL_ERROR("BUG_ON idx doesn't match seq control"
-                                         " idx=%d, seq_idx=%d, seq=%d\n",
-                                         idx, SEQ_TO_SN(sc),
-                                         hdr->seq_ctrl);
+                               IWL_ERR(priv,
+                                       "BUG_ON idx doesn't match seq control"
+                                       " idx=%d, seq_idx=%d, seq=%d\n",
+                                       idx, SEQ_TO_SN(sc), hdr->seq_ctrl);
                                return -1;
                        }
 
@@ -2129,7 +2137,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
        u8 *qc = NULL;
 
        if ((index >= txq->q.n_bd) || (iwl_queue_used(&txq->q, index) == 0)) {
-               IWL_ERROR("Read index for DMA queue txq_id (%d) index %d "
+               IWL_ERR(priv, "Read index for DMA queue txq_id (%d) index %d "
                          "is out of range [0-%d] %d %d\n", txq_id,
                          index, txq->q.n_bd, txq->q.write_ptr,
                          txq->q.read_ptr);
@@ -2147,7 +2155,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
 
        sta_id = iwl_get_ra_sta_id(priv, hdr);
        if (txq->sched_retry && unlikely(sta_id == IWL_INVALID_STATION)) {
-               IWL_ERROR("Station not known\n");
+               IWL_ERR(priv, "Station not known\n");
                return;
        }
 
@@ -2210,7 +2218,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
                iwl_txq_check_empty(priv, sta_id, tid, txq_id);
 
        if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK))
-               IWL_ERROR("TODO:  Implement Tx ABORT REQUIRED!!!\n");
+               IWL_ERR(priv, "TODO:  Implement Tx ABORT REQUIRED!!!\n");
 }
 
 static int iwl4965_calc_rssi(struct iwl_priv *priv,
@@ -2244,7 +2252,7 @@ static int iwl4965_calc_rssi(struct iwl_priv *priv,
 
        /* dBm = max_rssi dB - agc dB - constant.
         * Higher AGC (higher radio gain) means lower signal. */
-       return max_rssi - agc - IWL_RSSI_OFFSET;
+       return max_rssi - agc - IWL49_RSSI_OFFSET;
 }