mac80211: add initial support for AR9330
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 569-ath9k-configure-internal-regulator-for-AR9330.patch
1 diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
2 index ffdfa6d..963dc9b 100644
3 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
4 +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
5 @@ -3712,7 +3712,7 @@ static void ar9003_hw_internal_regulator_apply(struct ath_hw *ah)
6 ath9k_hw_ar9300_get_eeprom(ah, EEP_INTERNAL_REGULATOR);
7
8 if (internal_regulator) {
9 - if (AR_SREV_9485(ah)) {
10 + if (AR_SREV_9330(ah) || AR_SREV_9485(ah)) {
11 int reg_pmu_set;
12
13 reg_pmu_set = REG_READ(ah, AR_PHY_PMU2) & ~AR_PHY_PMU2_PGM;
14 @@ -3720,9 +3720,24 @@ static void ar9003_hw_internal_regulator_apply(struct ath_hw *ah)
15 if (!is_pmu_set(ah, AR_PHY_PMU2, reg_pmu_set))
16 return;
17
18 - reg_pmu_set = (5 << 1) | (7 << 4) | (1 << 8) |
19 - (2 << 14) | (6 << 17) | (1 << 20) |
20 - (3 << 24) | (1 << 28);
21 + if (AR_SREV_9330(ah)) {
22 + if (ah->is_clk_25mhz) {
23 + reg_pmu_set = (3 << 1) | (8 << 4) |
24 + (3 << 8) | (1 << 14) |
25 + (6 << 17) | (1 << 20) |
26 + (3 << 24);
27 + } else {
28 + reg_pmu_set = (4 << 1) | (7 << 4) |
29 + (3 << 8) | (1 << 14) |
30 + (6 << 17) | (1 << 20) |
31 + (3 << 24);
32 + }
33 + } else {
34 + reg_pmu_set = (5 << 1) | (7 << 4) |
35 + (1 << 8) | (2 << 14) |
36 + (6 << 17) | (1 << 20) |
37 + (3 << 24) | (1 << 28);
38 + }
39
40 REG_WRITE(ah, AR_PHY_PMU1, reg_pmu_set);
41 if (!is_pmu_set(ah, AR_PHY_PMU1, reg_pmu_set))
42 @@ -3753,7 +3768,7 @@ static void ar9003_hw_internal_regulator_apply(struct ath_hw *ah)
43 AR_RTC_REG_CONTROL1_SWREG_PROGRAM);
44 }
45 } else {
46 - if (AR_SREV_9485(ah)) {
47 + if (AR_SREV_9330(ah) || AR_SREV_9485(ah)) {
48 REG_RMW_FIELD(ah, AR_PHY_PMU2, AR_PHY_PMU2_PGM, 0);
49 while (REG_READ_FIELD(ah, AR_PHY_PMU2,
50 AR_PHY_PMU2_PGM))