diff options
author | Sujith <Sujith.Manoharan@atheros.com> | 2010-04-16 02:23:57 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-04-16 15:47:09 -0400 |
commit | 7d0d0df0eca695c83a08dc386824a9d1d7c526a4 (patch) | |
tree | df2104a15ef84bcd15478e956b3458241b3b7a78 /drivers/net/wireless/ath/ath9k/ar5008_phy.c | |
parent | 6819d57f07440a8f9540967d9212a70e9c98eceb (diff) |
ath9k_hw: Use buffered register writes
This patch adds macros at certain places
which could be optimized for multiple register writes.
The performance of ath9k_htc improves considerably,
especially reducing the latency involved in a scan run.
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/ar5008_phy.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar5008_phy.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c index 94eb069b5ae3..de8ce1291a46 100644 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c | |||
@@ -590,10 +590,14 @@ static void ar5008_hw_init_chain_masks(struct ath_hw *ah) | |||
590 | rx_chainmask = ah->rxchainmask; | 590 | rx_chainmask = ah->rxchainmask; |
591 | tx_chainmask = ah->txchainmask; | 591 | tx_chainmask = ah->txchainmask; |
592 | 592 | ||
593 | ENABLE_REGWRITE_BUFFER(ah); | ||
594 | |||
593 | switch (rx_chainmask) { | 595 | switch (rx_chainmask) { |
594 | case 0x5: | 596 | case 0x5: |
597 | DISABLE_REGWRITE_BUFFER(ah); | ||
595 | REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, | 598 | REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, |
596 | AR_PHY_SWAP_ALT_CHAIN); | 599 | AR_PHY_SWAP_ALT_CHAIN); |
600 | ENABLE_REGWRITE_BUFFER(ah); | ||
597 | case 0x3: | 601 | case 0x3: |
598 | if (ah->hw_version.macVersion == AR_SREV_REVISION_5416_10) { | 602 | if (ah->hw_version.macVersion == AR_SREV_REVISION_5416_10) { |
599 | REG_WRITE(ah, AR_PHY_RX_CHAINMASK, 0x7); | 603 | REG_WRITE(ah, AR_PHY_RX_CHAINMASK, 0x7); |
@@ -611,6 +615,10 @@ static void ar5008_hw_init_chain_masks(struct ath_hw *ah) | |||
611 | } | 615 | } |
612 | 616 | ||
613 | REG_WRITE(ah, AR_SELFGEN_MASK, tx_chainmask); | 617 | REG_WRITE(ah, AR_SELFGEN_MASK, tx_chainmask); |
618 | |||
619 | REGWRITE_BUFFER_FLUSH(ah); | ||
620 | DISABLE_REGWRITE_BUFFER(ah); | ||
621 | |||
614 | if (tx_chainmask == 0x5) { | 622 | if (tx_chainmask == 0x5) { |
615 | REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, | 623 | REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, |
616 | AR_PHY_SWAP_ALT_CHAIN); | 624 | AR_PHY_SWAP_ALT_CHAIN); |
@@ -689,8 +697,13 @@ static void ar5008_hw_set_channel_regs(struct ath_hw *ah, | |||
689 | 697 | ||
690 | ath9k_hw_set11nmac2040(ah); | 698 | ath9k_hw_set11nmac2040(ah); |
691 | 699 | ||
700 | ENABLE_REGWRITE_BUFFER(ah); | ||
701 | |||
692 | REG_WRITE(ah, AR_GTXTO, 25 << AR_GTXTO_TIMEOUT_LIMIT_S); | 702 | REG_WRITE(ah, AR_GTXTO, 25 << AR_GTXTO_TIMEOUT_LIMIT_S); |
693 | REG_WRITE(ah, AR_CST, 0xF << AR_CST_TIMEOUT_LIMIT_S); | 703 | REG_WRITE(ah, AR_CST, 0xF << AR_CST_TIMEOUT_LIMIT_S); |
704 | |||
705 | REGWRITE_BUFFER_FLUSH(ah); | ||
706 | DISABLE_REGWRITE_BUFFER(ah); | ||
694 | } | 707 | } |
695 | 708 | ||
696 | 709 | ||
@@ -773,6 +786,8 @@ static int ar5008_hw_process_ini(struct ath_hw *ah, | |||
773 | 786 | ||
774 | REG_WRITE(ah, AR_PHY_ADC_SERIAL_CTL, AR_PHY_SEL_INTERNAL_ADDAC); | 787 | REG_WRITE(ah, AR_PHY_ADC_SERIAL_CTL, AR_PHY_SEL_INTERNAL_ADDAC); |
775 | 788 | ||
789 | ENABLE_REGWRITE_BUFFER(ah); | ||
790 | |||
776 | for (i = 0; i < ah->iniModes.ia_rows; i++) { | 791 | for (i = 0; i < ah->iniModes.ia_rows; i++) { |
777 | u32 reg = INI_RA(&ah->iniModes, i, 0); | 792 | u32 reg = INI_RA(&ah->iniModes, i, 0); |
778 | u32 val = INI_RA(&ah->iniModes, i, modesIndex); | 793 | u32 val = INI_RA(&ah->iniModes, i, modesIndex); |
@@ -790,6 +805,9 @@ static int ar5008_hw_process_ini(struct ath_hw *ah, | |||
790 | DO_DELAY(regWrites); | 805 | DO_DELAY(regWrites); |
791 | } | 806 | } |
792 | 807 | ||
808 | REGWRITE_BUFFER_FLUSH(ah); | ||
809 | DISABLE_REGWRITE_BUFFER(ah); | ||
810 | |||
793 | if (AR_SREV_9280(ah) || AR_SREV_9287_10_OR_LATER(ah)) | 811 | if (AR_SREV_9280(ah) || AR_SREV_9287_10_OR_LATER(ah)) |
794 | REG_WRITE_ARRAY(&ah->iniModesRxGain, modesIndex, regWrites); | 812 | REG_WRITE_ARRAY(&ah->iniModesRxGain, modesIndex, regWrites); |
795 | 813 | ||
@@ -801,6 +819,8 @@ static int ar5008_hw_process_ini(struct ath_hw *ah, | |||
801 | REG_WRITE_ARRAY(&ah->iniModes_9271_1_0_only, | 819 | REG_WRITE_ARRAY(&ah->iniModes_9271_1_0_only, |
802 | modesIndex, regWrites); | 820 | modesIndex, regWrites); |
803 | 821 | ||
822 | ENABLE_REGWRITE_BUFFER(ah); | ||
823 | |||
804 | /* Write common array parameters */ | 824 | /* Write common array parameters */ |
805 | for (i = 0; i < ah->iniCommon.ia_rows; i++) { | 825 | for (i = 0; i < ah->iniCommon.ia_rows; i++) { |
806 | u32 reg = INI_RA(&ah->iniCommon, i, 0); | 826 | u32 reg = INI_RA(&ah->iniCommon, i, 0); |
@@ -816,6 +836,9 @@ static int ar5008_hw_process_ini(struct ath_hw *ah, | |||
816 | DO_DELAY(regWrites); | 836 | DO_DELAY(regWrites); |
817 | } | 837 | } |
818 | 838 | ||
839 | REGWRITE_BUFFER_FLUSH(ah); | ||
840 | DISABLE_REGWRITE_BUFFER(ah); | ||
841 | |||
819 | if (AR_SREV_9271(ah)) { | 842 | if (AR_SREV_9271(ah)) { |
820 | if (ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE) == 1) | 843 | if (ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE) == 1) |
821 | REG_WRITE_ARRAY(&ah->iniModes_high_power_tx_gain_9271, | 844 | REG_WRITE_ARRAY(&ah->iniModes_high_power_tx_gain_9271, |
@@ -1303,6 +1326,8 @@ static void ar5008_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan) | |||
1303 | udelay(50); | 1326 | udelay(50); |
1304 | } | 1327 | } |
1305 | 1328 | ||
1329 | ENABLE_REGWRITE_BUFFER(ah); | ||
1330 | |||
1306 | for (i = 0; i < NUM_NF_READINGS; i++) { | 1331 | for (i = 0; i < NUM_NF_READINGS; i++) { |
1307 | if (chainmask & (1 << i)) { | 1332 | if (chainmask & (1 << i)) { |
1308 | val = REG_READ(ah, ar5416_cca_regs[i]); | 1333 | val = REG_READ(ah, ar5416_cca_regs[i]); |
@@ -1311,6 +1336,9 @@ static void ar5008_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan) | |||
1311 | REG_WRITE(ah, ar5416_cca_regs[i], val); | 1336 | REG_WRITE(ah, ar5416_cca_regs[i], val); |
1312 | } | 1337 | } |
1313 | } | 1338 | } |
1339 | |||
1340 | REGWRITE_BUFFER_FLUSH(ah); | ||
1341 | DISABLE_REGWRITE_BUFFER(ah); | ||
1314 | } | 1342 | } |
1315 | 1343 | ||
1316 | void ar5008_hw_attach_phy_ops(struct ath_hw *ah) | 1344 | void ar5008_hw_attach_phy_ops(struct ath_hw *ah) |