Update to compat-wireless-2009-08-15

SVN-Revision: 17265
This commit is contained in:
Hauke Mehrtens 2009-08-15 08:26:38 +00:00
parent 92ee7505d8
commit 7dcdcbbc24
18 changed files with 184 additions and 647 deletions

View file

@ -17,12 +17,12 @@ ifneq ($(CONFIG_LINUX_2_6_21)$(CONFIG_LINUX_2_6_25),)
PKG_MD5SUM:=9563ceeed86bca0859ad5f010623277c
PATCH_DIR:=./patches-old
else
PKG_VERSION:=2009-06-25
PKG_RELEASE:=3
PKG_VERSION:=2009-08-15
PKG_RELEASE:=1
PKG_SOURCE_URL:= \
http://www.orbit-lab.org/kernel/compat-wireless-2.6/2009/06 \
http://www.orbit-lab.org/kernel/compat-wireless-2.6/2009/08 \
http://wireless.kernel.org/download/compat-wireless-2.6
PKG_MD5SUM:=e76d2580436069e2b44f0f57db790bfe
PKG_MD5SUM:=bc71c2b8554bb79511e9a38dd6d5b318
endif
PKG_SOURCE:=compat-wireless-$(PKG_VERSION).tar.bz2
@ -429,7 +429,6 @@ BUILDFLAGS:= \
$(if $(CONFIG_PCI),-DCONFIG_SSB_PCIHOST_POSSIBLE -DCONFIG_SSB_PCIHOST) \
$(if $(CONFIG_PCI),-DCONFIG_SSB_SPROM) \
$(if $(CONFIG_LEDS_TRIGGERS), -DCONFIG_MAC80211_LEDS -DCONFIG_LEDS_TRIGGERS -DCONFIG_B43_LEDS -DCONFIG_B43LEGACY_LEDS) \
$(if $(CONFIG_RFKILL_INPUT),-DCONFIG_B43_RFKILL -DCONFIG_B43LEGACY_RFKILL) \
$(if $(CONFIG_HW_RANDOM),-DCONFIG_B43_HWRNG -DCONFIG_B43LEGACY_HWRNG) \
$(if $(CONFIG_DEBUG_FS), -DCONFIG_MAC80211_DEBUGFS) \
-D__CONFIG_MAC80211_RC_DEFAULT=minstrel \
@ -451,8 +450,6 @@ MAKE_OPTS:= \
$(if $(CONFIG_PCI),CONFIG_SSB_DRIVER_PCICORE=y,CONFIG_SSB_DRIVER_PCICORE=n) \
$(if $(CONFIG_PCI),CONFIG_SSB_PCIHOST_POSSIBLE=y,CONFIG_SSB_PCIHOST_POSSIBLE=n) \
$(if $(CONFIG_PCI),CONFIG_SSB_PCIHOST=y,CONFIG_SSB_PCIHOST=n) \
$(if $(CONFIG_RFKILL_INPUT),CONFIG_B43_RFKILL=y,CONFIG_B43_RFKILL=n) \
$(if $(CONFIG_RFKILL_INPUT),CONFIG_B43LEGACY_RFKILL=y,CONFIG_B43LEGACY_RFKILL=n) \
CONFIG_B43LEGACY_LEDS=$(CONFIG_LEDS_TRIGGERS) \
CONFIG_B43_LEDS=$(CONFIG_LEDS_TRIGGERS) \
$(if $(CONFIG_HW_RANDOM),CONFIG_B43_HWRNG=y,CONFIG_B43_HWRNG=n) \

View file

@ -1,12 +1,10 @@
--- a/Makefile
+++ b/Makefile
@@ -20,8 +20,7 @@ NOSTDINC_FLAGS := -I$(M)/include/ -inclu
@@ -22,7 +22,6 @@ NOSTDINC_FLAGS := -I$(M)/include/ -inclu
obj-y := net/wireless/ net/mac80211/ net/rfkill/
ifeq ($(ONLY_CORE),)
obj-$(CONFIG_B44) += drivers/net/b44.o
-obj-y += drivers/ssb/ \
- drivers/misc/eeprom/ \
+obj-y += drivers/misc/eeprom/ \
obj-m += \
- drivers/ssb/ \
drivers/misc/eeprom/ \
drivers/net/usb/ \
drivers/net/wireless/
endif

View file

@ -1,7 +1,7 @@
--- a/config.mk
+++ b/config.mk
@@ -107,10 +107,10 @@ CONFIG_MAC80211_MESH=y
CONFIG_CFG80211=m
@@ -153,10 +153,10 @@ CONFIG_CFG80211_DEFAULT_PS=y
CONFIG_CFG80211_DEFAULT_PS_VALUE=1
# CONFIG_CFG80211_REG_DEBUG=y
-CONFIG_LIB80211=m
@ -15,7 +15,7 @@
# CONFIG_LIB80211_DEBUG=y
CONFIG_WIRELESS_OLD_REGULATORY=n
@@ -123,61 +123,61 @@ ifneq ($(CONFIG_PCI),)
@@ -169,61 +169,61 @@ ifneq ($(CONFIG_PCI),)
CONFIG_ATH5K=m
# CONFIG_ATH5K_DEBUG=y
@ -36,12 +36,12 @@
# CONFIG_IWLWIFI_DEBUG=y
# CONFIG_IWLWIFI_DEBUGFS=y
-CONFIG_IWLAGN=m
-CONFIG_IWL4965=y
-CONFIG_COMPAT_IWL4965=y
-CONFIG_IWL5000=y
-CONFIG_IWL3945=m
-CONFIG_IWL3945_SPECTRUM_MEASUREMENT=y
+# CONFIG_IWLAGN=m
+# CONFIG_IWL4965=y
+# CONFIG_COMPAT_IWL4965=y
+# CONFIG_IWL5000=y
+# CONFIG_IWL3945=m
+# CONFIG_IWL3945_SPECTRUM_MEASUREMENT=y
@ -112,7 +112,7 @@
# CONFIG_IPW2200_DEBUG=y
# The above enables use a second interface prefixed 'rtap'.
# Example usage:
@@ -192,27 +192,27 @@ CONFIG_IPW2200_QOS=y
@@ -238,27 +238,27 @@ CONFIG_IPW2200_QOS=y
#
# % echo 1 > /sys/bus/pci/drivers/ipw2200/*/rtap_iface
@ -154,7 +154,7 @@
CONFIG_RT2X00_LIB_PCI=m
CONFIG_RT2400PCI=m
@@ -228,24 +228,24 @@ CONFIG_RT61PCI=m
@@ -274,10 +274,10 @@ CONFIG_RT61PCI=m
NEED_RT2X00_FIRMWARE=y
endif
@ -168,13 +168,20 @@
endif
## end of PCI
@@ -285,18 +285,18 @@ endif
ifneq ($(CONFIG_PCMCIA),)
ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 26 && echo yes),yes)
-CONFIG_LIBERTAS=n
-CONFIG_LIBERTAS_CS=n
+# CONFIG_LIBERTAS=n
+# CONFIG_LIBERTAS_CS=n
else
-CONFIG_LIBERTAS_CS=m
-NEED_LIBERTAS=y
+# CONFIG_LIBERTAS_CS=m
+# NEED_LIBERTAS=y
endif
endif
## end of PCMCIA
@ -185,7 +192,7 @@
# USB Drivers
ifneq ($(CONFIG_USB),)
@@ -259,21 +259,21 @@ CONFIG_ZD1211RW=m
@@ -310,19 +310,19 @@ CONFIG_ZD1211RW=m
# is only wireless RNDIS chip known to date.
# Note: this depends on CONFIG_USB_NET_RNDIS_HOST and CONFIG_USB_NET_CDCETHER
# it also requires new RNDIS_HOST and CDC_ETHER modules which we add
@ -203,9 +210,7 @@
-CONFIG_AT76C50X_USB=m
+# CONFIG_AT76C50X_USB=m
# Activate AR9170 support only on kernel >= 2.6.29.
# The needed USB poison feature was added in this kernel release.
ifeq ($(shell test $(KERNEL_SUBLEVEL) -ge 29 && echo yes),yes)
ifeq ($(shell test $(KERNEL_SUBLEVEL) -ge 28 && echo yes),yes)
-CONFIG_AR9170_USB=m
-CONFIG_AR9170_LEDS=y
+# CONFIG_AR9170_USB=m
@ -213,16 +218,24 @@
endif
# RT2500USB does not require firmware
@@ -287,30 +287,30 @@ CONFIG_RT73USB=m
NEED_RT2X00_FIRMWARE=y
@@ -337,28 +337,28 @@ NEED_RT2X00_FIRMWARE=y
endif
ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 26 && echo yes),yes)
-CONFIG_LIBERTAS_THINFIRM_USB=n
-CONFIG_LIBERTAS_USB=n
-NEED_LIBERTAS=n
+# CONFIG_LIBERTAS_THINFIRM_USB=n
+# CONFIG_LIBERTAS_USB=n
+# NEED_LIBERTAS=n
else
-CONFIG_LIBERTAS_THINFIRM_USB=m
-CONFIG_LIBERTAS_USB=m
-NEED_LIBERTAS=y
+# CONFIG_LIBERTAS_THINFIRM_USB=m
+# CONFIG_LIBERTAS_USB=m
+# NEED_LIBERTAS=y
endif
endif # end of USB driver list
@ -230,21 +243,36 @@
-CONFIG_WL1251=m
-CONFIG_P54_SPI=m
-CONFIG_LIBERTAS_SPI=m
-NEED_LIBERTAS=y
+# CONFIG_WL1251=m
+# CONFIG_P54_SPI=m
ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 26 && echo yes),yes)
-CONFIG_LIBERTAS_SPI=n
-NEED_LIBERTAS=n
+# CONFIG_LIBERTAS_SPI=n
+# NEED_LIBERTAS=n
else
-CONFIG_LIBERTAS_SPI=m
-NEED_LIBERTAS=y
+# CONFIG_LIBERTAS_SPI=m
+# NEED_LIBERTAS=y
endif
endif # end of SPI driver list
@@ -366,17 +366,17 @@ endif # end of SPI driver list
ifneq ($(CONFIG_MMC),)
ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 26 && echo yes),yes)
-CONFIG_LIBERTAS_SDIO=n
-NEED_LIBERTAS=n
+# CONFIG_LIBERTAS_SDIO=n
+# NEED_LIBERTAS=n
else
-CONFIG_LIBERTAS_SDIO=m
-NEED_LIBERTAS=y
+# CONFIG_LIBERTAS_SDIO=m
+# NEED_LIBERTAS=y
endif
# Activate iwmc3200wifi support only on kernel >= 2.6.29.
# iwmc3200wifi uses new netdev_ops api no supported by old kernel.
@ -254,7 +282,7 @@
# CONFIG_IWM_DEBUG=y
endif
@@ -323,7 +323,7 @@ CONFIG_RT2X00_LIB=m
@@ -389,7 +389,7 @@ CONFIG_RT2X00_LIB=m
CONFIG_RT2X00_LIB_HT=y
CONFIG_RT2X00_LIB_FIRMWARE=y
CONFIG_RT2X00_LIB_CRYPTO=y
@ -263,12 +291,20 @@
CONFIG_RT2X00_LIB_LEDS=y
# CONFIG_RT2X00_LIB_DEBUGFS=y
# CONFIG_RT2X00_DEBUG=y
@@ -340,25 +340,25 @@ CONFIG_P54_LEDS=y
@@ -406,24 +406,24 @@ CONFIG_P54_LEDS=y
# Atheros
CONFIG_ATH_COMMON=m
-CONFIG_WL12XX=y
-CONFIG_WL1251=m
-CONFIG_WL1251_SPI=m
-CONFIG_WL1251_SDIO=m
-CONFIG_WL1271=m
+# CONFIG_WL12XX=y
+# CONFIG_WL1251=m
+# CONFIG_WL1251_SPI=m
+# CONFIG_WL1251_SDIO=m
+# CONFIG_WL1271=m
# Sonics Silicon Backplane
-CONFIG_SSB_POSSIBLE=y
@ -279,6 +315,10 @@
+# CONFIG_SSB_SPROM=y
# CONFIG_SSB_DEBUG=y
ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 26 && echo yes),yes)
-CONFIG_LIBERTAS=n
+# CONFIG_LIBERTAS=n
else
ifeq ($(NEED_LIBERTAS),y)
-CONFIG_LIBERTAS_THINFIRM=m
-CONFIG_LIBERTAS=m
@ -286,7 +326,8 @@
+# CONFIG_LIBERTAS=m
# CONFIG_LIBERTAS_DEBUG=y
endif
endif
@@ -431,8 +431,8 @@ endif
# We need the backported rfkill module on kernel < 2.6.31.
# In more recent kernel versions use the in kernel rfkill module.
ifeq ($(shell test $(KERNEL_SUBLEVEL) -le 30 && echo yes),yes)

View file

@ -0,0 +1,81 @@
--- a/net/wireless/compat-2.6.28.c
+++ b/net/wireless/compat-2.6.28.c
@@ -12,10 +12,11 @@
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28))
-#include <linux/usb.h>
-
/* 2.6.28 compat code goes here */
+#ifdef CONFIG_AR9170_USB
+#include <linux/usb.h>
+
/*
* Compat-wireless notes for USB backport stuff:
*
@@ -206,6 +207,7 @@ int usb_anchor_empty(struct usb_anchor *
}
EXPORT_SYMBOL_GPL(usb_anchor_empty);
+#endif
void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)
--- a/include/net/compat-2.6.28.h
+++ b/include/net/compat-2.6.28.h
@@ -9,7 +9,6 @@
#include <linux/skbuff.h>
#include <linux/if_ether.h>
-#include <linux/usb.h>
#ifndef ETH_P_PAE
#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
@@ -42,6 +41,8 @@ extern void usb_poison_urb(struct urb *u
#endif
extern void usb_unpoison_urb(struct urb *urb);
+#ifdef CONFIG_AR9170_USB
+#include <linux/usb.h>
#if 0
extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
#endif
@@ -49,6 +50,7 @@ extern void usb_poison_anchored_urbs(str
extern struct urb *usb_get_from_anchor(struct usb_anchor *anchor);
extern void usb_scuttle_anchored_urbs(struct usb_anchor *anchor);
extern int usb_anchor_empty(struct usb_anchor *anchor);
+#endif
void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
--- a/net/wireless/compat-2.6.29.c
+++ b/net/wireless/compat-2.6.29.c
@@ -12,6 +12,7 @@
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
+#ifdef CONFIG_AR9170_USB
#include <linux/usb.h>
/**
@@ -34,6 +35,7 @@ void usb_unpoison_anchored_urbs(struct u
spin_unlock_irqrestore(&anchor->lock, flags);
}
EXPORT_SYMBOL_GPL(usb_unpoison_anchored_urbs);
+#endif
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) */
--- a/include/net/compat-2.6.29.h
+++ b/include/net/compat-2.6.29.h
@@ -41,7 +41,9 @@ static inline struct sk_buff *skb_queue_
return skb->prev;
}
+#ifdef CONFIG_AR9170_USB
extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
+#endif
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) */

View file

@ -1,117 +0,0 @@
From: Johannes Berg <johannes@sipsolutions.net>
Subject: mac80211: fix todo lock
The key todo lock can be taken from different locks
that require it to be _bh to avoid lock inversion
due to (soft)irqs.
This should fix the two problems reported by Bob and
Gabor:
http://mid.gmane.org/20090619113049.GB18956@hash.localnet
http://mid.gmane.org/4A3FA376.8020307@openwrt.org
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Bob Copeland <me@bobcopeland.com>
Cc: Gabor Juhos <juhosg@openwrt.org>
---
net/mac80211/key.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -70,6 +70,8 @@ static DECLARE_WORK(todo_work, key_todo)
*
* @key: key to add to do item for
* @flag: todo flag(s)
+ *
+ * Must be called with IRQs or softirqs disabled.
*/
static void add_todo(struct ieee80211_key *key, u32 flag)
{
@@ -143,9 +145,9 @@ static void ieee80211_key_enable_hw_acce
ret = drv_set_key(key->local, SET_KEY, &sdata->vif, sta, &key->conf);
if (!ret) {
- spin_lock(&todo_lock);
+ spin_lock_bh(&todo_lock);
key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE;
- spin_unlock(&todo_lock);
+ spin_unlock_bh(&todo_lock);
}
if (ret && ret != -ENOSPC && ret != -EOPNOTSUPP)
@@ -167,12 +169,12 @@ static void ieee80211_key_disable_hw_acc
if (!key || !key->local->ops->set_key)
return;
- spin_lock(&todo_lock);
+ spin_lock_bh(&todo_lock);
if (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) {
- spin_unlock(&todo_lock);
+ spin_unlock_bh(&todo_lock);
return;
}
- spin_unlock(&todo_lock);
+ spin_unlock_bh(&todo_lock);
sta = get_sta_for_key(key);
sdata = key->sdata;
@@ -191,9 +193,9 @@ static void ieee80211_key_disable_hw_acc
wiphy_name(key->local->hw.wiphy),
key->conf.keyidx, sta ? sta->addr : bcast_addr, ret);
- spin_lock(&todo_lock);
+ spin_lock_bh(&todo_lock);
key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE;
- spin_unlock(&todo_lock);
+ spin_unlock_bh(&todo_lock);
}
static void __ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata,
@@ -440,14 +442,14 @@ void ieee80211_key_link(struct ieee80211
__ieee80211_key_replace(sdata, sta, old_key, key);
- spin_unlock_irqrestore(&sdata->local->key_lock, flags);
-
/* free old key later */
add_todo(old_key, KEY_FLAG_TODO_DELETE);
add_todo(key, KEY_FLAG_TODO_ADD_DEBUGFS);
if (netif_running(sdata->dev))
add_todo(key, KEY_FLAG_TODO_HWACCEL_ADD);
+
+ spin_unlock_irqrestore(&sdata->local->key_lock, flags);
}
static void __ieee80211_key_free(struct ieee80211_key *key)
@@ -550,7 +552,7 @@ static void __ieee80211_key_todo(void)
*/
synchronize_rcu();
- spin_lock(&todo_lock);
+ spin_lock_bh(&todo_lock);
while (!list_empty(&todo_list)) {
key = list_first_entry(&todo_list, struct ieee80211_key, todo);
list_del_init(&key->todo);
@@ -561,7 +563,7 @@ static void __ieee80211_key_todo(void)
KEY_FLAG_TODO_HWACCEL_REMOVE |
KEY_FLAG_TODO_DELETE);
key->flags &= ~todoflags;
- spin_unlock(&todo_lock);
+ spin_unlock_bh(&todo_lock);
work_done = false;
@@ -594,9 +596,9 @@ static void __ieee80211_key_todo(void)
WARN_ON(!work_done);
- spin_lock(&todo_lock);
+ spin_lock_bh(&todo_lock);
}
- spin_unlock(&todo_lock);
+ spin_unlock_bh(&todo_lock);
}
void ieee80211_key_todo(void)

View file

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath5k/reset.c
+++ b/drivers/net/wireless/ath/ath5k/reset.c
@@ -1296,8 +1296,14 @@ int ath5k_hw_reset(struct ath5k_hw *ah,
@@ -1370,8 +1370,14 @@ int ath5k_hw_reset(struct ath5k_hw *ah,
if (ah->ah_version != AR5K_AR5210) {
AR5K_REG_WRITE_BITS(ah, AR5K_TXCFG,
AR5K_TXCFG_SDMAMR, AR5K_DMASIZE_128B);

View file

@ -1,7 +1,7 @@
From ef5c58e9a39ba9a264fec2c2bfddbae51fe85da1 Mon Sep 17 00:00:00 2001
From 671e062837669b6d4a5e75d7d08ff485a7510e80 Mon Sep 17 00:00:00 2001
From: Ivo van Doorn <IvDoorn@gmail.com>
Date: Thu, 21 May 2009 19:17:53 +0200
Subject: [PATCH 1/2] rt2x00: Add rt2x00soc bus module
Date: Sat, 8 Aug 2009 23:42:51 +0200
Subject: [PATCH 1/3] rt2x00: Add rt2x00soc bus module
Add new library module for SoC drivers.
This is needed to fully support the platform
@ -22,7 +22,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
--- a/drivers/net/wireless/rt2x00/Makefile
+++ b/drivers/net/wireless/rt2x00/Makefile
@@ -12,6 +12,7 @@ rt2x00lib-$(CONFIG_RT2X00_LIB_HT) += rt2
@@ -11,6 +11,7 @@ rt2x00lib-$(CONFIG_RT2X00_LIB_HT) += rt2
obj-$(CONFIG_RT2X00_LIB) += rt2x00lib.o
obj-$(CONFIG_RT2X00_LIB_PCI) += rt2x00pci.o

View file

@ -1,30 +1,31 @@
From c5d3ab153ef4b68c9c6fab32f6f292c4394b72d3 Mon Sep 17 00:00:00 2001
From 8dff6729a634d7cf223679d9a29a3df77927540c Mon Sep 17 00:00:00 2001
From: Ivo van Doorn <IvDoorn@gmail.com>
Date: Thu, 21 May 2009 19:21:31 +0200
Subject: [PATCH 2/2] rt2x00: Implement support for rt2800pci
Date: Sat, 8 Aug 2009 23:47:53 +0200
Subject: [PATCH 2/3] rt2x00: Implement support for rt2800pci
Add support for the rt2800pci chipset.
Includes various patches from Mattias, Mark, Felix and Xose.
Includes various patches from Luis, Mattias, Mark, Felix and Xose.
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: Mattias Nissler <mattias.nissler@gmx.de>
Signed-off-by: Mark Asselstine <asselsm@gmail.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Luis Correia <luis.f.correia@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
drivers/net/wireless/rt2x00/Kconfig | 26 +
drivers/net/wireless/rt2x00/Makefile | 1 +
drivers/net/wireless/rt2x00/rt2800pci.c | 3241 +++++++++++++++++++++++++++++++
drivers/net/wireless/rt2x00/rt2800pci.c | 3243 +++++++++++++++++++++++++++++++
drivers/net/wireless/rt2x00/rt2800pci.h | 1929 ++++++++++++++++++
drivers/net/wireless/rt2x00/rt2x00.h | 6 +
5 files changed, 5203 insertions(+), 0 deletions(-)
5 files changed, 5205 insertions(+), 0 deletions(-)
create mode 100644 drivers/net/wireless/rt2x00/rt2800pci.c
create mode 100644 drivers/net/wireless/rt2x00/rt2800pci.h
--- a/drivers/net/wireless/rt2x00/Makefile
+++ b/drivers/net/wireless/rt2x00/Makefile
@@ -17,6 +17,7 @@ obj-$(CONFIG_RT2X00_LIB_USB) += rt2x00u
@@ -16,6 +16,7 @@ obj-$(CONFIG_RT2X00_LIB_USB) += rt2x00u
obj-$(CONFIG_RT2400PCI) += rt2400pci.o
obj-$(CONFIG_RT2500PCI) += rt2500pci.o
obj-$(CONFIG_RT61PCI) += rt61pci.o
@ -412,7 +413,6 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+};
+#endif /* CONFIG_RT2X00_LIB_DEBUGFS */
+
+#ifdef CONFIG_RT2X00_LIB_RFKILL
+static int rt2800pci_rfkill_poll(struct rt2x00_dev *rt2x00dev)
+{
+ u32 reg;
@ -420,9 +420,6 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2x00pci_register_read(rt2x00dev, GPIO_CTRL_CFG, &reg);
+ return rt2x00_get_field32(reg, GPIO_CTRL_CFG_BIT2);
+}
+#else
+#define rt2800pci_rfkill_poll NULL
+#endif /* CONFIG_RT2X00_LIB_RFKILL */
+
+#ifdef CONFIG_RT2X00_LIB_LEDS
+static void rt2800pci_brightness_set(struct led_classdev *led_cdev,
@ -661,7 +658,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_RTS,
+ !(filter_flags & FIF_CONTROL));
+ rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_PSPOLL,
+ !(filter_flags & FIF_CONTROL));
+ !(filter_flags & FIF_PSPOLL));
+ rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_BA, 1);
+ rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_BAR, 0);
+ rt2x00_set_field32(&reg, RX_FILTER_CFG_DROP_CNTL,
@ -2078,9 +2075,9 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ enum dev_state state)
+{
+ /*
+ * Always put the device to sleep (even when we intend to wakup!)
+ * Always put the device to sleep (even when we intend to wakeup!)
+ * if the device is booting and wasn't asleep it will return
+ * failure when attempting to wakup.
+ * failure when attempting to wakeup.
+ */
+ rt2800pci_mcu_request(rt2x00dev, MCU_SLEEP, 0xff, 0, 2);
+
@ -2102,7 +2099,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ /*
+ * Before the radio can be enabled, the device first has
+ * to be woken up. After that it needs a bit of time
+ * to be fully awake and the radio can be enabled.
+ * to be fully awake and then the radio can be enabled.
+ */
+ rt2800pci_set_state(rt2x00dev, STATE_AWAKE);
+ msleep(1);
@ -2110,7 +2107,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ break;
+ case STATE_RADIO_OFF:
+ /*
+ * After the radio has been disablee, the device should
+ * After the radio has been disabled, the device should
+ * be put to sleep for powersaving.
+ */
+ rt2800pci_disable_radio(rt2x00dev);
@ -2250,8 +2247,6 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ * otherwise we might be sending out invalid data.
+ */
+ rt2x00pci_register_read(rt2x00dev, BCN_TIME_CFG, &reg);
+ rt2x00_set_field32(&reg, BCN_TIME_CFG_TSF_TICKING, 0);
+ rt2x00_set_field32(&reg, BCN_TIME_CFG_TBTT_ENABLE, 0);
+ rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 0);
+ rt2x00pci_register_write(rt2x00dev, BCN_TIME_CFG, reg);
+
@ -2715,10 +2710,8 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ /*
+ * Detect if this device has an hardware controlled radio.
+ */
+#ifdef CONFIG_RT2X00_LIB_RFKILL
+ if (rt2x00_get_field16(eeprom, EEPROM_NIC_HW_RADIO))
+ __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
+#endif /* CONFIG_RT2X00_LIB_RFKILL */
+
+ /*
+ * Store led settings, for correct led behaviour.
@ -2934,6 +2927,13 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ return retval;
+
+ /*
+ * This device has multiple filters for control frames
+ * and has a separate filter for PS Poll frames.
+ */
+ __set_bit(DRIVER_SUPPORT_CONTROL_FILTERS, &rt2x00dev->flags);
+ __set_bit(DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL, &rt2x00dev->flags);
+
+ /*
+ * This device requires firmware.
+ */
+ if (!rt2x00_rt(&rt2x00dev->chip, RT2880) &&
@ -3104,6 +3104,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+ .conf_tx = rt2800pci_conf_tx,
+ .get_tx_stats = rt2x00mac_get_tx_stats,
+ .get_tsf = rt2800pci_get_tsf,
+ .rfkill_poll = rt2x00mac_rfkill_poll,
+};
+
+static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = {
@ -3340,7 +3341,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+
+/*
+ * Signal information.
+ * Defaul offset is required for RSSI <-> dBm conversion.
+ * Default offset is required for RSSI <-> dBm conversion.
+ */
+#define DEFAULT_RSSI_OFFSET 120 /* FIXME */
+
@ -5045,7 +5046,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+
+/*
+ * Word3
+ * WIV: Wireless Info Valid. 1: Driver filled WI, 0: DMA needs to copy WI
+ * WIV: Wireless Info Valid. 1: Driver filled WI, 0: DMA needs to copy WI
+ * QSEL: Select on-chip FIFO ID for 2nd-stage output scheduler.
+ * 0:MGMT, 1:HCCA 2:EDCA
+ */
@ -5186,7 +5187,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+#define RXWI_W3_SNR1 FIELD32(0x0000ff00)
+
+/*
+ * Macro's for converting txpower from EEPROM to mac80211 value
+ * Macros for converting txpower from EEPROM to mac80211 value
+ * and from mac80211 value to register value.
+ */
+#define MIN_G_TXPOWER 0
@ -5210,7 +5211,7 @@ Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
+#endif /* RT2800PCI_H */
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -147,6 +147,12 @@ struct rt2x00_chip {
@@ -158,6 +158,12 @@ struct rt2x00_chip {
#define RT2561 0x0302
#define RT2661 0x0401
#define RT2571 0x1300

View file

@ -7,10 +7,10 @@
+ if (AR_SREV_9100(sc->sc_ah))
+ return;
+
cancel_delayed_work_sync(&sc->ath_led_blink_work);
ath_unregister_led(&sc->assoc_led);
sc->sc_flags &= ~SC_OP_LED_ASSOCIATED;
@@ -1071,6 +1074,9 @@ static void ath_init_leds(struct ath_sof
ath_unregister_led(&sc->tx_led);
@@ -1070,6 +1073,9 @@ static void ath_init_leds(struct ath_sof
char *trigger;
int ret;

View file

@ -1,6 +1,6 @@
--- a/config.mk
+++ b/config.mk
@@ -125,7 +125,7 @@ CONFIG_ATH5K=m
@@ -171,7 +171,7 @@ CONFIG_ATH5K=m
# CONFIG_ATH5K_DEBUG=y
# CONFIG_ATH5K_RFKILL=y
CONFIG_ATH9K=m

View file

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -534,8 +534,18 @@ static int ath9k_hw_init_macaddr(struct
@@ -521,8 +521,18 @@ static int ath9k_hw_init_macaddr(struct
ah->macaddr[2 * i] = eeval >> 8;
ah->macaddr[2 * i + 1] = eeval & 0xff;
}

View file

@ -1,33 +0,0 @@
From d2fa21debb4ea8c022b0fbed165eea821d19da9e Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Sat, 20 Jun 2009 23:57:22 +0200
Subject: [PATCH] ath9k: wake up the chip for TSF reset
If we are in NETWORK SLEEP state, AR_SLP32_TSF_WRITE_STATUS limit
always exceeds in 'ath9k_hw_reset_tsf', because reading of the
AR_SLP3 register always return with the magic 0xdeadbeef value.
Changes-licensed-under: ISC
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
drivers/net/wireless/ath/ath9k/hw.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -3803,6 +3803,7 @@ void ath9k_hw_reset_tsf(struct ath_hw *a
{
int count;
+ ath9k_ps_wakeup(ah->ah_sc);
count = 0;
while (REG_READ(ah, AR_SLP32_MODE) & AR_SLP32_TSF_WRITE_STATUS) {
count++;
@@ -3814,6 +3815,7 @@ void ath9k_hw_reset_tsf(struct ath_hw *a
udelay(10);
}
REG_WRITE(ah, AR_RESET_TSF, AR_RESET_TSF_ONCE);
+ ath9k_ps_restore(ah->ah_sc);
}
bool ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting)

View file

@ -1,52 +0,0 @@
From 9a0a0221024ddb4ddf0e33bb6fdbb3b02eaaf292 Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Sat, 20 Jun 2009 23:57:23 +0200
Subject: [PATCH] ath9k: make use ath9k_hw_wait int ath9k_hw_reset_tsf
We have a dedicated function for this kind of checks, use that
instead of duplicating the code.
Changes-licensed-under: ISC
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
drivers/net/wireless/ath/ath9k/hw.c | 17 +++++------------
drivers/net/wireless/ath/ath9k/hw.h | 1 +
2 files changed, 6 insertions(+), 12 deletions(-)
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -3801,19 +3801,12 @@ void ath9k_hw_settsf64(struct ath_hw *ah
void ath9k_hw_reset_tsf(struct ath_hw *ah)
{
- int count;
-
ath9k_ps_wakeup(ah->ah_sc);
- count = 0;
- while (REG_READ(ah, AR_SLP32_MODE) & AR_SLP32_TSF_WRITE_STATUS) {
- count++;
- if (count > 10) {
- DPRINTF(ah->ah_sc, ATH_DBG_RESET,
- "AR_SLP32_TSF_WRITE_STATUS limit exceeded\n");
- break;
- }
- udelay(10);
- }
+ if (!ath9k_hw_wait(ah, AR_SLP32_MODE, AR_SLP32_TSF_WRITE_STATUS, 0,
+ AH_TSF_WRITE_TIMEOUT))
+ DPRINTF(ah->ah_sc, ATH_DBG_RESET,
+ "AR_SLP32_TSF_WRITE_STATUS limit exceeded\n");
+
REG_WRITE(ah, AR_RESET_TSF, AR_RESET_TSF_ONCE);
ath9k_ps_restore(ah->ah_sc);
}
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -95,6 +95,7 @@
#define MAX_RATE_POWER 63
#define AH_WAIT_TIMEOUT 100000 /* (us) */
+#define AH_TSF_WRITE_TIMEOUT 100 /* (us) */
#define AH_TIME_QUANTUM 10
#define AR_KEYTABLE_SIZE 128
#define POWER_UP_TIME 200000

View file

@ -1,67 +0,0 @@
From 841c7e339c4775f4cc614c92aaea82f70fcafbdb Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Sun, 21 Jun 2009 16:59:53 +0200
Subject: [PATCH 1/3] ath9k: serialize ath9k_hw_setpower calls
Because ath9k_setpower is called from various contexts, we have to
protect it against concurrent calls.
Changes-licensed-under: ISC
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
drivers/net/wireless/ath/ath9k/ath9k.h | 1 +
drivers/net/wireless/ath/ath9k/hw.c | 15 ++++++++++++++-
drivers/net/wireless/ath/ath9k/main.c | 1 +
3 files changed, 16 insertions(+), 1 deletions(-)
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -544,6 +544,7 @@ struct ath_softc {
int irq;
spinlock_t sc_resetlock;
spinlock_t sc_serial_rw;
+ spinlock_t sc_pm_lock;
struct mutex mutex;
u8 curbssid[ETH_ALEN];
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2738,7 +2738,8 @@ static bool ath9k_hw_set_power_awake(str
return true;
}
-bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode)
+static bool ath9k_hw_setpower_nolock(struct ath_hw *ah,
+ enum ath9k_power_mode mode)
{
int status = true, setChip = true;
static const char *modes[] = {
@@ -2772,6 +2773,18 @@ bool ath9k_hw_setpower(struct ath_hw *ah
return status;
}
+bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode)
+{
+ unsigned long flags;
+ bool ret;
+
+ spin_lock_irqsave(&ah->ah_sc->sc_pm_lock, flags);
+ ret = ath9k_hw_setpower_nolock(ah, mode);
+ spin_unlock_irqrestore(&ah->ah_sc->sc_pm_lock, flags);
+
+ return ret;
+}
+
/*
* Helper for ASPM support.
*
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1317,6 +1317,7 @@ static int ath_init(u16 devid, struct at
spin_lock_init(&sc->wiphy_lock);
spin_lock_init(&sc->sc_resetlock);
spin_lock_init(&sc->sc_serial_rw);
+ spin_lock_init(&sc->sc_pm_lock);
mutex_init(&sc->mutex);
tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc);
tasklet_init(&sc->bcon_tasklet, ath_beacon_tasklet,

View file

@ -1,76 +0,0 @@
From 900d70802f15e835b3dbbe8750313824aa30a118 Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Sun, 21 Jun 2009 16:59:53 +0200
Subject: [PATCH 2/3] ath9k: uninline ath9k_ps_{wakeup,restore} functions
Uninline these functions before we add functional changes to them.
Changes-licensed-under: ISC
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
drivers/net/wireless/ath/ath9k/ath9k.h | 23 ++---------------------
drivers/net/wireless/ath/ath9k/hw.c | 21 +++++++++++++++++++++
2 files changed, 23 insertions(+), 21 deletions(-)
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -658,27 +658,8 @@ static inline int ath_ahb_init(void) { r
static inline void ath_ahb_exit(void) {};
#endif
-static inline void ath9k_ps_wakeup(struct ath_softc *sc)
-{
- if (atomic_inc_return(&sc->ps_usecount) == 1)
- if (sc->sc_ah->power_mode != ATH9K_PM_AWAKE) {
- sc->sc_ah->restore_mode = sc->sc_ah->power_mode;
- ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE);
- }
-}
-
-static inline void ath9k_ps_restore(struct ath_softc *sc)
-{
- if (atomic_dec_and_test(&sc->ps_usecount))
- if ((sc->hw->conf.flags & IEEE80211_CONF_PS) &&
- !(sc->sc_flags & (SC_OP_WAIT_FOR_BEACON |
- SC_OP_WAIT_FOR_CAB |
- SC_OP_WAIT_FOR_PSPOLL_DATA |
- SC_OP_WAIT_FOR_TX_ACK)))
- ath9k_hw_setpower(sc->sc_ah,
- sc->sc_ah->restore_mode);
-}
-
+void ath9k_ps_wakeup(struct ath_softc *sc);
+void ath9k_ps_restore(struct ath_softc *sc);
void ath9k_set_bssid_mask(struct ieee80211_hw *hw);
int ath9k_wiphy_add(struct ath_softc *sc);
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2785,6 +2785,27 @@ bool ath9k_hw_setpower(struct ath_hw *ah
return ret;
}
+void ath9k_ps_wakeup(struct ath_softc *sc)
+{
+ if (atomic_inc_return(&sc->ps_usecount) == 1)
+ if (sc->sc_ah->power_mode != ATH9K_PM_AWAKE) {
+ sc->sc_ah->restore_mode = sc->sc_ah->power_mode;
+ ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE);
+ }
+}
+
+void ath9k_ps_restore(struct ath_softc *sc)
+{
+ if (atomic_dec_and_test(&sc->ps_usecount))
+ if ((sc->hw->conf.flags & IEEE80211_CONF_PS) &&
+ !(sc->sc_flags & (SC_OP_WAIT_FOR_BEACON |
+ SC_OP_WAIT_FOR_CAB |
+ SC_OP_WAIT_FOR_PSPOLL_DATA |
+ SC_OP_WAIT_FOR_TX_ACK)))
+ ath9k_hw_setpower(sc->sc_ah,
+ sc->sc_ah->restore_mode);
+}
+
/*
* Helper for ASPM support.
*

View file

@ -1,82 +0,0 @@
From 7446da6910f1368273a55ca99acba18828306a6e Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Sun, 21 Jun 2009 16:59:53 +0200
Subject: [PATCH 3/3] ath9k: serialize ath9k_ps_{wakeup,restore} calls
These functions are changing the power mode of the chip, but this may
have unpredictable effects, if another code are trying to set the power
mode via 'ath9k_hw_setpower' in the same time from another context.
Changes-licensed-under: ISC
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
drivers/net/wireless/ath/ath9k/ath9k.h | 2 +-
drivers/net/wireless/ath/ath9k/hw.c | 42 ++++++++++++++++++++++----------
2 files changed, 30 insertions(+), 14 deletions(-)
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -561,7 +561,7 @@ struct ath_softc {
u32 keymax;
DECLARE_BITMAP(keymap, ATH_KEYMAX);
u8 splitmic;
- atomic_t ps_usecount;
+ unsigned long ps_usecount;
enum ath9k_int imask;
enum ath9k_ht_extprotspacing ht_extprotspacing;
enum ath9k_ht_macmode tx_chan_width;
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2787,23 +2787,39 @@ bool ath9k_hw_setpower(struct ath_hw *ah
void ath9k_ps_wakeup(struct ath_softc *sc)
{
- if (atomic_inc_return(&sc->ps_usecount) == 1)
- if (sc->sc_ah->power_mode != ATH9K_PM_AWAKE) {
- sc->sc_ah->restore_mode = sc->sc_ah->power_mode;
- ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE);
- }
+ unsigned long flags;
+
+ spin_lock_irqsave(&sc->sc_pm_lock, flags);
+ if (++sc->ps_usecount != 1)
+ goto unlock;
+
+ if (sc->sc_ah->power_mode != ATH9K_PM_AWAKE) {
+ sc->sc_ah->restore_mode = sc->sc_ah->power_mode;
+ ath9k_hw_setpower_nolock(sc->sc_ah, ATH9K_PM_AWAKE);
+ }
+
+ unlock:
+ spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
}
void ath9k_ps_restore(struct ath_softc *sc)
{
- if (atomic_dec_and_test(&sc->ps_usecount))
- if ((sc->hw->conf.flags & IEEE80211_CONF_PS) &&
- !(sc->sc_flags & (SC_OP_WAIT_FOR_BEACON |
- SC_OP_WAIT_FOR_CAB |
- SC_OP_WAIT_FOR_PSPOLL_DATA |
- SC_OP_WAIT_FOR_TX_ACK)))
- ath9k_hw_setpower(sc->sc_ah,
- sc->sc_ah->restore_mode);
+ unsigned long flags;
+
+ spin_lock_irqsave(&sc->sc_pm_lock, flags);
+ if (--sc->ps_usecount != 0)
+ goto unlock;
+
+ if ((sc->hw->conf.flags & IEEE80211_CONF_PS) &&
+ !(sc->sc_flags & (SC_OP_WAIT_FOR_BEACON |
+ SC_OP_WAIT_FOR_CAB |
+ SC_OP_WAIT_FOR_PSPOLL_DATA |
+ SC_OP_WAIT_FOR_TX_ACK)))
+ ath9k_hw_setpower_nolock(sc->sc_ah,
+ sc->sc_ah->restore_mode);
+
+ unlock:
+ spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
}
/*

View file

@ -1,109 +0,0 @@
From c96f9c17f71213a562ce20d85a7418d5549235cc Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Fri, 24 Jul 2009 16:34:37 +0200
Subject: [PATCH 1/2] ath9k: fix race with IEEE80211_CONF_PS checks
There is a small window where the mac80211 changes the IEEE80211_CONF_PS
flag, and then informs the driver about the change. We have a race
condition if we are checking the flag in the same time. Avoid it by
introducing a local variable, and using that instead of checking the
IEEE80211_CONF_PS flag directly.
This fix the problem reported by Luis:
http://article.gmane.org/gmane.linux.kernel.wireless.general/34363
Changes-licensed-under: ISC
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
drivers/net/wireless/ath/ath9k/ath9k.h | 1 +
drivers/net/wireless/ath/ath9k/hw.c | 17 +++++++----------
drivers/net/wireless/ath/ath9k/hw.h | 1 -
drivers/net/wireless/ath/ath9k/main.c | 8 ++++----
4 files changed, 12 insertions(+), 15 deletions(-)
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -561,6 +561,7 @@ struct ath_softc {
u32 keymax;
DECLARE_BITMAP(keymap, ATH_KEYMAX);
u8 splitmic;
+ bool ps_enabled;
unsigned long ps_usecount;
enum ath9k_int imask;
enum ath9k_ht_extprotspacing ht_extprotspacing;
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2793,10 +2793,8 @@ void ath9k_ps_wakeup(struct ath_softc *s
if (++sc->ps_usecount != 1)
goto unlock;
- if (sc->sc_ah->power_mode != ATH9K_PM_AWAKE) {
- sc->sc_ah->restore_mode = sc->sc_ah->power_mode;
+ if (sc->sc_ah->power_mode != ATH9K_PM_AWAKE)
ath9k_hw_setpower_nolock(sc->sc_ah, ATH9K_PM_AWAKE);
- }
unlock:
spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
@@ -2810,13 +2808,12 @@ void ath9k_ps_restore(struct ath_softc *
if (--sc->ps_usecount != 0)
goto unlock;
- if ((sc->hw->conf.flags & IEEE80211_CONF_PS) &&
- !(sc->sc_flags & (SC_OP_WAIT_FOR_BEACON |
- SC_OP_WAIT_FOR_CAB |
- SC_OP_WAIT_FOR_PSPOLL_DATA |
- SC_OP_WAIT_FOR_TX_ACK)))
- ath9k_hw_setpower_nolock(sc->sc_ah,
- sc->sc_ah->restore_mode);
+ if (sc->ps_enabled &&
+ !(sc->sc_flags & (SC_OP_WAIT_FOR_BEACON |
+ SC_OP_WAIT_FOR_CAB |
+ SC_OP_WAIT_FOR_PSPOLL_DATA |
+ SC_OP_WAIT_FOR_TX_ACK)))
+ ath9k_hw_setpower_nolock(sc->sc_ah, ATH9K_PM_NETWORK_SLEEP);
unlock:
spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -418,7 +418,6 @@ struct ath_hw {
enum nl80211_iftype opmode;
enum ath9k_power_mode power_mode;
- enum ath9k_power_mode restore_mode;
struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS];
struct ar5416Stats stats;
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -496,8 +496,7 @@ static void ath9k_tasklet(unsigned long
if (status & ATH9K_INT_TX)
ath_tx_tasklet(sc);
- if ((status & ATH9K_INT_TSFOOR) &&
- (sc->hw->conf.flags & IEEE80211_CONF_PS)) {
+ if ((status & ATH9K_INT_TSFOOR) && sc->ps_enabled) {
/*
* TSF sync does not look correct; remain awake to sync with
* the next Beacon.
@@ -2001,7 +2000,7 @@ static int ath9k_tx(struct ieee80211_hw
goto exit;
}
- if (sc->hw->conf.flags & IEEE80211_CONF_PS) {
+ if (sc->ps_enabled) {
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
/*
* mac80211 does not set PM field for normal data frames, so we
@@ -2270,8 +2269,9 @@ static int ath9k_config(struct ieee80211
}
ath9k_hw_setrxabort(sc->sc_ah, 1);
}
- ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_NETWORK_SLEEP);
+ sc->ps_enabled = true;
} else {
+ sc->ps_enabled = false;
ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE);
if (!(ah->caps.hw_caps &
ATH9K_HW_CAP_AUTOSLEEP)) {

View file

@ -1,45 +0,0 @@
From 349626c9a263b41822a0c5a29061964b4a71ec3f Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Thu, 23 Jul 2009 09:55:52 +0200
Subject: [PATCH 2/2] ath9k: get rid of unnecessary setpower calls
We are using setpower routines regardless of the current power mode.
Don't bother the hardware, if it is not necessary.
Changes-licensed-under: ISC
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
drivers/net/wireless/ath/ath9k/hw.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -475,6 +475,8 @@ static struct ath_hw *ath9k_hw_newstate(
ah->gbeacon_rate = 0;
+ ah->power_mode = ATH9K_PM_UNDEFINED;
+
return ah;
}
@@ -2749,6 +2751,9 @@ static bool ath9k_hw_setpower_nolock(str
"UNDEFINED"
};
+ if (ah->power_mode == mode)
+ return status;
+
DPRINTF(ah->ah_sc, ATH_DBG_RESET, "%s -> %s\n",
modes[ah->power_mode], modes[mode]);
@@ -2793,8 +2798,7 @@ void ath9k_ps_wakeup(struct ath_softc *s
if (++sc->ps_usecount != 1)
goto unlock;
- if (sc->sc_ah->power_mode != ATH9K_PM_AWAKE)
- ath9k_hw_setpower_nolock(sc->sc_ah, ATH9K_PM_AWAKE);
+ ath9k_hw_setpower_nolock(sc->sc_ah, ATH9K_PM_AWAKE);
unlock:
spin_unlock_irqrestore(&sc->sc_pm_lock, flags);