aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-4965.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-4965.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c64
1 files changed, 38 insertions, 26 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 5a72bc0377de..d7d956db19d1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * 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)
85 reg += sizeof(u32), image++) { 85 reg += sizeof(u32), image++) {
86 val = iwl_read_prph(priv, reg); 86 val = iwl_read_prph(priv, reg);
87 if (val != le32_to_cpu(*image)) { 87 if (val != le32_to_cpu(*image)) {
88 IWL_ERROR("BSM uCode verification failed at " 88 IWL_ERR(priv, "BSM uCode verification failed at "
89 "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n", 89 "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n",
90 BSM_SRAM_LOWER_BOUND, 90 BSM_SRAM_LOWER_BOUND,
91 reg - BSM_SRAM_LOWER_BOUND, len, 91 reg - BSM_SRAM_LOWER_BOUND, len,
@@ -149,7 +149,7 @@ static int iwl4965_load_bsm(struct iwl_priv *priv)
149 priv->ucode_type = UCODE_RT; 149 priv->ucode_type = UCODE_RT;
150 150
151 /* make sure bootstrap program is no larger than BSM's SRAM size */ 151 /* make sure bootstrap program is no larger than BSM's SRAM size */
152 if (len > IWL_MAX_BSM_SIZE) 152 if (len > IWL49_MAX_BSM_SIZE)
153 return -EINVAL; 153 return -EINVAL;
154 154
155 /* Tell bootstrap uCode where to find the "Initialize" uCode 155 /* Tell bootstrap uCode where to find the "Initialize" uCode
@@ -186,7 +186,7 @@ static int iwl4965_load_bsm(struct iwl_priv *priv)
186 186
187 /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */ 187 /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */
188 iwl_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0); 188 iwl_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0);
189 iwl_write_prph(priv, BSM_WR_MEM_DST_REG, RTC_INST_LOWER_BOUND); 189 iwl_write_prph(priv, BSM_WR_MEM_DST_REG, IWL49_RTC_INST_LOWER_BOUND);
190 iwl_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32)); 190 iwl_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32));
191 191
192 /* Load bootstrap code into instruction SRAM now, 192 /* Load bootstrap code into instruction SRAM now,
@@ -203,7 +203,7 @@ static int iwl4965_load_bsm(struct iwl_priv *priv)
203 if (i < 100) 203 if (i < 100)
204 IWL_DEBUG_INFO("BSM write complete, poll %d iterations\n", i); 204 IWL_DEBUG_INFO("BSM write complete, poll %d iterations\n", i);
205 else { 205 else {
206 IWL_ERROR("BSM write did not complete!\n"); 206 IWL_ERR(priv, "BSM write did not complete!\n");
207 return -EIO; 207 return -EIO;
208 } 208 }
209 209
@@ -523,7 +523,8 @@ static void iwl4965_chain_noise_reset(struct iwl_priv *priv)
523 cmd.diff_gain_c = 0; 523 cmd.diff_gain_c = 0;
524 if (iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, 524 if (iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
525 sizeof(cmd), &cmd)) 525 sizeof(cmd), &cmd))
526 IWL_ERROR("Could not send REPLY_PHY_CALIBRATION_CMD\n"); 526 IWL_ERR(priv,
527 "Could not send REPLY_PHY_CALIBRATION_CMD\n");
527 data->state = IWL_CHAIN_NOISE_ACCUMULATE; 528 data->state = IWL_CHAIN_NOISE_ACCUMULATE;
528 IWL_DEBUG_CALIB("Run chain_noise_calibrate\n"); 529 IWL_DEBUG_CALIB("Run chain_noise_calibrate\n");
529 } 530 }
@@ -804,8 +805,9 @@ static int iwl4965_hw_set_hw_params(struct iwl_priv *priv)
804 805
805 if ((priv->cfg->mod_params->num_of_queues > IWL49_NUM_QUEUES) || 806 if ((priv->cfg->mod_params->num_of_queues > IWL49_NUM_QUEUES) ||
806 (priv->cfg->mod_params->num_of_queues < IWL_MIN_NUM_QUEUES)) { 807 (priv->cfg->mod_params->num_of_queues < IWL_MIN_NUM_QUEUES)) {
807 IWL_ERROR("invalid queues_num, should be between %d and %d\n", 808 IWL_ERR(priv,
808 IWL_MIN_NUM_QUEUES, IWL49_NUM_QUEUES); 809 "invalid queues_num, should be between %d and %d\n",
810 IWL_MIN_NUM_QUEUES, IWL49_NUM_QUEUES);
809 return -EINVAL; 811 return -EINVAL;
810 } 812 }
811 813
@@ -813,6 +815,7 @@ static int iwl4965_hw_set_hw_params(struct iwl_priv *priv)
813 priv->hw_params.dma_chnl_num = FH49_TCSR_CHNL_NUM; 815 priv->hw_params.dma_chnl_num = FH49_TCSR_CHNL_NUM;
814 priv->hw_params.scd_bc_tbls_size = 816 priv->hw_params.scd_bc_tbls_size =
815 IWL49_NUM_QUEUES * sizeof(struct iwl4965_scd_bc_tbl); 817 IWL49_NUM_QUEUES * sizeof(struct iwl4965_scd_bc_tbl);
818 priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
816 priv->hw_params.max_stations = IWL4965_STATION_COUNT; 819 priv->hw_params.max_stations = IWL4965_STATION_COUNT;
817 priv->hw_params.bcast_sta_id = IWL4965_BROADCAST_ID; 820 priv->hw_params.bcast_sta_id = IWL4965_BROADCAST_ID;
818 priv->hw_params.max_data_size = IWL49_RTC_DATA_SIZE; 821 priv->hw_params.max_data_size = IWL49_RTC_DATA_SIZE;
@@ -820,6 +823,8 @@ static int iwl4965_hw_set_hw_params(struct iwl_priv *priv)
820 priv->hw_params.max_bsm_size = BSM_SRAM_SIZE; 823 priv->hw_params.max_bsm_size = BSM_SRAM_SIZE;
821 priv->hw_params.fat_channel = BIT(IEEE80211_BAND_5GHZ); 824 priv->hw_params.fat_channel = BIT(IEEE80211_BAND_5GHZ);
822 825
826 priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
827
823 priv->hw_params.tx_chains_num = 2; 828 priv->hw_params.tx_chains_num = 2;
824 priv->hw_params.rx_chains_num = 2; 829 priv->hw_params.rx_chains_num = 2;
825 priv->hw_params.valid_tx_ant = ANT_A | ANT_B; 830 priv->hw_params.valid_tx_ant = ANT_A | ANT_B;
@@ -902,7 +907,6 @@ static s32 iwl4965_get_tx_atten_grp(u16 channel)
902 channel <= CALIB_IWL_TX_ATTEN_GR4_LCH) 907 channel <= CALIB_IWL_TX_ATTEN_GR4_LCH)
903 return CALIB_CH_GROUP_4; 908 return CALIB_CH_GROUP_4;
904 909
905 IWL_ERROR("Can't find txatten group for channel %d.\n", channel);
906 return -1; 910 return -1;
907} 911}
908 912
@@ -956,7 +960,7 @@ static int iwl4965_interpolate_chan(struct iwl_priv *priv, u32 channel,
956 960
957 s = iwl4965_get_sub_band(priv, channel); 961 s = iwl4965_get_sub_band(priv, channel);
958 if (s >= EEPROM_TX_POWER_BANDS) { 962 if (s >= EEPROM_TX_POWER_BANDS) {
959 IWL_ERROR("Tx Power can not find channel %d\n", channel); 963 IWL_ERR(priv, "Tx Power can not find channel %d\n", channel);
960 return -1; 964 return -1;
961 } 965 }
962 966
@@ -1303,7 +1307,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
1303 s32 factory_actual_pwr[2]; 1307 s32 factory_actual_pwr[2];
1304 s32 power_index; 1308 s32 power_index;
1305 1309
1306 /* user_txpower_limit is in dBm, convert to half-dBm (half-dB units 1310 /* tx_power_user_lmt is in dBm, convert to half-dBm (half-dB units
1307 * are used for indexing into txpower table) */ 1311 * are used for indexing into txpower table) */
1308 user_target_power = 2 * priv->tx_power_user_lmt; 1312 user_target_power = 2 * priv->tx_power_user_lmt;
1309 1313
@@ -1319,8 +1323,11 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
1319 /* get txatten group, used to select 1) thermal txpower adjustment 1323 /* get txatten group, used to select 1) thermal txpower adjustment
1320 * and 2) mimo txpower balance between Tx chains. */ 1324 * and 2) mimo txpower balance between Tx chains. */
1321 txatten_grp = iwl4965_get_tx_atten_grp(channel); 1325 txatten_grp = iwl4965_get_tx_atten_grp(channel);
1322 if (txatten_grp < 0) 1326 if (txatten_grp < 0) {
1327 IWL_ERR(priv, "Can't find txatten group for channel %d.\n",
1328 channel);
1323 return -EINVAL; 1329 return -EINVAL;
1330 }
1324 1331
1325 IWL_DEBUG_TXPOWER("channel %d belongs to txatten group %d\n", 1332 IWL_DEBUG_TXPOWER("channel %d belongs to txatten group %d\n",
1326 channel, txatten_grp); 1333 channel, txatten_grp);
@@ -1483,12 +1490,12 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
1483 1490
1484 /* stay within the table! */ 1491 /* stay within the table! */
1485 if (power_index > 107) { 1492 if (power_index > 107) {
1486 IWL_WARNING("txpower index %d > 107\n", 1493 IWL_WARN(priv, "txpower index %d > 107\n",
1487 power_index); 1494 power_index);
1488 power_index = 107; 1495 power_index = 107;
1489 } 1496 }
1490 if (power_index < 0) { 1497 if (power_index < 0) {
1491 IWL_WARNING("txpower index %d < 0\n", 1498 IWL_WARN(priv, "txpower index %d < 0\n",
1492 power_index); 1499 power_index);
1493 power_index = 0; 1500 power_index = 0;
1494 } 1501 }
@@ -1531,7 +1538,7 @@ static int iwl4965_send_tx_power(struct iwl_priv *priv)
1531 /* If this gets hit a lot, switch it to a BUG() and catch 1538 /* If this gets hit a lot, switch it to a BUG() and catch
1532 * the stack trace to find out who is calling this during 1539 * the stack trace to find out who is calling this during
1533 * a scan. */ 1540 * a scan. */
1534 IWL_WARNING("TX Power requested while scanning!\n"); 1541 IWL_WARN(priv, "TX Power requested while scanning!\n");
1535 return -EAGAIN; 1542 return -EAGAIN;
1536 } 1543 }
1537 1544
@@ -1725,7 +1732,7 @@ static int iwl4965_hw_get_temperature(const struct iwl_priv *priv)
1725 IWL_DEBUG_TEMP("Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt); 1732 IWL_DEBUG_TEMP("Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt);
1726 1733
1727 if (R3 == R1) { 1734 if (R3 == R1) {
1728 IWL_ERROR("Calibration conflict R1 == R3\n"); 1735 IWL_ERR(priv, "Calibration conflict R1 == R3\n");
1729 return -1; 1736 return -1;
1730 } 1737 }
1731 1738
@@ -1837,7 +1844,8 @@ static int iwl4965_txq_agg_disable(struct iwl_priv *priv, u16 txq_id,
1837 1844
1838 if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) || 1845 if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) ||
1839 (IWL49_FIRST_AMPDU_QUEUE + IWL49_NUM_AMPDU_QUEUES <= txq_id)) { 1846 (IWL49_FIRST_AMPDU_QUEUE + IWL49_NUM_AMPDU_QUEUES <= txq_id)) {
1840 IWL_WARNING("queue number out of range: %d, must be %d to %d\n", 1847 IWL_WARN(priv,
1848 "queue number out of range: %d, must be %d to %d\n",
1841 txq_id, IWL49_FIRST_AMPDU_QUEUE, 1849 txq_id, IWL49_FIRST_AMPDU_QUEUE,
1842 IWL49_FIRST_AMPDU_QUEUE + IWL49_NUM_AMPDU_QUEUES - 1); 1850 IWL49_FIRST_AMPDU_QUEUE + IWL49_NUM_AMPDU_QUEUES - 1);
1843 return -EINVAL; 1851 return -EINVAL;
@@ -1908,7 +1916,8 @@ static int iwl4965_txq_agg_enable(struct iwl_priv *priv, int txq_id,
1908 1916
1909 if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) || 1917 if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) ||
1910 (IWL49_FIRST_AMPDU_QUEUE + IWL49_NUM_AMPDU_QUEUES <= txq_id)) { 1918 (IWL49_FIRST_AMPDU_QUEUE + IWL49_NUM_AMPDU_QUEUES <= txq_id)) {
1911 IWL_WARNING("queue number out of range: %d, must be %d to %d\n", 1919 IWL_WARN(priv,
1920 "queue number out of range: %d, must be %d to %d\n",
1912 txq_id, IWL49_FIRST_AMPDU_QUEUE, 1921 txq_id, IWL49_FIRST_AMPDU_QUEUE,
1913 IWL49_FIRST_AMPDU_QUEUE + IWL49_NUM_AMPDU_QUEUES - 1); 1922 IWL49_FIRST_AMPDU_QUEUE + IWL49_NUM_AMPDU_QUEUES - 1);
1914 return -EINVAL; 1923 return -EINVAL;
@@ -2067,10 +2076,10 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
2067 2076
2068 sc = le16_to_cpu(hdr->seq_ctrl); 2077 sc = le16_to_cpu(hdr->seq_ctrl);
2069 if (idx != (SEQ_TO_SN(sc) & 0xff)) { 2078 if (idx != (SEQ_TO_SN(sc) & 0xff)) {
2070 IWL_ERROR("BUG_ON idx doesn't match seq control" 2079 IWL_ERR(priv,
2071 " idx=%d, seq_idx=%d, seq=%d\n", 2080 "BUG_ON idx doesn't match seq control"
2072 idx, SEQ_TO_SN(sc), 2081 " idx=%d, seq_idx=%d, seq=%d\n",
2073 hdr->seq_ctrl); 2082 idx, SEQ_TO_SN(sc), hdr->seq_ctrl);
2074 return -1; 2083 return -1;
2075 } 2084 }
2076 2085
@@ -2129,7 +2138,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
2129 u8 *qc = NULL; 2138 u8 *qc = NULL;
2130 2139
2131 if ((index >= txq->q.n_bd) || (iwl_queue_used(&txq->q, index) == 0)) { 2140 if ((index >= txq->q.n_bd) || (iwl_queue_used(&txq->q, index) == 0)) {
2132 IWL_ERROR("Read index for DMA queue txq_id (%d) index %d " 2141 IWL_ERR(priv, "Read index for DMA queue txq_id (%d) index %d "
2133 "is out of range [0-%d] %d %d\n", txq_id, 2142 "is out of range [0-%d] %d %d\n", txq_id,
2134 index, txq->q.n_bd, txq->q.write_ptr, 2143 index, txq->q.n_bd, txq->q.write_ptr,
2135 txq->q.read_ptr); 2144 txq->q.read_ptr);
@@ -2147,7 +2156,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
2147 2156
2148 sta_id = iwl_get_ra_sta_id(priv, hdr); 2157 sta_id = iwl_get_ra_sta_id(priv, hdr);
2149 if (txq->sched_retry && unlikely(sta_id == IWL_INVALID_STATION)) { 2158 if (txq->sched_retry && unlikely(sta_id == IWL_INVALID_STATION)) {
2150 IWL_ERROR("Station not known\n"); 2159 IWL_ERR(priv, "Station not known\n");
2151 return; 2160 return;
2152 } 2161 }
2153 2162
@@ -2210,7 +2219,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
2210 iwl_txq_check_empty(priv, sta_id, tid, txq_id); 2219 iwl_txq_check_empty(priv, sta_id, tid, txq_id);
2211 2220
2212 if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK)) 2221 if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK))
2213 IWL_ERROR("TODO: Implement Tx ABORT REQUIRED!!!\n"); 2222 IWL_ERR(priv, "TODO: Implement Tx ABORT REQUIRED!!!\n");
2214} 2223}
2215 2224
2216static int iwl4965_calc_rssi(struct iwl_priv *priv, 2225static int iwl4965_calc_rssi(struct iwl_priv *priv,
@@ -2244,7 +2253,7 @@ static int iwl4965_calc_rssi(struct iwl_priv *priv,
2244 2253
2245 /* dBm = max_rssi dB - agc dB - constant. 2254 /* dBm = max_rssi dB - agc dB - constant.
2246 * Higher AGC (higher radio gain) means lower signal. */ 2255 * Higher AGC (higher radio gain) means lower signal. */
2247 return max_rssi - agc - IWL_RSSI_OFFSET; 2256 return max_rssi - agc - IWL49_RSSI_OFFSET;
2248} 2257}
2249 2258
2250 2259
@@ -2287,6 +2296,9 @@ static struct iwl_lib_ops iwl4965_lib = {
2287 .txq_set_sched = iwl4965_txq_set_sched, 2296 .txq_set_sched = iwl4965_txq_set_sched,
2288 .txq_agg_enable = iwl4965_txq_agg_enable, 2297 .txq_agg_enable = iwl4965_txq_agg_enable,
2289 .txq_agg_disable = iwl4965_txq_agg_disable, 2298 .txq_agg_disable = iwl4965_txq_agg_disable,
2299 .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
2300 .txq_free_tfd = iwl_hw_txq_free_tfd,
2301 .txq_init = iwl_hw_tx_queue_init,
2290 .rx_handler_setup = iwl4965_rx_handler_setup, 2302 .rx_handler_setup = iwl4965_rx_handler_setup,
2291 .setup_deferred_work = iwl4965_setup_deferred_work, 2303 .setup_deferred_work = iwl4965_setup_deferred_work,
2292 .cancel_deferred_work = iwl4965_cancel_deferred_work, 2304 .cancel_deferred_work = iwl4965_cancel_deferred_work,