aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-4965.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-4965.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c64
1 files changed, 31 insertions, 33 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index a728c45b0d33..1e56dfa0cfbc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -192,37 +192,35 @@ u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *addr)
192 192
193static int iwl4965_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max) 193static int iwl4965_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max)
194{ 194{
195 int rc = 0; 195 int ret;
196 unsigned long flags; 196 unsigned long flags;
197 197
198 spin_lock_irqsave(&priv->lock, flags); 198 spin_lock_irqsave(&priv->lock, flags);
199 rc = iwl_grab_restricted_access(priv); 199 ret = iwl_grab_restricted_access(priv);
200 if (rc) { 200 if (ret) {
201 spin_unlock_irqrestore(&priv->lock, flags); 201 spin_unlock_irqrestore(&priv->lock, flags);
202 return rc; 202 return ret;
203 } 203 }
204 204
205 if (!pwr_max) { 205 if (!pwr_max) {
206 u32 val; 206 u32 val;
207 207
208 rc = pci_read_config_dword(priv->pci_dev, PCI_POWER_SOURCE, 208 ret = pci_read_config_dword(priv->pci_dev, PCI_POWER_SOURCE,
209 &val); 209 &val);
210 210
211 if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) 211 if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT)
212 iwl_set_bits_mask_restricted_reg( 212 iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
213 priv, APMG_PS_CTRL_REG,
214 APMG_PS_CTRL_VAL_PWR_SRC_VAUX, 213 APMG_PS_CTRL_VAL_PWR_SRC_VAUX,
215 ~APMG_PS_CTRL_MSK_PWR_SRC); 214 ~APMG_PS_CTRL_MSK_PWR_SRC);
216 } else 215 } else
217 iwl_set_bits_mask_restricted_reg( 216 iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
218 priv, APMG_PS_CTRL_REG,
219 APMG_PS_CTRL_VAL_PWR_SRC_VMAIN, 217 APMG_PS_CTRL_VAL_PWR_SRC_VMAIN,
220 ~APMG_PS_CTRL_MSK_PWR_SRC); 218 ~APMG_PS_CTRL_MSK_PWR_SRC);
221 219
222 iwl_release_restricted_access(priv); 220 iwl_release_restricted_access(priv);
223 spin_unlock_irqrestore(&priv->lock, flags); 221 spin_unlock_irqrestore(&priv->lock, flags);
224 222
225 return rc; 223 return ret;
226} 224}
227 225
228static int iwl4965_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq) 226static int iwl4965_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
@@ -384,7 +382,7 @@ static int iwl4965_txq_ctx_reset(struct iwl_priv *priv)
384 goto error_reset; 382 goto error_reset;
385 } 383 }
386 384
387 iwl_write_restricted_reg(priv, SCD_TXFACT, 0); 385 iwl_write_prph(priv, SCD_TXFACT, 0);
388 iwl_release_restricted_access(priv); 386 iwl_release_restricted_access(priv);
389 spin_unlock_irqrestore(&priv->lock, flags); 387 spin_unlock_irqrestore(&priv->lock, flags);
390 388
@@ -449,16 +447,16 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
449 return rc; 447 return rc;
450 } 448 }
451 449
452 iwl_read_restricted_reg(priv, APMG_CLK_CTRL_REG); 450 iwl_read_prph(priv, APMG_CLK_CTRL_REG);
453 451
454 iwl_write_restricted_reg(priv, APMG_CLK_CTRL_REG, 452 iwl_write_prph(priv, APMG_CLK_CTRL_REG,
455 APMG_CLK_VAL_DMA_CLK_RQT | 453 APMG_CLK_VAL_DMA_CLK_RQT |
456 APMG_CLK_VAL_BSM_CLK_RQT); 454 APMG_CLK_VAL_BSM_CLK_RQT);
457 iwl_read_restricted_reg(priv, APMG_CLK_CTRL_REG); 455 iwl_read_prph(priv, APMG_CLK_CTRL_REG);
458 456
459 udelay(20); 457 udelay(20);
460 458
461 iwl_set_bits_restricted_reg(priv, APMG_PCIDEV_STT_REG, 459 iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG,
462 APMG_PCIDEV_STT_VAL_L1_ACT_DIS); 460 APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
463 461
464 iwl_release_restricted_access(priv); 462 iwl_release_restricted_access(priv);
@@ -514,11 +512,11 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
514 return rc; 512 return rc;
515 } 513 }
516 514
517 iwl_read_restricted_reg(priv, APMG_PS_CTRL_REG); 515 iwl_read_prph(priv, APMG_PS_CTRL_REG);
518 iwl_set_bits_restricted_reg(priv, APMG_PS_CTRL_REG, 516 iwl_set_bits_prph(priv, APMG_PS_CTRL_REG,
519 APMG_PS_CTRL_VAL_RESET_REQ); 517 APMG_PS_CTRL_VAL_RESET_REQ);
520 udelay(5); 518 udelay(5);
521 iwl_clear_bits_restricted_reg(priv, APMG_PS_CTRL_REG, 519 iwl_clear_bits_prph(priv, APMG_PS_CTRL_REG,
522 APMG_PS_CTRL_VAL_RESET_REQ); 520 APMG_PS_CTRL_VAL_RESET_REQ);
523 521
524 iwl_release_restricted_access(priv); 522 iwl_release_restricted_access(priv);
@@ -645,13 +643,13 @@ int iwl_hw_nic_reset(struct iwl_priv *priv)
645 643
646 rc = iwl_grab_restricted_access(priv); 644 rc = iwl_grab_restricted_access(priv);
647 if (!rc) { 645 if (!rc) {
648 iwl_write_restricted_reg(priv, APMG_CLK_EN_REG, 646 iwl_write_prph(priv, APMG_CLK_EN_REG,
649 APMG_CLK_VAL_DMA_CLK_RQT | 647 APMG_CLK_VAL_DMA_CLK_RQT |
650 APMG_CLK_VAL_BSM_CLK_RQT); 648 APMG_CLK_VAL_BSM_CLK_RQT);
651 649
652 udelay(10); 650 udelay(10);
653 651
654 iwl_set_bits_restricted_reg(priv, APMG_PCIDEV_STT_REG, 652 iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG,
655 APMG_PCIDEV_STT_VAL_L1_ACT_DIS); 653 APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
656 654
657 iwl_release_restricted_access(priv); 655 iwl_release_restricted_access(priv);
@@ -1585,7 +1583,7 @@ static void iwl4965_set_wr_ptrs(struct iwl_priv *priv, int txq_id, u32 index)
1585{ 1583{
1586 iwl_write_restricted(priv, HBUS_TARG_WRPTR, 1584 iwl_write_restricted(priv, HBUS_TARG_WRPTR,
1587 (index & 0xff) | (txq_id << 8)); 1585 (index & 0xff) | (txq_id << 8));
1588 iwl_write_restricted_reg(priv, SCD_QUEUE_RDPTR(txq_id), index); 1586 iwl_write_prph(priv, SCD_QUEUE_RDPTR(txq_id), index);
1589} 1587}
1590 1588
1591/* 1589/*
@@ -1598,7 +1596,7 @@ static void iwl4965_tx_queue_set_status(struct iwl_priv *priv,
1598 int txq_id = txq->q.id; 1596 int txq_id = txq->q.id;
1599 int active = test_bit(txq_id, &priv->txq_ctx_active_msk)?1:0; 1597 int active = test_bit(txq_id, &priv->txq_ctx_active_msk)?1:0;
1600 1598
1601 iwl_write_restricted_reg(priv, SCD_QUEUE_STATUS_BITS(txq_id), 1599 iwl_write_prph(priv, SCD_QUEUE_STATUS_BITS(txq_id),
1602 (active << SCD_QUEUE_STTS_REG_POS_ACTIVE) | 1600 (active << SCD_QUEUE_STTS_REG_POS_ACTIVE) |
1603 (tx_fifo_id << SCD_QUEUE_STTS_REG_POS_TXF) | 1601 (tx_fifo_id << SCD_QUEUE_STTS_REG_POS_TXF) |
1604 (scd_retry << SCD_QUEUE_STTS_REG_POS_WSL) | 1602 (scd_retry << SCD_QUEUE_STTS_REG_POS_WSL) |
@@ -1656,7 +1654,7 @@ int iwl4965_alive_notify(struct iwl_priv *priv)
1656 return rc; 1654 return rc;
1657 } 1655 }
1658 1656
1659 priv->scd_base_addr = iwl_read_restricted_reg(priv, SCD_SRAM_BASE_ADDR); 1657 priv->scd_base_addr = iwl_read_prph(priv, SCD_SRAM_BASE_ADDR);
1660 a = priv->scd_base_addr + SCD_CONTEXT_DATA_OFFSET; 1658 a = priv->scd_base_addr + SCD_CONTEXT_DATA_OFFSET;
1661 for (; a < priv->scd_base_addr + SCD_TX_STTS_BITMAP_OFFSET; a += 4) 1659 for (; a < priv->scd_base_addr + SCD_TX_STTS_BITMAP_OFFSET; a += 4)
1662 iwl_write_restricted_mem(priv, a, 0); 1660 iwl_write_restricted_mem(priv, a, 0);
@@ -1665,14 +1663,14 @@ int iwl4965_alive_notify(struct iwl_priv *priv)
1665 for (; a < sizeof(u16) * priv->hw_setting.max_txq_num; a += 4) 1663 for (; a < sizeof(u16) * priv->hw_setting.max_txq_num; a += 4)
1666 iwl_write_restricted_mem(priv, a, 0); 1664 iwl_write_restricted_mem(priv, a, 0);
1667 1665
1668 iwl_write_restricted_reg(priv, SCD_DRAM_BASE_ADDR, 1666 iwl_write_prph(priv, SCD_DRAM_BASE_ADDR,
1669 (priv->hw_setting.shared_phys + 1667 (priv->hw_setting.shared_phys +
1670 offsetof(struct iwl_shared, queues_byte_cnt_tbls)) >> 10); 1668 offsetof(struct iwl_shared, queues_byte_cnt_tbls)) >> 10);
1671 iwl_write_restricted_reg(priv, SCD_QUEUECHAIN_SEL, 0); 1669 iwl_write_prph(priv, SCD_QUEUECHAIN_SEL, 0);
1672 1670
1673 /* initiate the queues */ 1671 /* initiate the queues */
1674 for (i = 0; i < priv->hw_setting.max_txq_num; i++) { 1672 for (i = 0; i < priv->hw_setting.max_txq_num; i++) {
1675 iwl_write_restricted_reg(priv, SCD_QUEUE_RDPTR(i), 0); 1673 iwl_write_prph(priv, SCD_QUEUE_RDPTR(i), 0);
1676 iwl_write_restricted(priv, HBUS_TARG_WRPTR, 0 | (i << 8)); 1674 iwl_write_restricted(priv, HBUS_TARG_WRPTR, 0 | (i << 8));
1677 iwl_write_restricted_mem(priv, priv->scd_base_addr + 1675 iwl_write_restricted_mem(priv, priv->scd_base_addr +
1678 SCD_CONTEXT_QUEUE_OFFSET(i), 1676 SCD_CONTEXT_QUEUE_OFFSET(i),
@@ -1687,10 +1685,10 @@ int iwl4965_alive_notify(struct iwl_priv *priv)
1687 SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); 1685 SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK);
1688 1686
1689 } 1687 }
1690 iwl_write_restricted_reg(priv, SCD_INTERRUPT_MASK, 1688 iwl_write_prph(priv, SCD_INTERRUPT_MASK,
1691 (1 << priv->hw_setting.max_txq_num) - 1); 1689 (1 << priv->hw_setting.max_txq_num) - 1);
1692 1690
1693 iwl_write_restricted_reg(priv, SCD_TXFACT, 1691 iwl_write_prph(priv, SCD_TXFACT,
1694 SCD_TXFACT_REG_TXFIFO_MASK(0, 7)); 1692 SCD_TXFACT_REG_TXFIFO_MASK(0, 7));
1695 1693
1696 iwl4965_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0); 1694 iwl4965_set_wr_ptrs(priv, IWL_CMD_QUEUE_NUM, 0);
@@ -4140,7 +4138,7 @@ static void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv,
4140 4138
4141static void iwl4965_tx_queue_stop_scheduler(struct iwl_priv *priv, u16 txq_id) 4139static void iwl4965_tx_queue_stop_scheduler(struct iwl_priv *priv, u16 txq_id)
4142{ 4140{
4143 iwl_write_restricted_reg(priv, 4141 iwl_write_prph(priv,
4144 SCD_QUEUE_STATUS_BITS(txq_id), 4142 SCD_QUEUE_STATUS_BITS(txq_id),
4145 (0 << SCD_QUEUE_STTS_REG_POS_ACTIVE)| 4143 (0 << SCD_QUEUE_STTS_REG_POS_ACTIVE)|
4146 (1 << SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN)); 4144 (1 << SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN));
@@ -4201,7 +4199,7 @@ static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id,
4201 iwl4965_tx_queue_set_q2ratid(priv, ra_tid, txq_id); 4199 iwl4965_tx_queue_set_q2ratid(priv, ra_tid, txq_id);
4202 4200
4203 4201
4204 iwl_set_bits_restricted_reg(priv, SCD_QUEUECHAIN_SEL, (1<<txq_id)); 4202 iwl_set_bits_prph(priv, SCD_QUEUECHAIN_SEL, (1<<txq_id));
4205 4203
4206 priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); 4204 priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff);
4207 priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); 4205 priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff);
@@ -4219,7 +4217,7 @@ static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id,
4219 (SCD_FRAME_LIMIT << SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) 4217 (SCD_FRAME_LIMIT << SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS)
4220 & SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK); 4218 & SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK);
4221 4219
4222 iwl_set_bits_restricted_reg(priv, SCD_INTERRUPT_MASK, (1 << txq_id)); 4220 iwl_set_bits_prph(priv, SCD_INTERRUPT_MASK, (1 << txq_id));
4223 4221
4224 iwl4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 1); 4222 iwl4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 1);
4225 4223
@@ -4253,14 +4251,14 @@ static int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id,
4253 4251
4254 iwl4965_tx_queue_stop_scheduler(priv, txq_id); 4252 iwl4965_tx_queue_stop_scheduler(priv, txq_id);
4255 4253
4256 iwl_clear_bits_restricted_reg(priv, SCD_QUEUECHAIN_SEL, (1 << txq_id)); 4254 iwl_clear_bits_prph(priv, SCD_QUEUECHAIN_SEL, (1 << txq_id));
4257 4255
4258 priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); 4256 priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff);
4259 priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); 4257 priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff);
4260 /* supposes that ssn_idx is valid (!= 0xFFF) */ 4258 /* supposes that ssn_idx is valid (!= 0xFFF) */
4261 iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx); 4259 iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx);
4262 4260
4263 iwl_clear_bits_restricted_reg(priv, SCD_INTERRUPT_MASK, (1 << txq_id)); 4261 iwl_clear_bits_prph(priv, SCD_INTERRUPT_MASK, (1 << txq_id));
4264 iwl4965_txq_ctx_deactivate(priv, txq_id); 4262 iwl4965_txq_ctx_deactivate(priv, txq_id);
4265 iwl4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 0); 4263 iwl4965_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 0);
4266 4264