diff options
author | Vasanthakumar Thiagarajan <vasanth@atheros.com> | 2010-12-07 05:20:39 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-12-07 16:34:58 -0500 |
commit | ab09b5b4beda8b33a117bf6fbbb2b5aa8f566129 (patch) | |
tree | 082fc8cf95c68bd075469165a1c439f49736497c /drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |
parent | 47e84dfb411fcaa51e12d94ab82570ec3aa86e32 (diff) |
ath9k_hw: Configure internal regulator for AR9485
Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/ar9003_eeprom.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 89 |
1 files changed, 74 insertions, 15 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c index 45fe5c2ec3b9..c02e43d5c9c9 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |||
@@ -3653,29 +3653,88 @@ static void ar9003_hw_atten_apply(struct ath_hw *ah, struct ath9k_channel *chan) | |||
3653 | } | 3653 | } |
3654 | } | 3654 | } |
3655 | 3655 | ||
3656 | static bool is_pmu_set(struct ath_hw *ah, u32 pmu_reg, int pmu_set) | ||
3657 | { | ||
3658 | int timeout = 100; | ||
3659 | |||
3660 | while (pmu_set != REG_READ(ah, pmu_reg)) { | ||
3661 | if (timeout-- == 0) | ||
3662 | return false; | ||
3663 | REG_WRITE(ah, pmu_reg, pmu_set); | ||
3664 | udelay(10); | ||
3665 | } | ||
3666 | |||
3667 | return true; | ||
3668 | } | ||
3669 | |||
3656 | static void ar9003_hw_internal_regulator_apply(struct ath_hw *ah) | 3670 | static void ar9003_hw_internal_regulator_apply(struct ath_hw *ah) |
3657 | { | 3671 | { |
3658 | int internal_regulator = | 3672 | int internal_regulator = |
3659 | ath9k_hw_ar9300_get_eeprom(ah, EEP_INTERNAL_REGULATOR); | 3673 | ath9k_hw_ar9300_get_eeprom(ah, EEP_INTERNAL_REGULATOR); |
3660 | 3674 | ||
3661 | if (internal_regulator) { | 3675 | if (internal_regulator) { |
3662 | /* Internal regulator is ON. Write swreg register. */ | 3676 | if (AR_SREV_9485(ah)) { |
3663 | int swreg = ath9k_hw_ar9300_get_eeprom(ah, EEP_SWREG); | 3677 | int reg_pmu_set; |
3664 | REG_WRITE(ah, AR_RTC_REG_CONTROL1, | 3678 | |
3665 | REG_READ(ah, AR_RTC_REG_CONTROL1) & | 3679 | reg_pmu_set = REG_READ(ah, AR_PHY_PMU2) & ~AR_PHY_PMU2_PGM; |
3666 | (~AR_RTC_REG_CONTROL1_SWREG_PROGRAM)); | 3680 | REG_WRITE(ah, AR_PHY_PMU2, reg_pmu_set); |
3667 | REG_WRITE(ah, AR_RTC_REG_CONTROL0, swreg); | 3681 | if (!is_pmu_set(ah, AR_PHY_PMU2, reg_pmu_set)) |
3668 | /* Set REG_CONTROL1.SWREG_PROGRAM */ | 3682 | return; |
3669 | REG_WRITE(ah, AR_RTC_REG_CONTROL1, | 3683 | |
3670 | REG_READ(ah, | 3684 | reg_pmu_set = (5 << 1) | (7 << 4) | (1 << 8) | |
3671 | AR_RTC_REG_CONTROL1) | | 3685 | (7 << 14) | (6 << 17) | (1 << 20) | |
3672 | AR_RTC_REG_CONTROL1_SWREG_PROGRAM); | 3686 | (3 << 24) | (1 << 28); |
3687 | |||
3688 | REG_WRITE(ah, AR_PHY_PMU1, reg_pmu_set); | ||
3689 | if (!is_pmu_set(ah, AR_PHY_PMU1, reg_pmu_set)) | ||
3690 | return; | ||
3691 | |||
3692 | reg_pmu_set = (REG_READ(ah, AR_PHY_PMU2) & ~0xFFC00000) | ||
3693 | | (4 << 26); | ||
3694 | REG_WRITE(ah, AR_PHY_PMU2, reg_pmu_set); | ||
3695 | if (!is_pmu_set(ah, AR_PHY_PMU2, reg_pmu_set)) | ||
3696 | return; | ||
3697 | |||
3698 | reg_pmu_set = (REG_READ(ah, AR_PHY_PMU2) & ~0x00200000) | ||
3699 | | (1 << 21); | ||
3700 | REG_WRITE(ah, AR_PHY_PMU2, reg_pmu_set); | ||
3701 | if (!is_pmu_set(ah, AR_PHY_PMU2, reg_pmu_set)) | ||
3702 | return; | ||
3703 | } else { | ||
3704 | /* Internal regulator is ON. Write swreg register. */ | ||
3705 | int swreg = ath9k_hw_ar9300_get_eeprom(ah, EEP_SWREG); | ||
3706 | REG_WRITE(ah, AR_RTC_REG_CONTROL1, | ||
3707 | REG_READ(ah, AR_RTC_REG_CONTROL1) & | ||
3708 | (~AR_RTC_REG_CONTROL1_SWREG_PROGRAM)); | ||
3709 | REG_WRITE(ah, AR_RTC_REG_CONTROL0, swreg); | ||
3710 | /* Set REG_CONTROL1.SWREG_PROGRAM */ | ||
3711 | REG_WRITE(ah, AR_RTC_REG_CONTROL1, | ||
3712 | REG_READ(ah, | ||
3713 | AR_RTC_REG_CONTROL1) | | ||
3714 | AR_RTC_REG_CONTROL1_SWREG_PROGRAM); | ||
3715 | } | ||
3673 | } else { | 3716 | } else { |
3674 | REG_WRITE(ah, AR_RTC_SLEEP_CLK, | 3717 | if (AR_SREV_9485(ah)) { |
3675 | (REG_READ(ah, | 3718 | REG_RMW_FIELD(ah, AR_PHY_PMU2, AR_PHY_PMU2_PGM, 0); |
3676 | AR_RTC_SLEEP_CLK) | | 3719 | while (REG_READ_FIELD(ah, AR_PHY_PMU2, |
3677 | AR_RTC_FORCE_SWREG_PRD)); | 3720 | AR_PHY_PMU2_PGM)) |
3721 | udelay(10); | ||
3722 | |||
3723 | REG_RMW_FIELD(ah, AR_PHY_PMU1, AR_PHY_PMU1_PWD, 0x1); | ||
3724 | while (!REG_READ_FIELD(ah, AR_PHY_PMU1, | ||
3725 | AR_PHY_PMU1_PWD)) | ||
3726 | udelay(10); | ||
3727 | REG_RMW_FIELD(ah, AR_PHY_PMU2, AR_PHY_PMU2_PGM, 0x1); | ||
3728 | while (!REG_READ_FIELD(ah, AR_PHY_PMU2, | ||
3729 | AR_PHY_PMU2_PGM)) | ||
3730 | udelay(10); | ||
3731 | } else | ||
3732 | REG_WRITE(ah, AR_RTC_SLEEP_CLK, | ||
3733 | (REG_READ(ah, | ||
3734 | AR_RTC_SLEEP_CLK) | | ||
3735 | AR_RTC_FORCE_SWREG_PRD)); | ||
3678 | } | 3736 | } |
3737 | |||
3679 | } | 3738 | } |
3680 | 3739 | ||
3681 | static void ath9k_hw_ar9300_set_board_values(struct ath_hw *ah, | 3740 | static void ath9k_hw_ar9300_set_board_values(struct ath_hw *ah, |