aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-5000.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-5000.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c59
1 files changed, 36 insertions, 23 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 66d053d28a74..89d92a8ca157 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2007-2008 Intel Corporation. All rights reserved. 3 * Copyright(c) 2007 - 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
@@ -289,7 +289,7 @@ static u32 eeprom_indirect_address(const struct iwl_priv *priv, u32 address)
289 offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_OTHERS); 289 offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_OTHERS);
290 break; 290 break;
291 default: 291 default:
292 IWL_ERROR("illegal indirect type: 0x%X\n", 292 IWL_ERR(priv, "illegal indirect type: 0x%X\n",
293 address & INDIRECT_TYPE_MSK); 293 address & INDIRECT_TYPE_MSK);
294 break; 294 break;
295 } 295 }
@@ -384,7 +384,8 @@ static void iwl5000_chain_noise_reset(struct iwl_priv *priv)
384 ret = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD, 384 ret = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
385 sizeof(cmd), &cmd); 385 sizeof(cmd), &cmd);
386 if (ret) 386 if (ret)
387 IWL_ERROR("Could not send REPLY_PHY_CALIBRATION_CMD\n"); 387 IWL_ERR(priv,
388 "Could not send REPLY_PHY_CALIBRATION_CMD\n");
388 data->state = IWL_CHAIN_NOISE_ACCUMULATE; 389 data->state = IWL_CHAIN_NOISE_ACCUMULATE;
389 IWL_DEBUG_CALIB("Run chain_noise_calibrate\n"); 390 IWL_DEBUG_CALIB("Run chain_noise_calibrate\n");
390 } 391 }
@@ -507,7 +508,7 @@ static void iwl5000_rx_calib_result(struct iwl_priv *priv,
507 index = IWL_CALIB_BASE_BAND; 508 index = IWL_CALIB_BASE_BAND;
508 break; 509 break;
509 default: 510 default:
510 IWL_ERROR("Unknown calibration notification %d\n", 511 IWL_ERR(priv, "Unknown calibration notification %d\n",
511 hdr->op_code); 512 hdr->op_code);
512 return; 513 return;
513 } 514 }
@@ -580,7 +581,8 @@ static int iwl5000_load_given_ucode(struct iwl_priv *priv,
580{ 581{
581 int ret = 0; 582 int ret = 0;
582 583
583 ret = iwl5000_load_section(priv, inst_image, RTC_INST_LOWER_BOUND); 584 ret = iwl5000_load_section(priv, inst_image,
585 IWL50_RTC_INST_LOWER_BOUND);
584 if (ret) 586 if (ret)
585 return ret; 587 return ret;
586 588
@@ -588,19 +590,19 @@ static int iwl5000_load_given_ucode(struct iwl_priv *priv,
588 ret = wait_event_interruptible_timeout(priv->wait_command_queue, 590 ret = wait_event_interruptible_timeout(priv->wait_command_queue,
589 priv->ucode_write_complete, 5 * HZ); 591 priv->ucode_write_complete, 5 * HZ);
590 if (ret == -ERESTARTSYS) { 592 if (ret == -ERESTARTSYS) {
591 IWL_ERROR("Could not load the INST uCode section due " 593 IWL_ERR(priv, "Could not load the INST uCode section due "
592 "to interrupt\n"); 594 "to interrupt\n");
593 return ret; 595 return ret;
594 } 596 }
595 if (!ret) { 597 if (!ret) {
596 IWL_ERROR("Could not load the INST uCode section\n"); 598 IWL_ERR(priv, "Could not load the INST uCode section\n");
597 return -ETIMEDOUT; 599 return -ETIMEDOUT;
598 } 600 }
599 601
600 priv->ucode_write_complete = 0; 602 priv->ucode_write_complete = 0;
601 603
602 ret = iwl5000_load_section( 604 ret = iwl5000_load_section(
603 priv, data_image, RTC_DATA_LOWER_BOUND); 605 priv, data_image, IWL50_RTC_DATA_LOWER_BOUND);
604 if (ret) 606 if (ret)
605 return ret; 607 return ret;
606 608
@@ -609,11 +611,11 @@ static int iwl5000_load_given_ucode(struct iwl_priv *priv,
609 ret = wait_event_interruptible_timeout(priv->wait_command_queue, 611 ret = wait_event_interruptible_timeout(priv->wait_command_queue,
610 priv->ucode_write_complete, 5 * HZ); 612 priv->ucode_write_complete, 5 * HZ);
611 if (ret == -ERESTARTSYS) { 613 if (ret == -ERESTARTSYS) {
612 IWL_ERROR("Could not load the INST uCode section due " 614 IWL_ERR(priv, "Could not load the INST uCode section due "
613 "to interrupt\n"); 615 "to interrupt\n");
614 return ret; 616 return ret;
615 } else if (!ret) { 617 } else if (!ret) {
616 IWL_ERROR("Could not load the DATA uCode section\n"); 618 IWL_ERR(priv, "Could not load the DATA uCode section\n");
617 return -ETIMEDOUT; 619 return -ETIMEDOUT;
618 } else 620 } else
619 ret = 0; 621 ret = 0;
@@ -675,7 +677,8 @@ static void iwl5000_init_alive_start(struct iwl_priv *priv)
675 iwl_clear_stations_table(priv); 677 iwl_clear_stations_table(priv);
676 ret = priv->cfg->ops->lib->alive_notify(priv); 678 ret = priv->cfg->ops->lib->alive_notify(priv);
677 if (ret) { 679 if (ret) {
678 IWL_WARNING("Could not complete ALIVE transition: %d\n", ret); 680 IWL_WARN(priv,
681 "Could not complete ALIVE transition: %d\n", ret);
679 goto restart; 682 goto restart;
680 } 683 }
681 684
@@ -824,8 +827,9 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
824{ 827{
825 if ((priv->cfg->mod_params->num_of_queues > IWL50_NUM_QUEUES) || 828 if ((priv->cfg->mod_params->num_of_queues > IWL50_NUM_QUEUES) ||
826 (priv->cfg->mod_params->num_of_queues < IWL_MIN_NUM_QUEUES)) { 829 (priv->cfg->mod_params->num_of_queues < IWL_MIN_NUM_QUEUES)) {
827 IWL_ERROR("invalid queues_num, should be between %d and %d\n", 830 IWL_ERR(priv,
828 IWL_MIN_NUM_QUEUES, IWL50_NUM_QUEUES); 831 "invalid queues_num, should be between %d and %d\n",
832 IWL_MIN_NUM_QUEUES, IWL50_NUM_QUEUES);
829 return -EINVAL; 833 return -EINVAL;
830 } 834 }
831 835
@@ -833,6 +837,7 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
833 priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM; 837 priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM;
834 priv->hw_params.scd_bc_tbls_size = 838 priv->hw_params.scd_bc_tbls_size =
835 IWL50_NUM_QUEUES * sizeof(struct iwl5000_scd_bc_tbl); 839 IWL50_NUM_QUEUES * sizeof(struct iwl5000_scd_bc_tbl);
840 priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
836 priv->hw_params.max_stations = IWL5000_STATION_COUNT; 841 priv->hw_params.max_stations = IWL5000_STATION_COUNT;
837 priv->hw_params.bcast_sta_id = IWL5000_BROADCAST_ID; 842 priv->hw_params.bcast_sta_id = IWL5000_BROADCAST_ID;
838 priv->hw_params.max_data_size = IWL50_RTC_DATA_SIZE; 843 priv->hw_params.max_data_size = IWL50_RTC_DATA_SIZE;
@@ -840,6 +845,8 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
840 priv->hw_params.max_bsm_size = 0; 845 priv->hw_params.max_bsm_size = 0;
841 priv->hw_params.fat_channel = BIT(IEEE80211_BAND_2GHZ) | 846 priv->hw_params.fat_channel = BIT(IEEE80211_BAND_2GHZ) |
842 BIT(IEEE80211_BAND_5GHZ); 847 BIT(IEEE80211_BAND_5GHZ);
848 priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
849
843 priv->hw_params.sens = &iwl5000_sensitivity; 850 priv->hw_params.sens = &iwl5000_sensitivity;
844 851
845 switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) { 852 switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
@@ -1011,7 +1018,8 @@ static int iwl5000_txq_agg_enable(struct iwl_priv *priv, int txq_id,
1011 1018
1012 if ((IWL50_FIRST_AMPDU_QUEUE > txq_id) || 1019 if ((IWL50_FIRST_AMPDU_QUEUE > txq_id) ||
1013 (IWL50_FIRST_AMPDU_QUEUE + IWL50_NUM_AMPDU_QUEUES <= txq_id)) { 1020 (IWL50_FIRST_AMPDU_QUEUE + IWL50_NUM_AMPDU_QUEUES <= txq_id)) {
1014 IWL_WARNING("queue number out of range: %d, must be %d to %d\n", 1021 IWL_WARN(priv,
1022 "queue number out of range: %d, must be %d to %d\n",
1015 txq_id, IWL50_FIRST_AMPDU_QUEUE, 1023 txq_id, IWL50_FIRST_AMPDU_QUEUE,
1016 IWL50_FIRST_AMPDU_QUEUE + IWL50_NUM_AMPDU_QUEUES - 1); 1024 IWL50_FIRST_AMPDU_QUEUE + IWL50_NUM_AMPDU_QUEUES - 1);
1017 return -EINVAL; 1025 return -EINVAL;
@@ -1076,7 +1084,8 @@ static int iwl5000_txq_agg_disable(struct iwl_priv *priv, u16 txq_id,
1076 1084
1077 if ((IWL50_FIRST_AMPDU_QUEUE > txq_id) || 1085 if ((IWL50_FIRST_AMPDU_QUEUE > txq_id) ||
1078 (IWL50_FIRST_AMPDU_QUEUE + IWL50_NUM_AMPDU_QUEUES <= txq_id)) { 1086 (IWL50_FIRST_AMPDU_QUEUE + IWL50_NUM_AMPDU_QUEUES <= txq_id)) {
1079 IWL_WARNING("queue number out of range: %d, must be %d to %d\n", 1087 IWL_WARN(priv,
1088 "queue number out of range: %d, must be %d to %d\n",
1080 txq_id, IWL50_FIRST_AMPDU_QUEUE, 1089 txq_id, IWL50_FIRST_AMPDU_QUEUE,
1081 IWL50_FIRST_AMPDU_QUEUE + IWL50_NUM_AMPDU_QUEUES - 1); 1090 IWL50_FIRST_AMPDU_QUEUE + IWL50_NUM_AMPDU_QUEUES - 1);
1082 return -EINVAL; 1091 return -EINVAL;
@@ -1197,8 +1206,9 @@ static int iwl5000_tx_status_reply_tx(struct iwl_priv *priv,
1197 1206
1198 sc = le16_to_cpu(hdr->seq_ctrl); 1207 sc = le16_to_cpu(hdr->seq_ctrl);
1199 if (idx != (SEQ_TO_SN(sc) & 0xff)) { 1208 if (idx != (SEQ_TO_SN(sc) & 0xff)) {
1200 IWL_ERROR("BUG_ON idx doesn't match seq control" 1209 IWL_ERR(priv,
1201 " idx=%d, seq_idx=%d, seq=%d\n", 1210 "BUG_ON idx doesn't match seq control"
1211 " idx=%d, seq_idx=%d, seq=%d\n",
1202 idx, SEQ_TO_SN(sc), 1212 idx, SEQ_TO_SN(sc),
1203 hdr->seq_ctrl); 1213 hdr->seq_ctrl);
1204 return -1; 1214 return -1;
@@ -1254,7 +1264,7 @@ static void iwl5000_rx_reply_tx(struct iwl_priv *priv,
1254 int freed; 1264 int freed;
1255 1265
1256 if ((index >= txq->q.n_bd) || (iwl_queue_used(&txq->q, index) == 0)) { 1266 if ((index >= txq->q.n_bd) || (iwl_queue_used(&txq->q, index) == 0)) {
1257 IWL_ERROR("Read index for DMA queue txq_id (%d) index %d " 1267 IWL_ERR(priv, "Read index for DMA queue txq_id (%d) index %d "
1258 "is out of range [0-%d] %d %d\n", txq_id, 1268 "is out of range [0-%d] %d %d\n", txq_id,
1259 index, txq->q.n_bd, txq->q.write_ptr, 1269 index, txq->q.n_bd, txq->q.write_ptr,
1260 txq->q.read_ptr); 1270 txq->q.read_ptr);
@@ -1328,7 +1338,7 @@ static void iwl5000_rx_reply_tx(struct iwl_priv *priv,
1328 iwl_txq_check_empty(priv, sta_id, tid, txq_id); 1338 iwl_txq_check_empty(priv, sta_id, tid, txq_id);
1329 1339
1330 if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK)) 1340 if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK))
1331 IWL_ERROR("TODO: Implement Tx ABORT REQUIRED!!!\n"); 1341 IWL_ERR(priv, "TODO: Implement Tx ABORT REQUIRED!!!\n");
1332} 1342}
1333 1343
1334/* Currently 5000 is the superset of everything */ 1344/* Currently 5000 is the superset of everything */
@@ -1356,7 +1366,7 @@ static void iwl5000_rx_handler_setup(struct iwl_priv *priv)
1356 1366
1357static int iwl5000_hw_valid_rtc_data_addr(u32 addr) 1367static int iwl5000_hw_valid_rtc_data_addr(u32 addr)
1358{ 1368{
1359 return (addr >= RTC_DATA_LOWER_BOUND) && 1369 return (addr >= IWL50_RTC_DATA_LOWER_BOUND) &&
1360 (addr < IWL50_RTC_DATA_UPPER_BOUND); 1370 (addr < IWL50_RTC_DATA_UPPER_BOUND);
1361} 1371}
1362 1372
@@ -1460,7 +1470,7 @@ static int iwl5000_calc_rssi(struct iwl_priv *priv,
1460 1470
1461 /* dBm = max_rssi dB - agc dB - constant. 1471 /* dBm = max_rssi dB - agc dB - constant.
1462 * Higher AGC (higher radio gain) means lower signal. */ 1472 * Higher AGC (higher radio gain) means lower signal. */
1463 return max_rssi - agc - IWL_RSSI_OFFSET; 1473 return max_rssi - agc - IWL49_RSSI_OFFSET;
1464} 1474}
1465 1475
1466static struct iwl_hcmd_ops iwl5000_hcmd = { 1476static struct iwl_hcmd_ops iwl5000_hcmd = {
@@ -1483,6 +1493,9 @@ static struct iwl_lib_ops iwl5000_lib = {
1483 .txq_set_sched = iwl5000_txq_set_sched, 1493 .txq_set_sched = iwl5000_txq_set_sched,
1484 .txq_agg_enable = iwl5000_txq_agg_enable, 1494 .txq_agg_enable = iwl5000_txq_agg_enable,
1485 .txq_agg_disable = iwl5000_txq_agg_disable, 1495 .txq_agg_disable = iwl5000_txq_agg_disable,
1496 .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
1497 .txq_free_tfd = iwl_hw_txq_free_tfd,
1498 .txq_init = iwl_hw_tx_queue_init,
1486 .rx_handler_setup = iwl5000_rx_handler_setup, 1499 .rx_handler_setup = iwl5000_rx_handler_setup,
1487 .setup_deferred_work = iwl5000_setup_deferred_work, 1500 .setup_deferred_work = iwl5000_setup_deferred_work,
1488 .is_valid_rtc_data_addr = iwl5000_hw_valid_rtc_data_addr, 1501 .is_valid_rtc_data_addr = iwl5000_hw_valid_rtc_data_addr,
@@ -1517,13 +1530,13 @@ static struct iwl_lib_ops iwl5000_lib = {
1517 }, 1530 },
1518}; 1531};
1519 1532
1520static struct iwl_ops iwl5000_ops = { 1533struct iwl_ops iwl5000_ops = {
1521 .lib = &iwl5000_lib, 1534 .lib = &iwl5000_lib,
1522 .hcmd = &iwl5000_hcmd, 1535 .hcmd = &iwl5000_hcmd,
1523 .utils = &iwl5000_hcmd_utils, 1536 .utils = &iwl5000_hcmd_utils,
1524}; 1537};
1525 1538
1526static struct iwl_mod_params iwl50_mod_params = { 1539struct iwl_mod_params iwl50_mod_params = {
1527 .num_of_queues = IWL50_NUM_QUEUES, 1540 .num_of_queues = IWL50_NUM_QUEUES,
1528 .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES, 1541 .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
1529 .amsdu_size_8K = 1, 1542 .amsdu_size_8K = 1,