diff options
author | Felix Fietkau <nbd@openwrt.org> | 2010-11-03 14:55:53 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2010-11-03 14:55:53 +0000 |
commit | b4e2c09b46d37dd2e7020b9f8f157c3fcfc9b76d (patch) | |
tree | df28bbae0879ec65f71f706c2ce7a9a13e5eba72 /package/mac80211 | |
parent | 00e1797f14aae1b62dc18be41c65b507e07b0d42 (diff) | |
download | upstream-b4e2c09b46d37dd2e7020b9f8f157c3fcfc9b76d.tar.gz upstream-b4e2c09b46d37dd2e7020b9f8f157c3fcfc9b76d.tar.bz2 upstream-b4e2c09b46d37dd2e7020b9f8f157c3fcfc9b76d.zip |
ar71xx: improve the wndr3700 quirks - move most of the code out of ath9k and instead allow the platform device to specify gpio overrides - fixes 5ghz signal strength issues
SVN-Revision: 23822
Diffstat (limited to 'package/mac80211')
9 files changed, 138 insertions, 110 deletions
diff --git a/package/mac80211/patches/310-ath9k_gpio_settings.patch b/package/mac80211/patches/310-ath9k_gpio_settings.patch new file mode 100644 index 0000000000..67111cc2cb --- /dev/null +++ b/package/mac80211/patches/310-ath9k_gpio_settings.patch @@ -0,0 +1,58 @@ +--- a/drivers/net/wireless/ath/ath9k/debug.c ++++ b/drivers/net/wireless/ath/ath9k/debug.c +@@ -920,6 +920,12 @@ int ath9k_init_debug(struct ath_hw *ah) + sc->debug.debugfs_phy, &ah->config.cwm_ignore_extcca)) + goto err; + ++ debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR, ++ sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask); ++ ++ debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR, ++ sc->debug.debugfs_phy, &sc->sc_ah->gpio_val); ++ + sc->debug.regidx = 0; + return 0; + err: +--- a/drivers/net/wireless/ath/ath9k/hw.h ++++ b/drivers/net/wireless/ath/ath9k/hw.h +@@ -743,6 +743,8 @@ struct ath_hw { + int initPDADC; + int PDADCdelta; + u8 led_pin; ++ u32 gpio_mask; ++ u32 gpio_val; + + struct ar5416IniArray iniModes; + struct ar5416IniArray iniCommon; +--- a/drivers/net/wireless/ath/ath9k/hw.c ++++ b/drivers/net/wireless/ath/ath9k/hw.c +@@ -1178,6 +1178,20 @@ static bool ath9k_hw_channel_change(stru + return true; + } + ++static void ath9k_hw_apply_gpio_override(struct ath_hw *ah) ++{ ++ u32 gpio_mask = ah->gpio_mask; ++ int i; ++ ++ for (i = 0; gpio_mask; i++, gpio_mask >>= 1) { ++ if (!(ah->gpio_mask & 1)) ++ continue; ++ ++ ath9k_hw_cfg_output(ah, i, AR_GPIO_OUTPUT_MUX_AS_OUTPUT); ++ ath9k_hw_set_gpio(ah, i, !!(ah->gpio_val & BIT(i))); ++ } ++} ++ + bool ath9k_hw_check_alive(struct ath_hw *ah) + { + int count = 50; +@@ -1464,6 +1478,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st + if (AR_SREV_9300_20_OR_LATER(ah)) + ar9003_hw_bb_watchdog_config(ah); + ++ ath9k_hw_apply_gpio_override(ah); ++ + return 0; + } + EXPORT_SYMBOL(ath9k_hw_reset); diff --git a/package/mac80211/patches/408-ath9k_tweak_rx_intr_mitigation.patch b/package/mac80211/patches/408-ath9k_tweak_rx_intr_mitigation.patch index b9bf3e70d1..d12a53244b 100644 --- a/package/mac80211/patches/408-ath9k_tweak_rx_intr_mitigation.patch +++ b/package/mac80211/patches/408-ath9k_tweak_rx_intr_mitigation.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -1420,7 +1420,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st +@@ -1434,7 +1434,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st if (ah->config.rx_intr_mitigation) { REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_LAST, 500); diff --git a/package/mac80211/patches/409-ath9k-add-wndr3700-antenna-initialization.patch b/package/mac80211/patches/409-ath9k-add-wndr3700-antenna-initialization.patch deleted file mode 100644 index 77db1729b3..0000000000 --- a/package/mac80211/patches/409-ath9k-add-wndr3700-antenna-initialization.patch +++ /dev/null @@ -1,76 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/init.c -+++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -16,6 +16,7 @@ - - #include <linux/slab.h> - -+#include "linux/ath9k_platform.h" - #include "ath9k.h" - - static char *dev_info = "ath9k"; -@@ -574,6 +575,8 @@ static int ath9k_init_softc(u16 devid, s - pdata = (struct ath9k_platform_data *) sc->dev->platform_data; - if (!pdata) - ah->ah_flags |= AH_USE_EEPROM; -+ else -+ sc->quirk_wndr3700 = pdata->quirk_wndr3700; - - common = ath9k_hw_common(ah); - common->ops = &ath9k_common_ops; -@@ -704,6 +707,24 @@ void ath9k_set_hw_capab(struct ath_softc - SET_IEEE80211_PERM_ADDR(hw, common->macaddr); - } - -+#ifdef CONFIG_ATHEROS_AR71XX -+static void wndr3700_init_antenna(struct ath_hw *ah) -+{ -+ ath9k_hw_cfg_output(ah, 6, AR_GPIO_OUTPUT_MUX_AS_OUTPUT); -+ ath9k_hw_cfg_output(ah, 7, AR_GPIO_OUTPUT_MUX_AS_OUTPUT); -+ ath9k_hw_cfg_output(ah, 8, AR_GPIO_OUTPUT_MUX_AS_OUTPUT); -+ ath9k_hw_cfg_output(ah, 9, AR_GPIO_OUTPUT_MUX_AS_OUTPUT); -+ -+ /* select the first antenna group */ -+ ath9k_hw_set_gpio(ah, 6, 0); -+ ath9k_hw_set_gpio(ah, 7, 1); -+ ath9k_hw_set_gpio(ah, 8, 0); -+ ath9k_hw_set_gpio(ah, 9, 1); -+} -+#else -+static inline void wndr3700_init_antenna(struct ath_hw *ah) {} -+#endif /* CONFIG_ATHEROS_AR71XX */ -+ - int ath9k_init_device(u16 devid, struct ath_softc *sc, u16 subsysid, - const struct ath_bus_ops *bus_ops) - { -@@ -723,6 +744,9 @@ int ath9k_init_device(u16 devid, struct - common = ath9k_hw_common(ah); - ath9k_set_hw_capab(sc, hw); - -+ if (sc->quirk_wndr3700) -+ wndr3700_init_antenna(ah); -+ - /* Initialize regulatory */ - error = ath_regd_init(&common->regulatory, sc->hw->wiphy, - ath9k_reg_notifier); ---- a/drivers/net/wireless/ath/ath9k/ath9k.h -+++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -635,6 +635,8 @@ struct ath_softc { - - int beacon_interval; - -+ bool quirk_wndr3700; -+ - #ifdef CONFIG_ATH9K_DEBUGFS - struct ath9k_debug debug; - #endif ---- a/include/linux/ath9k_platform.h -+++ b/include/linux/ath9k_platform.h -@@ -24,6 +24,8 @@ - struct ath9k_platform_data { - u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS]; - u8 *macaddr; -+ -+ bool quirk_wndr3700; - }; - - #endif /* _LINUX_ATH9K_PLATFORM_H */ diff --git a/package/mac80211/patches/409-ath9k_platform_settings.patch b/package/mac80211/patches/409-ath9k_platform_settings.patch new file mode 100644 index 0000000000..3355d955a0 --- /dev/null +++ b/package/mac80211/patches/409-ath9k_platform_settings.patch @@ -0,0 +1,69 @@ +--- a/drivers/net/wireless/ath/ath9k/init.c ++++ b/drivers/net/wireless/ath/ath9k/init.c +@@ -16,6 +16,7 @@ + + #include <linux/slab.h> + ++#include "linux/ath9k_platform.h" + #include "ath9k.h" + + static char *dev_info = "ath9k"; +@@ -572,8 +573,14 @@ static int ath9k_init_softc(u16 devid, s + sc->sc_ah = ah; + + pdata = (struct ath9k_platform_data *) sc->dev->platform_data; +- if (!pdata) ++ if (!pdata) { + ah->ah_flags |= AH_USE_EEPROM; ++ sc->sc_ah->led_pin = -1; ++ } else { ++ sc->sc_ah->gpio_mask = pdata->gpio_mask; ++ sc->sc_ah->gpio_val = pdata->gpio_val; ++ sc->sc_ah->led_pin = pdata->led_pin; ++ } + + common = ath9k_hw_common(ah); + common->ops = &ath9k_common_ops; +--- a/drivers/net/wireless/ath/ath9k/hw.h ++++ b/drivers/net/wireless/ath/ath9k/hw.h +@@ -742,7 +742,7 @@ struct ath_hw { + u32 originalGain[22]; + int initPDADC; + int PDADCdelta; +- u8 led_pin; ++ int led_pin; + u32 gpio_mask; + u32 gpio_val; + +--- a/drivers/net/wireless/ath/ath9k/gpio.c ++++ b/drivers/net/wireless/ath/ath9k/gpio.c +@@ -147,10 +147,12 @@ void ath_init_leds(struct ath_softc *sc) + if (AR_SREV_9100(sc->sc_ah)) + return; + +- if (AR_SREV_9287(sc->sc_ah)) +- sc->sc_ah->led_pin = ATH_LED_PIN_9287; +- else +- sc->sc_ah->led_pin = ATH_LED_PIN_DEF; ++ if (sc->sc_ah->led_pin < 0) { ++ if (AR_SREV_9287(sc->sc_ah)) ++ sc->sc_ah->led_pin = ATH_LED_PIN_9287; ++ else ++ sc->sc_ah->led_pin = ATH_LED_PIN_DEF; ++ } + + /* Configure gpio 1 for output */ + ath9k_hw_cfg_output(sc->sc_ah, sc->sc_ah->led_pin, +--- a/include/linux/ath9k_platform.h ++++ b/include/linux/ath9k_platform.h +@@ -24,6 +24,10 @@ + struct ath9k_platform_data { + u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS]; + u8 *macaddr; ++ ++ int led_pin; ++ u32 gpio_mask; ++ u32 gpio_val; + }; + + #endif /* _LINUX_ATH9K_PLATFORM_H */ diff --git a/package/mac80211/patches/410-ath9k-wndr3700-led-pin-fix.patch b/package/mac80211/patches/410-ath9k-wndr3700-led-pin-fix.patch deleted file mode 100644 index 03d017a6de..0000000000 --- a/package/mac80211/patches/410-ath9k-wndr3700-led-pin-fix.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/gpio.c -+++ b/drivers/net/wireless/ath/ath9k/gpio.c -@@ -147,7 +147,9 @@ void ath_init_leds(struct ath_softc *sc) - if (AR_SREV_9100(sc->sc_ah)) - return; - -- if (AR_SREV_9287(sc->sc_ah)) -+ if (sc->quirk_wndr3700) -+ sc->sc_ah->led_pin = ATH_LED_PIN_WNDR3700; -+ else if (AR_SREV_9287(sc->sc_ah)) - sc->sc_ah->led_pin = ATH_LED_PIN_9287; - else - sc->sc_ah->led_pin = ATH_LED_PIN_DEF; ---- a/drivers/net/wireless/ath/ath9k/ath9k.h -+++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -455,6 +455,7 @@ void ath9k_btcoex_timer_pause(struct ath - - #define ATH_LED_PIN_DEF 1 - #define ATH_LED_PIN_9287 8 -+#define ATH_LED_PIN_WNDR3700 5 - #define ATH_LED_ON_DURATION_IDLE 350 /* in msecs */ - #define ATH_LED_OFF_DURATION_IDLE 250 /* in msecs */ - diff --git a/package/mac80211/patches/500-ath9k_eeprom_debugfs.patch b/package/mac80211/patches/500-ath9k_eeprom_debugfs.patch index 20ad8b2644..26c045cd93 100644 --- a/package/mac80211/patches/500-ath9k_eeprom_debugfs.patch +++ b/package/mac80211/patches/500-ath9k_eeprom_debugfs.patch @@ -54,9 +54,9 @@ int ath9k_init_debug(struct ath_hw *ah) { struct ath_common *common = ath9k_hw_common(ah); -@@ -920,6 +967,10 @@ int ath9k_init_debug(struct ath_hw *ah) - sc->debug.debugfs_phy, &ah->config.cwm_ignore_extcca)) - goto err; +@@ -926,6 +973,10 @@ int ath9k_init_debug(struct ath_hw *ah) + debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR, + sc->debug.debugfs_phy, &sc->sc_ah->gpio_val); + if (!debugfs_create_file("eeprom", S_IRUSR, + sc->debug.debugfs_phy, sc, &fops_eeprom)) diff --git a/package/mac80211/patches/521-ath9k_hw_tx_power.patch b/package/mac80211/patches/521-ath9k_hw_tx_power.patch index 4777cec263..1183450882 100644 --- a/package/mac80211/patches/521-ath9k_hw_tx_power.patch +++ b/package/mac80211/patches/521-ath9k_hw_tx_power.patch @@ -252,7 +252,7 @@ ath9k_hw_rfbus_done(ah); -@@ -2177,7 +2177,7 @@ bool ath9k_hw_disable(struct ath_hw *ah) +@@ -2193,7 +2193,7 @@ bool ath9k_hw_disable(struct ath_hw *ah) } EXPORT_SYMBOL(ath9k_hw_disable); @@ -261,7 +261,7 @@ { struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah); struct ath9k_channel *chan = ah->curchan; -@@ -2190,7 +2190,7 @@ void ath9k_hw_set_txpowerlimit(struct at +@@ -2206,7 +2206,7 @@ void ath9k_hw_set_txpowerlimit(struct at channel->max_antenna_gain * 2, channel->max_power * 2, min((u32) MAX_RATE_POWER, @@ -272,7 +272,7 @@ --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h -@@ -860,7 +860,7 @@ u32 ath9k_hw_getrxfilter(struct ath_hw * +@@ -862,7 +862,7 @@ u32 ath9k_hw_getrxfilter(struct ath_hw * void ath9k_hw_setrxfilter(struct ath_hw *ah, u32 bits); bool ath9k_hw_phy_disable(struct ath_hw *ah); bool ath9k_hw_disable(struct ath_hw *ah); diff --git a/package/mac80211/patches/522-ath9k_tx_power_init.patch b/package/mac80211/patches/522-ath9k_tx_power_init.patch index b8138af255..de25219f3c 100644 --- a/package/mac80211/patches/522-ath9k_tx_power_init.patch +++ b/package/mac80211/patches/522-ath9k_tx_power_init.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -650,6 +650,37 @@ err_hw: +@@ -654,6 +654,37 @@ err_hw: return ret; } @@ -38,7 +38,7 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) { struct ath_common *common = ath9k_hw_common(sc->sc_ah); -@@ -765,6 +796,8 @@ int ath9k_init_device(u16 devid, struct +@@ -748,6 +779,8 @@ int ath9k_init_device(u16 devid, struct if (error != 0) goto error_rx; diff --git a/package/mac80211/patches/530-ath9k_locking_fix.patch b/package/mac80211/patches/530-ath9k_locking_fix.patch index 29303323ab..354b720308 100644 --- a/package/mac80211/patches/530-ath9k_locking_fix.patch +++ b/package/mac80211/patches/530-ath9k_locking_fix.patch @@ -8,7 +8,7 @@ spinlock_t rxbuflock; struct list_head rxbuf; struct ath_descdma rxdma; -@@ -600,9 +599,9 @@ struct ath_softc { +@@ -599,9 +598,9 @@ struct ath_softc { struct ath_hw *sc_ah; void __iomem *mem; int irq; @@ -337,7 +337,7 @@ static bool ath_beacon_dtim_pending_cab(struct sk_buff *skb) --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -588,7 +588,6 @@ static int ath9k_init_softc(u16 devid, s +@@ -592,7 +592,6 @@ static int ath9k_init_softc(u16 devid, s spin_lock_init(&common->cc_lock); spin_lock_init(&sc->wiphy_lock); |