diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2011-08-26 02:11:02 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-08-29 15:25:34 -0400 |
commit | 105183b156b7c220b47c3162e087101a0a6abc9f (patch) | |
tree | 08da9b6643bd8aac810deb8a2c9fa0f5fbc34dc6 /drivers/net | |
parent | 04e1cabe4294fdf744489deb1e91edb1ec02e9a4 (diff) |
iwlagn: move scd_bc_tbls and scd_base_addr to iwl_trans_pcie
Needed for PCIe only
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c | 26 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-trans.c | 33 |
4 files changed, 47 insertions, 19 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 022cfc738903..ab9816aeb40a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -1242,9 +1242,6 @@ struct iwl_priv { | |||
1242 | struct iwl_tx_queue *txq; | 1242 | struct iwl_tx_queue *txq; |
1243 | unsigned long txq_ctx_active_msk; | 1243 | unsigned long txq_ctx_active_msk; |
1244 | struct iwl_dma_ptr kw; /* keep warm address */ | 1244 | struct iwl_dma_ptr kw; /* keep warm address */ |
1245 | struct iwl_dma_ptr scd_bc_tbls; | ||
1246 | |||
1247 | u32 scd_base_addr; /* scheduler sram base address */ | ||
1248 | 1245 | ||
1249 | /* counts mgmt, ctl, and data packets */ | 1246 | /* counts mgmt, ctl, and data packets */ |
1250 | struct traffic_stats tx_stats; | 1247 | struct traffic_stats tx_stats; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h b/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h index 717b6dc38b20..cb4b59dcfc3b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h +++ b/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h | |||
@@ -91,6 +91,8 @@ struct iwl_rx_queue { | |||
91 | * @rxq: all the RX queue data | 91 | * @rxq: all the RX queue data |
92 | * @rx_replenish: work that will be called when buffers need to be allocated | 92 | * @rx_replenish: work that will be called when buffers need to be allocated |
93 | * @trans: pointer to the generic transport area | 93 | * @trans: pointer to the generic transport area |
94 | * @scd_base_addr: scheduler sram base address in SRAM | ||
95 | * @scd_bc_tbls: pointer to the byte count table of the scheduler | ||
94 | */ | 96 | */ |
95 | struct iwl_trans_pcie { | 97 | struct iwl_trans_pcie { |
96 | struct iwl_rx_queue rxq; | 98 | struct iwl_rx_queue rxq; |
@@ -109,6 +111,8 @@ struct iwl_trans_pcie { | |||
109 | struct isr_statistics isr_stats; | 111 | struct isr_statistics isr_stats; |
110 | 112 | ||
111 | u32 inta_mask; | 113 | u32 inta_mask; |
114 | u32 scd_base_addr; | ||
115 | struct iwl_dma_ptr scd_bc_tbls; | ||
112 | }; | 116 | }; |
113 | 117 | ||
114 | #define IWL_TRANS_GET_PCIE_TRANS(_iwl_trans) \ | 118 | #define IWL_TRANS_GET_PCIE_TRANS(_iwl_trans) \ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c index e1f9ceeb02ed..a462d697a690 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c | |||
@@ -45,7 +45,10 @@ void iwl_trans_txq_update_byte_cnt_tbl(struct iwl_priv *priv, | |||
45 | struct iwl_tx_queue *txq, | 45 | struct iwl_tx_queue *txq, |
46 | u16 byte_cnt) | 46 | u16 byte_cnt) |
47 | { | 47 | { |
48 | struct iwlagn_scd_bc_tbl *scd_bc_tbl = priv->scd_bc_tbls.addr; | 48 | struct iwlagn_scd_bc_tbl *scd_bc_tbl; |
49 | struct iwl_trans *trans = trans(priv); | ||
50 | struct iwl_trans_pcie *trans_pcie = | ||
51 | IWL_TRANS_GET_PCIE_TRANS(trans); | ||
49 | int write_ptr = txq->q.write_ptr; | 52 | int write_ptr = txq->q.write_ptr; |
50 | int txq_id = txq->q.id; | 53 | int txq_id = txq->q.id; |
51 | u8 sec_ctl = 0; | 54 | u8 sec_ctl = 0; |
@@ -53,6 +56,8 @@ void iwl_trans_txq_update_byte_cnt_tbl(struct iwl_priv *priv, | |||
53 | u16 len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE; | 56 | u16 len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE; |
54 | __le16 bc_ent; | 57 | __le16 bc_ent; |
55 | 58 | ||
59 | scd_bc_tbl = trans_pcie->scd_bc_tbls.addr; | ||
60 | |||
56 | WARN_ON(len > 0xFFF || write_ptr >= TFD_QUEUE_SIZE_MAX); | 61 | WARN_ON(len > 0xFFF || write_ptr >= TFD_QUEUE_SIZE_MAX); |
57 | 62 | ||
58 | sta_id = txq->cmd[txq->q.write_ptr]->cmd.tx.sta_id; | 63 | sta_id = txq->cmd[txq->q.write_ptr]->cmd.tx.sta_id; |
@@ -335,12 +340,17 @@ int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q, | |||
335 | static void iwlagn_txq_inval_byte_cnt_tbl(struct iwl_priv *priv, | 340 | static void iwlagn_txq_inval_byte_cnt_tbl(struct iwl_priv *priv, |
336 | struct iwl_tx_queue *txq) | 341 | struct iwl_tx_queue *txq) |
337 | { | 342 | { |
338 | struct iwlagn_scd_bc_tbl *scd_bc_tbl = priv->scd_bc_tbls.addr; | 343 | struct iwlagn_scd_bc_tbl *scd_bc_tbl; |
344 | struct iwl_trans *trans = trans(priv); | ||
345 | struct iwl_trans_pcie *trans_pcie = | ||
346 | IWL_TRANS_GET_PCIE_TRANS(trans); | ||
339 | int txq_id = txq->q.id; | 347 | int txq_id = txq->q.id; |
340 | int read_ptr = txq->q.read_ptr; | 348 | int read_ptr = txq->q.read_ptr; |
341 | u8 sta_id = 0; | 349 | u8 sta_id = 0; |
342 | __le16 bc_ent; | 350 | __le16 bc_ent; |
343 | 351 | ||
352 | scd_bc_tbl = trans_pcie->scd_bc_tbls.addr; | ||
353 | |||
344 | WARN_ON(read_ptr >= TFD_QUEUE_SIZE_MAX); | 354 | WARN_ON(read_ptr >= TFD_QUEUE_SIZE_MAX); |
345 | 355 | ||
346 | if (txq_id != priv->shrd->cmd_queue) | 356 | if (txq_id != priv->shrd->cmd_queue) |
@@ -361,9 +371,13 @@ static int iwlagn_tx_queue_set_q2ratid(struct iwl_priv *priv, u16 ra_tid, | |||
361 | u32 tbl_dw; | 371 | u32 tbl_dw; |
362 | u16 scd_q2ratid; | 372 | u16 scd_q2ratid; |
363 | 373 | ||
374 | struct iwl_trans *trans = trans(priv); | ||
375 | struct iwl_trans_pcie *trans_pcie = | ||
376 | IWL_TRANS_GET_PCIE_TRANS(trans); | ||
377 | |||
364 | scd_q2ratid = ra_tid & SCD_QUEUE_RA_TID_MAP_RATID_MSK; | 378 | scd_q2ratid = ra_tid & SCD_QUEUE_RA_TID_MAP_RATID_MSK; |
365 | 379 | ||
366 | tbl_dw_addr = priv->scd_base_addr + | 380 | tbl_dw_addr = trans_pcie->scd_base_addr + |
367 | SCD_TRANS_TBL_OFFSET_QUEUE(txq_id); | 381 | SCD_TRANS_TBL_OFFSET_QUEUE(txq_id); |
368 | 382 | ||
369 | tbl_dw = iwl_read_targ_mem(priv, tbl_dw_addr); | 383 | tbl_dw = iwl_read_targ_mem(priv, tbl_dw_addr); |
@@ -424,6 +438,10 @@ void iwl_trans_pcie_txq_agg_setup(struct iwl_priv *priv, int sta_id, int tid, | |||
424 | unsigned long flags; | 438 | unsigned long flags; |
425 | struct iwl_tid_data *tid_data; | 439 | struct iwl_tid_data *tid_data; |
426 | 440 | ||
441 | struct iwl_trans *trans = trans(priv); | ||
442 | struct iwl_trans_pcie *trans_pcie = | ||
443 | IWL_TRANS_GET_PCIE_TRANS(trans); | ||
444 | |||
427 | if (WARN_ON(sta_id == IWL_INVALID_STATION)) | 445 | if (WARN_ON(sta_id == IWL_INVALID_STATION)) |
428 | return; | 446 | return; |
429 | if (WARN_ON(tid >= MAX_TID_COUNT)) | 447 | if (WARN_ON(tid >= MAX_TID_COUNT)) |
@@ -459,7 +477,7 @@ void iwl_trans_pcie_txq_agg_setup(struct iwl_priv *priv, int sta_id, int tid, | |||
459 | iwl_trans_set_wr_ptrs(priv, txq_id, ssn_idx); | 477 | iwl_trans_set_wr_ptrs(priv, txq_id, ssn_idx); |
460 | 478 | ||
461 | /* Set up Tx window size and frame limit for this queue */ | 479 | /* Set up Tx window size and frame limit for this queue */ |
462 | iwl_write_targ_mem(priv, priv->scd_base_addr + | 480 | iwl_write_targ_mem(priv, trans_pcie->scd_base_addr + |
463 | SCD_CONTEXT_QUEUE_OFFSET(txq_id) + | 481 | SCD_CONTEXT_QUEUE_OFFSET(txq_id) + |
464 | sizeof(u32), | 482 | sizeof(u32), |
465 | ((frame_limit << | 483 | ((frame_limit << |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.c b/drivers/net/wireless/iwlwifi/iwl-trans.c index 06cec8268c6c..0e04b51e7f79 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans.c | |||
@@ -469,6 +469,9 @@ static void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id) | |||
469 | static void iwl_trans_pcie_tx_free(struct iwl_priv *priv) | 469 | static void iwl_trans_pcie_tx_free(struct iwl_priv *priv) |
470 | { | 470 | { |
471 | int txq_id; | 471 | int txq_id; |
472 | struct iwl_trans *trans = trans(priv); | ||
473 | struct iwl_trans_pcie *trans_pcie = | ||
474 | IWL_TRANS_GET_PCIE_TRANS(trans); | ||
472 | 475 | ||
473 | /* Tx queues */ | 476 | /* Tx queues */ |
474 | if (priv->txq) { | 477 | if (priv->txq) { |
@@ -482,7 +485,7 @@ static void iwl_trans_pcie_tx_free(struct iwl_priv *priv) | |||
482 | 485 | ||
483 | iwlagn_free_dma_ptr(priv, &priv->kw); | 486 | iwlagn_free_dma_ptr(priv, &priv->kw); |
484 | 487 | ||
485 | iwlagn_free_dma_ptr(priv, &priv->scd_bc_tbls); | 488 | iwlagn_free_dma_ptr(priv, &trans_pcie->scd_bc_tbls); |
486 | } | 489 | } |
487 | 490 | ||
488 | /** | 491 | /** |
@@ -496,6 +499,9 @@ static int iwl_trans_tx_alloc(struct iwl_priv *priv) | |||
496 | { | 499 | { |
497 | int ret; | 500 | int ret; |
498 | int txq_id, slots_num; | 501 | int txq_id, slots_num; |
502 | struct iwl_trans *trans = trans(priv); | ||
503 | struct iwl_trans_pcie *trans_pcie = | ||
504 | IWL_TRANS_GET_PCIE_TRANS(trans); | ||
499 | 505 | ||
500 | /*It is not allowed to alloc twice, so warn when this happens. | 506 | /*It is not allowed to alloc twice, so warn when this happens. |
501 | * We cannot rely on the previous allocation, so free and fail */ | 507 | * We cannot rely on the previous allocation, so free and fail */ |
@@ -504,7 +510,7 @@ static int iwl_trans_tx_alloc(struct iwl_priv *priv) | |||
504 | goto error; | 510 | goto error; |
505 | } | 511 | } |
506 | 512 | ||
507 | ret = iwlagn_alloc_dma_ptr(priv, &priv->scd_bc_tbls, | 513 | ret = iwlagn_alloc_dma_ptr(priv, &trans_pcie->scd_bc_tbls, |
508 | hw_params(priv).scd_bc_tbls_size); | 514 | hw_params(priv).scd_bc_tbls_size); |
509 | if (ret) { | 515 | if (ret) { |
510 | IWL_ERR(priv, "Scheduler BC Table allocation failed\n"); | 516 | IWL_ERR(priv, "Scheduler BC Table allocation failed\n"); |
@@ -785,30 +791,33 @@ static void iwl_trans_pcie_tx_start(struct iwl_priv *priv) | |||
785 | { | 791 | { |
786 | const struct queue_to_fifo_ac *queue_to_fifo; | 792 | const struct queue_to_fifo_ac *queue_to_fifo; |
787 | struct iwl_rxon_context *ctx; | 793 | struct iwl_rxon_context *ctx; |
794 | struct iwl_trans *trans = trans(priv); | ||
795 | struct iwl_trans_pcie *trans_pcie = | ||
796 | IWL_TRANS_GET_PCIE_TRANS(trans); | ||
788 | u32 a; | 797 | u32 a; |
789 | unsigned long flags; | 798 | unsigned long flags; |
790 | int i, chan; | 799 | int i, chan; |
791 | u32 reg_val; | 800 | u32 reg_val; |
792 | 801 | ||
793 | spin_lock_irqsave(&priv->shrd->lock, flags); | 802 | spin_lock_irqsave(&trans->shrd->lock, flags); |
794 | 803 | ||
795 | priv->scd_base_addr = iwl_read_prph(priv, SCD_SRAM_BASE_ADDR); | 804 | trans_pcie->scd_base_addr = iwl_read_prph(priv, SCD_SRAM_BASE_ADDR); |
796 | a = priv->scd_base_addr + SCD_CONTEXT_MEM_LOWER_BOUND; | 805 | a = trans_pcie->scd_base_addr + SCD_CONTEXT_MEM_LOWER_BOUND; |
797 | /* reset conext data memory */ | 806 | /* reset conext data memory */ |
798 | for (; a < priv->scd_base_addr + SCD_CONTEXT_MEM_UPPER_BOUND; | 807 | for (; a < trans_pcie->scd_base_addr + SCD_CONTEXT_MEM_UPPER_BOUND; |
799 | a += 4) | 808 | a += 4) |
800 | iwl_write_targ_mem(priv, a, 0); | 809 | iwl_write_targ_mem(priv, a, 0); |
801 | /* reset tx status memory */ | 810 | /* reset tx status memory */ |
802 | for (; a < priv->scd_base_addr + SCD_TX_STTS_MEM_UPPER_BOUND; | 811 | for (; a < trans_pcie->scd_base_addr + SCD_TX_STTS_MEM_UPPER_BOUND; |
803 | a += 4) | 812 | a += 4) |
804 | iwl_write_targ_mem(priv, a, 0); | 813 | iwl_write_targ_mem(priv, a, 0); |
805 | for (; a < priv->scd_base_addr + | 814 | for (; a < trans_pcie->scd_base_addr + |
806 | SCD_TRANS_TBL_OFFSET_QUEUE(hw_params(priv).max_txq_num); | 815 | SCD_TRANS_TBL_OFFSET_QUEUE(hw_params(priv).max_txq_num); |
807 | a += 4) | 816 | a += 4) |
808 | iwl_write_targ_mem(priv, a, 0); | 817 | iwl_write_targ_mem(priv, a, 0); |
809 | 818 | ||
810 | iwl_write_prph(priv, SCD_DRAM_BASE_ADDR, | 819 | iwl_write_prph(priv, SCD_DRAM_BASE_ADDR, |
811 | priv->scd_bc_tbls.dma >> 10); | 820 | trans_pcie->scd_bc_tbls.dma >> 10); |
812 | 821 | ||
813 | /* Enable DMA channel */ | 822 | /* Enable DMA channel */ |
814 | for (chan = 0; chan < FH_TCSR_CHNL_NUM ; chan++) | 823 | for (chan = 0; chan < FH_TCSR_CHNL_NUM ; chan++) |
@@ -829,9 +838,9 @@ static void iwl_trans_pcie_tx_start(struct iwl_priv *priv) | |||
829 | for (i = 0; i < hw_params(priv).max_txq_num; i++) { | 838 | for (i = 0; i < hw_params(priv).max_txq_num; i++) { |
830 | iwl_write_prph(priv, SCD_QUEUE_RDPTR(i), 0); | 839 | iwl_write_prph(priv, SCD_QUEUE_RDPTR(i), 0); |
831 | iwl_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8)); | 840 | iwl_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8)); |
832 | iwl_write_targ_mem(priv, priv->scd_base_addr + | 841 | iwl_write_targ_mem(priv, trans_pcie->scd_base_addr + |
833 | SCD_CONTEXT_QUEUE_OFFSET(i), 0); | 842 | SCD_CONTEXT_QUEUE_OFFSET(i), 0); |
834 | iwl_write_targ_mem(priv, priv->scd_base_addr + | 843 | iwl_write_targ_mem(priv, trans_pcie->scd_base_addr + |
835 | SCD_CONTEXT_QUEUE_OFFSET(i) + | 844 | SCD_CONTEXT_QUEUE_OFFSET(i) + |
836 | sizeof(u32), | 845 | sizeof(u32), |
837 | ((SCD_WIN_SIZE << | 846 | ((SCD_WIN_SIZE << |
@@ -843,7 +852,7 @@ static void iwl_trans_pcie_tx_start(struct iwl_priv *priv) | |||
843 | } | 852 | } |
844 | 853 | ||
845 | iwl_write_prph(priv, SCD_INTERRUPT_MASK, | 854 | iwl_write_prph(priv, SCD_INTERRUPT_MASK, |
846 | IWL_MASK(0, hw_params(priv).max_txq_num)); | 855 | IWL_MASK(0, hw_params(trans).max_txq_num)); |
847 | 856 | ||
848 | /* Activate all Tx DMA/FIFO channels */ | 857 | /* Activate all Tx DMA/FIFO channels */ |
849 | iwl_trans_txq_set_sched(priv, IWL_MASK(0, 7)); | 858 | iwl_trans_txq_set_sched(priv, IWL_MASK(0, 7)); |