84
85
CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
86
87
spin_unlock_irqrestore(&priv->lock, flags);
87
IWL_DEBUG_INFO("stop master\n");
88
IWL_DEBUG_INFO(priv, "stop master\n");
108
109
iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
109
110
CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A);
111
iwl_set_bit(priv, CSR_ANA_PLL_CFG, CSR50_ANA_PLL_CFG_VAL);
112
if (priv->cfg->need_pll_cfg)
113
iwl_set_bit(priv, CSR_ANA_PLL_CFG, CSR50_ANA_PLL_CFG_VAL);
113
115
/* set "initialization complete" bit to move adapter
114
116
* D0U* --> D0A* state */
118
120
ret = iwl_poll_direct_bit(priv, CSR_GP_CNTRL,
119
121
CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
121
IWL_DEBUG_INFO("Failed to init the card\n");
123
IWL_DEBUG_INFO(priv, "Failed to init the card\n");
177
179
/* FIXME: put here L1A -L0S w/a */
179
iwl_set_bit(priv, CSR_ANA_PLL_CFG, CSR50_ANA_PLL_CFG_VAL);
181
if (priv->cfg->need_pll_cfg)
182
iwl_set_bit(priv, CSR_ANA_PLL_CFG, CSR50_ANA_PLL_CFG_VAL);
181
184
/* set "initialization complete" bit to move adapter
182
185
* D0U* --> D0A* state */
186
189
ret = iwl_poll_direct_bit(priv, CSR_GP_CNTRL,
187
190
CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
189
IWL_DEBUG_INFO("Failed to init the card\n");
192
IWL_DEBUG_INFO(priv, "Failed to init the card\n");
338
341
data->delta_gain_code[i] |= (1 << 2);
341
IWL_DEBUG_CALIB("Delta gains: ANT_B = %d ANT_C = %d\n",
344
IWL_DEBUG_CALIB(priv, "Delta gains: ANT_B = %d ANT_C = %d\n",
342
345
data->delta_gain_code[1], data->delta_gain_code[2]);
344
347
if (!data->radio_write) {
388
391
"Could not send REPLY_PHY_CALIBRATION_CMD\n");
389
392
data->state = IWL_CHAIN_NOISE_ACCUMULATE;
390
IWL_DEBUG_CALIB("Run chain_noise_calibrate\n");
393
IWL_DEBUG_CALIB(priv, "Run chain_noise_calibrate\n");
394
static void iwl5000_rts_tx_cmd_flag(struct ieee80211_tx_info *info,
397
void iwl5000_rts_tx_cmd_flag(struct ieee80211_tx_info *info,
395
398
__le32 *tx_flags)
397
400
if ((info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) ||
518
521
static void iwl5000_rx_calib_complete(struct iwl_priv *priv,
519
522
struct iwl_rx_mem_buffer *rxb)
521
IWL_DEBUG_INFO("Init. calibration is completed, restarting fw.\n");
524
IWL_DEBUG_INFO(priv, "Init. calibration is completed, restarting fw.\n");
522
525
queue_work(priv->workqueue, &priv->restart);
589
IWL_DEBUG_INFO("INST uCode section being loaded...\n");
592
IWL_DEBUG_INFO(priv, "INST uCode section being loaded...\n");
590
593
ret = wait_event_interruptible_timeout(priv->wait_command_queue,
591
594
priv->ucode_write_complete, 5 * HZ);
592
595
if (ret == -ERESTARTSYS) {
609
IWL_DEBUG_INFO("DATA uCode section being loaded...\n");
612
IWL_DEBUG_INFO(priv, "DATA uCode section being loaded...\n");
611
614
ret = wait_event_interruptible_timeout(priv->wait_command_queue,
612
615
priv->ucode_write_complete, 5 * HZ);
632
635
/* check whether init ucode should be loaded, or rather runtime ucode */
633
636
if (priv->ucode_init.len && (priv->ucode_type == UCODE_NONE)) {
634
IWL_DEBUG_INFO("Init ucode found. Loading init ucode...\n");
637
IWL_DEBUG_INFO(priv, "Init ucode found. Loading init ucode...\n");
635
638
ret = iwl5000_load_given_ucode(priv,
636
639
&priv->ucode_init, &priv->ucode_init_data);
638
IWL_DEBUG_INFO("Init ucode load complete.\n");
641
IWL_DEBUG_INFO(priv, "Init ucode load complete.\n");
639
642
priv->ucode_type = UCODE_INIT;
642
IWL_DEBUG_INFO("Init ucode not found, or already loaded. "
645
IWL_DEBUG_INFO(priv, "Init ucode not found, or already loaded. "
643
646
"Loading runtime ucode...\n");
644
647
ret = iwl5000_load_given_ucode(priv,
645
648
&priv->ucode_code, &priv->ucode_data);
647
IWL_DEBUG_INFO("Runtime ucode load complete.\n");
650
IWL_DEBUG_INFO(priv, "Runtime ucode load complete.\n");
648
651
priv->ucode_type = UCODE_RT;
660
663
if (priv->card_alive_init.is_valid != UCODE_VALID_OK) {
661
664
/* We had an error bringing up the hardware, so take it
662
665
* all the way back down so we can try again */
663
IWL_DEBUG_INFO("Initialize Alive failed.\n");
666
IWL_DEBUG_INFO(priv, "Initialize Alive failed.\n");
670
673
if (iwl_verify_ucode(priv)) {
671
674
/* Runtime instruction load was bad;
672
675
* take it all the way back down so we can try again */
673
IWL_DEBUG_INFO("Bad \"initialize\" uCode load.\n");
676
IWL_DEBUG_INFO(priv, "Bad \"initialize\" uCode load.\n");
714
717
txq->sched_retry = scd_retry;
716
IWL_DEBUG_INFO("%s %s Queue %d on AC %d\n",
719
IWL_DEBUG_INFO(priv, "%s %s Queue %d on AC %d\n",
717
720
active ? "Activate" : "Deactivate",
718
721
scd_retry ? "BA" : "AC", txq_id, tx_fifo_id);
837
840
priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM;
838
841
priv->hw_params.scd_bc_tbls_size =
839
842
IWL50_NUM_QUEUES * sizeof(struct iwl5000_scd_bc_tbl);
843
priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
840
844
priv->hw_params.max_stations = IWL5000_STATION_COUNT;
841
845
priv->hw_params.bcast_sta_id = IWL5000_BROADCAST_ID;
842
priv->hw_params.max_data_size = IWL50_RTC_DATA_SIZE;
843
priv->hw_params.max_inst_size = IWL50_RTC_INST_SIZE;
847
switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
848
case CSR_HW_REV_TYPE_6x00:
849
case CSR_HW_REV_TYPE_6x50:
850
priv->hw_params.max_data_size = IWL60_RTC_DATA_SIZE;
851
priv->hw_params.max_inst_size = IWL60_RTC_INST_SIZE;
854
priv->hw_params.max_data_size = IWL50_RTC_DATA_SIZE;
855
priv->hw_params.max_inst_size = IWL50_RTC_INST_SIZE;
844
858
priv->hw_params.max_bsm_size = 0;
845
859
priv->hw_params.fat_channel = BIT(IEEE80211_BAND_2GHZ) |
846
860
BIT(IEEE80211_BAND_5GHZ);
849
863
priv->hw_params.sens = &iwl5000_sensitivity;
851
switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
852
case CSR_HW_REV_TYPE_5100:
853
priv->hw_params.tx_chains_num = 1;
854
priv->hw_params.rx_chains_num = 2;
855
priv->hw_params.valid_tx_ant = ANT_B;
856
priv->hw_params.valid_rx_ant = ANT_AB;
858
case CSR_HW_REV_TYPE_5150:
859
priv->hw_params.tx_chains_num = 1;
860
priv->hw_params.rx_chains_num = 2;
861
priv->hw_params.valid_tx_ant = ANT_A;
862
priv->hw_params.valid_rx_ant = ANT_AB;
864
case CSR_HW_REV_TYPE_5300:
865
case CSR_HW_REV_TYPE_5350:
866
priv->hw_params.tx_chains_num = 3;
867
priv->hw_params.rx_chains_num = 3;
868
priv->hw_params.valid_tx_ant = ANT_ABC;
869
priv->hw_params.valid_rx_ant = ANT_ABC;
865
priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
866
priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant);
867
priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant;
868
priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant;
873
870
switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
874
case CSR_HW_REV_TYPE_5100:
875
case CSR_HW_REV_TYPE_5300:
876
case CSR_HW_REV_TYPE_5350:
877
/* 5X00 and 5350 wants in Celsius */
878
priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD;
880
871
case CSR_HW_REV_TYPE_5150:
881
872
/* 5150 wants in Kelvin */
882
873
priv->hw_params.ct_kill_threshold =
883
874
iwl5150_get_ct_threshold(priv);
877
/* all others want Celsius */
878
priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD;
887
882
/* Set initial calibration set */
888
883
switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
889
case CSR_HW_REV_TYPE_5100:
890
case CSR_HW_REV_TYPE_5300:
891
case CSR_HW_REV_TYPE_5350:
884
case CSR_HW_REV_TYPE_5150:
885
priv->hw_params.calib_init_cfg =
888
BIT(IWL_CALIB_TX_IQ) |
889
BIT(IWL_CALIB_BASE_BAND);
892
893
priv->hw_params.calib_init_cfg =
893
894
BIT(IWL_CALIB_XTAL) |
894
895
BIT(IWL_CALIB_LO) |
1164
1157
idx = start_idx;
1166
1159
/* FIXME: code repetition */
1167
IWL_DEBUG_TX_REPLY("FrameCnt = %d, StartIdx=%d idx=%d\n",
1160
IWL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, StartIdx=%d idx=%d\n",
1168
1161
agg->frame_count, agg->start_idx, idx);
1170
1163
info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb[0]);
1177
1170
/* FIXME: code repetition end */
1179
IWL_DEBUG_TX_REPLY("1 Frame 0x%x failure :%d\n",
1172
IWL_DEBUG_TX_REPLY(priv, "1 Frame 0x%x failure :%d\n",
1180
1173
status & 0xff, tx_resp->failure_frame);
1181
IWL_DEBUG_TX_REPLY("Rate Info rate_n_flags=%x\n", rate_n_flags);
1174
IWL_DEBUG_TX_REPLY(priv, "Rate Info rate_n_flags=%x\n", rate_n_flags);
1183
1176
agg->wait_for_ba = 0;
1198
1191
AGG_TX_STATE_ABORT_MSK))
1201
IWL_DEBUG_TX_REPLY("FrameCnt = %d, txq_id=%d idx=%d\n",
1194
IWL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, txq_id=%d idx=%d\n",
1202
1195
agg->frame_count, txq_id, idx);
1204
1197
hdr = iwl_tx_queue_get_hdr(priv, txq_id, idx);
1233
1226
bitmap |= 1ULL << sh;
1234
IWL_DEBUG_TX_REPLY("start=%d bitmap=0x%llx\n",
1227
IWL_DEBUG_TX_REPLY(priv, "start=%d bitmap=0x%llx\n",
1235
1228
start, (unsigned long long)bitmap);
1238
1231
agg->bitmap = bitmap;
1239
1232
agg->start_idx = start;
1240
IWL_DEBUG_TX_REPLY("Frames %d start_idx=%d bitmap=0x%llx\n",
1233
IWL_DEBUG_TX_REPLY(priv, "Frames %d start_idx=%d bitmap=0x%llx\n",
1241
1234
agg->frame_count, agg->start_idx,
1242
1235
(unsigned long long)agg->bitmap);
1291
1284
if (txq->q.read_ptr != (scd_ssn & 0xff)) {
1292
1285
index = iwl_queue_dec_wrap(scd_ssn & 0xff, txq->q.n_bd);
1293
IWL_DEBUG_TX_REPLY("Retry scheduler reclaim "
1286
IWL_DEBUG_TX_REPLY(priv, "Retry scheduler reclaim "
1294
1287
"scd_ssn=%d idx=%d txq=%d swq=%d\n",
1295
1288
scd_ssn , index, txq_id, txq->swq_id);
1317
1310
le32_to_cpu(tx_resp->rate_n_flags),
1320
IWL_DEBUG_TX_REPLY("TXQ %d status %s (0x%08x) rate_n_flags "
1313
IWL_DEBUG_TX_REPLY(priv, "TXQ %d status %s (0x%08x) rate_n_flags "
1321
1314
"0x%x retries %d\n",
1323
1316
iwl_get_tx_fail_reason(status), status,
1388
1381
(rxon1->acquisition_data == rxon2->acquisition_data) &&
1389
1382
(rxon1->rx_chain == rxon2->rx_chain) &&
1390
1383
(rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) {
1391
IWL_DEBUG_INFO("Using current RXON_ASSOC. Not resending.\n");
1384
IWL_DEBUG_INFO(priv, "Using current RXON_ASSOC. Not resending.\n");
1418
1411
static int iwl5000_send_tx_power(struct iwl_priv *priv)
1420
1413
struct iwl5000_tx_power_dbm_cmd tx_power_cmd;
1422
1416
/* half dBm need to multiply */
1423
1417
tx_power_cmd.global_lmt = (s8)(2 * priv->tx_power_user_lmt);
1424
1418
tx_power_cmd.flags = IWL50_TX_POWER_NO_CLOSED;
1425
1419
tx_power_cmd.srv_chan_lmt = IWL50_TX_POWER_AUTO;
1426
return iwl_send_cmd_pdu_async(priv, REPLY_TX_POWER_DBM_CMD,
1421
if (IWL_UCODE_API(priv->ucode_ver) == 1)
1422
tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD_V1;
1424
tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD;
1426
return iwl_send_cmd_pdu_async(priv, tx_ant_cfg_cmd,
1427
1427
sizeof(tx_power_cmd), &tx_power_cmd,
1437
1437
/* Calc max signal level (dBm) among 3 possible receivers */
1438
static int iwl5000_calc_rssi(struct iwl_priv *priv,
1438
int iwl5000_calc_rssi(struct iwl_priv *priv,
1439
1439
struct iwl_rx_phy_res *rx_resp)
1441
1441
/* data from PHY/DSP regarding signal strength, etc.,
1464
1464
max_rssi = max_t(u32, rssi_a, rssi_b);
1465
1465
max_rssi = max_t(u32, max_rssi, rssi_c);
1467
IWL_DEBUG_STATS("Rssi In A %d B %d C %d Max %d AGC dB %d\n",
1467
IWL_DEBUG_STATS(priv, "Rssi In A %d B %d C %d Max %d AGC dB %d\n",
1468
1468
rssi_a, rssi_b, rssi_c, max_rssi, agc);
1470
1470
/* dBm = max_rssi dB - agc dB - constant.
1472
1472
return max_rssi - agc - IWL49_RSSI_OFFSET;
1475
static struct iwl_hcmd_ops iwl5000_hcmd = {
1475
struct iwl_hcmd_ops iwl5000_hcmd = {
1476
1476
.rxon_assoc = iwl5000_send_rxon_assoc,
1479
static struct iwl_hcmd_utils_ops iwl5000_hcmd_utils = {
1479
struct iwl_hcmd_utils_ops iwl5000_hcmd_utils = {
1480
1480
.get_hcmd_size = iwl5000_get_hcmd_size,
1481
1481
.build_addsta_hcmd = iwl5000_build_addsta_hcmd,
1482
1482
.gain_computation = iwl5000_gain_computation,
1485
1485
.calc_rssi = iwl5000_calc_rssi,
1488
static struct iwl_lib_ops iwl5000_lib = {
1488
struct iwl_lib_ops iwl5000_lib = {
1489
1489
.set_hw_params = iwl5000_hw_set_hw_params,
1490
1490
.txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl,
1491
1491
.txq_inval_byte_cnt_tbl = iwl5000_txq_inval_byte_cnt_tbl,
1492
1492
.txq_set_sched = iwl5000_txq_set_sched,
1493
1493
.txq_agg_enable = iwl5000_txq_agg_enable,
1494
1494
.txq_agg_disable = iwl5000_txq_agg_disable,
1495
.txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
1496
.txq_free_tfd = iwl_hw_txq_free_tfd,
1497
.txq_init = iwl_hw_tx_queue_init,
1495
1498
.rx_handler_setup = iwl5000_rx_handler_setup,
1496
1499
.setup_deferred_work = iwl5000_setup_deferred_work,
1497
1500
.is_valid_rtc_data_addr = iwl5000_hw_valid_rtc_data_addr,
1529
static struct iwl_ops iwl5000_ops = {
1532
struct iwl_ops iwl5000_ops = {
1530
1533
.lib = &iwl5000_lib,
1531
1534
.hcmd = &iwl5000_hcmd,
1532
1535
.utils = &iwl5000_hcmd_utils,
1535
static struct iwl_mod_params iwl50_mod_params = {
1538
struct iwl_mod_params iwl50_mod_params = {
1536
1539
.num_of_queues = IWL50_NUM_QUEUES,
1537
1540
.num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
1538
1541
.amsdu_size_8K = 1,
1552
1555
.eeprom_ver = EEPROM_5000_EEPROM_VERSION,
1553
1556
.eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
1554
1557
.mod_params = &iwl50_mod_params,
1558
.valid_tx_ant = ANT_ABC,
1559
.valid_rx_ant = ANT_ABC,
1560
.need_pll_cfg = true,
1557
1563
struct iwl_cfg iwl5100_bg_cfg = {
1565
1571
.eeprom_ver = EEPROM_5000_EEPROM_VERSION,
1566
1572
.eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
1567
1573
.mod_params = &iwl50_mod_params,
1574
.valid_tx_ant = ANT_B,
1575
.valid_rx_ant = ANT_AB,
1576
.need_pll_cfg = true,
1570
1579
struct iwl_cfg iwl5100_abg_cfg = {
1578
1587
.eeprom_ver = EEPROM_5000_EEPROM_VERSION,
1579
1588
.eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
1580
1589
.mod_params = &iwl50_mod_params,
1590
.valid_tx_ant = ANT_B,
1591
.valid_rx_ant = ANT_AB,
1592
.need_pll_cfg = true,
1583
1595
struct iwl_cfg iwl5100_agn_cfg = {
1591
1603
.eeprom_ver = EEPROM_5000_EEPROM_VERSION,
1592
1604
.eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
1593
1605
.mod_params = &iwl50_mod_params,
1606
.valid_tx_ant = ANT_B,
1607
.valid_rx_ant = ANT_AB,
1608
.need_pll_cfg = true,
1596
1611
struct iwl_cfg iwl5350_agn_cfg = {
1604
1619
.eeprom_ver = EEPROM_5050_EEPROM_VERSION,
1605
1620
.eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
1606
1621
.mod_params = &iwl50_mod_params,
1622
.valid_tx_ant = ANT_ABC,
1623
.valid_rx_ant = ANT_ABC,
1624
.need_pll_cfg = true,
1609
1627
struct iwl_cfg iwl5150_agn_cfg = {
1617
1635
.eeprom_ver = EEPROM_5050_EEPROM_VERSION,
1618
1636
.eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
1619
1637
.mod_params = &iwl50_mod_params,
1638
.valid_tx_ant = ANT_A,
1639
.valid_rx_ant = ANT_AB,
1640
.need_pll_cfg = true,
1622
1643
MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX));