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
This commit is contained in:
parent
00e1797f14
commit
b4e2c09b46
13 changed files with 177 additions and 122 deletions
58
package/mac80211/patches/310-ath9k_gpio_settings.patch
Normal file
58
package/mac80211/patches/310-ath9k_gpio_settings.patch
Normal file
|
@ -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,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);
|
||||
|
|
|
@ -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 */
|
69
package/mac80211/patches/409-ath9k_platform_settings.patch
Normal file
69
package/mac80211/patches/409-ath9k_platform_settings.patch
Normal file
|
@ -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 */
|
||||
|
|
@ -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))
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
#include "dev-ap91-pci.h"
|
||||
#include "pci-ath9k-fixup.h"
|
||||
|
||||
static struct ath9k_platform_data ap91_wmac_data;
|
||||
static struct ath9k_platform_data ap91_wmac_data = {
|
||||
.led_pin = -1,
|
||||
};
|
||||
static char ap91_wmac_mac[6];
|
||||
|
||||
static struct ar71xx_pci_irq ap91_pci_irqs[] __initdata = {
|
||||
|
|
|
@ -18,8 +18,12 @@
|
|||
#include "dev-ap94-pci.h"
|
||||
#include "pci-ath9k-fixup.h"
|
||||
|
||||
static struct ath9k_platform_data ap94_wmac0_data;
|
||||
static struct ath9k_platform_data ap94_wmac1_data;
|
||||
static struct ath9k_platform_data ap94_wmac0_data = {
|
||||
.led_pin = -1,
|
||||
};
|
||||
static struct ath9k_platform_data ap94_wmac1_data = {
|
||||
.led_pin = -1,
|
||||
};
|
||||
static char ap94_wmac0_mac[6];
|
||||
static char ap94_wmac1_mac[6];
|
||||
|
||||
|
@ -52,8 +56,17 @@ static int ap94_pci_plat_dev_init(struct pci_dev *dev)
|
|||
|
||||
void __init ap94_pci_enable_quirk_wndr3700(void)
|
||||
{
|
||||
ap94_wmac0_data.quirk_wndr3700 = 1;
|
||||
ap94_wmac1_data.quirk_wndr3700 = 1;
|
||||
/* WNDR3700 uses GPIO 6-9 for antenna configuration */
|
||||
|
||||
ap94_wmac0_data.led_pin = 5;
|
||||
ap94_wmac0_data.gpio_mask = (0xf << 6);
|
||||
/* 2.4 GHz uses the first fixed antenna group (0, 1, 0, 1) */
|
||||
ap94_wmac0_data.gpio_val = (5 << 6);
|
||||
|
||||
ap94_wmac1_data.led_pin = 5;
|
||||
ap94_wmac1_data.gpio_mask = (0xf << 6);
|
||||
/* 5 GHz uses the second fixed antenna group (0, 1, 1, 0) */
|
||||
ap94_wmac1_data.gpio_val = (6 << 6);
|
||||
}
|
||||
|
||||
void __init ap94_pci_init(u8 *cal_data0, u8 *mac_addr0,
|
||||
|
|
|
@ -22,7 +22,9 @@
|
|||
|
||||
#include "dev-ar913x-wmac.h"
|
||||
|
||||
static struct ath9k_platform_data ar913x_wmac_data;
|
||||
static struct ath9k_platform_data ar913x_wmac_data = {
|
||||
.led_pin = -1,
|
||||
};
|
||||
static char ar913x_wmac_mac[6];
|
||||
|
||||
static struct resource ar913x_wmac_resources[] = {
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
/*
|
||||
* ath9k platform data defines
|
||||
* Copyright (c) 2008 Atheros Communications Inc.
|
||||
* Copyright (c) 2009 Gabor Juhos <juhosg@openwrt.org>
|
||||
* Copyright (c) 2009 Imre Kaloz <kaloz@openwrt.org>
|
||||
*
|
||||
* Copyright (C) 2008 Gabor Juhos <juhosg@openwrt.org>
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 as published
|
||||
* by the Free Software Foundation.
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_ATH9K_PLATFORM_H
|
||||
|
@ -17,7 +25,9 @@ struct ath9k_platform_data {
|
|||
u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
|
||||
u8 *macaddr;
|
||||
|
||||
unsigned long quirk_wndr3700:1;
|
||||
int led_pin;
|
||||
u32 gpio_mask;
|
||||
u32 gpio_val;
|
||||
};
|
||||
|
||||
#endif /* _LINUX_ATH9K_PLATFORM_H */
|
||||
|
|
Loading…
Reference in a new issue