diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-01-21 12:46:35 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-01-21 16:21:43 -0500 |
commit | 4a4fdf2e0b9e3534f6ec4f3e7077470bd66924ab (patch) | |
tree | d841b7e9230093fbbe4a5c08b1ae9a9706d125a1 /drivers/net/wireless/ath | |
parent | 2b1351a30705925ed06b41ec98a6fbaad4ba4d6f (diff) |
ath9k_hw: replace magic values in register writes with proper defines
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 24 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar9003_phy.h | 2 |
2 files changed, 14 insertions, 12 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c index 4819747fa4c3..a25655640f48 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |||
@@ -3959,19 +3959,19 @@ static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray) | |||
3959 | { | 3959 | { |
3960 | #define POW_SM(_r, _s) (((_r) & 0x3f) << (_s)) | 3960 | #define POW_SM(_r, _s) (((_r) & 0x3f) << (_s)) |
3961 | /* make sure forced gain is not set */ | 3961 | /* make sure forced gain is not set */ |
3962 | REG_WRITE(ah, 0xa458, 0); | 3962 | REG_WRITE(ah, AR_PHY_TX_FORCED_GAIN, 0); |
3963 | 3963 | ||
3964 | /* Write the OFDM power per rate set */ | 3964 | /* Write the OFDM power per rate set */ |
3965 | 3965 | ||
3966 | /* 6 (LSB), 9, 12, 18 (MSB) */ | 3966 | /* 6 (LSB), 9, 12, 18 (MSB) */ |
3967 | REG_WRITE(ah, 0xa3c0, | 3967 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE(0), |
3968 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 24) | | 3968 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 24) | |
3969 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 16) | | 3969 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 16) | |
3970 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 8) | | 3970 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 8) | |
3971 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 0)); | 3971 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 0)); |
3972 | 3972 | ||
3973 | /* 24 (LSB), 36, 48, 54 (MSB) */ | 3973 | /* 24 (LSB), 36, 48, 54 (MSB) */ |
3974 | REG_WRITE(ah, 0xa3c4, | 3974 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE(1), |
3975 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_54], 24) | | 3975 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_54], 24) | |
3976 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_48], 16) | | 3976 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_48], 16) | |
3977 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_36], 8) | | 3977 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_36], 8) | |
@@ -3980,14 +3980,14 @@ static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray) | |||
3980 | /* Write the CCK power per rate set */ | 3980 | /* Write the CCK power per rate set */ |
3981 | 3981 | ||
3982 | /* 1L (LSB), reserved, 2L, 2S (MSB) */ | 3982 | /* 1L (LSB), reserved, 2L, 2S (MSB) */ |
3983 | REG_WRITE(ah, 0xa3c8, | 3983 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE(2), |
3984 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 24) | | 3984 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 24) | |
3985 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 16) | | 3985 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 16) | |
3986 | /* POW_SM(txPowerTimes2, 8) | this is reserved for AR9003 */ | 3986 | /* POW_SM(txPowerTimes2, 8) | this is reserved for AR9003 */ |
3987 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 0)); | 3987 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 0)); |
3988 | 3988 | ||
3989 | /* 5.5L (LSB), 5.5S, 11L, 11S (MSB) */ | 3989 | /* 5.5L (LSB), 5.5S, 11L, 11S (MSB) */ |
3990 | REG_WRITE(ah, 0xa3cc, | 3990 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE(3), |
3991 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_11S], 24) | | 3991 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_11S], 24) | |
3992 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_11L], 16) | | 3992 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_11L], 16) | |
3993 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_5S], 8) | | 3993 | POW_SM(pPwrArray[ALL_TARGET_LEGACY_5S], 8) | |
@@ -3997,7 +3997,7 @@ static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray) | |||
3997 | /* Write the HT20 power per rate set */ | 3997 | /* Write the HT20 power per rate set */ |
3998 | 3998 | ||
3999 | /* 0/8/16 (LSB), 1-3/9-11/17-19, 4, 5 (MSB) */ | 3999 | /* 0/8/16 (LSB), 1-3/9-11/17-19, 4, 5 (MSB) */ |
4000 | REG_WRITE(ah, 0xa3d0, | 4000 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE(4), |
4001 | POW_SM(pPwrArray[ALL_TARGET_HT20_5], 24) | | 4001 | POW_SM(pPwrArray[ALL_TARGET_HT20_5], 24) | |
4002 | POW_SM(pPwrArray[ALL_TARGET_HT20_4], 16) | | 4002 | POW_SM(pPwrArray[ALL_TARGET_HT20_4], 16) | |
4003 | POW_SM(pPwrArray[ALL_TARGET_HT20_1_3_9_11_17_19], 8) | | 4003 | POW_SM(pPwrArray[ALL_TARGET_HT20_1_3_9_11_17_19], 8) | |
@@ -4005,7 +4005,7 @@ static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray) | |||
4005 | ); | 4005 | ); |
4006 | 4006 | ||
4007 | /* 6 (LSB), 7, 12, 13 (MSB) */ | 4007 | /* 6 (LSB), 7, 12, 13 (MSB) */ |
4008 | REG_WRITE(ah, 0xa3d4, | 4008 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE(5), |
4009 | POW_SM(pPwrArray[ALL_TARGET_HT20_13], 24) | | 4009 | POW_SM(pPwrArray[ALL_TARGET_HT20_13], 24) | |
4010 | POW_SM(pPwrArray[ALL_TARGET_HT20_12], 16) | | 4010 | POW_SM(pPwrArray[ALL_TARGET_HT20_12], 16) | |
4011 | POW_SM(pPwrArray[ALL_TARGET_HT20_7], 8) | | 4011 | POW_SM(pPwrArray[ALL_TARGET_HT20_7], 8) | |
@@ -4013,7 +4013,7 @@ static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray) | |||
4013 | ); | 4013 | ); |
4014 | 4014 | ||
4015 | /* 14 (LSB), 15, 20, 21 */ | 4015 | /* 14 (LSB), 15, 20, 21 */ |
4016 | REG_WRITE(ah, 0xa3e4, | 4016 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE(9), |
4017 | POW_SM(pPwrArray[ALL_TARGET_HT20_21], 24) | | 4017 | POW_SM(pPwrArray[ALL_TARGET_HT20_21], 24) | |
4018 | POW_SM(pPwrArray[ALL_TARGET_HT20_20], 16) | | 4018 | POW_SM(pPwrArray[ALL_TARGET_HT20_20], 16) | |
4019 | POW_SM(pPwrArray[ALL_TARGET_HT20_15], 8) | | 4019 | POW_SM(pPwrArray[ALL_TARGET_HT20_15], 8) | |
@@ -4023,7 +4023,7 @@ static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray) | |||
4023 | /* Mixed HT20 and HT40 rates */ | 4023 | /* Mixed HT20 and HT40 rates */ |
4024 | 4024 | ||
4025 | /* HT20 22 (LSB), HT20 23, HT40 22, HT40 23 (MSB) */ | 4025 | /* HT20 22 (LSB), HT20 23, HT40 22, HT40 23 (MSB) */ |
4026 | REG_WRITE(ah, 0xa3e8, | 4026 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE(10), |
4027 | POW_SM(pPwrArray[ALL_TARGET_HT40_23], 24) | | 4027 | POW_SM(pPwrArray[ALL_TARGET_HT40_23], 24) | |
4028 | POW_SM(pPwrArray[ALL_TARGET_HT40_22], 16) | | 4028 | POW_SM(pPwrArray[ALL_TARGET_HT40_22], 16) | |
4029 | POW_SM(pPwrArray[ALL_TARGET_HT20_23], 8) | | 4029 | POW_SM(pPwrArray[ALL_TARGET_HT20_23], 8) | |
@@ -4035,7 +4035,7 @@ static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray) | |||
4035 | * correct PAR difference between HT40 and HT20/LEGACY | 4035 | * correct PAR difference between HT40 and HT20/LEGACY |
4036 | * 0/8/16 (LSB), 1-3/9-11/17-19, 4, 5 (MSB) | 4036 | * 0/8/16 (LSB), 1-3/9-11/17-19, 4, 5 (MSB) |
4037 | */ | 4037 | */ |
4038 | REG_WRITE(ah, 0xa3d8, | 4038 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE(6), |
4039 | POW_SM(pPwrArray[ALL_TARGET_HT40_5], 24) | | 4039 | POW_SM(pPwrArray[ALL_TARGET_HT40_5], 24) | |
4040 | POW_SM(pPwrArray[ALL_TARGET_HT40_4], 16) | | 4040 | POW_SM(pPwrArray[ALL_TARGET_HT40_4], 16) | |
4041 | POW_SM(pPwrArray[ALL_TARGET_HT40_1_3_9_11_17_19], 8) | | 4041 | POW_SM(pPwrArray[ALL_TARGET_HT40_1_3_9_11_17_19], 8) | |
@@ -4043,7 +4043,7 @@ static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray) | |||
4043 | ); | 4043 | ); |
4044 | 4044 | ||
4045 | /* 6 (LSB), 7, 12, 13 (MSB) */ | 4045 | /* 6 (LSB), 7, 12, 13 (MSB) */ |
4046 | REG_WRITE(ah, 0xa3dc, | 4046 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE(7), |
4047 | POW_SM(pPwrArray[ALL_TARGET_HT40_13], 24) | | 4047 | POW_SM(pPwrArray[ALL_TARGET_HT40_13], 24) | |
4048 | POW_SM(pPwrArray[ALL_TARGET_HT40_12], 16) | | 4048 | POW_SM(pPwrArray[ALL_TARGET_HT40_12], 16) | |
4049 | POW_SM(pPwrArray[ALL_TARGET_HT40_7], 8) | | 4049 | POW_SM(pPwrArray[ALL_TARGET_HT40_7], 8) | |
@@ -4051,7 +4051,7 @@ static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray) | |||
4051 | ); | 4051 | ); |
4052 | 4052 | ||
4053 | /* 14 (LSB), 15, 20, 21 */ | 4053 | /* 14 (LSB), 15, 20, 21 */ |
4054 | REG_WRITE(ah, 0xa3ec, | 4054 | REG_WRITE(ah, AR_PHY_POWER_TX_RATE(11), |
4055 | POW_SM(pPwrArray[ALL_TARGET_HT40_21], 24) | | 4055 | POW_SM(pPwrArray[ALL_TARGET_HT40_21], 24) | |
4056 | POW_SM(pPwrArray[ALL_TARGET_HT40_20], 16) | | 4056 | POW_SM(pPwrArray[ALL_TARGET_HT40_20], 16) | |
4057 | POW_SM(pPwrArray[ALL_TARGET_HT40_15], 8) | | 4057 | POW_SM(pPwrArray[ALL_TARGET_HT40_15], 8) | |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.h b/drivers/net/wireless/ath/ath9k/ar9003_phy.h index 59bab6bd8a74..8bdda2cf9dd7 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h | |||
@@ -486,6 +486,8 @@ | |||
486 | #define AR_PHY_HEAVYCLIP_40 (AR_SM_BASE + 0x1ac) | 486 | #define AR_PHY_HEAVYCLIP_40 (AR_SM_BASE + 0x1ac) |
487 | #define AR_PHY_ILLEGAL_TXRATE (AR_SM_BASE + 0x1b0) | 487 | #define AR_PHY_ILLEGAL_TXRATE (AR_SM_BASE + 0x1b0) |
488 | 488 | ||
489 | #define AR_PHY_POWER_TX_RATE(_d) (AR_SM_BASE + 0x1c0 + ((_d) << 2)) | ||
490 | |||
489 | #define AR_PHY_PWRTX_MAX (AR_SM_BASE + 0x1f0) | 491 | #define AR_PHY_PWRTX_MAX (AR_SM_BASE + 0x1f0) |
490 | #define AR_PHY_POWER_TX_SUB (AR_SM_BASE + 0x1f4) | 492 | #define AR_PHY_POWER_TX_SUB (AR_SM_BASE + 0x1f4) |
491 | 493 | ||