diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-03-23 15:57:27 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-03-30 14:15:19 -0400 |
commit | a9b6b2569cf107fe541381e82faa0a3c47a9a7fd (patch) | |
tree | ddd70da664996e96c554682e2348f60598a41c12 /drivers | |
parent | ca7a4deb4a1a87dbdc6e7cab0d1022a535204226 (diff) |
ath9k_hw: turn a few big macros into functions
RF_BANK_SETUP, REG_WRITE_RF_ARRAY and REG_WRITE_ARRAY are way too big,
so they shouldn't be inlined at every single callsite, especially since they
can easily be turned into real functions.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar5008_phy.c | 38 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 14 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.h | 14 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/phy.h | 16 |
4 files changed, 51 insertions, 31 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c index 94acce59f51d..4361704fe0d0 100644 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c | |||
@@ -44,6 +44,34 @@ static const int m1ThreshExt_off = 127; | |||
44 | static const int m2ThreshExt_off = 127; | 44 | static const int m2ThreshExt_off = 127; |
45 | 45 | ||
46 | 46 | ||
47 | static void ar5008_rf_bank_setup(u32 *bank, struct ar5416IniArray *array, | ||
48 | int col) | ||
49 | { | ||
50 | int i; | ||
51 | |||
52 | for (i = 0; i < array->ia_rows; i++) | ||
53 | bank[i] = INI_RA(array, i, col); | ||
54 | } | ||
55 | |||
56 | |||
57 | #define REG_WRITE_RF_ARRAY(iniarray, regData, regWr) \ | ||
58 | ar5008_write_rf_array(ah, iniarray, regData, &(regWr)) | ||
59 | |||
60 | static void ar5008_write_rf_array(struct ath_hw *ah, struct ar5416IniArray *array, | ||
61 | u32 *data, unsigned int *writecnt) | ||
62 | { | ||
63 | int r; | ||
64 | |||
65 | ENABLE_REGWRITE_BUFFER(ah); | ||
66 | |||
67 | for (r = 0; r < array->ia_rows; r++) { | ||
68 | REG_WRITE(ah, INI_RA(array, r, 0), data[r]); | ||
69 | DO_DELAY(*writecnt); | ||
70 | } | ||
71 | |||
72 | REGWRITE_BUFFER_FLUSH(ah); | ||
73 | } | ||
74 | |||
47 | /** | 75 | /** |
48 | * ar5008_hw_phy_modify_rx_buffer() - perform analog swizzling of parameters | 76 | * ar5008_hw_phy_modify_rx_buffer() - perform analog swizzling of parameters |
49 | * @rfbuf: | 77 | * @rfbuf: |
@@ -530,16 +558,16 @@ static bool ar5008_hw_set_rf_regs(struct ath_hw *ah, | |||
530 | eepMinorRev = ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV); | 558 | eepMinorRev = ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV); |
531 | 559 | ||
532 | /* Setup Bank 0 Write */ | 560 | /* Setup Bank 0 Write */ |
533 | RF_BANK_SETUP(ah->analogBank0Data, &ah->iniBank0, 1); | 561 | ar5008_rf_bank_setup(ah->analogBank0Data, &ah->iniBank0, 1); |
534 | 562 | ||
535 | /* Setup Bank 1 Write */ | 563 | /* Setup Bank 1 Write */ |
536 | RF_BANK_SETUP(ah->analogBank1Data, &ah->iniBank1, 1); | 564 | ar5008_rf_bank_setup(ah->analogBank1Data, &ah->iniBank1, 1); |
537 | 565 | ||
538 | /* Setup Bank 2 Write */ | 566 | /* Setup Bank 2 Write */ |
539 | RF_BANK_SETUP(ah->analogBank2Data, &ah->iniBank2, 1); | 567 | ar5008_rf_bank_setup(ah->analogBank2Data, &ah->iniBank2, 1); |
540 | 568 | ||
541 | /* Setup Bank 6 Write */ | 569 | /* Setup Bank 6 Write */ |
542 | RF_BANK_SETUP(ah->analogBank3Data, &ah->iniBank3, | 570 | ar5008_rf_bank_setup(ah->analogBank3Data, &ah->iniBank3, |
543 | modesIndex); | 571 | modesIndex); |
544 | { | 572 | { |
545 | int i; | 573 | int i; |
@@ -569,7 +597,7 @@ static bool ar5008_hw_set_rf_regs(struct ath_hw *ah, | |||
569 | } | 597 | } |
570 | 598 | ||
571 | /* Setup Bank 7 Setup */ | 599 | /* Setup Bank 7 Setup */ |
572 | RF_BANK_SETUP(ah->analogBank7Data, &ah->iniBank7, 1); | 600 | ar5008_rf_bank_setup(ah->analogBank7Data, &ah->iniBank7, 1); |
573 | 601 | ||
574 | /* Write Analog registers */ | 602 | /* Write Analog registers */ |
575 | REG_WRITE_RF_ARRAY(&ah->iniBank0, ah->analogBank0Data, | 603 | REG_WRITE_RF_ARRAY(&ah->iniBank0, ah->analogBank0Data, |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 807d410e7645..bb9a3f3c1b71 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -130,6 +130,20 @@ bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout) | |||
130 | } | 130 | } |
131 | EXPORT_SYMBOL(ath9k_hw_wait); | 131 | EXPORT_SYMBOL(ath9k_hw_wait); |
132 | 132 | ||
133 | void ath9k_hw_write_array(struct ath_hw *ah, struct ar5416IniArray *array, | ||
134 | int column, unsigned int *writecnt) | ||
135 | { | ||
136 | int r; | ||
137 | |||
138 | ENABLE_REGWRITE_BUFFER(ah); | ||
139 | for (r = 0; r < array->ia_rows; r++) { | ||
140 | REG_WRITE(ah, INI_RA(array, r, 0), | ||
141 | INI_RA(array, r, column)); | ||
142 | DO_DELAY(*writecnt); | ||
143 | } | ||
144 | REGWRITE_BUFFER_FLUSH(ah); | ||
145 | } | ||
146 | |||
133 | u32 ath9k_hw_reverse_bits(u32 val, u32 n) | 147 | u32 ath9k_hw_reverse_bits(u32 val, u32 n) |
134 | { | 148 | { |
135 | u32 retval; | 149 | u32 retval; |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index e256658c740a..dafbe97a969c 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -106,16 +106,8 @@ | |||
106 | udelay(1); \ | 106 | udelay(1); \ |
107 | } while (0) | 107 | } while (0) |
108 | 108 | ||
109 | #define REG_WRITE_ARRAY(iniarray, column, regWr) do { \ | 109 | #define REG_WRITE_ARRAY(iniarray, column, regWr) \ |
110 | int r; \ | 110 | ath9k_hw_write_array(ah, iniarray, column, &(regWr)) |
111 | ENABLE_REGWRITE_BUFFER(ah); \ | ||
112 | for (r = 0; r < ((iniarray)->ia_rows); r++) { \ | ||
113 | REG_WRITE(ah, INI_RA((iniarray), (r), 0), \ | ||
114 | INI_RA((iniarray), r, (column))); \ | ||
115 | DO_DELAY(regWr); \ | ||
116 | } \ | ||
117 | REGWRITE_BUFFER_FLUSH(ah); \ | ||
118 | } while (0) | ||
119 | 111 | ||
120 | #define AR_GPIO_OUTPUT_MUX_AS_OUTPUT 0 | 112 | #define AR_GPIO_OUTPUT_MUX_AS_OUTPUT 0 |
121 | #define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1 | 113 | #define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1 |
@@ -913,6 +905,8 @@ void ath9k_hw_antdiv_comb_conf_set(struct ath_hw *ah, | |||
913 | 905 | ||
914 | /* General Operation */ | 906 | /* General Operation */ |
915 | bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout); | 907 | bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout); |
908 | void ath9k_hw_write_array(struct ath_hw *ah, struct ar5416IniArray *array, | ||
909 | int column, unsigned int *writecnt); | ||
916 | u32 ath9k_hw_reverse_bits(u32 val, u32 n); | 910 | u32 ath9k_hw_reverse_bits(u32 val, u32 n); |
917 | bool ath9k_get_channel_edges(struct ath_hw *ah, u16 flags, u16 *low, u16 *high); | 911 | bool ath9k_get_channel_edges(struct ath_hw *ah, u16 flags, u16 *low, u16 *high); |
918 | u16 ath9k_hw_computetxtime(struct ath_hw *ah, | 912 | u16 ath9k_hw_computetxtime(struct ath_hw *ah, |
diff --git a/drivers/net/wireless/ath/ath9k/phy.h b/drivers/net/wireless/ath/ath9k/phy.h index e4029325c787..f50e2c29f71e 100644 --- a/drivers/net/wireless/ath/ath9k/phy.h +++ b/drivers/net/wireless/ath/ath9k/phy.h | |||
@@ -38,27 +38,11 @@ | |||
38 | #define AR_PHY_CLC_Q0 0x0000ffd0 | 38 | #define AR_PHY_CLC_Q0 0x0000ffd0 |
39 | #define AR_PHY_CLC_Q0_S 5 | 39 | #define AR_PHY_CLC_Q0_S 5 |
40 | 40 | ||
41 | #define REG_WRITE_RF_ARRAY(iniarray, regData, regWr) do { \ | ||
42 | int r; \ | ||
43 | ENABLE_REGWRITE_BUFFER(ah); \ | ||
44 | for (r = 0; r < ((iniarray)->ia_rows); r++) { \ | ||
45 | REG_WRITE(ah, INI_RA((iniarray), r, 0), (regData)[r]); \ | ||
46 | DO_DELAY(regWr); \ | ||
47 | } \ | ||
48 | REGWRITE_BUFFER_FLUSH(ah); \ | ||
49 | } while (0) | ||
50 | |||
51 | #define ANTSWAP_AB 0x0001 | 41 | #define ANTSWAP_AB 0x0001 |
52 | #define REDUCE_CHAIN_0 0x00000050 | 42 | #define REDUCE_CHAIN_0 0x00000050 |
53 | #define REDUCE_CHAIN_1 0x00000051 | 43 | #define REDUCE_CHAIN_1 0x00000051 |
54 | #define AR_PHY_CHIP_ID 0x9818 | 44 | #define AR_PHY_CHIP_ID 0x9818 |
55 | 45 | ||
56 | #define RF_BANK_SETUP(_bank, _iniarray, _col) do { \ | ||
57 | int i; \ | ||
58 | for (i = 0; i < (_iniarray)->ia_rows; i++) \ | ||
59 | (_bank)[i] = INI_RA((_iniarray), i, _col);; \ | ||
60 | } while (0) | ||
61 | |||
62 | #define AR_PHY_TIMING11_SPUR_FREQ_SD 0x3FF00000 | 46 | #define AR_PHY_TIMING11_SPUR_FREQ_SD 0x3FF00000 |
63 | #define AR_PHY_TIMING11_SPUR_FREQ_SD_S 20 | 47 | #define AR_PHY_TIMING11_SPUR_FREQ_SD_S 20 |
64 | 48 | ||