From 07a583c323f781abc58d46cfd539c6bb82a50125 Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Mon, 25 Jan 2016 13:16:49 +0100 Subject: [PATCH] A set of patches enables consumer grade Atheros wireless card 5Ghz AP mode + working hostapd example --- config/hostapd.conf | 7 +- config/linux-marvell-default.config | 1 + .../403-ath_regd_optional.patch | 58 +++++++++++++++ ...lock_atheros_regulatory_restrictions.patch | 70 +++++++++++++++++++ 4 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 patch/kernel/marvell-default/403-ath_regd_optional.patch create mode 100644 patch/kernel/marvell-default/unlock_atheros_regulatory_restrictions.patch diff --git a/config/hostapd.conf b/config/hostapd.conf index 8187d7a03d..b26b6ea5ee 100644 --- a/config/hostapd.conf +++ b/config/hostapd.conf @@ -20,4 +20,9 @@ macaddr_acl=0 noscan=1 #ht_capab=[HT40-][SHORT-GI-40][SHORT-GI-40][DSSS_CCK-40] #country_code=SI -#ieee80211d=1 \ No newline at end of file +#ieee80211d=1 + +#5 Ghz example config +#hw_mode=a +#channel=108 +#ht_capab=[HT40+][SHORT-GI-40][DSSS_CCK-40] \ No newline at end of file diff --git a/config/linux-marvell-default.config b/config/linux-marvell-default.config index 6590916264..053992dee7 100644 --- a/config/linux-marvell-default.config +++ b/config/linux-marvell-default.config @@ -1885,6 +1885,7 @@ CONFIG_WLAN=y # CONFIG_MWL8K is not set CONFIG_ATH_COMMON=m CONFIG_ATH_CARDS=m +CONFIG_ATH_USER_REGD=y # CONFIG_ATH_DEBUG is not set # CONFIG_ATH5K is not set # CONFIG_ATH5K_PCI is not set diff --git a/patch/kernel/marvell-default/403-ath_regd_optional.patch b/patch/kernel/marvell-default/403-ath_regd_optional.patch new file mode 100644 index 0000000000..8c79e47e69 --- /dev/null +++ b/patch/kernel/marvell-default/403-ath_regd_optional.patch @@ -0,0 +1,58 @@ +--- a/drivers/net/wireless/ath/regd.c ++++ b/drivers/net/wireless/ath/regd.c +@@ -341,6 +341,10 @@ ath_reg_apply_beaconing_flags(struct wip + struct ieee80211_channel *ch; + unsigned int i; + ++#ifdef CPTCFG_ATH_USER_REGD ++ return; ++#endif ++ + for (band = 0; band < IEEE80211_NUM_BANDS; band++) { + if (!wiphy->bands[band]) + continue; +@@ -374,6 +378,10 @@ ath_reg_apply_ir_flags(struct wiphy *wip + { + struct ieee80211_supported_band *sband; + ++#ifdef CPTCFG_ATH_USER_REGD ++ return; ++#endif ++ + sband = wiphy->bands[IEEE80211_BAND_2GHZ]; + if (!sband) + return; +@@ -402,6 +410,10 @@ static void ath_reg_apply_radar_flags(st + struct ieee80211_channel *ch; + unsigned int i; + ++#ifdef CPTCFG_ATH_USER_REGD ++ return; ++#endif ++ + if (!wiphy->bands[IEEE80211_BAND_5GHZ]) + return; + +@@ -631,6 +643,10 @@ ath_regd_init_wiphy(struct ath_regulator + { + const struct ieee80211_regdomain *regd; + ++#ifdef CPTCFG_ATH_USER_REGD ++ return 0; ++#endif ++ + wiphy->reg_notifier = reg_notifier; + wiphy->regulatory_flags |= REGULATORY_STRICT_REG | + REGULATORY_CUSTOM_REG; +--- a/drivers/net/wireless/ath/Kconfig ++++ b/drivers/net/wireless/ath/Kconfig +@@ -21,6 +21,9 @@ menuconfig ATH_CARDS + + if ATH_CARDS + ++config ATH_USER_REGD ++ bool "Do not enforce EEPROM regulatory restrictions" ++ + config ATH_DEBUG + bool "Atheros wireless debugging" + ---help--- \ No newline at end of file diff --git a/patch/kernel/marvell-default/unlock_atheros_regulatory_restrictions.patch b/patch/kernel/marvell-default/unlock_atheros_regulatory_restrictions.patch new file mode 100644 index 0000000000..65324ca249 --- /dev/null +++ b/patch/kernel/marvell-default/unlock_atheros_regulatory_restrictions.patch @@ -0,0 +1,70 @@ +diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c +index ccc4c71..71a4d00 100644 +--- a/drivers/net/wireless/ath/regd.c ++++ b/drivers/net/wireless/ath/regd.c +@@ -49,12 +49,9 @@ static int __ath_regd_init(struct ath_regulatory *reg); + #define ATH9K_5GHZ_5725_5850 REG_RULE(5725-10, 5850+10, 40, 0, 30,\ + NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS) + +-#define ATH9K_2GHZ_ALL ATH9K_2GHZ_CH01_11, \ +- ATH9K_2GHZ_CH12_13, \ +- ATH9K_2GHZ_CH14 ++#define ATH9K_2GHZ_ALL REG_RULE(2400, 2483, 40, 0, 30, 0) + +-#define ATH9K_5GHZ_ALL ATH9K_5GHZ_5150_5350, \ +- ATH9K_5GHZ_5470_5850 ++#define ATH9K_5GHZ_ALL REG_RULE(5140, 5860, 40, 0, 30, 0) + + /* This one skips what we call "mid band" */ + #define ATH9K_5GHZ_NO_MIDBAND ATH9K_5GHZ_5150_5350, \ +@@ -76,9 +73,8 @@ static const struct ieee80211_regdomain ath_world_regdom_63_65 = { + .n_reg_rules = 4, + .alpha2 = "99", + .reg_rules = { +- ATH9K_2GHZ_CH01_11, +- ATH9K_2GHZ_CH12_13, +- ATH9K_5GHZ_NO_MIDBAND, ++ ATH9K_2GHZ_ALL, ++ ATH9K_5GHZ_ALL, + } + }; + +@@ -87,8 +83,8 @@ static const struct ieee80211_regdomain ath_world_regdom_64 = { + .n_reg_rules = 3, + .alpha2 = "99", + .reg_rules = { +- ATH9K_2GHZ_CH01_11, +- ATH9K_5GHZ_NO_MIDBAND, ++ ATH9K_2GHZ_ALL, ++ ATH9K_5GHZ_ALL, + } + }; + +@@ -97,7 +93,7 @@ static const struct ieee80211_regdomain ath_world_regdom_66_69 = { + .n_reg_rules = 3, + .alpha2 = "99", + .reg_rules = { +- ATH9K_2GHZ_CH01_11, ++ ATH9K_2GHZ_ALL, + ATH9K_5GHZ_ALL, + } + }; +@@ -107,8 +103,7 @@ static const struct ieee80211_regdomain ath_world_regdom_67_68_6A_6C = { + .n_reg_rules = 4, + .alpha2 = "99", + .reg_rules = { +- ATH9K_2GHZ_CH01_11, +- ATH9K_2GHZ_CH12_13, ++ ATH9K_2GHZ_ALL, + ATH9K_5GHZ_ALL, + } + }; +@@ -174,7 +169,7 @@ EXPORT_SYMBOL(ath_is_49ghz_allowed); + /* Frequency is one where radar detection is required */ + static bool ath_is_radar_freq(u16 center_freq) + { +- return (center_freq >= 5260 && center_freq <= 5700); ++ return false; + } + + /*