diff options
author | Pavel Roskin <proski@gnu.org> | 2011-07-23 09:29:09 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-08-08 16:03:59 -0400 |
commit | 32c254645f90a5a5486788c0deb30531fdb609c2 (patch) | |
tree | aea42daf095801158bc1177d4c9f8f3694d2e135 /drivers/net/wireless/ath/ath5k/reset.c | |
parent | 8d44a823c847c3d20e33c4c714ab48b700f41f14 (diff) |
ath5k: eliminate CHANNEL_* macros, use AR5K_MODE_* in channel->hw_value
When checking for the band, use channel->band.
Change ath5k_hw_nic_wakeup() and ath5k_channel_ok() to take
ieee80211_channel. Change ath5k_hw_radio_revision() to take
ieee80211_band.
Signed-off-by: Pavel Roskin <proski@gnu.org>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/reset.c')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/reset.c | 70 |
1 files changed, 30 insertions, 40 deletions
diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c index 5d6d3bd67d63..8bc57e457615 100644 --- a/drivers/net/wireless/ath/ath5k/reset.c +++ b/drivers/net/wireless/ath/ath5k/reset.c | |||
@@ -102,12 +102,18 @@ static void ath5k_hw_init_core_clock(struct ath5k_hw *ah) | |||
102 | /* | 102 | /* |
103 | * Set core clock frequency | 103 | * Set core clock frequency |
104 | */ | 104 | */ |
105 | if (channel->hw_value & CHANNEL_5GHZ) | 105 | switch (channel->hw_value) { |
106 | clock = 40; /* 802.11a */ | 106 | case AR5K_MODE_11A: |
107 | else if (channel->hw_value & CHANNEL_CCK) | 107 | clock = 40; |
108 | clock = 22; /* 802.11b */ | 108 | break; |
109 | else | 109 | case AR5K_MODE_11B: |
110 | clock = 44; /* 802.11g */ | 110 | clock = 22; |
111 | break; | ||
112 | case AR5K_MODE_11G: | ||
113 | default: | ||
114 | clock = 44; | ||
115 | break; | ||
116 | } | ||
111 | 117 | ||
112 | /* Use clock multiplier for non-default | 118 | /* Use clock multiplier for non-default |
113 | * bwmode */ | 119 | * bwmode */ |
@@ -581,8 +587,9 @@ int ath5k_hw_on_hold(struct ath5k_hw *ah) | |||
581 | 587 | ||
582 | /* | 588 | /* |
583 | * Bring up MAC + PHY Chips and program PLL | 589 | * Bring up MAC + PHY Chips and program PLL |
590 | * Channel is NULL for the initial wakeup. | ||
584 | */ | 591 | */ |
585 | int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) | 592 | int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, struct ieee80211_channel *channel) |
586 | { | 593 | { |
587 | struct pci_dev *pdev = ah->pdev; | 594 | struct pci_dev *pdev = ah->pdev; |
588 | u32 turbo, mode, clock, bus_flags; | 595 | u32 turbo, mode, clock, bus_flags; |
@@ -592,7 +599,7 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) | |||
592 | mode = 0; | 599 | mode = 0; |
593 | clock = 0; | 600 | clock = 0; |
594 | 601 | ||
595 | if ((ath5k_get_bus_type(ah) != ATH_AHB) || !initial) { | 602 | if ((ath5k_get_bus_type(ah) != ATH_AHB) || channel) { |
596 | /* Wakeup the device */ | 603 | /* Wakeup the device */ |
597 | ret = ath5k_hw_set_power(ah, AR5K_PM_AWAKE, true, 0); | 604 | ret = ath5k_hw_set_power(ah, AR5K_PM_AWAKE, true, 0); |
598 | if (ret) { | 605 | if (ret) { |
@@ -652,7 +659,7 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) | |||
652 | 659 | ||
653 | /* On initialization skip PLL programming since we don't have | 660 | /* On initialization skip PLL programming since we don't have |
654 | * a channel / mode set yet */ | 661 | * a channel / mode set yet */ |
655 | if (initial) | 662 | if (!channel) |
656 | return 0; | 663 | return 0; |
657 | 664 | ||
658 | if (ah->ah_version != AR5K_AR5210) { | 665 | if (ah->ah_version != AR5K_AR5210) { |
@@ -668,13 +675,13 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) | |||
668 | clock = AR5K_PHY_PLL_RF5111; /*Zero*/ | 675 | clock = AR5K_PHY_PLL_RF5111; /*Zero*/ |
669 | } | 676 | } |
670 | 677 | ||
671 | if (flags & CHANNEL_2GHZ) { | 678 | if (channel->band == IEEE80211_BAND_2GHZ) { |
672 | mode |= AR5K_PHY_MODE_FREQ_2GHZ; | 679 | mode |= AR5K_PHY_MODE_FREQ_2GHZ; |
673 | clock |= AR5K_PHY_PLL_44MHZ; | 680 | clock |= AR5K_PHY_PLL_44MHZ; |
674 | 681 | ||
675 | if (flags & CHANNEL_CCK) { | 682 | if (channel->hw_value == AR5K_MODE_11B) { |
676 | mode |= AR5K_PHY_MODE_MOD_CCK; | 683 | mode |= AR5K_PHY_MODE_MOD_CCK; |
677 | } else if (flags & CHANNEL_OFDM) { | 684 | } else { |
678 | /* XXX Dynamic OFDM/CCK is not supported by the | 685 | /* XXX Dynamic OFDM/CCK is not supported by the |
679 | * AR5211 so we set MOD_OFDM for plain g (no | 686 | * AR5211 so we set MOD_OFDM for plain g (no |
680 | * CCK headers) operation. We need to test | 687 | * CCK headers) operation. We need to test |
@@ -686,27 +693,16 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) | |||
686 | mode |= AR5K_PHY_MODE_MOD_OFDM; | 693 | mode |= AR5K_PHY_MODE_MOD_OFDM; |
687 | else | 694 | else |
688 | mode |= AR5K_PHY_MODE_MOD_DYN; | 695 | mode |= AR5K_PHY_MODE_MOD_DYN; |
689 | } else { | ||
690 | ATH5K_ERR(ah, | ||
691 | "invalid radio modulation mode\n"); | ||
692 | return -EINVAL; | ||
693 | } | 696 | } |
694 | } else if (flags & CHANNEL_5GHZ) { | 697 | } else if (channel->band == IEEE80211_BAND_5GHZ) { |
695 | mode |= AR5K_PHY_MODE_FREQ_5GHZ; | 698 | mode |= (AR5K_PHY_MODE_FREQ_5GHZ | |
699 | AR5K_PHY_MODE_MOD_OFDM); | ||
696 | 700 | ||
697 | /* Different PLL setting for 5413 */ | 701 | /* Different PLL setting for 5413 */ |
698 | if (ah->ah_radio == AR5K_RF5413) | 702 | if (ah->ah_radio == AR5K_RF5413) |
699 | clock = AR5K_PHY_PLL_40MHZ_5413; | 703 | clock = AR5K_PHY_PLL_40MHZ_5413; |
700 | else | 704 | else |
701 | clock |= AR5K_PHY_PLL_40MHZ; | 705 | clock |= AR5K_PHY_PLL_40MHZ; |
702 | |||
703 | if (flags & CHANNEL_OFDM) | ||
704 | mode |= AR5K_PHY_MODE_MOD_OFDM; | ||
705 | else { | ||
706 | ATH5K_ERR(ah, | ||
707 | "invalid radio modulation mode\n"); | ||
708 | return -EINVAL; | ||
709 | } | ||
710 | } else { | 706 | } else { |
711 | ATH5K_ERR(ah, "invalid radio frequency mode\n"); | 707 | ATH5K_ERR(ah, "invalid radio frequency mode\n"); |
712 | return -EINVAL; | 708 | return -EINVAL; |
@@ -822,7 +818,7 @@ static void ath5k_hw_tweak_initval_settings(struct ath5k_hw *ah, | |||
822 | u32 data; | 818 | u32 data; |
823 | ath5k_hw_reg_write(ah, AR5K_PHY_CCKTXCTL_WORLD, | 819 | ath5k_hw_reg_write(ah, AR5K_PHY_CCKTXCTL_WORLD, |
824 | AR5K_PHY_CCKTXCTL); | 820 | AR5K_PHY_CCKTXCTL); |
825 | if (channel->hw_value & CHANNEL_5GHZ) | 821 | if (channel->band == IEEE80211_BAND_5GHZ) |
826 | data = 0xffb81020; | 822 | data = 0xffb81020; |
827 | else | 823 | else |
828 | data = 0xffb80d20; | 824 | data = 0xffb80d20; |
@@ -905,7 +901,7 @@ static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah, | |||
905 | /* Set CCK to OFDM power delta on tx power | 901 | /* Set CCK to OFDM power delta on tx power |
906 | * adjustment register */ | 902 | * adjustment register */ |
907 | if (ah->ah_phy_revision >= AR5K_SREV_PHY_5212A) { | 903 | if (ah->ah_phy_revision >= AR5K_SREV_PHY_5212A) { |
908 | if (channel->hw_value == CHANNEL_G) | 904 | if (channel->hw_value == AR5K_MODE_11G) |
909 | ath5k_hw_reg_write(ah, | 905 | ath5k_hw_reg_write(ah, |
910 | AR5K_REG_SM((ee->ee_cck_ofdm_gain_delta * -1), | 906 | AR5K_REG_SM((ee->ee_cck_ofdm_gain_delta * -1), |
911 | AR5K_PHY_TX_PWR_ADJ_CCK_GAIN_DELTA) | | 907 | AR5K_PHY_TX_PWR_ADJ_CCK_GAIN_DELTA) | |
@@ -1084,29 +1080,23 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, | |||
1084 | ret = 0; | 1080 | ret = 0; |
1085 | } | 1081 | } |
1086 | 1082 | ||
1087 | switch (channel->hw_value & CHANNEL_MODES) { | 1083 | mode = channel->hw_value; |
1088 | case CHANNEL_A: | 1084 | switch (mode) { |
1089 | mode = AR5K_MODE_11A; | 1085 | case AR5K_MODE_11A: |
1090 | break; | 1086 | break; |
1091 | case CHANNEL_G: | 1087 | case AR5K_MODE_11G: |
1092 | |||
1093 | if (ah->ah_version <= AR5K_AR5211) { | 1088 | if (ah->ah_version <= AR5K_AR5211) { |
1094 | ATH5K_ERR(ah, | 1089 | ATH5K_ERR(ah, |
1095 | "G mode not available on 5210/5211"); | 1090 | "G mode not available on 5210/5211"); |
1096 | return -EINVAL; | 1091 | return -EINVAL; |
1097 | } | 1092 | } |
1098 | |||
1099 | mode = AR5K_MODE_11G; | ||
1100 | break; | 1093 | break; |
1101 | case CHANNEL_B: | 1094 | case AR5K_MODE_11B: |
1102 | |||
1103 | if (ah->ah_version < AR5K_AR5211) { | 1095 | if (ah->ah_version < AR5K_AR5211) { |
1104 | ATH5K_ERR(ah, | 1096 | ATH5K_ERR(ah, |
1105 | "B mode not available on 5210"); | 1097 | "B mode not available on 5210"); |
1106 | return -EINVAL; | 1098 | return -EINVAL; |
1107 | } | 1099 | } |
1108 | |||
1109 | mode = AR5K_MODE_11B; | ||
1110 | break; | 1100 | break; |
1111 | default: | 1101 | default: |
1112 | ATH5K_ERR(ah, | 1102 | ATH5K_ERR(ah, |
@@ -1192,7 +1182,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, | |||
1192 | } | 1182 | } |
1193 | 1183 | ||
1194 | /* Wakeup the device */ | 1184 | /* Wakeup the device */ |
1195 | ret = ath5k_hw_nic_wakeup(ah, channel->hw_value, false); | 1185 | ret = ath5k_hw_nic_wakeup(ah, channel); |
1196 | if (ret) | 1186 | if (ret) |
1197 | return ret; | 1187 | return ret; |
1198 | 1188 | ||