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.c103
1 files changed, 2 insertions, 101 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index bbcb9c5dde6a..bea2f46ef26f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -423,105 +423,6 @@ static void iwl5000_rx_calib_complete(struct iwl_priv *priv,
423 queue_work(priv->workqueue, &priv->restart); 423 queue_work(priv->workqueue, &priv->restart);
424} 424}
425 425
426/*
427 * ucode
428 */
429static int iwl5000_load_section(struct iwl_priv *priv, const char *name,
430 struct fw_desc *image, u32 dst_addr)
431{
432 dma_addr_t phy_addr = image->p_addr;
433 u32 byte_cnt = image->len;
434 int ret;
435
436 priv->ucode_write_complete = 0;
437
438 iwl_write_direct32(priv,
439 FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL),
440 FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE);
441
442 iwl_write_direct32(priv,
443 FH_SRVC_CHNL_SRAM_ADDR_REG(FH_SRVC_CHNL), dst_addr);
444
445 iwl_write_direct32(priv,
446 FH_TFDIB_CTRL0_REG(FH_SRVC_CHNL),
447 phy_addr & FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK);
448
449 iwl_write_direct32(priv,
450 FH_TFDIB_CTRL1_REG(FH_SRVC_CHNL),
451 (iwl_get_dma_hi_addr(phy_addr)
452 << FH_MEM_TFDIB_REG1_ADDR_BITSHIFT) | byte_cnt);
453
454 iwl_write_direct32(priv,
455 FH_TCSR_CHNL_TX_BUF_STS_REG(FH_SRVC_CHNL),
456 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM |
457 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_IDX |
458 FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID);
459
460 iwl_write_direct32(priv,
461 FH_TCSR_CHNL_TX_CONFIG_REG(FH_SRVC_CHNL),
462 FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE |
463 FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE |
464 FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD);
465
466 IWL_DEBUG_INFO(priv, "%s uCode section being loaded...\n", name);
467 ret = wait_event_interruptible_timeout(priv->wait_command_queue,
468 priv->ucode_write_complete, 5 * HZ);
469 if (ret == -ERESTARTSYS) {
470 IWL_ERR(priv, "Could not load the %s uCode section due "
471 "to interrupt\n", name);
472 return ret;
473 }
474 if (!ret) {
475 IWL_ERR(priv, "Could not load the %s uCode section\n",
476 name);
477 return -ETIMEDOUT;
478 }
479
480 return 0;
481}
482
483static int iwl5000_load_given_ucode(struct iwl_priv *priv,
484 struct fw_desc *inst_image,
485 struct fw_desc *data_image)
486{
487 int ret = 0;
488
489 ret = iwl5000_load_section(priv, "INST", inst_image,
490 IWL50_RTC_INST_LOWER_BOUND);
491 if (ret)
492 return ret;
493
494 return iwl5000_load_section(priv, "DATA", data_image,
495 IWL50_RTC_DATA_LOWER_BOUND);
496}
497
498int iwl5000_load_ucode(struct iwl_priv *priv)
499{
500 int ret = 0;
501
502 /* check whether init ucode should be loaded, or rather runtime ucode */
503 if (priv->ucode_init.len && (priv->ucode_type == UCODE_NONE)) {
504 IWL_DEBUG_INFO(priv, "Init ucode found. Loading init ucode...\n");
505 ret = iwl5000_load_given_ucode(priv,
506 &priv->ucode_init, &priv->ucode_init_data);
507 if (!ret) {
508 IWL_DEBUG_INFO(priv, "Init ucode load complete.\n");
509 priv->ucode_type = UCODE_INIT;
510 }
511 } else {
512 IWL_DEBUG_INFO(priv, "Init ucode not found, or already loaded. "
513 "Loading runtime ucode...\n");
514 ret = iwl5000_load_given_ucode(priv,
515 &priv->ucode_code, &priv->ucode_data);
516 if (!ret) {
517 IWL_DEBUG_INFO(priv, "Runtime ucode load complete.\n");
518 priv->ucode_type = UCODE_RT;
519 }
520 }
521
522 return ret;
523}
524
525void iwl5000_init_alive_start(struct iwl_priv *priv) 426void iwl5000_init_alive_start(struct iwl_priv *priv)
526{ 427{
527 int ret = 0; 428 int ret = 0;
@@ -1413,7 +1314,7 @@ struct iwl_lib_ops iwl5000_lib = {
1413 .dump_nic_error_log = iwl_dump_nic_error_log, 1314 .dump_nic_error_log = iwl_dump_nic_error_log,
1414 .dump_csr = iwl_dump_csr, 1315 .dump_csr = iwl_dump_csr,
1415 .dump_fh = iwl_dump_fh, 1316 .dump_fh = iwl_dump_fh,
1416 .load_ucode = iwl5000_load_ucode, 1317 .load_ucode = iwlagn_load_ucode,
1417 .init_alive_start = iwl5000_init_alive_start, 1318 .init_alive_start = iwl5000_init_alive_start,
1418 .alive_notify = iwl5000_alive_notify, 1319 .alive_notify = iwl5000_alive_notify,
1419 .send_tx_power = iwl5000_send_tx_power, 1320 .send_tx_power = iwl5000_send_tx_power,
@@ -1470,7 +1371,7 @@ static struct iwl_lib_ops iwl5150_lib = {
1470 .dump_nic_event_log = iwl_dump_nic_event_log, 1371 .dump_nic_event_log = iwl_dump_nic_event_log,
1471 .dump_nic_error_log = iwl_dump_nic_error_log, 1372 .dump_nic_error_log = iwl_dump_nic_error_log,
1472 .dump_csr = iwl_dump_csr, 1373 .dump_csr = iwl_dump_csr,
1473 .load_ucode = iwl5000_load_ucode, 1374 .load_ucode = iwlagn_load_ucode,
1474 .init_alive_start = iwl5000_init_alive_start, 1375 .init_alive_start = iwl5000_init_alive_start,
1475 .alive_notify = iwl5000_alive_notify, 1376 .alive_notify = iwl5000_alive_notify,
1476 .send_tx_power = iwl5000_send_tx_power, 1377 .send_tx_power = iwl5000_send_tx_power,