diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/ath/ar9170/ar9170.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ar9170/main.c | 14 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath.h | 18 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/ath5k.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/base.c | 14 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/base.h | 13 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/phy.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ath9k.h | 10 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/eeprom_4k.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/eeprom_9287.c | 16 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/eeprom_def.c | 14 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 53 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/main.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/ath/regd.h | 20 |
15 files changed, 116 insertions, 79 deletions
diff --git a/drivers/net/wireless/ath/ar9170/ar9170.h b/drivers/net/wireless/ath/ar9170/ar9170.h index e6c3ee3e0581..95f8256c2026 100644 --- a/drivers/net/wireless/ath/ar9170/ar9170.h +++ b/drivers/net/wireless/ath/ar9170/ar9170.h | |||
@@ -157,6 +157,7 @@ struct ar9170_sta_tid { | |||
157 | 157 | ||
158 | struct ar9170 { | 158 | struct ar9170 { |
159 | struct ieee80211_hw *hw; | 159 | struct ieee80211_hw *hw; |
160 | struct ath_common common; | ||
160 | struct mutex mutex; | 161 | struct mutex mutex; |
161 | enum ar9170_device_state state; | 162 | enum ar9170_device_state state; |
162 | unsigned long bad_hw_nagger; | 163 | unsigned long bad_hw_nagger; |
@@ -222,7 +223,6 @@ struct ar9170 { | |||
222 | 223 | ||
223 | /* EEPROM */ | 224 | /* EEPROM */ |
224 | struct ar9170_eeprom eeprom; | 225 | struct ar9170_eeprom eeprom; |
225 | struct ath_regulatory regulatory; | ||
226 | 226 | ||
227 | /* tx queues - as seen by hw - */ | 227 | /* tx queues - as seen by hw - */ |
228 | struct sk_buff_head tx_pending[__AR9170_NUM_TXQ]; | 228 | struct sk_buff_head tx_pending[__AR9170_NUM_TXQ]; |
diff --git a/drivers/net/wireless/ath/ar9170/main.c b/drivers/net/wireless/ath/ar9170/main.c index 6a9462e4fd87..d30f33d4d41b 100644 --- a/drivers/net/wireless/ath/ar9170/main.c +++ b/drivers/net/wireless/ath/ar9170/main.c | |||
@@ -2641,6 +2641,7 @@ static int ar9170_read_eeprom(struct ar9170 *ar) | |||
2641 | { | 2641 | { |
2642 | #define RW 8 /* number of words to read at once */ | 2642 | #define RW 8 /* number of words to read at once */ |
2643 | #define RB (sizeof(u32) * RW) | 2643 | #define RB (sizeof(u32) * RW) |
2644 | struct ath_regulatory *regulatory = &ar->common.regulatory; | ||
2644 | u8 *eeprom = (void *)&ar->eeprom; | 2645 | u8 *eeprom = (void *)&ar->eeprom; |
2645 | u8 *addr = ar->eeprom.mac_address; | 2646 | u8 *addr = ar->eeprom.mac_address; |
2646 | __le32 offsets[RW]; | 2647 | __le32 offsets[RW]; |
@@ -2707,8 +2708,8 @@ static int ar9170_read_eeprom(struct ar9170 *ar) | |||
2707 | else | 2708 | else |
2708 | ar->hw->channel_change_time = 80 * 1000; | 2709 | ar->hw->channel_change_time = 80 * 1000; |
2709 | 2710 | ||
2710 | ar->regulatory.current_rd = le16_to_cpu(ar->eeprom.reg_domain[0]); | 2711 | regulatory->current_rd = le16_to_cpu(ar->eeprom.reg_domain[0]); |
2711 | ar->regulatory.current_rd_ext = le16_to_cpu(ar->eeprom.reg_domain[1]); | 2712 | regulatory->current_rd_ext = le16_to_cpu(ar->eeprom.reg_domain[1]); |
2712 | 2713 | ||
2713 | /* second part of wiphy init */ | 2714 | /* second part of wiphy init */ |
2714 | SET_IEEE80211_PERM_ADDR(ar->hw, addr); | 2715 | SET_IEEE80211_PERM_ADDR(ar->hw, addr); |
@@ -2722,11 +2723,12 @@ static int ar9170_reg_notifier(struct wiphy *wiphy, | |||
2722 | struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); | 2723 | struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); |
2723 | struct ar9170 *ar = hw->priv; | 2724 | struct ar9170 *ar = hw->priv; |
2724 | 2725 | ||
2725 | return ath_reg_notifier_apply(wiphy, request, &ar->regulatory); | 2726 | return ath_reg_notifier_apply(wiphy, request, &ar->common.regulatory); |
2726 | } | 2727 | } |
2727 | 2728 | ||
2728 | int ar9170_register(struct ar9170 *ar, struct device *pdev) | 2729 | int ar9170_register(struct ar9170 *ar, struct device *pdev) |
2729 | { | 2730 | { |
2731 | struct ath_regulatory *regulatory = &ar->common.regulatory; | ||
2730 | int err; | 2732 | int err; |
2731 | 2733 | ||
2732 | /* try to read EEPROM, init MAC addr */ | 2734 | /* try to read EEPROM, init MAC addr */ |
@@ -2734,7 +2736,7 @@ int ar9170_register(struct ar9170 *ar, struct device *pdev) | |||
2734 | if (err) | 2736 | if (err) |
2735 | goto err_out; | 2737 | goto err_out; |
2736 | 2738 | ||
2737 | err = ath_regd_init(&ar->regulatory, ar->hw->wiphy, | 2739 | err = ath_regd_init(regulatory, ar->hw->wiphy, |
2738 | ar9170_reg_notifier); | 2740 | ar9170_reg_notifier); |
2739 | if (err) | 2741 | if (err) |
2740 | goto err_out; | 2742 | goto err_out; |
@@ -2743,8 +2745,8 @@ int ar9170_register(struct ar9170 *ar, struct device *pdev) | |||
2743 | if (err) | 2745 | if (err) |
2744 | goto err_out; | 2746 | goto err_out; |
2745 | 2747 | ||
2746 | if (!ath_is_world_regd(&ar->regulatory)) | 2748 | if (!ath_is_world_regd(regulatory)) |
2747 | regulatory_hint(ar->hw->wiphy, ar->regulatory.alpha2); | 2749 | regulatory_hint(ar->hw->wiphy, regulatory->alpha2); |
2748 | 2750 | ||
2749 | err = ar9170_init_leds(ar); | 2751 | err = ar9170_init_leds(ar); |
2750 | if (err) | 2752 | if (err) |
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h index e284cd3ac6d4..a63e90cbf9e5 100644 --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h | |||
@@ -19,8 +19,26 @@ | |||
19 | 19 | ||
20 | #include <linux/skbuff.h> | 20 | #include <linux/skbuff.h> |
21 | 21 | ||
22 | struct reg_dmn_pair_mapping { | ||
23 | u16 regDmnEnum; | ||
24 | u16 reg_5ghz_ctl; | ||
25 | u16 reg_2ghz_ctl; | ||
26 | }; | ||
27 | |||
28 | struct ath_regulatory { | ||
29 | char alpha2[2]; | ||
30 | u16 country_code; | ||
31 | u16 max_power_level; | ||
32 | u32 tp_scale; | ||
33 | u16 current_rd; | ||
34 | u16 current_rd_ext; | ||
35 | int16_t power_limit; | ||
36 | struct reg_dmn_pair_mapping *regpair; | ||
37 | }; | ||
38 | |||
22 | struct ath_common { | 39 | struct ath_common { |
23 | u16 cachelsz; | 40 | u16 cachelsz; |
41 | struct ath_regulatory regulatory; | ||
24 | }; | 42 | }; |
25 | 43 | ||
26 | struct sk_buff *ath_rxbuf_alloc(struct ath_common *common, | 44 | struct sk_buff *ath_rxbuf_alloc(struct ath_common *common, |
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h index c09402eea7f3..862762cea54c 100644 --- a/drivers/net/wireless/ath/ath5k/ath5k.h +++ b/drivers/net/wireless/ath/ath5k/ath5k.h | |||
@@ -27,8 +27,6 @@ | |||
27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
28 | #include <net/mac80211.h> | 28 | #include <net/mac80211.h> |
29 | 29 | ||
30 | #include "../regd.h" | ||
31 | |||
32 | /* RX/TX descriptor hw structs | 30 | /* RX/TX descriptor hw structs |
33 | * TODO: Driver part should only see sw structs */ | 31 | * TODO: Driver part should only see sw structs */ |
34 | #include "desc.h" | 32 | #include "desc.h" |
@@ -1077,7 +1075,6 @@ struct ath5k_hw { | |||
1077 | 1075 | ||
1078 | int ah_gpio_npins; | 1076 | int ah_gpio_npins; |
1079 | 1077 | ||
1080 | struct ath_regulatory ah_regulatory; | ||
1081 | struct ath5k_capabilities ah_capabilities; | 1078 | struct ath5k_capabilities ah_capabilities; |
1082 | 1079 | ||
1083 | struct ath5k_txq_info ah_txq[AR5K_NUM_TX_QUEUES]; | 1080 | struct ath5k_txq_info ah_txq[AR5K_NUM_TX_QUEUES]; |
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index 3951b5b13424..5056410d788a 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -718,9 +718,9 @@ static int ath5k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *re | |||
718 | { | 718 | { |
719 | struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); | 719 | struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); |
720 | struct ath5k_softc *sc = hw->priv; | 720 | struct ath5k_softc *sc = hw->priv; |
721 | struct ath_regulatory *reg = &sc->ah->ah_regulatory; | 721 | struct ath_regulatory *regulatory = &sc->common.regulatory; |
722 | 722 | ||
723 | return ath_reg_notifier_apply(wiphy, request, reg); | 723 | return ath_reg_notifier_apply(wiphy, request, regulatory); |
724 | } | 724 | } |
725 | 725 | ||
726 | static int | 726 | static int |
@@ -728,6 +728,7 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw) | |||
728 | { | 728 | { |
729 | struct ath5k_softc *sc = hw->priv; | 729 | struct ath5k_softc *sc = hw->priv; |
730 | struct ath5k_hw *ah = sc->ah; | 730 | struct ath5k_hw *ah = sc->ah; |
731 | struct ath_regulatory *regulatory = &sc->common.regulatory; | ||
731 | u8 mac[ETH_ALEN] = {}; | 732 | u8 mac[ETH_ALEN] = {}; |
732 | int ret; | 733 | int ret; |
733 | 734 | ||
@@ -817,9 +818,8 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw) | |||
817 | memset(sc->bssidmask, 0xff, ETH_ALEN); | 818 | memset(sc->bssidmask, 0xff, ETH_ALEN); |
818 | ath5k_hw_set_bssid_mask(sc->ah, sc->bssidmask); | 819 | ath5k_hw_set_bssid_mask(sc->ah, sc->bssidmask); |
819 | 820 | ||
820 | ah->ah_regulatory.current_rd = | 821 | regulatory->current_rd = ah->ah_capabilities.cap_eeprom.ee_regdomain; |
821 | ah->ah_capabilities.cap_eeprom.ee_regdomain; | 822 | ret = ath_regd_init(regulatory, hw->wiphy, ath5k_reg_notifier); |
822 | ret = ath_regd_init(&ah->ah_regulatory, hw->wiphy, ath5k_reg_notifier); | ||
823 | if (ret) { | 823 | if (ret) { |
824 | ATH5K_ERR(sc, "can't initialize regulatory system\n"); | 824 | ATH5K_ERR(sc, "can't initialize regulatory system\n"); |
825 | goto err_queues; | 825 | goto err_queues; |
@@ -831,8 +831,8 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw) | |||
831 | goto err_queues; | 831 | goto err_queues; |
832 | } | 832 | } |
833 | 833 | ||
834 | if (!ath_is_world_regd(&sc->ah->ah_regulatory)) | 834 | if (!ath_is_world_regd(regulatory)) |
835 | regulatory_hint(hw->wiphy, sc->ah->ah_regulatory.alpha2); | 835 | regulatory_hint(hw->wiphy, regulatory->alpha2); |
836 | 836 | ||
837 | ath5k_init_leds(sc); | 837 | ath5k_init_leds(sc); |
838 | 838 | ||
diff --git a/drivers/net/wireless/ath/ath5k/base.h b/drivers/net/wireless/ath/ath5k/base.h index 25a72a85aaa5..a28c42f32c9d 100644 --- a/drivers/net/wireless/ath/ath5k/base.h +++ b/drivers/net/wireless/ath/ath5k/base.h | |||
@@ -50,6 +50,8 @@ | |||
50 | 50 | ||
51 | #include "ath5k.h" | 51 | #include "ath5k.h" |
52 | #include "debug.h" | 52 | #include "debug.h" |
53 | |||
54 | #include "../regd.h" | ||
53 | #include "../ath.h" | 55 | #include "../ath.h" |
54 | 56 | ||
55 | #define ATH_RXBUF 40 /* number of RX buffers */ | 57 | #define ATH_RXBUF 40 /* number of RX buffers */ |
@@ -200,4 +202,15 @@ struct ath5k_softc { | |||
200 | #define ath5k_hw_hasveol(_ah) \ | 202 | #define ath5k_hw_hasveol(_ah) \ |
201 | (ath5k_hw_get_capability(_ah, AR5K_CAP_VEOL, 0, NULL) == 0) | 203 | (ath5k_hw_get_capability(_ah, AR5K_CAP_VEOL, 0, NULL) == 0) |
202 | 204 | ||
205 | static inline struct ath_common *ath5k_hw_common(struct ath5k_hw *ah) | ||
206 | { | ||
207 | return &ah->ah_sc->common; | ||
208 | } | ||
209 | |||
210 | static inline struct ath_regulatory *ath5k_hw_regulatory(struct ath5k_hw *ah) | ||
211 | { | ||
212 | return &(ath5k_hw_common(ah)->regulatory); | ||
213 | |||
214 | } | ||
215 | |||
203 | #endif | 216 | #endif |
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c index 298fcf015227..1a039f2bd732 100644 --- a/drivers/net/wireless/ath/ath5k/phy.c +++ b/drivers/net/wireless/ath/ath5k/phy.c | |||
@@ -2198,6 +2198,7 @@ static void | |||
2198 | ath5k_get_max_ctl_power(struct ath5k_hw *ah, | 2198 | ath5k_get_max_ctl_power(struct ath5k_hw *ah, |
2199 | struct ieee80211_channel *channel) | 2199 | struct ieee80211_channel *channel) |
2200 | { | 2200 | { |
2201 | struct ath_regulatory *regulatory = ath5k_hw_regulatory(ah); | ||
2201 | struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; | 2202 | struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom; |
2202 | struct ath5k_edge_power *rep = ee->ee_ctl_pwr; | 2203 | struct ath5k_edge_power *rep = ee->ee_ctl_pwr; |
2203 | u8 *ctl_val = ee->ee_ctl; | 2204 | u8 *ctl_val = ee->ee_ctl; |
@@ -2208,7 +2209,7 @@ ath5k_get_max_ctl_power(struct ath5k_hw *ah, | |||
2208 | u8 ctl_idx = 0xFF; | 2209 | u8 ctl_idx = 0xFF; |
2209 | u32 target = channel->center_freq; | 2210 | u32 target = channel->center_freq; |
2210 | 2211 | ||
2211 | ctl_mode = ath_regd_get_band_ctl(&ah->ah_regulatory, channel->band); | 2212 | ctl_mode = ath_regd_get_band_ctl(regulatory, channel->band); |
2212 | 2213 | ||
2213 | switch (channel->hw_value & CHANNEL_MODES) { | 2214 | switch (channel->hw_value & CHANNEL_MODES) { |
2214 | case CHANNEL_A: | 2215 | case CHANNEL_A: |
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index 2c9f6628a8e7..0e444a629040 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -631,6 +631,16 @@ int ath_get_hal_qnum(u16 queue, struct ath_softc *sc); | |||
631 | int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc); | 631 | int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc); |
632 | int ath_cabq_update(struct ath_softc *); | 632 | int ath_cabq_update(struct ath_softc *); |
633 | 633 | ||
634 | static inline struct ath_common *ath9k_hw_common(struct ath_hw *ah) | ||
635 | { | ||
636 | return &ah->ah_sc->common; | ||
637 | } | ||
638 | |||
639 | static inline struct ath_regulatory *ath9k_hw_regulatory(struct ath_hw *ah) | ||
640 | { | ||
641 | return &(ath9k_hw_common(ah)->regulatory); | ||
642 | } | ||
643 | |||
634 | static inline void ath_read_cachesize(struct ath_softc *sc, int *csz) | 644 | static inline void ath_read_cachesize(struct ath_softc *sc, int *csz) |
635 | { | 645 | { |
636 | sc->bus_ops->read_cachesize(sc, csz); | 646 | sc->bus_ops->read_cachesize(sc, csz); |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_4k.c b/drivers/net/wireless/ath/ath9k/eeprom_4k.c index d34dd23e806a..b8eca7be5f3a 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c | |||
@@ -508,6 +508,7 @@ static void ath9k_hw_set_4k_power_per_rate_table(struct ath_hw *ah, | |||
508 | || (((cfgCtl & ~CTL_MODE_M) | (pCtlMode[ctlMode] & CTL_MODE_M)) == \ | 508 | || (((cfgCtl & ~CTL_MODE_M) | (pCtlMode[ctlMode] & CTL_MODE_M)) == \ |
509 | ((pEepData->ctlIndex[i] & CTL_MODE_M) | SD_NO_CTL)) | 509 | ((pEepData->ctlIndex[i] & CTL_MODE_M) | SD_NO_CTL)) |
510 | 510 | ||
511 | struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); | ||
511 | int i; | 512 | int i; |
512 | int16_t twiceLargestAntenna; | 513 | int16_t twiceLargestAntenna; |
513 | u16 twiceMinEdgePower; | 514 | u16 twiceMinEdgePower; |
@@ -541,9 +542,9 @@ static void ath9k_hw_set_4k_power_per_rate_table(struct ath_hw *ah, | |||
541 | twiceLargestAntenna, 0); | 542 | twiceLargestAntenna, 0); |
542 | 543 | ||
543 | maxRegAllowedPower = twiceMaxRegulatoryPower + twiceLargestAntenna; | 544 | maxRegAllowedPower = twiceMaxRegulatoryPower + twiceLargestAntenna; |
544 | if (ah->regulatory.tp_scale != ATH9K_TP_SCALE_MAX) { | 545 | if (regulatory->tp_scale != ATH9K_TP_SCALE_MAX) { |
545 | maxRegAllowedPower -= | 546 | maxRegAllowedPower -= |
546 | (tpScaleReductionTable[(ah->regulatory.tp_scale)] * 2); | 547 | (tpScaleReductionTable[(regulatory->tp_scale)] * 2); |
547 | } | 548 | } |
548 | 549 | ||
549 | scaledPower = min(powerLimit, maxRegAllowedPower); | 550 | scaledPower = min(powerLimit, maxRegAllowedPower); |
@@ -707,6 +708,7 @@ static void ath9k_hw_4k_set_txpower(struct ath_hw *ah, | |||
707 | u8 twiceMaxRegulatoryPower, | 708 | u8 twiceMaxRegulatoryPower, |
708 | u8 powerLimit) | 709 | u8 powerLimit) |
709 | { | 710 | { |
711 | struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); | ||
710 | struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k; | 712 | struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k; |
711 | struct modal_eep_4k_header *pModal = &pEepData->modalHeader; | 713 | struct modal_eep_4k_header *pModal = &pEepData->modalHeader; |
712 | int16_t ratesArray[Ar5416RateSize]; | 714 | int16_t ratesArray[Ar5416RateSize]; |
@@ -744,7 +746,7 @@ static void ath9k_hw_4k_set_txpower(struct ath_hw *ah, | |||
744 | else if (IS_CHAN_HT20(chan)) | 746 | else if (IS_CHAN_HT20(chan)) |
745 | i = rateHt20_0; | 747 | i = rateHt20_0; |
746 | 748 | ||
747 | ah->regulatory.max_power_level = ratesArray[i]; | 749 | regulatory->max_power_level = ratesArray[i]; |
748 | 750 | ||
749 | if (AR_SREV_9280_10_OR_LATER(ah)) { | 751 | if (AR_SREV_9280_10_OR_LATER(ah)) { |
750 | for (i = 0; i < Ar5416RateSize; i++) | 752 | for (i = 0; i < Ar5416RateSize; i++) |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c index 959097927eee..c20c21a79b21 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c | |||
@@ -599,7 +599,7 @@ static void ath9k_hw_set_AR9287_power_per_rate_table(struct ath_hw *ah, | |||
599 | { | 599 | { |
600 | #define REDUCE_SCALED_POWER_BY_TWO_CHAIN 6 | 600 | #define REDUCE_SCALED_POWER_BY_TWO_CHAIN 6 |
601 | #define REDUCE_SCALED_POWER_BY_THREE_CHAIN 10 | 601 | #define REDUCE_SCALED_POWER_BY_THREE_CHAIN 10 |
602 | 602 | struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); | |
603 | u16 twiceMaxEdgePower = AR5416_MAX_RATE_POWER; | 603 | u16 twiceMaxEdgePower = AR5416_MAX_RATE_POWER; |
604 | static const u16 tpScaleReductionTable[5] = | 604 | static const u16 tpScaleReductionTable[5] = |
605 | { 0, 3, 6, 9, AR5416_MAX_RATE_POWER }; | 605 | { 0, 3, 6, 9, AR5416_MAX_RATE_POWER }; |
@@ -632,9 +632,9 @@ static void ath9k_hw_set_AR9287_power_per_rate_table(struct ath_hw *ah, | |||
632 | twiceLargestAntenna, 0); | 632 | twiceLargestAntenna, 0); |
633 | 633 | ||
634 | maxRegAllowedPower = twiceMaxRegulatoryPower + twiceLargestAntenna; | 634 | maxRegAllowedPower = twiceMaxRegulatoryPower + twiceLargestAntenna; |
635 | if (ah->regulatory.tp_scale != ATH9K_TP_SCALE_MAX) | 635 | if (regulatory->tp_scale != ATH9K_TP_SCALE_MAX) |
636 | maxRegAllowedPower -= | 636 | maxRegAllowedPower -= |
637 | (tpScaleReductionTable[(ah->regulatory.tp_scale)] * 2); | 637 | (tpScaleReductionTable[(regulatory->tp_scale)] * 2); |
638 | 638 | ||
639 | scaledPower = min(powerLimit, maxRegAllowedPower); | 639 | scaledPower = min(powerLimit, maxRegAllowedPower); |
640 | 640 | ||
@@ -831,7 +831,7 @@ static void ath9k_hw_AR9287_set_txpower(struct ath_hw *ah, | |||
831 | { | 831 | { |
832 | #define INCREASE_MAXPOW_BY_TWO_CHAIN 6 | 832 | #define INCREASE_MAXPOW_BY_TWO_CHAIN 6 |
833 | #define INCREASE_MAXPOW_BY_THREE_CHAIN 10 | 833 | #define INCREASE_MAXPOW_BY_THREE_CHAIN 10 |
834 | 834 | struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); | |
835 | struct ar9287_eeprom *pEepData = &ah->eeprom.map9287; | 835 | struct ar9287_eeprom *pEepData = &ah->eeprom.map9287; |
836 | struct modal_eep_ar9287_header *pModal = &pEepData->modalHeader; | 836 | struct modal_eep_ar9287_header *pModal = &pEepData->modalHeader; |
837 | int16_t ratesArray[Ar5416RateSize]; | 837 | int16_t ratesArray[Ar5416RateSize]; |
@@ -949,20 +949,20 @@ static void ath9k_hw_AR9287_set_txpower(struct ath_hw *ah, | |||
949 | i = rate6mb; | 949 | i = rate6mb; |
950 | 950 | ||
951 | if (AR_SREV_9280_10_OR_LATER(ah)) | 951 | if (AR_SREV_9280_10_OR_LATER(ah)) |
952 | ah->regulatory.max_power_level = | 952 | regulatory->max_power_level = |
953 | ratesArray[i] + AR9287_PWR_TABLE_OFFSET_DB * 2; | 953 | ratesArray[i] + AR9287_PWR_TABLE_OFFSET_DB * 2; |
954 | else | 954 | else |
955 | ah->regulatory.max_power_level = ratesArray[i]; | 955 | regulatory->max_power_level = ratesArray[i]; |
956 | 956 | ||
957 | switch (ar5416_get_ntxchains(ah->txchainmask)) { | 957 | switch (ar5416_get_ntxchains(ah->txchainmask)) { |
958 | case 1: | 958 | case 1: |
959 | break; | 959 | break; |
960 | case 2: | 960 | case 2: |
961 | ah->regulatory.max_power_level += | 961 | regulatory->max_power_level += |
962 | INCREASE_MAXPOW_BY_TWO_CHAIN; | 962 | INCREASE_MAXPOW_BY_TWO_CHAIN; |
963 | break; | 963 | break; |
964 | case 3: | 964 | case 3: |
965 | ah->regulatory.max_power_level += | 965 | regulatory->max_power_level += |
966 | INCREASE_MAXPOW_BY_THREE_CHAIN; | 966 | INCREASE_MAXPOW_BY_THREE_CHAIN; |
967 | break; | 967 | break; |
968 | default: | 968 | default: |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c index 5211ad94c8fb..ae7fb5dcb266 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_def.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c | |||
@@ -904,6 +904,7 @@ static void ath9k_hw_set_def_power_per_rate_table(struct ath_hw *ah, | |||
904 | #define REDUCE_SCALED_POWER_BY_TWO_CHAIN 6 /* 10*log10(2)*2 */ | 904 | #define REDUCE_SCALED_POWER_BY_TWO_CHAIN 6 /* 10*log10(2)*2 */ |
905 | #define REDUCE_SCALED_POWER_BY_THREE_CHAIN 10 /* 10*log10(3)*2 */ | 905 | #define REDUCE_SCALED_POWER_BY_THREE_CHAIN 10 /* 10*log10(3)*2 */ |
906 | 906 | ||
907 | struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); | ||
907 | struct ar5416_eeprom_def *pEepData = &ah->eeprom.def; | 908 | struct ar5416_eeprom_def *pEepData = &ah->eeprom.def; |
908 | u16 twiceMaxEdgePower = AR5416_MAX_RATE_POWER; | 909 | u16 twiceMaxEdgePower = AR5416_MAX_RATE_POWER; |
909 | static const u16 tpScaleReductionTable[5] = | 910 | static const u16 tpScaleReductionTable[5] = |
@@ -953,9 +954,9 @@ static void ath9k_hw_set_def_power_per_rate_table(struct ath_hw *ah, | |||
953 | 954 | ||
954 | maxRegAllowedPower = twiceMaxRegulatoryPower + twiceLargestAntenna; | 955 | maxRegAllowedPower = twiceMaxRegulatoryPower + twiceLargestAntenna; |
955 | 956 | ||
956 | if (ah->regulatory.tp_scale != ATH9K_TP_SCALE_MAX) { | 957 | if (regulatory->tp_scale != ATH9K_TP_SCALE_MAX) { |
957 | maxRegAllowedPower -= | 958 | maxRegAllowedPower -= |
958 | (tpScaleReductionTable[(ah->regulatory.tp_scale)] * 2); | 959 | (tpScaleReductionTable[(regulatory->tp_scale)] * 2); |
959 | } | 960 | } |
960 | 961 | ||
961 | scaledPower = min(powerLimit, maxRegAllowedPower); | 962 | scaledPower = min(powerLimit, maxRegAllowedPower); |
@@ -1163,6 +1164,7 @@ static void ath9k_hw_def_set_txpower(struct ath_hw *ah, | |||
1163 | u8 powerLimit) | 1164 | u8 powerLimit) |
1164 | { | 1165 | { |
1165 | #define RT_AR_DELTA(x) (ratesArray[x] - cck_ofdm_delta) | 1166 | #define RT_AR_DELTA(x) (ratesArray[x] - cck_ofdm_delta) |
1167 | struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); | ||
1166 | struct ar5416_eeprom_def *pEepData = &ah->eeprom.def; | 1168 | struct ar5416_eeprom_def *pEepData = &ah->eeprom.def; |
1167 | struct modal_eep_header *pModal = | 1169 | struct modal_eep_header *pModal = |
1168 | &(pEepData->modalHeader[IS_CHAN_2GHZ(chan)]); | 1170 | &(pEepData->modalHeader[IS_CHAN_2GHZ(chan)]); |
@@ -1292,19 +1294,19 @@ static void ath9k_hw_def_set_txpower(struct ath_hw *ah, | |||
1292 | i = rateHt20_0; | 1294 | i = rateHt20_0; |
1293 | 1295 | ||
1294 | if (AR_SREV_9280_10_OR_LATER(ah)) | 1296 | if (AR_SREV_9280_10_OR_LATER(ah)) |
1295 | ah->regulatory.max_power_level = | 1297 | regulatory->max_power_level = |
1296 | ratesArray[i] + AR5416_PWR_TABLE_OFFSET * 2; | 1298 | ratesArray[i] + AR5416_PWR_TABLE_OFFSET * 2; |
1297 | else | 1299 | else |
1298 | ah->regulatory.max_power_level = ratesArray[i]; | 1300 | regulatory->max_power_level = ratesArray[i]; |
1299 | 1301 | ||
1300 | switch(ar5416_get_ntxchains(ah->txchainmask)) { | 1302 | switch(ar5416_get_ntxchains(ah->txchainmask)) { |
1301 | case 1: | 1303 | case 1: |
1302 | break; | 1304 | break; |
1303 | case 2: | 1305 | case 2: |
1304 | ah->regulatory.max_power_level += INCREASE_MAXPOW_BY_TWO_CHAIN; | 1306 | regulatory->max_power_level += INCREASE_MAXPOW_BY_TWO_CHAIN; |
1305 | break; | 1307 | break; |
1306 | case 3: | 1308 | case 3: |
1307 | ah->regulatory.max_power_level += INCREASE_MAXPOW_BY_THREE_CHAIN; | 1309 | regulatory->max_power_level += INCREASE_MAXPOW_BY_THREE_CHAIN; |
1308 | break; | 1310 | break; |
1309 | default: | 1311 | default: |
1310 | DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, | 1312 | DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index df62113d89d6..4f3d5ea34812 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -439,8 +439,13 @@ static void ath9k_hw_init_config(struct ath_hw *ah) | |||
439 | 439 | ||
440 | static void ath9k_hw_init_defaults(struct ath_hw *ah) | 440 | static void ath9k_hw_init_defaults(struct ath_hw *ah) |
441 | { | 441 | { |
442 | struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); | ||
443 | |||
444 | regulatory->country_code = CTRY_DEFAULT; | ||
445 | regulatory->power_limit = MAX_RATE_POWER; | ||
446 | regulatory->tp_scale = ATH9K_TP_SCALE_MAX; | ||
447 | |||
442 | ah->hw_version.magic = AR5416_MAGIC; | 448 | ah->hw_version.magic = AR5416_MAGIC; |
443 | ah->regulatory.country_code = CTRY_DEFAULT; | ||
444 | ah->hw_version.subvendorid = 0; | 449 | ah->hw_version.subvendorid = 0; |
445 | 450 | ||
446 | ah->ah_flags = 0; | 451 | ah->ah_flags = 0; |
@@ -449,8 +454,6 @@ static void ath9k_hw_init_defaults(struct ath_hw *ah) | |||
449 | if (!AR_SREV_9100(ah)) | 454 | if (!AR_SREV_9100(ah)) |
450 | ah->ah_flags = AH_USE_EEPROM; | 455 | ah->ah_flags = AH_USE_EEPROM; |
451 | 456 | ||
452 | ah->regulatory.power_limit = MAX_RATE_POWER; | ||
453 | ah->regulatory.tp_scale = ATH9K_TP_SCALE_MAX; | ||
454 | ah->atim_window = 0; | 457 | ah->atim_window = 0; |
455 | ah->sta_id1_defaults = AR_STA_ID1_CRPT_MIC_ENABLE; | 458 | ah->sta_id1_defaults = AR_STA_ID1_CRPT_MIC_ENABLE; |
456 | ah->beacon_interval = 100; | 459 | ah->beacon_interval = 100; |
@@ -1368,6 +1371,7 @@ static int ath9k_hw_process_ini(struct ath_hw *ah, | |||
1368 | struct ath9k_channel *chan, | 1371 | struct ath9k_channel *chan, |
1369 | enum ath9k_ht_macmode macmode) | 1372 | enum ath9k_ht_macmode macmode) |
1370 | { | 1373 | { |
1374 | struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); | ||
1371 | int i, regWrites = 0; | 1375 | int i, regWrites = 0; |
1372 | struct ieee80211_channel *channel = chan->chan; | 1376 | struct ieee80211_channel *channel = chan->chan; |
1373 | u32 modesIndex, freqIndex; | 1377 | u32 modesIndex, freqIndex; |
@@ -1474,11 +1478,11 @@ static int ath9k_hw_process_ini(struct ath_hw *ah, | |||
1474 | ath9k_olc_init(ah); | 1478 | ath9k_olc_init(ah); |
1475 | 1479 | ||
1476 | ah->eep_ops->set_txpower(ah, chan, | 1480 | ah->eep_ops->set_txpower(ah, chan, |
1477 | ath9k_regd_get_ctl(&ah->regulatory, chan), | 1481 | ath9k_regd_get_ctl(regulatory, chan), |
1478 | channel->max_antenna_gain * 2, | 1482 | channel->max_antenna_gain * 2, |
1479 | channel->max_power * 2, | 1483 | channel->max_power * 2, |
1480 | min((u32) MAX_RATE_POWER, | 1484 | min((u32) MAX_RATE_POWER, |
1481 | (u32) ah->regulatory.power_limit)); | 1485 | (u32) regulatory->power_limit)); |
1482 | 1486 | ||
1483 | if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) { | 1487 | if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) { |
1484 | DPRINTF(ah->ah_sc, ATH_DBG_FATAL, | 1488 | DPRINTF(ah->ah_sc, ATH_DBG_FATAL, |
@@ -1796,6 +1800,7 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah, | |||
1796 | struct ath9k_channel *chan, | 1800 | struct ath9k_channel *chan, |
1797 | enum ath9k_ht_macmode macmode) | 1801 | enum ath9k_ht_macmode macmode) |
1798 | { | 1802 | { |
1803 | struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); | ||
1799 | struct ieee80211_channel *channel = chan->chan; | 1804 | struct ieee80211_channel *channel = chan->chan; |
1800 | u32 synthDelay, qnum; | 1805 | u32 synthDelay, qnum; |
1801 | 1806 | ||
@@ -1828,11 +1833,11 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah, | |||
1828 | } | 1833 | } |
1829 | 1834 | ||
1830 | ah->eep_ops->set_txpower(ah, chan, | 1835 | ah->eep_ops->set_txpower(ah, chan, |
1831 | ath9k_regd_get_ctl(&ah->regulatory, chan), | 1836 | ath9k_regd_get_ctl(regulatory, chan), |
1832 | channel->max_antenna_gain * 2, | 1837 | channel->max_antenna_gain * 2, |
1833 | channel->max_power * 2, | 1838 | channel->max_power * 2, |
1834 | min((u32) MAX_RATE_POWER, | 1839 | min((u32) MAX_RATE_POWER, |
1835 | (u32) ah->regulatory.power_limit)); | 1840 | (u32) regulatory->power_limit)); |
1836 | 1841 | ||
1837 | synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY; | 1842 | synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY; |
1838 | if (IS_CHAN_B(chan)) | 1843 | if (IS_CHAN_B(chan)) |
@@ -3480,27 +3485,29 @@ void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah, | |||
3480 | void ath9k_hw_fill_cap_info(struct ath_hw *ah) | 3485 | void ath9k_hw_fill_cap_info(struct ath_hw *ah) |
3481 | { | 3486 | { |
3482 | struct ath9k_hw_capabilities *pCap = &ah->caps; | 3487 | struct ath9k_hw_capabilities *pCap = &ah->caps; |
3488 | struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); | ||
3489 | |||
3483 | u16 capField = 0, eeval; | 3490 | u16 capField = 0, eeval; |
3484 | 3491 | ||
3485 | eeval = ah->eep_ops->get_eeprom(ah, EEP_REG_0); | 3492 | eeval = ah->eep_ops->get_eeprom(ah, EEP_REG_0); |
3486 | ah->regulatory.current_rd = eeval; | 3493 | regulatory->current_rd = eeval; |
3487 | 3494 | ||
3488 | eeval = ah->eep_ops->get_eeprom(ah, EEP_REG_1); | 3495 | eeval = ah->eep_ops->get_eeprom(ah, EEP_REG_1); |
3489 | if (AR_SREV_9285_10_OR_LATER(ah)) | 3496 | if (AR_SREV_9285_10_OR_LATER(ah)) |
3490 | eeval |= AR9285_RDEXT_DEFAULT; | 3497 | eeval |= AR9285_RDEXT_DEFAULT; |
3491 | ah->regulatory.current_rd_ext = eeval; | 3498 | regulatory->current_rd_ext = eeval; |
3492 | 3499 | ||
3493 | capField = ah->eep_ops->get_eeprom(ah, EEP_OP_CAP); | 3500 | capField = ah->eep_ops->get_eeprom(ah, EEP_OP_CAP); |
3494 | 3501 | ||
3495 | if (ah->opmode != NL80211_IFTYPE_AP && | 3502 | if (ah->opmode != NL80211_IFTYPE_AP && |
3496 | ah->hw_version.subvendorid == AR_SUBVENDOR_ID_NEW_A) { | 3503 | ah->hw_version.subvendorid == AR_SUBVENDOR_ID_NEW_A) { |
3497 | if (ah->regulatory.current_rd == 0x64 || | 3504 | if (regulatory->current_rd == 0x64 || |
3498 | ah->regulatory.current_rd == 0x65) | 3505 | regulatory->current_rd == 0x65) |
3499 | ah->regulatory.current_rd += 5; | 3506 | regulatory->current_rd += 5; |
3500 | else if (ah->regulatory.current_rd == 0x41) | 3507 | else if (regulatory->current_rd == 0x41) |
3501 | ah->regulatory.current_rd = 0x43; | 3508 | regulatory->current_rd = 0x43; |
3502 | DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY, | 3509 | DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY, |
3503 | "regdomain mapped to 0x%x\n", ah->regulatory.current_rd); | 3510 | "regdomain mapped to 0x%x\n", regulatory->current_rd); |
3504 | } | 3511 | } |
3505 | 3512 | ||
3506 | eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE); | 3513 | eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE); |
@@ -3635,7 +3642,7 @@ void ath9k_hw_fill_cap_info(struct ath_hw *ah) | |||
3635 | else | 3642 | else |
3636 | pCap->hw_caps |= ATH9K_HW_CAP_4KB_SPLITTRANS; | 3643 | pCap->hw_caps |= ATH9K_HW_CAP_4KB_SPLITTRANS; |
3637 | 3644 | ||
3638 | if (ah->regulatory.current_rd_ext & (1 << REG_EXT_JAPAN_MIDBAND)) { | 3645 | if (regulatory->current_rd_ext & (1 << REG_EXT_JAPAN_MIDBAND)) { |
3639 | pCap->reg_cap = | 3646 | pCap->reg_cap = |
3640 | AR_EEPROM_EEREGCAP_EN_KK_NEW_11A | | 3647 | AR_EEPROM_EEREGCAP_EN_KK_NEW_11A | |
3641 | AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN | | 3648 | AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN | |
@@ -3664,6 +3671,7 @@ void ath9k_hw_fill_cap_info(struct ath_hw *ah) | |||
3664 | bool ath9k_hw_getcapability(struct ath_hw *ah, enum ath9k_capability_type type, | 3671 | bool ath9k_hw_getcapability(struct ath_hw *ah, enum ath9k_capability_type type, |
3665 | u32 capability, u32 *result) | 3672 | u32 capability, u32 *result) |
3666 | { | 3673 | { |
3674 | struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); | ||
3667 | switch (type) { | 3675 | switch (type) { |
3668 | case ATH9K_CAP_CIPHER: | 3676 | case ATH9K_CAP_CIPHER: |
3669 | switch (capability) { | 3677 | switch (capability) { |
@@ -3712,13 +3720,13 @@ bool ath9k_hw_getcapability(struct ath_hw *ah, enum ath9k_capability_type type, | |||
3712 | case 0: | 3720 | case 0: |
3713 | return 0; | 3721 | return 0; |
3714 | case 1: | 3722 | case 1: |
3715 | *result = ah->regulatory.power_limit; | 3723 | *result = regulatory->power_limit; |
3716 | return 0; | 3724 | return 0; |
3717 | case 2: | 3725 | case 2: |
3718 | *result = ah->regulatory.max_power_level; | 3726 | *result = regulatory->max_power_level; |
3719 | return 0; | 3727 | return 0; |
3720 | case 3: | 3728 | case 3: |
3721 | *result = ah->regulatory.tp_scale; | 3729 | *result = regulatory->tp_scale; |
3722 | return 0; | 3730 | return 0; |
3723 | } | 3731 | } |
3724 | return false; | 3732 | return false; |
@@ -3956,17 +3964,18 @@ bool ath9k_hw_disable(struct ath_hw *ah) | |||
3956 | 3964 | ||
3957 | void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit) | 3965 | void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit) |
3958 | { | 3966 | { |
3967 | struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); | ||
3959 | struct ath9k_channel *chan = ah->curchan; | 3968 | struct ath9k_channel *chan = ah->curchan; |
3960 | struct ieee80211_channel *channel = chan->chan; | 3969 | struct ieee80211_channel *channel = chan->chan; |
3961 | 3970 | ||
3962 | ah->regulatory.power_limit = min(limit, (u32) MAX_RATE_POWER); | 3971 | regulatory->power_limit = min(limit, (u32) MAX_RATE_POWER); |
3963 | 3972 | ||
3964 | ah->eep_ops->set_txpower(ah, chan, | 3973 | ah->eep_ops->set_txpower(ah, chan, |
3965 | ath9k_regd_get_ctl(&ah->regulatory, chan), | 3974 | ath9k_regd_get_ctl(regulatory, chan), |
3966 | channel->max_antenna_gain * 2, | 3975 | channel->max_antenna_gain * 2, |
3967 | channel->max_power * 2, | 3976 | channel->max_power * 2, |
3968 | min((u32) MAX_RATE_POWER, | 3977 | min((u32) MAX_RATE_POWER, |
3969 | (u32) ah->regulatory.power_limit)); | 3978 | (u32) regulatory->power_limit)); |
3970 | } | 3979 | } |
3971 | 3980 | ||
3972 | void ath9k_hw_setmac(struct ath_hw *ah, const u8 *mac) | 3981 | void ath9k_hw_setmac(struct ath_hw *ah, const u8 *mac) |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index de31a1595f12..24b30631d93e 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -396,7 +396,6 @@ struct ath_hw { | |||
396 | struct ath9k_hw_version hw_version; | 396 | struct ath9k_hw_version hw_version; |
397 | struct ath9k_ops_config config; | 397 | struct ath9k_ops_config config; |
398 | struct ath9k_hw_capabilities caps; | 398 | struct ath9k_hw_capabilities caps; |
399 | struct ath_regulatory regulatory; | ||
400 | struct ath9k_channel channels[38]; | 399 | struct ath9k_channel channels[38]; |
401 | struct ath9k_channel *curchan; | 400 | struct ath9k_channel *curchan; |
402 | 401 | ||
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index fddda206def2..de197117fdcf 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -1293,7 +1293,7 @@ static int ath9k_reg_notifier(struct wiphy *wiphy, | |||
1293 | struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); | 1293 | struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); |
1294 | struct ath_wiphy *aphy = hw->priv; | 1294 | struct ath_wiphy *aphy = hw->priv; |
1295 | struct ath_softc *sc = aphy->sc; | 1295 | struct ath_softc *sc = aphy->sc; |
1296 | struct ath_regulatory *reg = &sc->sc_ah->regulatory; | 1296 | struct ath_regulatory *reg = &sc->common.regulatory; |
1297 | 1297 | ||
1298 | return ath_reg_notifier_apply(wiphy, request, reg); | 1298 | return ath_reg_notifier_apply(wiphy, request, reg); |
1299 | } | 1299 | } |
@@ -1586,12 +1586,12 @@ int ath_init_device(u16 devid, struct ath_softc *sc) | |||
1586 | 1586 | ||
1587 | ath_set_hw_capab(sc, hw); | 1587 | ath_set_hw_capab(sc, hw); |
1588 | 1588 | ||
1589 | error = ath_regd_init(&sc->sc_ah->regulatory, sc->hw->wiphy, | 1589 | error = ath_regd_init(&sc->common.regulatory, sc->hw->wiphy, |
1590 | ath9k_reg_notifier); | 1590 | ath9k_reg_notifier); |
1591 | if (error) | 1591 | if (error) |
1592 | return error; | 1592 | return error; |
1593 | 1593 | ||
1594 | reg = &sc->sc_ah->regulatory; | 1594 | reg = &sc->common.regulatory; |
1595 | 1595 | ||
1596 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) { | 1596 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) { |
1597 | setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_2GHZ].ht_cap); | 1597 | setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_2GHZ].ht_cap); |
diff --git a/drivers/net/wireless/ath/regd.h b/drivers/net/wireless/ath/regd.h index 07291ccb23f2..4d3c53674e5a 100644 --- a/drivers/net/wireless/ath/regd.h +++ b/drivers/net/wireless/ath/regd.h | |||
@@ -18,9 +18,10 @@ | |||
18 | #define REGD_H | 18 | #define REGD_H |
19 | 19 | ||
20 | #include <linux/nl80211.h> | 20 | #include <linux/nl80211.h> |
21 | |||
22 | #include <net/cfg80211.h> | 21 | #include <net/cfg80211.h> |
23 | 22 | ||
23 | #include "ath.h" | ||
24 | |||
24 | #define NO_CTL 0xff | 25 | #define NO_CTL 0xff |
25 | #define SD_NO_CTL 0xE0 | 26 | #define SD_NO_CTL 0xE0 |
26 | #define NO_CTL 0xff | 27 | #define NO_CTL 0xff |
@@ -47,29 +48,12 @@ | |||
47 | #define CHANNEL_HALF_BW 10 | 48 | #define CHANNEL_HALF_BW 10 |
48 | #define CHANNEL_QUARTER_BW 5 | 49 | #define CHANNEL_QUARTER_BW 5 |
49 | 50 | ||
50 | struct reg_dmn_pair_mapping { | ||
51 | u16 regDmnEnum; | ||
52 | u16 reg_5ghz_ctl; | ||
53 | u16 reg_2ghz_ctl; | ||
54 | }; | ||
55 | |||
56 | struct country_code_to_enum_rd { | 51 | struct country_code_to_enum_rd { |
57 | u16 countryCode; | 52 | u16 countryCode; |
58 | u16 regDmnEnum; | 53 | u16 regDmnEnum; |
59 | const char *isoName; | 54 | const char *isoName; |
60 | }; | 55 | }; |
61 | 56 | ||
62 | struct ath_regulatory { | ||
63 | char alpha2[2]; | ||
64 | u16 country_code; | ||
65 | u16 max_power_level; | ||
66 | u32 tp_scale; | ||
67 | u16 current_rd; | ||
68 | u16 current_rd_ext; | ||
69 | int16_t power_limit; | ||
70 | struct reg_dmn_pair_mapping *regpair; | ||
71 | }; | ||
72 | |||
73 | enum CountryCode { | 57 | enum CountryCode { |
74 | CTRY_ALBANIA = 8, | 58 | CTRY_ALBANIA = 8, |
75 | CTRY_ALGERIA = 12, | 59 | CTRY_ALGERIA = 12, |