diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-5000.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-5000.c | 85 |
1 files changed, 20 insertions, 65 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index cbc01a00eaf4..f6003e7996af 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -145,7 +145,8 @@ static void iwl5000_apm_stop(struct iwl_priv *priv) | |||
145 | 145 | ||
146 | udelay(10); | 146 | udelay(10); |
147 | 147 | ||
148 | iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); | 148 | /* clear "init complete" move adapter D0A* --> D0U state */ |
149 | iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); | ||
149 | 150 | ||
150 | spin_unlock_irqrestore(&priv->lock, flags); | 151 | spin_unlock_irqrestore(&priv->lock, flags); |
151 | } | 152 | } |
@@ -208,14 +209,14 @@ static void iwl5000_nic_config(struct iwl_priv *priv) | |||
208 | { | 209 | { |
209 | unsigned long flags; | 210 | unsigned long flags; |
210 | u16 radio_cfg; | 211 | u16 radio_cfg; |
211 | u8 val_link; | 212 | u16 link; |
212 | 213 | ||
213 | spin_lock_irqsave(&priv->lock, flags); | 214 | spin_lock_irqsave(&priv->lock, flags); |
214 | 215 | ||
215 | pci_read_config_byte(priv->pci_dev, PCI_LINK_CTRL, &val_link); | 216 | pci_read_config_word(priv->pci_dev, PCI_CFG_LINK_CTRL, &link); |
216 | 217 | ||
217 | /* L1 is enabled by BIOS */ | 218 | /* L1 is enabled by BIOS */ |
218 | if ((val_link & PCI_LINK_VAL_L1_EN) == PCI_LINK_VAL_L1_EN) | 219 | if ((link & PCI_CFG_LINK_CTRL_VAL_L1_EN) == PCI_CFG_LINK_CTRL_VAL_L1_EN) |
219 | /* diable L0S disabled L1A enabled */ | 220 | /* diable L0S disabled L1A enabled */ |
220 | iwl_set_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); | 221 | iwl_set_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); |
221 | else | 222 | else |
@@ -444,48 +445,6 @@ static int iwl5000_send_Xtal_calib(struct iwl_priv *priv) | |||
444 | sizeof(cal_cmd), &cal_cmd); | 445 | sizeof(cal_cmd), &cal_cmd); |
445 | } | 446 | } |
446 | 447 | ||
447 | static int iwl5000_send_calib_results(struct iwl_priv *priv) | ||
448 | { | ||
449 | int ret = 0; | ||
450 | |||
451 | struct iwl_host_cmd hcmd = { | ||
452 | .id = REPLY_PHY_CALIBRATION_CMD, | ||
453 | .meta.flags = CMD_SIZE_HUGE, | ||
454 | }; | ||
455 | |||
456 | if (priv->calib_results.lo_res) { | ||
457 | hcmd.len = priv->calib_results.lo_res_len; | ||
458 | hcmd.data = priv->calib_results.lo_res; | ||
459 | ret = iwl_send_cmd_sync(priv, &hcmd); | ||
460 | |||
461 | if (ret) | ||
462 | goto err; | ||
463 | } | ||
464 | |||
465 | if (priv->calib_results.tx_iq_res) { | ||
466 | hcmd.len = priv->calib_results.tx_iq_res_len; | ||
467 | hcmd.data = priv->calib_results.tx_iq_res; | ||
468 | ret = iwl_send_cmd_sync(priv, &hcmd); | ||
469 | |||
470 | if (ret) | ||
471 | goto err; | ||
472 | } | ||
473 | |||
474 | if (priv->calib_results.tx_iq_perd_res) { | ||
475 | hcmd.len = priv->calib_results.tx_iq_perd_res_len; | ||
476 | hcmd.data = priv->calib_results.tx_iq_perd_res; | ||
477 | ret = iwl_send_cmd_sync(priv, &hcmd); | ||
478 | |||
479 | if (ret) | ||
480 | goto err; | ||
481 | } | ||
482 | |||
483 | return 0; | ||
484 | err: | ||
485 | IWL_ERROR("Error %d\n", ret); | ||
486 | return ret; | ||
487 | } | ||
488 | |||
489 | static int iwl5000_send_calib_cfg(struct iwl_priv *priv) | 448 | static int iwl5000_send_calib_cfg(struct iwl_priv *priv) |
490 | { | 449 | { |
491 | struct iwl5000_calib_cfg_cmd calib_cfg_cmd; | 450 | struct iwl5000_calib_cfg_cmd calib_cfg_cmd; |
@@ -510,33 +469,30 @@ static void iwl5000_rx_calib_result(struct iwl_priv *priv, | |||
510 | struct iwl_rx_packet *pkt = (void *)rxb->skb->data; | 469 | struct iwl_rx_packet *pkt = (void *)rxb->skb->data; |
511 | struct iwl5000_calib_hdr *hdr = (struct iwl5000_calib_hdr *)pkt->u.raw; | 470 | struct iwl5000_calib_hdr *hdr = (struct iwl5000_calib_hdr *)pkt->u.raw; |
512 | int len = le32_to_cpu(pkt->len) & FH_RSCSR_FRAME_SIZE_MSK; | 471 | int len = le32_to_cpu(pkt->len) & FH_RSCSR_FRAME_SIZE_MSK; |
513 | 472 | int index; | |
514 | iwl_free_calib_results(priv); | ||
515 | 473 | ||
516 | /* reduce the size of the length field itself */ | 474 | /* reduce the size of the length field itself */ |
517 | len -= 4; | 475 | len -= 4; |
518 | 476 | ||
477 | /* Define the order in which the results will be sent to the runtime | ||
478 | * uCode. iwl_send_calib_results sends them in a row according to their | ||
479 | * index. We sort them here */ | ||
519 | switch (hdr->op_code) { | 480 | switch (hdr->op_code) { |
520 | case IWL5000_PHY_CALIBRATE_LO_CMD: | 481 | case IWL5000_PHY_CALIBRATE_LO_CMD: |
521 | priv->calib_results.lo_res = kzalloc(len, GFP_ATOMIC); | 482 | index = IWL5000_CALIB_LO; |
522 | priv->calib_results.lo_res_len = len; | ||
523 | memcpy(priv->calib_results.lo_res, pkt->u.raw, len); | ||
524 | break; | 483 | break; |
525 | case IWL5000_PHY_CALIBRATE_TX_IQ_CMD: | 484 | case IWL5000_PHY_CALIBRATE_TX_IQ_CMD: |
526 | priv->calib_results.tx_iq_res = kzalloc(len, GFP_ATOMIC); | 485 | index = IWL5000_CALIB_TX_IQ; |
527 | priv->calib_results.tx_iq_res_len = len; | ||
528 | memcpy(priv->calib_results.tx_iq_res, pkt->u.raw, len); | ||
529 | break; | 486 | break; |
530 | case IWL5000_PHY_CALIBRATE_TX_IQ_PERD_CMD: | 487 | case IWL5000_PHY_CALIBRATE_TX_IQ_PERD_CMD: |
531 | priv->calib_results.tx_iq_perd_res = kzalloc(len, GFP_ATOMIC); | 488 | index = IWL5000_CALIB_TX_IQ_PERD; |
532 | priv->calib_results.tx_iq_perd_res_len = len; | ||
533 | memcpy(priv->calib_results.tx_iq_perd_res, pkt->u.raw, len); | ||
534 | break; | 489 | break; |
535 | default: | 490 | default: |
536 | IWL_ERROR("Unknown calibration notification %d\n", | 491 | IWL_ERROR("Unknown calibration notification %d\n", |
537 | hdr->op_code); | 492 | hdr->op_code); |
538 | return; | 493 | return; |
539 | } | 494 | } |
495 | iwl_calib_set(&priv->calib_results[index], pkt->u.raw, len); | ||
540 | } | 496 | } |
541 | 497 | ||
542 | static void iwl5000_rx_calib_complete(struct iwl_priv *priv, | 498 | static void iwl5000_rx_calib_complete(struct iwl_priv *priv, |
@@ -577,14 +533,11 @@ static int iwl5000_load_section(struct iwl_priv *priv, | |||
577 | FH_TFDIB_CTRL0_REG(FH_SRVC_CHNL), | 533 | FH_TFDIB_CTRL0_REG(FH_SRVC_CHNL), |
578 | phy_addr & FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK); | 534 | phy_addr & FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK); |
579 | 535 | ||
580 | /* FIME: write the MSB of the phy_addr in CTRL1 | ||
581 | * iwl_write_direct32(priv, | ||
582 | IWL_FH_TFDIB_CTRL1_REG(IWL_FH_SRVC_CHNL), | ||
583 | ((phy_addr & MSB_MSK) | ||
584 | << FH_MEM_TFDIB_REG1_ADDR_BITSHIFT) | byte_count); | ||
585 | */ | ||
586 | iwl_write_direct32(priv, | 536 | iwl_write_direct32(priv, |
587 | FH_TFDIB_CTRL1_REG(FH_SRVC_CHNL), byte_cnt); | 537 | FH_TFDIB_CTRL1_REG(FH_SRVC_CHNL), |
538 | (iwl_get_dma_hi_address(phy_addr) | ||
539 | << FH_MEM_TFDIB_REG1_ADDR_BITSHIFT) | byte_cnt); | ||
540 | |||
588 | iwl_write_direct32(priv, | 541 | iwl_write_direct32(priv, |
589 | FH_TCSR_CHNL_TX_BUF_STS_REG(FH_SRVC_CHNL), | 542 | FH_TCSR_CHNL_TX_BUF_STS_REG(FH_SRVC_CHNL), |
590 | 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM | | 543 | 1 << FH_TCSR_CHNL_TX_BUF_STS_REG_POS_TB_NUM | |
@@ -834,7 +787,7 @@ static int iwl5000_alive_notify(struct iwl_priv *priv) | |||
834 | iwl5000_send_Xtal_calib(priv); | 787 | iwl5000_send_Xtal_calib(priv); |
835 | 788 | ||
836 | if (priv->ucode_type == UCODE_RT) | 789 | if (priv->ucode_type == UCODE_RT) |
837 | iwl5000_send_calib_results(priv); | 790 | iwl_send_calib_results(priv); |
838 | 791 | ||
839 | return 0; | 792 | return 0; |
840 | } | 793 | } |
@@ -1616,6 +1569,8 @@ struct iwl_cfg iwl5350_agn_cfg = { | |||
1616 | .mod_params = &iwl50_mod_params, | 1569 | .mod_params = &iwl50_mod_params, |
1617 | }; | 1570 | }; |
1618 | 1571 | ||
1572 | MODULE_FIRMWARE("iwlwifi-5000" IWL5000_UCODE_API ".ucode"); | ||
1573 | |||
1619 | module_param_named(disable50, iwl50_mod_params.disable, int, 0444); | 1574 | module_param_named(disable50, iwl50_mod_params.disable, int, 0444); |
1620 | MODULE_PARM_DESC(disable50, | 1575 | MODULE_PARM_DESC(disable50, |
1621 | "manually disable the 50XX radio (default 0 [radio on])"); | 1576 | "manually disable the 50XX radio (default 0 [radio on])"); |