aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2012-03-26 11:57:01 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2012-04-18 10:30:42 -0400
commit035f7ff27dcfadcb6028de1bbb5d17d49ea8d804 (patch)
tree9b3400fe1494c07cf540aa1292c1278afdbcbbb0 /drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
parent68f360dcfff19e338e7d565df48d222578f55f33 (diff)
iwlwifi: transport holds its pointer to the config
Instead of using the shared area that we be killed. Remove the pointer to config from shared since it is not used any more. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-trans-pcie.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
index 14a32c420fd4..76f05ea1ad38 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
@@ -79,7 +79,7 @@
79#define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo)))) 79#define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo))))
80 80
81#define SCD_QUEUECHAIN_SEL_ALL(trans, trans_pcie) \ 81#define SCD_QUEUECHAIN_SEL_ALL(trans, trans_pcie) \
82 (((1<<cfg(trans)->base_params->num_of_queues) - 1) &\ 82 (((1<<trans->cfg->base_params->num_of_queues) - 1) &\
83 (~(1<<(trans_pcie)->cmd_queue))) 83 (~(1<<(trans_pcie)->cmd_queue)))
84 84
85static int iwl_trans_rx_alloc(struct iwl_trans *trans) 85static int iwl_trans_rx_alloc(struct iwl_trans *trans)
@@ -522,7 +522,7 @@ static void iwl_trans_pcie_tx_free(struct iwl_trans *trans)
522 /* Tx queues */ 522 /* Tx queues */
523 if (trans_pcie->txq) { 523 if (trans_pcie->txq) {
524 for (txq_id = 0; 524 for (txq_id = 0;
525 txq_id < cfg(trans)->base_params->num_of_queues; txq_id++) 525 txq_id < trans->cfg->base_params->num_of_queues; txq_id++)
526 iwl_tx_queue_free(trans, txq_id); 526 iwl_tx_queue_free(trans, txq_id);
527 } 527 }
528 528
@@ -547,7 +547,7 @@ static int iwl_trans_tx_alloc(struct iwl_trans *trans)
547 int txq_id, slots_num; 547 int txq_id, slots_num;
548 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 548 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
549 549
550 u16 scd_bc_tbls_size = cfg(trans)->base_params->num_of_queues * 550 u16 scd_bc_tbls_size = trans->cfg->base_params->num_of_queues *
551 sizeof(struct iwlagn_scd_bc_tbl); 551 sizeof(struct iwlagn_scd_bc_tbl);
552 552
553 /*It is not allowed to alloc twice, so warn when this happens. 553 /*It is not allowed to alloc twice, so warn when this happens.
@@ -571,7 +571,7 @@ static int iwl_trans_tx_alloc(struct iwl_trans *trans)
571 goto error; 571 goto error;
572 } 572 }
573 573
574 trans_pcie->txq = kcalloc(cfg(trans)->base_params->num_of_queues, 574 trans_pcie->txq = kcalloc(trans->cfg->base_params->num_of_queues,
575 sizeof(struct iwl_tx_queue), GFP_KERNEL); 575 sizeof(struct iwl_tx_queue), GFP_KERNEL);
576 if (!trans_pcie->txq) { 576 if (!trans_pcie->txq) {
577 IWL_ERR(trans, "Not enough memory for txq\n"); 577 IWL_ERR(trans, "Not enough memory for txq\n");
@@ -580,7 +580,7 @@ static int iwl_trans_tx_alloc(struct iwl_trans *trans)
580 } 580 }
581 581
582 /* Alloc and init all Tx queues, including the command queue (#4/#9) */ 582 /* Alloc and init all Tx queues, including the command queue (#4/#9) */
583 for (txq_id = 0; txq_id < cfg(trans)->base_params->num_of_queues; 583 for (txq_id = 0; txq_id < trans->cfg->base_params->num_of_queues;
584 txq_id++) { 584 txq_id++) {
585 slots_num = (txq_id == trans_pcie->cmd_queue) ? 585 slots_num = (txq_id == trans_pcie->cmd_queue) ?
586 TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; 586 TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
@@ -626,7 +626,7 @@ static int iwl_tx_init(struct iwl_trans *trans)
626 spin_unlock_irqrestore(&trans_pcie->irq_lock, flags); 626 spin_unlock_irqrestore(&trans_pcie->irq_lock, flags);
627 627
628 /* Alloc and init all Tx queues, including the command queue (#4/#9) */ 628 /* Alloc and init all Tx queues, including the command queue (#4/#9) */
629 for (txq_id = 0; txq_id < cfg(trans)->base_params->num_of_queues; 629 for (txq_id = 0; txq_id < trans->cfg->base_params->num_of_queues;
630 txq_id++) { 630 txq_id++) {
631 slots_num = (txq_id == trans_pcie->cmd_queue) ? 631 slots_num = (txq_id == trans_pcie->cmd_queue) ?
632 TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS; 632 TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
@@ -749,9 +749,9 @@ static int iwl_apm_init(struct iwl_trans *trans)
749 iwl_apm_config(trans); 749 iwl_apm_config(trans);
750 750
751 /* Configure analog phase-lock-loop before activating to D0A */ 751 /* Configure analog phase-lock-loop before activating to D0A */
752 if (cfg(trans)->base_params->pll_cfg_val) 752 if (trans->cfg->base_params->pll_cfg_val)
753 iwl_set_bit(trans, CSR_ANA_PLL_CFG, 753 iwl_set_bit(trans, CSR_ANA_PLL_CFG,
754 cfg(trans)->base_params->pll_cfg_val); 754 trans->cfg->base_params->pll_cfg_val);
755 755
756 /* 756 /*
757 * Set "initialization complete" bit to move adapter from 757 * Set "initialization complete" bit to move adapter from
@@ -861,7 +861,7 @@ static int iwl_nic_init(struct iwl_trans *trans)
861 if (iwl_tx_init(trans)) 861 if (iwl_tx_init(trans))
862 return -ENOMEM; 862 return -ENOMEM;
863 863
864 if (cfg(trans)->base_params->shadow_reg_enable) { 864 if (trans->cfg->base_params->shadow_reg_enable) {
865 /* enable shadow regs in HW */ 865 /* enable shadow regs in HW */
866 iwl_set_bit(trans, CSR_MAC_SHADOW_REG_CTRL, 866 iwl_set_bit(trans, CSR_MAC_SHADOW_REG_CTRL,
867 0x800FFFFF); 867 0x800FFFFF);
@@ -1080,7 +1080,7 @@ static void iwl_tx_start(struct iwl_trans *trans)
1080 iwl_write_targ_mem(trans, a, 0); 1080 iwl_write_targ_mem(trans, a, 0);
1081 for (; a < trans_pcie->scd_base_addr + 1081 for (; a < trans_pcie->scd_base_addr +
1082 SCD_TRANS_TBL_OFFSET_QUEUE( 1082 SCD_TRANS_TBL_OFFSET_QUEUE(
1083 cfg(trans)->base_params->num_of_queues); 1083 trans->cfg->base_params->num_of_queues);
1084 a += 4) 1084 a += 4)
1085 iwl_write_targ_mem(trans, a, 0); 1085 iwl_write_targ_mem(trans, a, 0);
1086 1086
@@ -1103,7 +1103,7 @@ static void iwl_tx_start(struct iwl_trans *trans)
1103 iwl_write_prph(trans, SCD_AGGR_SEL, 0); 1103 iwl_write_prph(trans, SCD_AGGR_SEL, 0);
1104 1104
1105 /* initiate the queues */ 1105 /* initiate the queues */
1106 for (i = 0; i < cfg(trans)->base_params->num_of_queues; i++) { 1106 for (i = 0; i < trans->cfg->base_params->num_of_queues; i++) {
1107 iwl_write_prph(trans, SCD_QUEUE_RDPTR(i), 0); 1107 iwl_write_prph(trans, SCD_QUEUE_RDPTR(i), 0);
1108 iwl_write_direct32(trans, HBUS_TARG_WRPTR, 0 | (i << 8)); 1108 iwl_write_direct32(trans, HBUS_TARG_WRPTR, 0 | (i << 8));
1109 iwl_write_targ_mem(trans, trans_pcie->scd_base_addr + 1109 iwl_write_targ_mem(trans, trans_pcie->scd_base_addr +
@@ -1120,7 +1120,7 @@ static void iwl_tx_start(struct iwl_trans *trans)
1120 } 1120 }
1121 1121
1122 iwl_write_prph(trans, SCD_INTERRUPT_MASK, 1122 iwl_write_prph(trans, SCD_INTERRUPT_MASK,
1123 IWL_MASK(0, cfg(trans)->base_params->num_of_queues)); 1123 IWL_MASK(0, trans->cfg->base_params->num_of_queues));
1124 1124
1125 /* Activate all Tx DMA/FIFO channels */ 1125 /* Activate all Tx DMA/FIFO channels */
1126 iwl_trans_txq_set_sched(trans, IWL_MASK(0, 7)); 1126 iwl_trans_txq_set_sched(trans, IWL_MASK(0, 7));
@@ -1188,7 +1188,7 @@ static int iwl_trans_tx_stop(struct iwl_trans *trans)
1188 } 1188 }
1189 1189
1190 /* Unmap DMA from host system and free skb's */ 1190 /* Unmap DMA from host system and free skb's */
1191 for (txq_id = 0; txq_id < cfg(trans)->base_params->num_of_queues; 1191 for (txq_id = 0; txq_id < trans->cfg->base_params->num_of_queues;
1192 txq_id++) 1192 txq_id++)
1193 iwl_tx_queue_unmap(trans, txq_id); 1193 iwl_tx_queue_unmap(trans, txq_id);
1194 1194
@@ -1617,7 +1617,7 @@ static int iwl_trans_pcie_wait_tx_queue_empty(struct iwl_trans *trans)
1617 int ret = 0; 1617 int ret = 0;
1618 1618
1619 /* waiting for all the tx frames complete might take a while */ 1619 /* waiting for all the tx frames complete might take a while */
1620 for (cnt = 0; cnt < cfg(trans)->base_params->num_of_queues; cnt++) { 1620 for (cnt = 0; cnt < trans->cfg->base_params->num_of_queues; cnt++) {
1621 if (cnt == trans_pcie->cmd_queue) 1621 if (cnt == trans_pcie->cmd_queue)
1622 continue; 1622 continue;
1623 txq = &trans_pcie->txq[cnt]; 1623 txq = &trans_pcie->txq[cnt];
@@ -1829,7 +1829,7 @@ static ssize_t iwl_dbgfs_tx_queue_read(struct file *file,
1829 int ret; 1829 int ret;
1830 size_t bufsz; 1830 size_t bufsz;
1831 1831
1832 bufsz = sizeof(char) * 64 * cfg(trans)->base_params->num_of_queues; 1832 bufsz = sizeof(char) * 64 * trans->cfg->base_params->num_of_queues;
1833 1833
1834 if (!trans_pcie->txq) { 1834 if (!trans_pcie->txq) {
1835 IWL_ERR(trans, "txq not ready\n"); 1835 IWL_ERR(trans, "txq not ready\n");
@@ -1839,7 +1839,7 @@ static ssize_t iwl_dbgfs_tx_queue_read(struct file *file,
1839 if (!buf) 1839 if (!buf)
1840 return -ENOMEM; 1840 return -ENOMEM;
1841 1841
1842 for (cnt = 0; cnt < cfg(trans)->base_params->num_of_queues; cnt++) { 1842 for (cnt = 0; cnt < trans->cfg->base_params->num_of_queues; cnt++) {
1843 txq = &trans_pcie->txq[cnt]; 1843 txq = &trans_pcie->txq[cnt];
1844 q = &txq->q; 1844 q = &txq->q;
1845 pos += scnprintf(buf + pos, bufsz - pos, 1845 pos += scnprintf(buf + pos, bufsz - pos,
@@ -2085,7 +2085,8 @@ const struct iwl_trans_ops trans_ops_pcie = {
2085 2085
2086struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd, 2086struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd,
2087 struct pci_dev *pdev, 2087 struct pci_dev *pdev,
2088 const struct pci_device_id *ent) 2088 const struct pci_device_id *ent,
2089 const struct iwl_cfg *cfg)
2089{ 2090{
2090 struct iwl_trans_pcie *trans_pcie; 2091 struct iwl_trans_pcie *trans_pcie;
2091 struct iwl_trans *trans; 2092 struct iwl_trans *trans;
@@ -2102,6 +2103,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd,
2102 2103
2103 trans->ops = &trans_ops_pcie; 2104 trans->ops = &trans_ops_pcie;
2104 trans->shrd = shrd; 2105 trans->shrd = shrd;
2106 trans->cfg = cfg;
2105 trans_pcie->trans = trans; 2107 trans_pcie->trans = trans;
2106 spin_lock_init(&trans_pcie->irq_lock); 2108 spin_lock_init(&trans_pcie->irq_lock);
2107 init_waitqueue_head(&trans_pcie->ucode_write_waitq); 2109 init_waitqueue_head(&trans_pcie->ucode_write_waitq);