ar71xx/mac80211: add a workaround for the bad signal strength on the WNDR3700

SVN-Revision: 19565
This commit is contained in:
Gabor Juhos 2010-02-09 16:27:35 +00:00
parent 40ba15806f
commit 0cbc5f678d
6 changed files with 96 additions and 8 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2007-2009 OpenWrt.org
# Copyright (C) 2007-2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=mac80211
PKG_VERSION:=2010-02-02
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
# http://www.orbit-lab.org/kernel/compat-wireless-2.6/2010/11 \
# http://wireless.kernel.org/download/compat-wireless-2.6

View File

@ -0,0 +1,76 @@
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -14,6 +14,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include "linux/ath9k_platform.h"
#include "ath9k.h"
static char *dev_info = "ath9k";
@@ -546,6 +547,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;
@@ -670,6 +673,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)
{
@@ -688,6 +709,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
@@ -510,6 +510,8 @@ struct ath_softc {
struct ath_beacon_config cur_beacon_conf;
struct delayed_work tx_complete_work;
struct ath_btcoex btcoex;
+
+ unsigned long quirk_wndr3700:1;
};
struct ath_wiphy {
--- 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;
+
+ unsigned long quirk_wndr3700:1;
};
#endif /* _LINUX_ATH9K_PLATFORM_H */

View File

@ -1,7 +1,7 @@
/*
* Atheros AP94 reference board PCI initialization
*
* Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
* Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org>
*
* 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
@ -125,6 +125,12 @@ static void ap94_pci_fixup(struct pci_dev *dev)
}
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATHEROS, PCI_ANY_ID, ap94_pci_fixup);
void __init ap94_pci_enable_quirk_wndr3700(void)
{
ap94_wmac0_data.quirk_wndr3700 = 1;
ap94_wmac1_data.quirk_wndr3700 = 1;
}
void __init ap94_pci_init(u8 *cal_data0, u8 *mac_addr0,
u8 *cal_data1, u8 *mac_addr1)
{

View File

@ -1,7 +1,7 @@
/*
* Atheros AP94 reference board PCI initialization
*
* Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
* Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org>
*
* 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
@ -14,11 +14,14 @@
#if defined(CONFIG_AR71XX_DEV_AP94_PCI)
void ap94_pci_init(u8 *cal_data0, u8 *mac_addr0,
u8 *cal_data1, u8 *mac_addr1) __init;
void ap94_pci_enable_quirk_wndr3700(void) __init;
#else
static inline void ap94_pci_init(u8 *cal_data0, u8 *mac_addr0,
u8 *cal_data1, u8 *mac_addr1)
{
}
u8 *cal_data1, u8 *mac_addr1) {}
static inline void ap94_pci_enable_quirk_wndr3700(void) {}
#endif
#endif /* _AR71XX_DEV_AP94_PCI_H */

View File

@ -2,7 +2,7 @@
* Netgear WNDR3700 board support
*
* Copyright (C) 2009 Marco Porsch
* Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
* Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org>
*
* 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
@ -191,6 +191,7 @@ static void __init wndr3700_setup(void)
platform_device_register(&wndr3700_rtl8366s_device);
platform_device_register_simple("wndr3700-led-usb", -1, NULL, 0);
ap94_pci_enable_quirk_wndr3700();
ap94_pci_init(art + WNDR3700_CALDATA0_OFFSET,
art + WNDR3700_WMAC0_MAC_OFFSET,
art + WNDR3700_CALDATA1_OFFSET,

View File

@ -16,6 +16,8 @@
struct ath9k_platform_data {
u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
u8 *macaddr;
unsigned long quirk_wndr3700:1;
};
#endif /* _LINUX_ATH9K_PLATFORM_H */