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: 23822master
parent
00e1797f14
commit
b4e2c09b46
@ -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);
|
@ -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 */
|
@ -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 */
|
@ -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 */
|
||||
|
Loading…
Reference in new issue