mac80211: update to wireless-testing 2013-11-05

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 38783
This commit is contained in:
Felix Fietkau 2013-11-12 22:11:33 +00:00
parent 37756a97a0
commit 5f1c42d8b6
55 changed files with 5079 additions and 13253 deletions

View file

@ -10,11 +10,11 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=mac80211
PKG_VERSION:=2013-06-27
PKG_VERSION:=2013-11-05
PKG_RELEASE:=1
PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
PKG_BACKPORT_VERSION:=.1
PKG_MD5SUM:=73bd220c64c5c6fdc22b3bb7f180644f
PKG_BACKPORT_VERSION:=
PKG_MD5SUM:=5ef839d02d19c341629555a529beebee
PKG_SOURCE:=compat-wireless-$(PKG_VERSION)$(PKG_BACKPORT_VERSION).tar.bz2
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
@ -24,8 +24,8 @@ PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
PKG_DRIVERS = \
adm8211 ath5k libertas-usb libertas-sd p54-common p54-pci p54-usb p54-spi \
rt2x00-lib rt2x00-pci rt2x00-usb rt2x00-soc rt2800-lib rt2400-pci \
rt2500-pci rt2500-usb rt61-pci rt73-usb rt2800-pci rt2800-usb \
rt2x00-lib rt2x00-pci rt2x00-usb rt2800-lib rt2400-pci rt2500-pci \
rt2500-usb rt61-pci rt73-usb rt2800-mmio rt2800-pci rt2800-usb rt2800-soc \
rtl8180 rtl8187 zd1211rw mac80211-hwsim carl9170 b43 b43legacy \
ath9k-common ath9k ath9k-htc ath10k ath net-libipw net-ipw2100 net-ipw2200 \
mwl8k net-hermes net-hermes-pci net-hermes-plx net-hermes-pcmcia \
@ -263,15 +263,6 @@ $(call KernelPackage/rt2x00/Default)
AUTOLOAD:=$(call AutoProbe,rt2x00usb)
endef
define KernelPackage/rt2x00-soc
$(call KernelPackage/rt2x00/Default)
DEPENDS+=@TARGET_ramips_rt305x +kmod-rt2x00-mmio +kmod-rt2x00-lib
HIDDEN:=1
TITLE+= (SoC)
FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00soc.ko
AUTOLOAD:=$(call AutoProbe,rt2x00soc)
endef
define KernelPackage/rt2800-lib
$(call KernelPackage/rt2x00/Default)
DEPENDS+= @(PCI_SUPPORT||USB_SUPPORT||TARGET_ramips) +kmod-rt2x00-lib +kmod-lib-crc-ccitt +@DRIVER_11N_SUPPORT
@ -320,9 +311,27 @@ define KernelPackage/rt73-usb
AUTOLOAD:=$(call AutoProbe,rt73usb)
endef
define KernelPackage/rt2800-mmio
$(call KernelPackage/rt2x00/Default)
TITLE += (RT28xx/RT3xxx MMIO)
DEPENDS += +kmod-rt2800-lib +kmod-rt2x00-mmio
HIDDEN:=1
FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800mmio.ko
endef
define KernelPackage/rt2800-soc
$(call KernelPackage/rt2x00/Default)
DEPENDS += @TARGET_ramips_rt305x +kmod-rt2800-mmio +kmod-rt2800-lib
TITLE += (RT28xx/RT3xxx SoC)
FILES := \
$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2x00soc.ko \
$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800soc.ko
AUTOLOAD:=$(call AutoProbe,rt2800soc)
endef
define KernelPackage/rt2800-pci
$(call KernelPackage/rt2x00/Default)
DEPENDS+= @(PCI_SUPPORT||TARGET_ramips_rt305x) +PCI_SUPPORT:kmod-rt2x00-pci +kmod-rt2800-lib +kmod-lib-crc-ccitt +TARGET_ramips_rt305x:kmod-rt2x00-soc
DEPENDS+= @PCI_SUPPORT +kmod-rt2x00-pci +kmod-rt2800-lib +kmod-rt2800-mmio
TITLE+= (RT2860 PCI)
FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rt2x00/rt2800pci.ko
AUTOLOAD:=$(call AutoProbe,rt2800pci)
@ -1365,7 +1374,6 @@ config-$(call config_package,rt2x00-lib) += RT2X00 RT2X00_LIB
config-$(call config_package,rt2x00-pci) += RT2X00_LIB_PCI
config-$(call config_package,rt2x00-mmio) += RT2X00_LIB_MMIO
config-$(call config_package,rt2x00-usb) += RT2X00_LIB_USB
config-$(call config_package,rt2x00-soc) += RT2X00_LIB_SOC
config-$(CONFIG_PACKAGE_RT2X00_LIB_DEBUGFS) += RT2X00_LIB_DEBUGFS
config-$(CONFIG_PACKAGE_RT2X00_DEBUG) += RT2X00_DEBUG
@ -1377,6 +1385,7 @@ config-$(call config_package,rt73-usb) += RT73USB
config-$(call config_package,rt2800-lib) += RT2800_LIB
config-$(call config_package,rt2800-soc) += RT2800SOC
config-$(call config_package,rt2800-pci) += RT2800PCI
config-y += RT2800PCI_RT33XX RT2800PCI_RT35XX RT2800PCI_RT53XX RT2800PCI_RT3290
@ -1748,13 +1757,14 @@ $(eval $(call KernelPackage,rt2x00-lib))
$(eval $(call KernelPackage,rt2x00-mmio))
$(eval $(call KernelPackage,rt2x00-pci))
$(eval $(call KernelPackage,rt2x00-usb))
$(eval $(call KernelPackage,rt2x00-soc))
$(eval $(call KernelPackage,rt2800-lib))
$(eval $(call KernelPackage,rt2400-pci))
$(eval $(call KernelPackage,rt2500-pci))
$(eval $(call KernelPackage,rt2500-usb))
$(eval $(call KernelPackage,rt61-pci))
$(eval $(call KernelPackage,rt73-usb))
$(eval $(call KernelPackage,rt2800-mmio))
$(eval $(call KernelPackage,rt2800-soc))
$(eval $(call KernelPackage,rt2800-pci))
$(eval $(call KernelPackage,rt2800-usb))
$(eval $(call KernelPackage,rtl8180))

View file

@ -128,7 +128,7 @@
+ @$(MAKE) Kconfig.versions
@$(MAKE) -f Makefile.real "$@"
else
.PHONY: defconfig-help
--- a/Makefile.real
+++ b/Makefile.real
@@ -54,7 +54,7 @@ defconfig-%::

View file

@ -1,13 +1,20 @@
--- a/drivers/net/wireless/rt2x00/Kconfig
+++ b/drivers/net/wireless/rt2x00/Kconfig
@@ -202,25 +202,28 @@ config RT2800USB_UNKNOWN
endif
@@ -225,36 +225,37 @@ config RT2800SOC
config RT2800_LIB
- tristate
+ tristate "RT2800 USB/PCI support"
depends on m
config RT2800_LIB_MMIO
- tristate
+ tristate "RT2800 MMIO support"
depends on m
select RT2X00_LIB_MMIO
select RT2800_LIB
config RT2X00_LIB_MMIO
- tristate
+ tristate "RT2x00 MMIO support"
@ -16,7 +23,6 @@
config RT2X00_LIB_PCI
- tristate
+ tristate "RT2x00 PCI support"
+ depends on PCI
depends on m
select RT2X00_LIB
@ -30,7 +36,12 @@
config RT2X00_LIB_USB
- tristate
+ tristate "RT2x00 USB support"
+ depends on USB
depends on m
select RT2X00_LIB
config RT2X00_LIB
- tristate
+ tristate "RT2x00 support"
depends on m
select BACKPORT_AVERAGE

View file

@ -1,6 +1,6 @@
--- a/.local-symbols
+++ b/.local-symbols
@@ -363,42 +363,6 @@ USB_CDC_PHONET=
@@ -382,42 +382,6 @@ USB_CDC_PHONET=
USB_IPHETH=
USB_SIERRA_NET=
USB_VL600=
@ -77,7 +77,7 @@
return (bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev);
#else
return bus->chipco.dev;
@@ -4735,7 +4735,7 @@ static int b43_wireless_core_init(struct
@@ -4736,7 +4736,7 @@ static int b43_wireless_core_init(struct
}
if (sprom->boardflags_lo & B43_BFL_XTAL_NOSLOW)
hf |= B43_HF_DSCRQ; /* Disable slowclock requests from ucode. */

View file

@ -0,0 +1,347 @@
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
@@ -5,7 +5,6 @@ config MAC80211
depends on CRYPTO
depends on CRYPTO_ARC4
depends on CRYPTO_AES
- depends on CRYPTO_CCM
depends on CRC32
select BACKPORT_AVERAGE
---help---
--- a/net/mac80211/aes_ccm.c
+++ b/net/mac80211/aes_ccm.c
@@ -2,8 +2,6 @@
* Copyright 2003-2004, Instant802 Networks, Inc.
* Copyright 2005-2006, Devicescape Software, Inc.
*
- * Rewrite: Copyright (C) 2013 Linaro Ltd <ard.biesheuvel@linaro.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 by the Free Software Foundation.
@@ -19,75 +17,134 @@
#include "key.h"
#include "aes_ccm.h"
-void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
- u8 *data, size_t data_len, u8 *mic)
+static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *scratch, u8 *a)
{
- struct scatterlist assoc, pt, ct[2];
- struct {
- struct aead_request req;
- u8 priv[crypto_aead_reqsize(tfm)];
- } aead_req;
-
- memset(&aead_req, 0, sizeof(aead_req));
-
- sg_init_one(&pt, data, data_len);
- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
- sg_init_table(ct, 2);
- sg_set_buf(&ct[0], data, data_len);
- sg_set_buf(&ct[1], mic, IEEE80211_CCMP_MIC_LEN);
-
- aead_request_set_tfm(&aead_req.req, tfm);
- aead_request_set_assoc(&aead_req.req, &assoc, assoc.length);
- aead_request_set_crypt(&aead_req.req, &pt, ct, data_len, b_0);
+ int i;
+ u8 *b_0, *aad, *b, *s_0;
- crypto_aead_encrypt(&aead_req.req);
+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
+ aad = scratch + 4 * AES_BLOCK_SIZE;
+ b = scratch;
+ s_0 = scratch + AES_BLOCK_SIZE;
+
+ crypto_cipher_encrypt_one(tfm, b, b_0);
+
+ /* Extra Authenticate-only data (always two AES blocks) */
+ for (i = 0; i < AES_BLOCK_SIZE; i++)
+ aad[i] ^= b[i];
+ crypto_cipher_encrypt_one(tfm, b, aad);
+
+ aad += AES_BLOCK_SIZE;
+
+ for (i = 0; i < AES_BLOCK_SIZE; i++)
+ aad[i] ^= b[i];
+ crypto_cipher_encrypt_one(tfm, a, aad);
+
+ /* Mask out bits from auth-only-b_0 */
+ b_0[0] &= 0x07;
+
+ /* S_0 is used to encrypt T (= MIC) */
+ b_0[14] = 0;
+ b_0[15] = 0;
+ crypto_cipher_encrypt_one(tfm, s_0, b_0);
}
-int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
- u8 *data, size_t data_len, u8 *mic)
+
+void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
+ u8 *data, size_t data_len,
+ u8 *cdata, u8 *mic)
{
- struct scatterlist assoc, pt, ct[2];
- struct {
- struct aead_request req;
- u8 priv[crypto_aead_reqsize(tfm)];
- } aead_req;
-
- memset(&aead_req, 0, sizeof(aead_req));
-
- sg_init_one(&pt, data, data_len);
- sg_init_one(&assoc, &aad[2], be16_to_cpup((__be16 *)aad));
- sg_init_table(ct, 2);
- sg_set_buf(&ct[0], data, data_len);
- sg_set_buf(&ct[1], mic, IEEE80211_CCMP_MIC_LEN);
-
- aead_request_set_tfm(&aead_req.req, tfm);
- aead_request_set_assoc(&aead_req.req, &assoc, assoc.length);
- aead_request_set_crypt(&aead_req.req, ct, &pt,
- data_len + IEEE80211_CCMP_MIC_LEN, b_0);
+ int i, j, last_len, num_blocks;
+ u8 *pos, *cpos, *b, *s_0, *e, *b_0;
+
+ b = scratch;
+ s_0 = scratch + AES_BLOCK_SIZE;
+ e = scratch + 2 * AES_BLOCK_SIZE;
+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
+
+ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
+ last_len = data_len % AES_BLOCK_SIZE;
+ aes_ccm_prepare(tfm, scratch, b);
+
+ /* Process payload blocks */
+ pos = data;
+ cpos = cdata;
+ for (j = 1; j <= num_blocks; j++) {
+ int blen = (j == num_blocks && last_len) ?
+ last_len : AES_BLOCK_SIZE;
+
+ /* Authentication followed by encryption */
+ for (i = 0; i < blen; i++)
+ b[i] ^= pos[i];
+ crypto_cipher_encrypt_one(tfm, b, b);
+
+ b_0[14] = (j >> 8) & 0xff;
+ b_0[15] = j & 0xff;
+ crypto_cipher_encrypt_one(tfm, e, b_0);
+ for (i = 0; i < blen; i++)
+ *cpos++ = *pos++ ^ e[i];
+ }
- return crypto_aead_decrypt(&aead_req.req);
+ for (i = 0; i < IEEE80211_CCMP_MIC_LEN; i++)
+ mic[i] = b[i] ^ s_0[i];
}
-struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[])
+
+int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch,
+ u8 *cdata, size_t data_len, u8 *mic, u8 *data)
{
- struct crypto_aead *tfm;
- int err;
+ int i, j, last_len, num_blocks;
+ u8 *pos, *cpos, *b, *s_0, *a, *b_0;
- tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC);
- if (IS_ERR(tfm))
- return tfm;
-
- err = crypto_aead_setkey(tfm, key, WLAN_KEY_LEN_CCMP);
- if (!err)
- err = crypto_aead_setauthsize(tfm, IEEE80211_CCMP_MIC_LEN);
- if (!err)
- return tfm;
+ b = scratch;
+ s_0 = scratch + AES_BLOCK_SIZE;
+ a = scratch + 2 * AES_BLOCK_SIZE;
+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
+
+ num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE);
+ last_len = data_len % AES_BLOCK_SIZE;
+ aes_ccm_prepare(tfm, scratch, a);
+
+ /* Process payload blocks */
+ cpos = cdata;
+ pos = data;
+ for (j = 1; j <= num_blocks; j++) {
+ int blen = (j == num_blocks && last_len) ?
+ last_len : AES_BLOCK_SIZE;
+
+ /* Decryption followed by authentication */
+ b_0[14] = (j >> 8) & 0xff;
+ b_0[15] = j & 0xff;
+ crypto_cipher_encrypt_one(tfm, b, b_0);
+ for (i = 0; i < blen; i++) {
+ *pos = *cpos++ ^ b[i];
+ a[i] ^= *pos++;
+ }
+ crypto_cipher_encrypt_one(tfm, a, a);
+ }
+
+ for (i = 0; i < IEEE80211_CCMP_MIC_LEN; i++) {
+ if ((mic[i] ^ s_0[i]) != a[i])
+ return -1;
+ }
- crypto_free_aead(tfm);
- return ERR_PTR(err);
+ return 0;
}
-void ieee80211_aes_key_free(struct crypto_aead *tfm)
+
+struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[])
+{
+ struct crypto_cipher *tfm;
+
+ tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
+ if (!IS_ERR(tfm))
+ crypto_cipher_setkey(tfm, key, WLAN_KEY_LEN_CCMP);
+
+ return tfm;
+}
+
+
+void ieee80211_aes_key_free(struct crypto_cipher *tfm)
{
- crypto_free_aead(tfm);
+ crypto_free_cipher(tfm);
}
--- a/net/mac80211/aes_ccm.h
+++ b/net/mac80211/aes_ccm.h
@@ -12,11 +12,13 @@
#include <linux/crypto.h>
-struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[]);
-void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
- u8 *data, size_t data_len, u8 *mic);
-int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
- u8 *data, size_t data_len, u8 *mic);
-void ieee80211_aes_key_free(struct crypto_aead *tfm);
+struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[]);
+void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch,
+ u8 *data, size_t data_len,
+ u8 *cdata, u8 *mic);
+int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch,
+ u8 *cdata, size_t data_len,
+ u8 *mic, u8 *data);
+void ieee80211_aes_key_free(struct crypto_cipher *tfm);
#endif /* AES_CCM_H */
--- a/net/mac80211/key.h
+++ b/net/mac80211/key.h
@@ -83,7 +83,7 @@ struct ieee80211_key {
* Management frames.
*/
u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
- struct crypto_aead *tfm;
+ struct crypto_cipher *tfm;
u32 replays; /* dot11RSNAStatsCCMPReplays */
} ccmp;
struct {
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -301,16 +301,22 @@ ieee80211_crypto_tkip_decrypt(struct iee
}
-static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *b_0, u8 *aad,
+static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *scratch,
int encrypted)
{
__le16 mask_fc;
int a4_included, mgmt;
u8 qos_tid;
- u16 len_a;
+ u8 *b_0, *aad;
+ u16 data_len, len_a;
unsigned int hdrlen;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+ memset(scratch, 0, 6 * AES_BLOCK_SIZE);
+
+ b_0 = scratch + 3 * AES_BLOCK_SIZE;
+ aad = scratch + 4 * AES_BLOCK_SIZE;
+
/*
* Mask FC: zero subtype b4 b5 b6 (if not mgmt)
* Retry, PwrMgt, MoreData; set Protected
@@ -332,21 +338,20 @@ static void ccmp_special_blocks(struct s
else
qos_tid = 0;
- /* In CCM, the initial vectors (IV) used for CTR mode encryption and CBC
- * mode authentication are not allowed to collide, yet both are derived
- * from this vector b_0. We only set L := 1 here to indicate that the
- * data size can be represented in (L+1) bytes. The CCM layer will take
- * care of storing the data length in the top (L+1) bytes and setting
- * and clearing the other bits as is required to derive the two IVs.
- */
- b_0[0] = 0x1;
+ data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN;
+ if (encrypted)
+ data_len -= IEEE80211_CCMP_MIC_LEN;
+ /* First block, b_0 */
+ b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */
/* Nonce: Nonce Flags | A2 | PN
* Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
*/
b_0[1] = qos_tid | (mgmt << 4);
memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
memcpy(&b_0[8], pn, IEEE80211_CCMP_PN_LEN);
+ /* l(m) */
+ put_unaligned_be16(data_len, &b_0[14]);
/* AAD (extra authenticate-only data) / masked 802.11 header
* FC | A1 | A2 | A3 | SC | [A4] | [QC] */
@@ -402,8 +407,7 @@ static int ccmp_encrypt_skb(struct ieee8
u8 *pos;
u8 pn[6];
u64 pn64;
- u8 aad[2 * AES_BLOCK_SIZE];
- u8 b_0[AES_BLOCK_SIZE];
+ u8 scratch[6 * AES_BLOCK_SIZE];
if (info->control.hw_key &&
!(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
@@ -456,9 +460,9 @@ static int ccmp_encrypt_skb(struct ieee8
return 0;
pos += IEEE80211_CCMP_HDR_LEN;
- ccmp_special_blocks(skb, pn, b_0, aad, 0);
- ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
- skb_put(skb, IEEE80211_CCMP_MIC_LEN));
+ ccmp_special_blocks(skb, pn, scratch, 0);
+ ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, scratch, pos, len,
+ pos, skb_put(skb, IEEE80211_CCMP_MIC_LEN));
return 0;
}
@@ -521,16 +525,16 @@ ieee80211_crypto_ccmp_decrypt(struct iee
}
if (!(status->flag & RX_FLAG_DECRYPTED)) {
- u8 aad[2 * AES_BLOCK_SIZE];
- u8 b_0[AES_BLOCK_SIZE];
+ u8 scratch[6 * AES_BLOCK_SIZE];
/* hardware didn't decrypt/verify MIC */
- ccmp_special_blocks(skb, pn, b_0, aad, 1);
+ ccmp_special_blocks(skb, pn, scratch, 1);
if (ieee80211_aes_ccm_decrypt(
- key->u.ccmp.tfm, b_0, aad,
+ key->u.ccmp.tfm, scratch,
skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN,
data_len,
- skb->data + skb->len - IEEE80211_CCMP_MIC_LEN))
+ skb->data + skb->len - IEEE80211_CCMP_MIC_LEN,
+ skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN))
return RX_DROP_UNUSABLE;
}

View file

@ -1,6 +1,6 @@
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -300,7 +300,7 @@ void ieee80211_restart_hw(struct ieee802
@@ -291,7 +291,7 @@ void ieee80211_restart_hw(struct ieee802
}
EXPORT_SYMBOL(ieee80211_restart_hw);
@ -9,7 +9,7 @@
static int ieee80211_ifa_changed(struct notifier_block *nb,
unsigned long data, void *arg)
{
@@ -359,7 +359,7 @@ static int ieee80211_ifa_changed(struct
@@ -350,7 +350,7 @@ static int ieee80211_ifa_changed(struct
}
#endif
@ -18,7 +18,7 @@
static int ieee80211_ifa6_changed(struct notifier_block *nb,
unsigned long data, void *arg)
{
@@ -990,14 +990,14 @@ int ieee80211_register_hw(struct ieee802
@@ -978,14 +978,14 @@ int ieee80211_register_hw(struct ieee802
goto fail_pm_qos;
}
@ -35,7 +35,7 @@
local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
result = register_inet6addr_notifier(&local->ifa6_notifier);
if (result)
@@ -1006,13 +1006,13 @@ int ieee80211_register_hw(struct ieee802
@@ -994,13 +994,13 @@ int ieee80211_register_hw(struct ieee802
return 0;
@ -52,7 +52,7 @@
fail_ifa:
pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
&local->network_latency_notifier);
@@ -1045,10 +1045,10 @@ void ieee80211_unregister_hw(struct ieee
@@ -1033,10 +1033,10 @@ void ieee80211_unregister_hw(struct ieee
pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
&local->network_latency_notifier);

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2102,7 +2102,7 @@ static int ieee80211_scan(struct wiphy *
@@ -2113,7 +2113,7 @@ static int ieee80211_scan(struct wiphy *
* the frames sent while scanning on other channel will be
* lost)
*/

View file

@ -1,12 +1,12 @@
--- a/drivers/net/wireless/ath/Makefile
+++ b/drivers/net/wireless/ath/Makefile
@@ -11,7 +11,7 @@ obj-$(CPTCFG_ATH_COMMON) += ath.o
ath-objs := main.o \
@@ -13,8 +13,8 @@ ath-objs := main.o \
regd.o \
hw.o \
- key.o
+ key.o \
+ debug.o
key.o \
+ debug.o \
dfs_pattern_detector.o \
dfs_pri_detector.o
-ath-$(CPTCFG_ATH_DEBUG) += debug.o
ccflags-y += -D__CHECK_ENDIAN__

View file

@ -8,7 +8,7 @@
#include <asm/unaligned.h>
#include "hw.h"
@@ -513,8 +514,16 @@ static int ath9k_hw_init_macaddr(struct
@@ -512,8 +513,16 @@ static int ath9k_hw_init_macaddr(struct
common->macaddr[2 * i] = eeval >> 8;
common->macaddr[2 * i + 1] = eeval & 0xff;
}

View file

@ -11,7 +11,7 @@
for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
if (!wiphy->bands[band])
@@ -250,6 +254,10 @@ ath_reg_apply_active_scan_flags(struct w
@@ -249,6 +253,10 @@ ath_reg_apply_active_scan_flags(struct w
struct ieee80211_channel *ch;
const struct ieee80211_reg_rule *reg_rule;
@ -22,7 +22,7 @@
sband = wiphy->bands[IEEE80211_BAND_2GHZ];
if (!sband)
return;
@@ -299,6 +307,10 @@ static void ath_reg_apply_radar_flags(st
@@ -298,6 +306,10 @@ static void ath_reg_apply_radar_flags(st
struct ieee80211_channel *ch;
unsigned int i;
@ -33,7 +33,7 @@
if (!wiphy->bands[IEEE80211_BAND_5GHZ])
return;
@@ -503,6 +515,10 @@ ath_regd_init_wiphy(struct ath_regulator
@@ -606,6 +618,10 @@ ath_regd_init_wiphy(struct ath_regulator
{
const struct ieee80211_regdomain *regd;
@ -58,11 +58,11 @@
---help---
--- a/.local-symbols
+++ b/.local-symbols
@@ -123,6 +123,7 @@ RTL8187_LEDS=
@@ -126,6 +126,7 @@ RTL8187_LEDS=
ATH_COMMON=
ATH_CARDS=
ATH_DEBUG=
+ATH_USER_REGD=
ATH_REG_DYNAMIC_USER_REG_HINTS=
ATH_REG_DYNAMIC_USER_CERT_TESTING=
ATH5K=
ATH5K_DEBUG=
ATH5K_TRACER=

View file

@ -1,15 +1,15 @@
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -42,7 +42,8 @@ static int __ath_regd_init(struct ath_re
NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_OFDM)
NL80211_RRF_NO_IR | NL80211_RRF_NO_OFDM)
/* We allow IBSS on these on a case by case basis by regulatory domain */
-#define ATH9K_5GHZ_5150_5350 REG_RULE(5150-10, 5350+10, 80, 0, 30,\
+#define ATH9K_5GHZ_5150_5350 REG_RULE(5150-10, 5250, 80, 0, 30, 0), \
+ REG_RULE(5250, 5350+10, 80, 0, 30,\
NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS)
+#define ATH9K_5GHZ_5150_5350 REG_RULE(5150-10, 5240+10, 80, 0, 30, 0),\
+ REG_RULE(5260-10, 5350+10, 80, 0, 30,\
NL80211_RRF_NO_IR)
#define ATH9K_5GHZ_5470_5850 REG_RULE(5470-10, 5850+10, 80, 0, 30,\
NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS)
NL80211_RRF_NO_IR)
@@ -60,57 +61,56 @@ static int __ath_regd_init(struct ath_re
#define ATH9K_5GHZ_NO_MIDBAND ATH9K_5GHZ_5150_5350, \
ATH9K_5GHZ_5725_5850

View file

@ -1,6 +1,6 @@
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1696,6 +1696,8 @@ void regulatory_hint_11d(struct wiphy *w
@@ -1706,6 +1706,8 @@ void regulatory_hint_country_ie(struct w
enum environment_cap env = ENVIRON_ANY;
struct regulatory_request *request = NULL, *lr;
@ -9,7 +9,7 @@
/* IE len must be evenly divisible by 2 */
if (country_ie_len & 0x01)
return;
@@ -1890,6 +1892,7 @@ static void restore_regulatory_settings(
@@ -1900,6 +1902,7 @@ static void restore_regulatory_settings(
void regulatory_hint_disconnect(void)
{

View file

@ -1,10 +1,10 @@
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -814,6 +814,7 @@ static const struct ieee80211_iface_limi
@@ -844,6 +844,7 @@ static const struct ieee80211_iface_limi
#endif
BIT(NL80211_IFTYPE_AP) |
BIT(NL80211_IFTYPE_P2P_GO) },
+ { .max = 1, .types = BIT(NL80211_IFTYPE_ADHOC) },
};
static const struct ieee80211_iface_limit if_dfs_limits[] = {

View file

@ -18,7 +18,7 @@
goto end;
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -1916,7 +1916,7 @@ ath5k_beacon_send(struct ath5k_hw *ah)
@@ -1951,7 +1951,7 @@ ath5k_beacon_send(struct ath5k_hw *ah)
}
if ((ah->opmode == NL80211_IFTYPE_AP && ah->num_ap_vifs +
@ -27,7 +27,7 @@
ah->opmode == NL80211_IFTYPE_MESH_POINT) {
u64 tsf = ath5k_hw_get_tsf64(ah);
u32 tsftu = TSF_TO_TU(tsf);
@@ -2002,7 +2002,7 @@ ath5k_beacon_update_timers(struct ath5k_
@@ -2037,7 +2037,7 @@ ath5k_beacon_update_timers(struct ath5k_
intval = ah->bintval & AR5K_BEACON_PERIOD;
if (ah->opmode == NL80211_IFTYPE_AP && ah->num_ap_vifs
@ -36,7 +36,7 @@
intval /= ATH_BCBUF; /* staggered multi-bss beacons */
if (intval < 15)
ATH5K_WARN(ah, "intval %u is too low, min 15\n",
@@ -2469,6 +2469,7 @@ static const struct ieee80211_iface_limi
@@ -2504,6 +2504,7 @@ static const struct ieee80211_iface_limi
BIT(NL80211_IFTYPE_MESH_POINT) |
#endif
BIT(NL80211_IFTYPE_AP) },

View file

@ -11,7 +11,7 @@ drivers/net/wireless/ath/ath5k/debug.c | 86 ++++++++++++++++++++++++++++++++
--- a/drivers/net/wireless/ath/ath5k/debug.c
+++ b/drivers/net/wireless/ath/ath5k/debug.c
@@ -811,6 +811,89 @@ static const struct file_operations fops
@@ -821,6 +821,89 @@ static const struct file_operations fops
.llseek = default_llseek,
};
@ -101,7 +101,7 @@ drivers/net/wireless/ath/ath5k/debug.c | 86 ++++++++++++++++++++++++++++++++
/* debugfs: queues etc */
@@ -902,6 +985,9 @@ ath5k_debug_init_device(struct ath5k_hw
@@ -914,6 +997,9 @@ ath5k_debug_init_device(struct ath5k_hw
debugfs_create_file("beacon", S_IWUSR | S_IRUSR, phydir, ah,
&fops_beacon);

View file

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -1871,6 +1871,53 @@ void ath9k_deinit_debug(struct ath_softc
@@ -1782,6 +1782,53 @@ void ath9k_deinit_debug(struct ath_softc
}
}
@ -54,9 +54,9 @@
int ath9k_init_debug(struct ath_hw *ah)
{
struct ath_common *common = ath9k_hw_common(ah);
@@ -1888,6 +1935,8 @@ int ath9k_init_debug(struct ath_hw *ah)
@@ -1800,6 +1847,8 @@ int ath9k_init_debug(struct ath_hw *ah)
ath9k_dfs_init_debug(sc);
ath9k_tx99_init_debug(sc);
+ debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
+ &fops_eeprom);

View file

@ -71,7 +71,7 @@
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -717,6 +717,7 @@ enum ath_cal_list {
@@ -727,6 +727,7 @@ enum ath_cal_list {
#define AH_USE_EEPROM 0x1
#define AH_UNPLUGGED 0x2 /* The card has been physically removed. */
#define AH_FASTCC 0x4
@ -81,7 +81,7 @@
struct ath_ops reg_ops;
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -665,6 +665,8 @@ static int ath9k_init_softc(u16 devid, s
@@ -695,6 +695,8 @@ static int ath9k_init_softc(u16 devid, s
ah->is_clk_25mhz = pdata->is_clk_25mhz;
ah->get_mac_revision = pdata->get_mac_revision;
ah->external_reset = pdata->external_reset;
@ -89,7 +89,7 @@
+ ah->ah_flags |= AH_NO_EEP_SWAP;
}
common = ath9k_hw_common(ah);
common->ops = &ah->reg_ops;
--- a/include/linux/ath9k_platform.h
+++ b/include/linux/ath9k_platform.h
@@ -31,6 +31,7 @@ struct ath9k_platform_data {

View file

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -1072,23 +1072,23 @@ static int __init ath9k_init(void)
@@ -1086,23 +1086,23 @@ static int __init ath9k_init(void)
goto err_out;
}

View file

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1993,8 +1993,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
@@ -2014,8 +2014,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
REG_WRITE(ah, AR_OBS, 8);
if (ah->config.rx_intr_mitigation) {

View file

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -1918,6 +1918,52 @@ static const struct file_operations fops
@@ -1829,6 +1829,52 @@ static const struct file_operations fops
.owner = THIS_MODULE
};
@ -53,7 +53,7 @@
int ath9k_init_debug(struct ath_hw *ah)
{
struct ath_common *common = ath9k_hw_common(ah);
@@ -1937,6 +1983,8 @@ int ath9k_init_debug(struct ath_hw *ah)
@@ -1849,6 +1895,8 @@ int ath9k_init_debug(struct ath_hw *ah)
debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
&fops_eeprom);

View file

@ -1,10 +1,10 @@
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -724,6 +724,7 @@ int ath9k_hw_init(struct ath_hw *ah)
@@ -732,6 +732,7 @@ int ath9k_hw_init(struct ath_hw *ah)
case AR9300_DEVID_AR9462:
case AR9485_DEVID_AR1111:
case AR9300_DEVID_AR9565:
+ case AR9300_DEVID_AR9381:
+ case AR9300_DEVID_INVALID:
break;
default:
if (common->bus_ops->ath_bus_type == ATH_USB)
@ -14,17 +14,17 @@
#define AR9300_DEVID_QCA955X 0x0038
#define AR9485_DEVID_AR1111 0x0037
#define AR9300_DEVID_AR9565 0x0036
+#define AR9300_DEVID_AR9381 0xabcd
+#define AR9300_DEVID_INVALID 0xabcd
#define AR5416_AR9100_DEVID 0x000b
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -270,6 +270,7 @@ static DEFINE_PCI_DEVICE_TABLE(ath_pci_i
{ PCI_VDEVICE(ATHEROS, 0x0034) }, /* PCI-E AR9462 */
{ PCI_VDEVICE(ATHEROS, 0x0037) }, /* PCI-E AR1111/AR9485 */
{ PCI_VDEVICE(ATHEROS, 0x0036) }, /* PCI-E AR9565 */
+ { PCI_VDEVICE(ATHEROS, 0xabcd) }, /* PCI-E AR9381 */
@@ -463,6 +463,7 @@ static DEFINE_PCI_DEVICE_TABLE(ath_pci_i
{ PCI_VDEVICE(ATHEROS, 0x0036),
.driver_data = ATH9K_PCI_BT_ANT_DIV },
+ { PCI_VDEVICE(ATHEROS, 0xabcd) }, /* PCI-E internal chip default ID */
{ 0 }
};

View file

@ -1,6 +1,6 @@
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1622,6 +1622,7 @@ struct ieee80211_hw {
@@ -1659,6 +1659,7 @@ struct ieee80211_hw {
u8 max_tx_aggregation_subframes;
u8 offchannel_tx_hw_queue;
u8 radiotap_mcs_details;
@ -10,7 +10,7 @@
u8 uapsd_queues;
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2283,7 +2283,9 @@ static int ieee80211_get_tx_power(struct
@@ -2294,7 +2294,9 @@ static int ieee80211_get_tx_power(struct
struct ieee80211_local *local = wiphy_priv(wiphy);
struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
@ -23,7 +23,7 @@
*dbm = sdata->vif.bss_conf.txpower;
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -167,6 +167,7 @@ static u32 ieee80211_hw_conf_chan(struct
@@ -158,6 +158,7 @@ static u32 ieee80211_hw_conf_chan(struct
if (local->hw.conf.power_level != power) {
changed |= IEEE80211_CONF_CHANGE_POWER;

View file

@ -14,7 +14,7 @@
out:
spin_unlock_bh(&sc->sc_pcu_lock);
@@ -1304,6 +1308,7 @@ static int ath9k_config(struct ieee80211
@@ -1340,6 +1344,7 @@ static int ath9k_config(struct ieee80211
sc->config.txpowlimit = 2 * conf->power_level;
ath9k_cmn_update_txpow(ah, sc->curtxpow,
sc->config.txpowlimit, &sc->curtxpow);

View file

@ -17,7 +17,7 @@
u8 rs_moreaggr;
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -892,6 +892,7 @@ static void ath9k_process_rssi(struct at
@@ -906,6 +906,7 @@ static void ath9k_process_rssi(struct at
struct ath_hw *ah = common->ah;
int last_rssi;
int rssi = rx_stats->rs_rssi;
@ -25,7 +25,7 @@
/*
* RSSI is not available for subframes in an A-MPDU.
@@ -910,6 +911,20 @@ static void ath9k_process_rssi(struct at
@@ -924,6 +925,20 @@ static void ath9k_process_rssi(struct at
return;
}
@ -46,15 +46,34 @@
/*
* Update Beacon RSSI, this is used by ANI.
*/
@@ -1000,7 +1015,7 @@ static int ath_process_fft(struct ath_so
fft_sample.tlv.length = __cpu_to_be16(length);
@@ -1073,14 +1088,14 @@ static int ath_process_fft(struct ath_so
fft_sample_40.channel_type = chan_type;
fft_sample.freq = __cpu_to_be16(ah->curchan->chan->center_freq);
- fft_sample.rssi = fix_rssi_inv_only(rs->rs_rssi_ctl0);
+ fft_sample.rssi = fix_rssi_inv_only(rs->rs_rssi_ctl[0]);
fft_sample.noise = ah->noise;
if (chan_type == NL80211_CHAN_HT40PLUS) {
- lower_rssi = fix_rssi_inv_only(rs->rs_rssi_ctl0);
- upper_rssi = fix_rssi_inv_only(rs->rs_rssi_ext0);
+ lower_rssi = fix_rssi_inv_only(rs->rs_rssi_ctl[0]);
+ upper_rssi = fix_rssi_inv_only(rs->rs_rssi_ext[0]);
switch (len - SPECTRAL_HT20_TOTAL_DATA_LEN) {
fft_sample_40.lower_noise = ah->noise;
fft_sample_40.upper_noise = ext_nf;
} else {
- lower_rssi = fix_rssi_inv_only(rs->rs_rssi_ext0);
- upper_rssi = fix_rssi_inv_only(rs->rs_rssi_ctl0);
+ lower_rssi = fix_rssi_inv_only(rs->rs_rssi_ext[0]);
+ upper_rssi = fix_rssi_inv_only(rs->rs_rssi_ctl[0]);
fft_sample_40.lower_noise = ext_nf;
fft_sample_40.upper_noise = ah->noise;
@@ -1116,7 +1131,7 @@ static int ath_process_fft(struct ath_so
fft_sample_20.tlv.length = __cpu_to_be16(length);
fft_sample_20.freq = __cpu_to_be16(freq);
- fft_sample_20.rssi = fix_rssi_inv_only(rs->rs_rssi_ctl0);
+ fft_sample_20.rssi = fix_rssi_inv_only(rs->rs_rssi_ctl[0]);
fft_sample_20.noise = ah->noise;
mag_info = ((struct ath_ht20_mag_info *)radar_info) - 1;
--- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
@@ -476,12 +476,12 @@ int ath9k_hw_process_rxdesc_edma(struct
@ -131,7 +150,7 @@
* hardware stores this as 8 bit signed value.
--- a/drivers/net/wireless/ath/ath9k/antenna.c
+++ b/drivers/net/wireless/ath/ath9k/antenna.c
@@ -744,14 +744,14 @@ void ath_ant_comb_scan(struct ath_softc
@@ -724,14 +724,14 @@ void ath_ant_comb_scan(struct ath_softc
struct ath_ant_comb *antcomb = &sc->ant_comb;
int alt_ratio = 0, alt_rssi_avg = 0, main_rssi_avg = 0, curr_alt_set;
int curr_main_set;

View file

@ -1,6 +1,24 @@
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2081,6 +2081,7 @@ struct cfg80211_update_ft_ies_params {
* (as advertised by the nl80211 feature flag.)
* @get_tx_power: store the current TX power into the dbm variable;
* return 0 if successful
+ * @set_antenna_gain: set antenna gain to reduce maximum tx power if necessary
*
* @set_wds_peer: set the WDS peer for a WDS interface
*
@@ -2303,6 +2304,7 @@ struct cfg80211_ops {
enum nl80211_tx_power_setting type, int mbm);
int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
int *dbm);
+ int (*set_antenna_gain)(struct wiphy *wiphy, int dbi);
int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
const u8 *addr);
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1002,6 +1002,7 @@ enum ieee80211_smps_mode {
@@ -1029,6 +1029,7 @@ enum ieee80211_smps_mode {
*
* @power_level: requested transmit power (in dBm), backward compatibility
* value only that is set to the minimum of all interfaces
@ -8,7 +26,7 @@
*
* @chandef: the channel definition to tune to
* @radar_enabled: whether radar detection is enabled
@@ -1023,6 +1024,7 @@ struct ieee80211_conf {
@@ -1050,6 +1051,7 @@ struct ieee80211_conf {
u32 flags;
int power_level, dynamic_ps_timeout;
int max_sleep_period;
@ -16,9 +34,60 @@
u16 listen_interval;
u8 ps_dtim_period;
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1511,6 +1511,9 @@ enum nl80211_commands {
* @NL80211_ATTR_SUPPORT_5_10_MHZ: A flag indicating that the device supports
* 5 MHz and 10 MHz channel bandwidth.
*
+ * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
+ * transmit power to stay within regulatory limits. u32, dBi.
+ *
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
*/
@@ -1829,6 +1832,8 @@ enum nl80211_attrs {
NL80211_ATTR_SUPPORT_5_10_MHZ,
+ NL80211_ATTR_WIPHY_ANTENNA_GAIN,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2304,6 +2304,19 @@ static int ieee80211_get_tx_power(struct
return 0;
}
+static int ieee80211_set_antenna_gain(struct wiphy *wiphy, int dbi)
+{
+ struct ieee80211_local *local = wiphy_priv(wiphy);
+
+ if (dbi < 0)
+ return -EINVAL;
+
+ local->user_antenna_gain = dbi;
+ ieee80211_hw_config(local, 0);
+
+ return 0;
+}
+
static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
const u8 *addr)
{
@@ -3839,6 +3852,7 @@ struct cfg80211_ops mac80211_config_ops
.set_wiphy_params = ieee80211_set_wiphy_params,
.set_tx_power = ieee80211_set_tx_power,
.get_tx_power = ieee80211_get_tx_power,
+ .set_antenna_gain = ieee80211_set_antenna_gain,
.set_wds_peer = ieee80211_set_wds_peer,
.rfkill_poll = ieee80211_rfkill_poll,
CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1130,6 +1130,7 @@ struct ieee80211_local {
@@ -1179,6 +1179,7 @@ struct ieee80211_local {
int dynamic_ps_forced_timeout;
int user_power_level; /* in dBm, for all interfaces */
@ -26,38 +95,59 @@
enum ieee80211_smps_mode smps_mode;
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1460,6 +1460,9 @@ enum nl80211_commands {
* @NL80211_ATTR_CSA_C_OFF_PRESP: Offset of the channel switch counter
* field in the probe response (%NL80211_ATTR_PROBE_RESP).
*
+ * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
+ * transmit power to stay within regulatory limits.
+ *
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
*/
@@ -1766,6 +1769,8 @@ enum nl80211_attrs {
NL80211_ATTR_CSA_C_OFF_BEACON,
NL80211_ATTR_CSA_C_OFF_PRESP,
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -101,7 +101,7 @@ static u32 ieee80211_hw_conf_chan(struct
struct ieee80211_sub_if_data *sdata;
struct cfg80211_chan_def chandef = {};
u32 changed = 0;
- int power;
+ int power, ant_gain, max_power;
u32 offchannel_flag;
+ NL80211_ATTR_WIPHY_ANTENNA_GAIN,
offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
@@ -156,8 +156,21 @@ static u32 ieee80211_hw_conf_chan(struct
}
rcu_read_unlock();
- if (local->hw.conf.power_level != power) {
+ max_power = chandef.chan->max_reg_power;
+ ant_gain = chandef.chan->max_antenna_gain;
+ if (local->user_antenna_gain > 0) {
+ if (local->user_antenna_gain > ant_gain) {
+ max_power -= local->user_antenna_gain - ant_gain;
+ ant_gain = 0;
+ } else
+ ant_gain -= local->user_antenna_gain;
+ power = min(power, max_power);
+ }
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
+ if (local->hw.conf.power_level != power ||
+ local->hw.conf.max_antenna_gain != ant_gain) {
changed |= IEEE80211_CONF_CHANGE_POWER;
+ local->hw.conf.max_antenna_gain = ant_gain;
local->hw.cur_power_level = power;
local->hw.conf.power_level = power;
}
@@ -588,6 +601,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(
IEEE80211_RADIOTAP_MCS_HAVE_BW;
local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
+ local->user_antenna_gain = 0;
local->hw.uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES;
local->hw.uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN;
local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -354,6 +354,7 @@ static const struct nla_policy nl80211_p
[NL80211_ATTR_CSA_IES] = { .type = NLA_NESTED },
[NL80211_ATTR_CSA_C_OFF_BEACON] = { .type = NLA_U16 },
[NL80211_ATTR_CSA_C_OFF_PRESP] = { .type = NLA_U16 },
@@ -357,6 +357,7 @@ static const struct nla_policy nl80211_p
[NL80211_ATTR_STA_SUPPORTED_CHANNELS] = { .type = NLA_BINARY },
[NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES] = { .type = NLA_BINARY },
[NL80211_ATTR_HANDLE_DFS] = { .type = NLA_FLAG },
+ [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 },
};
/* policy for the key attributes */
@@ -2000,6 +2001,22 @@ static int nl80211_set_wiphy(struct sk_b
@@ -2038,6 +2039,22 @@ static int nl80211_set_wiphy(struct sk_b
goto bad_res;
}
@ -80,92 +170,3 @@
if (info->attrs[NL80211_ATTR_WIPHY_ANTENNA_TX] &&
info->attrs[NL80211_ATTR_WIPHY_ANTENNA_RX]) {
u32 tx_ant, rx_ant;
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2293,6 +2293,19 @@ static int ieee80211_get_tx_power(struct
return 0;
}
+static int ieee80211_set_antenna_gain(struct wiphy *wiphy, int dbi)
+{
+ struct ieee80211_local *local = wiphy_priv(wiphy);
+
+ if (dbi < 0)
+ return -EINVAL;
+
+ local->user_antenna_gain = dbi;
+ ieee80211_hw_config(local, 0);
+
+ return 0;
+}
+
static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev,
const u8 *addr)
{
@@ -3656,6 +3669,7 @@ struct cfg80211_ops mac80211_config_ops
.set_wiphy_params = ieee80211_set_wiphy_params,
.set_tx_power = ieee80211_set_tx_power,
.get_tx_power = ieee80211_get_tx_power,
+ .set_antenna_gain = ieee80211_set_antenna_gain,
.set_wds_peer = ieee80211_set_wds_peer,
.rfkill_poll = ieee80211_rfkill_poll,
CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1994,6 +1994,7 @@ struct cfg80211_update_ft_ies_params {
* (as advertised by the nl80211 feature flag.)
* @get_tx_power: store the current TX power into the dbm variable;
* return 0 if successful
+ * @set_antenna_gain: set antenna gain to reduce maximum tx power if necessary
*
* @set_wds_peer: set the WDS peer for a WDS interface
*
@@ -2215,6 +2216,7 @@ struct cfg80211_ops {
enum nl80211_tx_power_setting type, int mbm);
int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
int *dbm);
+ int (*set_antenna_gain)(struct wiphy *wiphy, int dbi);
int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
const u8 *addr);
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -102,6 +102,7 @@ static u32 ieee80211_hw_conf_chan(struct
struct cfg80211_chan_def chandef = {};
u32 changed = 0;
int power = 0;
+ int ant_gain, max_power;
u32 offchannel_flag;
offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
@@ -165,8 +166,21 @@ static u32 ieee80211_hw_conf_chan(struct
power = min(power, chandef.chan->max_power);
- if (local->hw.conf.power_level != power) {
+ max_power = chandef.chan->max_reg_power;
+ ant_gain = chandef.chan->max_antenna_gain;
+ if (local->user_antenna_gain > 0) {
+ if (local->user_antenna_gain > ant_gain) {
+ max_power -= local->user_antenna_gain - ant_gain;
+ ant_gain = 0;
+ } else
+ ant_gain -= local->user_antenna_gain;
+ power = min(power, max_power);
+ }
+
+ if (local->hw.conf.power_level != power ||
+ local->hw.conf.max_antenna_gain != ant_gain) {
changed |= IEEE80211_CONF_CHANGE_POWER;
+ local->hw.conf.max_antenna_gain = ant_gain;
local->hw.cur_power_level = power;
local->hw.conf.power_level = power;
}
@@ -597,6 +611,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(
IEEE80211_RADIOTAP_MCS_HAVE_BW;
local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
+ local->user_antenna_gain = 0;
local->hw.uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES;
local->hw.uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN;
local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;

View file

@ -10,7 +10,7 @@
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2832,7 +2832,7 @@ void ath9k_hw_apply_txpower(struct ath_h
@@ -2853,7 +2853,7 @@ void ath9k_hw_apply_txpower(struct ath_h
channel = chan->chan;
chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER);
new_pwr = min_t(int, chan_pwr, reg->power_limit);
@ -21,7 +21,7 @@
if (ant_gain > max_gain)
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1304,7 +1304,10 @@ static int ath9k_config(struct ieee80211
@@ -1340,7 +1340,10 @@ static int ath9k_config(struct ieee80211
}
if (changed & IEEE80211_CONF_CHANGE_POWER) {

View file

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -561,6 +561,9 @@ struct ath9k_wow_pattern {
@@ -558,6 +558,9 @@ struct ath9k_wow_pattern {
void ath_init_leds(struct ath_softc *sc);
void ath_deinit_leds(struct ath_softc *sc);
void ath_fill_led_pin(struct ath_softc *sc);
@ -10,7 +10,7 @@
#else
static inline void ath_init_leds(struct ath_softc *sc)
{
@@ -705,6 +708,13 @@ enum spectral_mode {
@@ -732,6 +735,13 @@ enum spectral_mode {
SPECTRAL_CHANSCAN,
};
@ -24,7 +24,7 @@
struct ath_softc {
struct ieee80211_hw *hw;
struct device *dev;
@@ -747,9 +757,8 @@ struct ath_softc {
@@ -774,9 +784,8 @@ struct ath_softc {
struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
#ifdef CPTCFG_MAC80211_LEDS
@ -162,7 +162,7 @@
void ath_fill_led_pin(struct ath_softc *sc)
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -978,7 +978,7 @@ int ath9k_init_device(u16 devid, struct
@@ -992,7 +992,7 @@ int ath9k_init_device(u16 devid, struct
#ifdef CPTCFG_MAC80211_LEDS
/* must be initialized before ieee80211_register_hw */
@ -173,7 +173,7 @@
#endif
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -1963,6 +1963,61 @@ static const struct file_operations fops
@@ -1874,6 +1874,61 @@ static const struct file_operations fops
.llseek = default_llseek,
};
@ -235,7 +235,7 @@
int ath9k_init_debug(struct ath_hw *ah)
{
@@ -1985,6 +2040,10 @@ int ath9k_init_debug(struct ath_hw *ah)
@@ -1897,6 +1952,10 @@ int ath9k_init_debug(struct ath_hw *ah)
&fops_eeprom);
debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
sc, &fops_chanbw);

View file

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -2019,6 +2019,50 @@ static const struct file_operations fops
@@ -1930,6 +1930,50 @@ static const struct file_operations fops
#endif
@ -51,7 +51,7 @@
int ath9k_init_debug(struct ath_hw *ah)
{
struct ath_common *common = ath9k_hw_common(ah);
@@ -2044,6 +2088,8 @@ int ath9k_init_debug(struct ath_hw *ah)
@@ -1956,6 +2000,8 @@ int ath9k_init_debug(struct ath_hw *ah)
debugfs_create_file("gpio_led", S_IWUSR,
sc->debug.debugfs_phy, sc, &fops_gpio_led);
#endif
@ -62,7 +62,7 @@
debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy, sc,
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -475,6 +475,12 @@ enum {
@@ -480,6 +480,12 @@ enum {
ATH9K_RESET_COLD,
};
@ -75,7 +75,7 @@
struct ath9k_hw_version {
u32 magic;
u16 devid;
@@ -755,6 +761,8 @@ struct ath_hw {
@@ -765,6 +771,8 @@ struct ath_hw {
u32 rfkill_polarity;
u32 ah_flags;
@ -84,7 +84,7 @@
bool reset_power_on;
bool htc_reset_init;
@@ -1005,6 +1013,7 @@ void ath9k_hw_set_sta_beacon_timers(stru
@@ -1016,6 +1024,7 @@ void ath9k_hw_check_nav(struct ath_hw *a
bool ath9k_hw_check_alive(struct ath_hw *ah);
bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
@ -94,7 +94,7 @@
void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause);
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1840,6 +1840,20 @@ fail:
@@ -1861,6 +1861,20 @@ fail:
return -EINVAL;
}
@ -115,7 +115,7 @@
int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
struct ath9k_hw_cal_data *caldata, bool fastcc)
{
@@ -2039,6 +2053,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
@@ -2060,6 +2074,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
}
ath9k_hw_apply_gpio_override(ah);
@ -125,7 +125,7 @@
REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV, AR_BTCOEX_WL_LNADIV_FORCE_ON);
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -565,6 +565,11 @@ irqreturn_t ath_isr(int irq, void *dev)
@@ -571,6 +571,11 @@ irqreturn_t ath_isr(int irq, void *dev)
ath9k_hw_getisr(ah, &status); /* NB: clears ISR too */
status &= ah->imask; /* discard unasked-for bits */

View file

@ -12,7 +12,7 @@
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2432,17 +2432,25 @@ int ath9k_hw_fill_cap_info(struct ath_hw
@@ -2453,17 +2453,25 @@ int ath9k_hw_fill_cap_info(struct ath_hw
}
eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE);
@ -48,7 +48,7 @@
AR_SREV_9285(ah) ||
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -925,6 +925,8 @@ struct ath_hw {
@@ -935,6 +935,8 @@ struct ath_hw {
bool is_clk_25mhz;
int (*get_mac_revision)(void);
int (*external_reset)(void);
@ -59,7 +59,7 @@
};
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -665,6 +665,8 @@ static int ath9k_init_softc(u16 devid, s
@@ -695,6 +695,8 @@ static int ath9k_init_softc(u16 devid, s
ah->is_clk_25mhz = pdata->is_clk_25mhz;
ah->get_mac_revision = pdata->get_mac_revision;
ah->external_reset = pdata->external_reset;

View file

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -676,6 +676,7 @@ struct ath_spec_scan {
@@ -682,6 +682,7 @@ struct ath_spec_scan {
* @config_pci_powersave:
* @calibrate: periodic calibration for NF, ANI, IQ, ADC gain, ADC-DC
*
@ -8,7 +8,7 @@
* @spectral_scan_config: set parameters for spectral scan and enable/disable it
* @spectral_scan_trigger: trigger a spectral scan run
* @spectral_scan_wait: wait for a spectral scan run to finish
@@ -698,6 +699,7 @@ struct ath_hw_ops {
@@ -704,6 +705,7 @@ struct ath_hw_ops {
struct ath_hw_antcomb_conf *antconf);
void (*antdiv_comb_conf_set)(struct ath_hw *ah,
struct ath_hw_antcomb_conf *antconf);
@ -18,8 +18,8 @@
void (*spectral_scan_trigger)(struct ath_hw *ah);
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
@@ -1609,6 +1609,26 @@ static void ar9003_hw_spectral_scan_wait
}
@@ -1709,6 +1709,26 @@ static void ar9003_hw_tx99_set_txpower(s
ATH9K_POW_SM(p_pwr_array[ALL_TARGET_HT40_14], 0));
}
+static void ar9003_hw_get_adc_entropy(struct ath_hw *ah, u8 *buf, size_t len)
@ -45,7 +45,7 @@
void ar9003_hw_attach_phy_ops(struct ath_hw *ah)
{
struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
@@ -1639,6 +1659,7 @@ void ar9003_hw_attach_phy_ops(struct ath
@@ -1739,6 +1759,7 @@ void ar9003_hw_attach_phy_ops(struct ath
priv_ops->set_radar_params = ar9003_hw_set_radar_params;
priv_ops->fast_chan_change = ar9003_hw_fast_chan_change;
@ -55,7 +55,7 @@
ops->spectral_scan_config = ar9003_hw_spectral_scan_config;
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -794,7 +794,8 @@ static void ath9k_init_txpower_limits(st
@@ -824,7 +824,8 @@ static void ath9k_init_txpower_limits(st
if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ);
@ -65,7 +65,7 @@
}
void ath9k_reload_chainmask_settings(struct ath_softc *sc)
@@ -940,6 +941,18 @@ void ath9k_set_hw_capab(struct ath_softc
@@ -954,6 +955,18 @@ void ath9k_set_hw_capab(struct ath_softc
SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
}
@ -84,7 +84,7 @@
int ath9k_init_device(u16 devid, struct ath_softc *sc,
const struct ath_bus_ops *bus_ops)
{
@@ -985,6 +998,8 @@ int ath9k_init_device(u16 devid, struct
@@ -999,6 +1012,8 @@ int ath9k_init_device(u16 devid, struct
ARRAY_SIZE(ath9k_tpt_blink));
#endif
@ -95,8 +95,8 @@
if (error)
--- a/drivers/net/wireless/ath/ath9k/hw-ops.h
+++ b/drivers/net/wireless/ath/ath9k/hw-ops.h
@@ -78,6 +78,12 @@ static inline void ath9k_hw_antdiv_comb_
ath9k_hw_ops(ah)->antdiv_comb_conf_set(ah, antconf);
@@ -94,6 +94,12 @@ static inline void ath9k_hw_tx99_set_txp
ath9k_hw_ops(ah)->tx99_set_txpower(ah, power);
}
+static inline void ath9k_hw_get_adc_entropy(struct ath_hw *ah,
@ -110,7 +110,7 @@
static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable)
--- a/drivers/net/wireless/ath/ath9k/link.c
+++ b/drivers/net/wireless/ath/ath9k/link.c
@@ -342,6 +342,11 @@ void ath_ani_calibrate(unsigned long dat
@@ -354,6 +354,11 @@ void ath_ani_calibrate(unsigned long dat
unsigned int timestamp = jiffies_to_msecs(jiffies);
u32 cal_interval, short_cal_interval, long_cal_interval;
unsigned long flags;
@ -120,11 +120,11 @@
+ ath9k_hw_get_adc_entropy(ah, buf, sizeof(buf));
+ add_device_randomness(buf, sizeof(buf));
if (ah->caldata && ah->caldata->nfcal_interference)
if (ah->caldata && test_bit(NFCAL_INTF, &ah->caldata->cal_flags))
long_cal_interval = ATH_LONG_CALINTERVAL_INT;
--- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
@@ -1299,9 +1299,30 @@ static void ar5008_hw_set_radar_conf(str
@@ -1296,9 +1296,30 @@ static void ar5008_hw_set_radar_conf(str
conf->radar_inband = 8;
}
@ -155,7 +155,7 @@
static const u32 ar5416_cca_regs[6] = {
AR_PHY_CCA,
AR_PHY_CH1_CCA,
@@ -1316,6 +1337,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
@@ -1313,6 +1334,8 @@ int ar5008_hw_attach_phy_ops(struct ath_
if (ret)
return ret;

View file

@ -22,10 +22,10 @@
+#endif /* _RT2X00_PLATFORM_H */
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -39,6 +39,7 @@
#include <linux/input-polldev.h>
@@ -40,6 +40,7 @@
#include <linux/kfifo.h>
#include <linux/hrtimer.h>
#include <linux/average.h>
+#include <linux/rt2x00_platform.h>
#include <net/mac80211.h>

View file

@ -1,6 +1,158 @@
--- a/.local-symbols
+++ b/.local-symbols
@@ -283,6 +283,7 @@ RT2X00_LIB_FIRMWARE=
RT2X00_LIB_CRYPTO=
RT2X00_LIB_LEDS=
RT2X00_LIB_DEBUGFS=
+RT2X00_LIB_EEPROM=
RT2X00_DEBUG=
RTL_CARDS=
RTL8192CE=
--- a/drivers/net/wireless/rt2x00/Kconfig
+++ b/drivers/net/wireless/rt2x00/Kconfig
@@ -69,6 +69,7 @@ config RT2800PCI
select RT2X00_LIB_MMIO
select RT2X00_LIB_PCI
select RT2X00_LIB_FIRMWARE
+ select RT2X00_LIB_EEPROM
select RT2X00_LIB_CRYPTO
depends on CRC_CCITT
depends on EEPROM_93CX6
@@ -215,6 +216,7 @@ config RT2800SOC
select RT2X00_LIB_MMIO
select RT2X00_LIB_CRYPTO
select RT2X00_LIB_FIRMWARE
+ select RT2X00_LIB_EEPROM
select RT2800_LIB
select RT2800_LIB_MMIO
---help---
@@ -266,6 +268,9 @@ config RT2X00_LIB_FIRMWARE
config RT2X00_LIB_CRYPTO
boolean
+config RT2X00_LIB_EEPROM
+ boolean
+
config RT2X00_LIB_LEDS
boolean
default y if (RT2X00_LIB=y && LEDS_CLASS=y) || (RT2X00_LIB=m && LEDS_CLASS!=n)
--- a/drivers/net/wireless/rt2x00/Makefile
+++ b/drivers/net/wireless/rt2x00/Makefile
@@ -7,6 +7,7 @@ rt2x00lib-$(CPTCFG_RT2X00_LIB_DEBUGFS) +
rt2x00lib-$(CPTCFG_RT2X00_LIB_CRYPTO) += rt2x00crypto.o
rt2x00lib-$(CPTCFG_RT2X00_LIB_FIRMWARE) += rt2x00firmware.o
rt2x00lib-$(CPTCFG_RT2X00_LIB_LEDS) += rt2x00leds.o
+rt2x00lib-$(CPTCFG_RT2X00_LIB_EEPROM) += rt2x00eeprom.o
obj-$(CPTCFG_RT2X00_LIB) += rt2x00lib.o
obj-$(CPTCFG_RT2X00_LIB_MMIO) += rt2x00mmio.o
--- a/drivers/net/wireless/rt2x00/rt2800lib.h
+++ b/drivers/net/wireless/rt2x00/rt2800lib.h
@@ -22,6 +22,8 @@
#ifndef RT2800LIB_H
#define RT2800LIB_H
+#include "rt2800.h"
+
struct rt2800_ops {
void (*register_read)(struct rt2x00_dev *rt2x00dev,
const unsigned int offset, u32 *value);
@@ -121,6 +123,15 @@ static inline int rt2800_read_eeprom(str
{
const struct rt2800_ops *rt2800ops = rt2x00dev->ops->drv;
+ if (rt2x00dev->eeprom_file) {
+ memcpy(rt2x00dev->eeprom, rt2x00dev->eeprom_file->data,
+ EEPROM_SIZE);
+ return 0;
+ }
+
+ if (!rt2800ops->read_eeprom)
+ return -EINVAL;
+
return rt2800ops->read_eeprom(rt2x00dev);
}
--- a/drivers/net/wireless/rt2x00/rt2800soc.c
+++ b/drivers/net/wireless/rt2x00/rt2800soc.c
@@ -97,19 +97,6 @@ static int rt2800soc_set_device_state(st
return retval;
}
-static int rt2800soc_read_eeprom(struct rt2x00_dev *rt2x00dev)
-{
- void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE);
-
- if (!base_addr)
- return -ENOMEM;
-
- memcpy_fromio(rt2x00dev->eeprom, base_addr, EEPROM_SIZE);
-
- iounmap(base_addr);
- return 0;
-}
-
/* Firmware functions */
static char *rt2800soc_get_firmware_name(struct rt2x00_dev *rt2x00dev)
{
@@ -173,7 +160,6 @@ static const struct rt2800_ops rt2800soc
.register_multiread = rt2x00mmio_register_multiread,
.register_multiwrite = rt2x00mmio_register_multiwrite,
.regbusy_read = rt2x00mmio_regbusy_read,
- .read_eeprom = rt2800soc_read_eeprom,
.hwcrypt_disabled = rt2800soc_hwcrypt_disabled,
.drv_write_firmware = rt2800soc_write_firmware,
.drv_init_registers = rt2800mmio_init_registers,
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -696,6 +696,7 @@ enum rt2x00_capability_flags {
REQUIRE_SW_SEQNO,
REQUIRE_HT_TX_DESC,
REQUIRE_PS_AUTOWAKE,
+ REQUIRE_EEPROM_FILE,
/*
* Capabilities
@@ -965,6 +966,11 @@ struct rt2x00_dev {
const struct firmware *fw;
/*
+ * EEPROM image.
+ */
+ const struct firmware *eeprom_file;
+
+ /*
* FIFO for storing tx status reports between isr and tasklet.
*/
DECLARE_KFIFO_PTR(txstatus_fifo, u32);
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -1325,6 +1325,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup);
INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep);
+ retval = rt2x00lib_load_eeprom_file(rt2x00dev);
+ if (retval)
+ goto exit;
+
/*
* Let the driver probe the device to detect the capabilities.
*/
@@ -1455,6 +1459,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
*/
if (rt2x00dev->drv_data)
kfree(rt2x00dev->drv_data);
+
+ /*
+ * Free EEPROM image.
+ */
+ rt2x00lib_free_eeprom_file(rt2x00dev);
}
EXPORT_SYMBOL_GPL(rt2x00lib_remove_dev);
--- /dev/null
+++ b/drivers/net/wireless/rt2x00/rt2x00eeprom.c
@@ -0,0 +1,98 @@
@@ -0,0 +1,111 @@
+/*
+ Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
+ Copyright (C) 2004 - 2009 Gertjan van Wingerde <gwingerde@gmail.com>
@ -33,13 +185,24 @@
+#include "rt2x00.h"
+#include "rt2x00lib.h"
+
+static const char *
+rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev)
+{
+ struct rt2x00_platform_data *pdata = rt2x00dev->dev->platform_data;
+
+ if (pdata && pdata->eeprom_file_name)
+ return pdata->eeprom_file_name;
+
+ return NULL
+}
+
+static int rt2x00lib_request_eeprom_file(struct rt2x00_dev *rt2x00dev)
+{
+ const struct firmware *ee;
+ char *ee_name;
+ int retval;
+
+ ee_name = rt2x00dev->ops->lib->get_eeprom_file_name(rt2x00dev);
+ ee_name = rt2x00lib_get_eeprom_file_name(rt2x00dev);
+ if (!ee_name) {
+ rt2x00_err(rt2x00dev,
+ "Invalid EEPROM filename.\n"
@ -82,9 +245,11 @@
+{
+ int retval;
+
+ if (!test_bit(REQUIRE_EEPROM_FILE, &rt2x00dev->cap_flags))
+ if (!rt2x00lib_get_eeprom_file_name(rt2x00dev))
+ return 0;
+
+ set_bit(REQUIRE_EEPROM_FILE, &rt2x00dev->cap_flags);
+
+ if (!rt2x00dev->eeprom_file) {
+ retval = rt2x00lib_request_eeprom_file(rt2x00dev);
+ if (retval)
@ -99,36 +264,6 @@
+ release_firmware(rt2x00dev->eeprom_file);
+ rt2x00dev->eeprom_file = NULL;
+}
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -550,6 +550,7 @@ struct rt2x00lib_ops {
const u8 *data, const size_t len);
int (*load_firmware) (struct rt2x00_dev *rt2x00dev,
const u8 *data, const size_t len);
+ char *(*get_eeprom_file_name) (struct rt2x00_dev *rt2x00dev);
/*
* Device initialization/deinitialization handlers.
@@ -706,6 +707,7 @@ enum rt2x00_capability_flags {
REQUIRE_SW_SEQNO,
REQUIRE_HT_TX_DESC,
REQUIRE_PS_AUTOWAKE,
+ REQUIRE_EEPROM_FILE,
/*
* Capabilities
@@ -975,6 +977,11 @@ struct rt2x00_dev {
const struct firmware *fw;
/*
+ * EEPROM image.
+ */
+ const struct firmware *eeprom_file;
+
+ /*
* FIFO for storing tx status reports between isr and tasklet.
*/
DECLARE_KFIFO_PTR(txstatus_fifo, u32);
--- a/drivers/net/wireless/rt2x00/rt2x00lib.h
+++ b/drivers/net/wireless/rt2x00/rt2x00lib.h
@@ -322,6 +322,22 @@ static inline void rt2x00lib_free_firmwa
@ -154,119 +289,6 @@
* Debugfs handlers.
*/
#ifdef CPTCFG_RT2X00_LIB_DEBUGFS
--- a/drivers/net/wireless/rt2x00/Kconfig
+++ b/drivers/net/wireless/rt2x00/Kconfig
@@ -69,6 +69,7 @@ config RT2800PCI
select RT2X00_LIB_PCI if PCI
select RT2X00_LIB_SOC if SOC_RT288X || SOC_RT305X
select RT2X00_LIB_FIRMWARE
+ select RT2X00_LIB_EEPROM
select RT2X00_LIB_CRYPTO
depends on CRC_CCITT
depends on EEPROM_93CX6
@@ -244,6 +245,9 @@ config RT2X00_LIB_FIRMWARE
config RT2X00_LIB_CRYPTO
boolean
+config RT2X00_LIB_EEPROM
+ boolean
+
config RT2X00_LIB_LEDS
depends on !BACKPORT_KERNEL_2_6_25
boolean
--- a/drivers/net/wireless/rt2x00/Makefile
+++ b/drivers/net/wireless/rt2x00/Makefile
@@ -7,6 +7,7 @@ rt2x00lib-$(CPTCFG_RT2X00_LIB_DEBUGFS) +
rt2x00lib-$(CPTCFG_RT2X00_LIB_CRYPTO) += rt2x00crypto.o
rt2x00lib-$(CPTCFG_RT2X00_LIB_FIRMWARE) += rt2x00firmware.o
rt2x00lib-$(CPTCFG_RT2X00_LIB_LEDS) += rt2x00leds.o
+rt2x00lib-$(CPTCFG_RT2X00_LIB_EEPROM) += rt2x00eeprom.o
obj-$(CPTCFG_RT2X00_LIB) += rt2x00lib.o
obj-$(CPTCFG_RT2X00_LIB_MMIO) += rt2x00mmio.o
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -90,25 +90,11 @@ static void rt2800pci_mcu_status(struct
rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);
}
-#if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X)
static int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev)
{
- void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE);
-
- if (!base_addr)
- return -ENOMEM;
-
- memcpy_fromio(rt2x00dev->eeprom, base_addr, EEPROM_SIZE);
-
- iounmap(base_addr);
+ memcpy(rt2x00dev->eeprom, rt2x00dev->eeprom_file->data, EEPROM_SIZE);
return 0;
}
-#else
-static inline int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev)
-{
- return -ENOMEM;
-}
-#endif /* CONFIG_SOC_RT288X || CONFIG_SOC_RT305X */
#ifdef CONFIG_PCI
static void rt2800pci_eepromregister_read(struct eeprom_93cx6 *eeprom)
@@ -332,6 +318,20 @@ static int rt2800pci_write_firmware(stru
}
/*
+ * EEPROM file functions.
+ */
+static char *rt2800pci_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev)
+{
+ struct rt2x00_platform_data *pdata;
+
+ pdata = rt2x00dev->dev->platform_data;
+ if (pdata)
+ return pdata->eeprom_file_name;
+
+ return NULL;
+}
+
+/*
* Initialization functions.
*/
static bool rt2800pci_get_entry_state(struct queue_entry *entry)
@@ -1160,6 +1160,7 @@ static const struct rt2x00lib_ops rt2800
.get_firmware_name = rt2800pci_get_firmware_name,
.check_firmware = rt2800_check_firmware,
.load_firmware = rt2800_load_firmware,
+ .get_eeprom_file_name = rt2800pci_get_eeprom_file_name,
.initialize = rt2x00mmio_initialize,
.uninitialize = rt2x00mmio_uninitialize,
.get_entry_state = rt2800pci_get_entry_state,
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -1325,6 +1325,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup);
INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep);
+ retval = rt2x00lib_load_eeprom_file(rt2x00dev);
+ if (retval)
+ goto exit;
+
/*
* Let the driver probe the device to detect the capabilities.
*/
@@ -1455,6 +1459,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
*/
if (rt2x00dev->drv_data)
kfree(rt2x00dev->drv_data);
+
+ /*
+ * Free EEPROM image.
+ */
+ rt2x00lib_free_eeprom_file(rt2x00dev);
}
EXPORT_SYMBOL_GPL(rt2x00lib_remove_dev);
--- a/drivers/net/wireless/rt2x00/rt2x00soc.c
+++ b/drivers/net/wireless/rt2x00/rt2x00soc.c
@@ -94,6 +94,7 @@ int rt2x00soc_probe(struct platform_devi
@ -277,13 +299,3 @@
rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC);
--- a/.local-symbols
+++ b/.local-symbols
@@ -272,6 +272,7 @@ RT2X00_LIB_FIRMWARE=
RT2X00_LIB_CRYPTO=
RT2X00_LIB_LEDS=
RT2X00_LIB_DEBUGFS=
+RT2X00_LIB_EEPROM=
RT2X00_DEBUG=
RTLWIFI=
RTLWIFI_DEBUG=

View file

@ -0,0 +1,31 @@
--- a/drivers/net/wireless/rt2x00/rt2x00eeprom.c
+++ b/drivers/net/wireless/rt2x00/rt2x00eeprom.c
@@ -26,6 +26,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/of.h>
#include "rt2x00.h"
#include "rt2x00lib.h"
@@ -34,11 +35,19 @@ static const char *
rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev)
{
struct rt2x00_platform_data *pdata = rt2x00dev->dev->platform_data;
+ struct device_node *np;
+ char *eep;
if (pdata && pdata->eeprom_file_name)
return pdata->eeprom_file_name;
- return NULL
+#ifdef CONFIG_OF
+ np = rt2x00dev->dev->of_node;
+ if (np && of_property_read_string(np, "ralink,eeprom", &eep) == 0)
+ return eep;
+#endif
+
+ return NULL;
}
static int rt2x00lib_request_eeprom_file(struct rt2x00_dev *rt2x00dev)

View file

@ -12,32 +12,35 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
--- a/drivers/net/wireless/rt2x00/Kconfig
+++ b/drivers/net/wireless/rt2x00/Kconfig
@@ -71,6 +71,7 @@ config RT2800PCI
select RT2X00_LIB_FIRMWARE
@@ -219,6 +219,7 @@ config RT2800SOC
select RT2X00_LIB_EEPROM
select RT2X00_LIB_CRYPTO
select RT2800_LIB
select RT2800_LIB_MMIO
+ select MTD if SOC_RT288X || SOC_RT305X
depends on CRC_CCITT
depends on EEPROM_93CX6
---help---
This adds support for Ralink WiSoC devices.
Supported chips: RT2880, RT3050, RT3052, RT3350, RT3352.
--- a/drivers/net/wireless/rt2x00/rt2x00eeprom.c
+++ b/drivers/net/wireless/rt2x00/rt2x00eeprom.c
@@ -30,12 +30,77 @@
@@ -26,17 +26,72 @@
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
#include <linux/of.h>
#include "rt2x00.h"
#include "rt2x00lib.h"
+#ifdef CONFIG_OF
+#include <linux/of.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+
+static struct firmware mtd_fw;
+
+static int rt2800pci_read_eeprom_mtd(struct rt2x00_dev *rt2x00dev)
+static int rt2800lib_read_eeprom_mtd(struct rt2x00_dev *rt2x00dev)
+{
+ int ret = -EINVAL;
+#ifdef CONFIG_OF
+ static struct firmware mtd_fw;
+ struct device_node *np = rt2x00dev->dev->of_node, *mtd_np = NULL;
+ size_t retlen, len = rt2x00dev->ops->eeprom_size;
+ int ret, size, offset = 0;
+ int size, offset = 0;
+ struct mtd_info *mtd;
+ const char *part;
+ const __be32 *list;
@ -78,25 +81,32 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ mtd_fw.size = len;
+ mtd_fw.data = rt2x00dev->eeprom;
+ }
+#endif
+
+ return ret;
+}
+#else
+static inline int rt2800pci_read_eeprom_mtd(struct rt2x00_dev *rt2x00dev)
+{
+ return -EINVAL;
+}
+#endif
+
static const char *
rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev)
{
struct rt2x00_platform_data *pdata = rt2x00dev->dev->platform_data;
struct device_node *np;
- char *eep;
+ const char *eep;
if (pdata && pdata->eeprom_file_name)
return pdata->eeprom_file_name;
@@ -53,9 +108,12 @@ rt2x00lib_get_eeprom_file_name(struct rt
static int rt2x00lib_request_eeprom_file(struct rt2x00_dev *rt2x00dev)
{
const struct firmware *ee;
char *ee_name;
- char *ee_name;
+ const char *ee_name;
int retval;
+ if (!rt2800pci_read_eeprom_mtd(rt2x00dev))
+ if (!rt2800lib_read_eeprom_mtd(rt2x00dev))
+ return 0;
+
ee_name = rt2x00dev->ops->lib->get_eeprom_file_name(rt2x00dev);
ee_name = rt2x00lib_get_eeprom_file_name(rt2x00dev);
if (!ee_name) {
rt2x00_err(rt2x00dev,

View file

@ -1,46 +0,0 @@
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -90,7 +90,7 @@ static void rt2800pci_mcu_status(struct
rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);
}
-static int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev)
+static int rt2800pci_read_eeprom_file(struct rt2x00_dev *rt2x00dev)
{
memcpy(rt2x00dev->eeprom, rt2x00dev->eeprom_file->data, EEPROM_SIZE);
return 0;
@@ -1097,8 +1097,9 @@ static int rt2800pci_read_eeprom(struct
{
int retval;
- if (rt2x00_is_soc(rt2x00dev))
- retval = rt2800pci_read_eeprom_soc(rt2x00dev);
+ if (rt2x00_is_soc(rt2x00dev) ||
+ test_bit(REQUIRE_EEPROM_FILE, &rt2x00dev->cap_flags))
+ retval = rt2800pci_read_eeprom_file(rt2x00dev);
else if (rt2800pci_efuse_detect(rt2x00dev))
retval = rt2800pci_read_eeprom_efuse(rt2x00dev);
else
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -78,6 +78,7 @@ exit:
int rt2x00pci_probe(struct pci_dev *pci_dev, const struct rt2x00_ops *ops)
{
struct ieee80211_hw *hw;
+ struct rt2x00_platform_data *pdata;
struct rt2x00_dev *rt2x00dev;
int retval;
u16 chip;
@@ -125,6 +126,12 @@ int rt2x00pci_probe(struct pci_dev *pci_
rt2x00dev->irq = pci_dev->irq;
rt2x00dev->name = pci_name(pci_dev);
+ /* if we get passed the name of a eeprom_file_name, then use this in
+ favour of the eeprom */
+ pdata = rt2x00dev->dev->platform_data;
+ if (pdata && pdata->eeprom_file_name)
+ set_bit(REQUIRE_EEPROM_FILE, &rt2x00dev->cap_flags);
+
if (pci_is_pcie(pci_dev))
rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_PCIE);
else

View file

@ -37,7 +37,7 @@
num_rates += 4;
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -415,6 +415,7 @@ struct hw_mode_spec {
@@ -405,6 +405,7 @@ struct hw_mode_spec {
unsigned int supported_bands;
#define SUPPORT_BAND_2GHZ 0x00000001
#define SUPPORT_BAND_5GHZ 0x00000002

View file

@ -31,7 +31,7 @@
{
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -1327,6 +1327,7 @@ static inline void rt2x00debug_dump_fram
@@ -1403,6 +1403,7 @@ static inline void rt2x00debug_dump_fram
*/
u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev,
struct ieee80211_vif *vif);

View file

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -3186,11 +3186,17 @@ static void rt2800_config_channel(struct
@@ -3178,11 +3178,17 @@ static void rt2800_config_channel(struct
/*
* Change BBP settings
*/
@ -18,7 +18,7 @@
} else if (rt2x00_rt(rt2x00dev, RT3593)) {
if (rf->channel > 14) {
/* Disable CCK Packet detection on 5GHz */
@@ -3204,14 +3210,8 @@ static void rt2800_config_channel(struct
@@ -3196,14 +3202,8 @@ static void rt2800_config_channel(struct
else
rt2800_bbp_write(rt2x00dev, 105, 0x34);
@ -33,7 +33,7 @@
rt2800_bbp_write(rt2x00dev, 86, 0);
}
@@ -6093,6 +6093,12 @@ static void rt2800_init_rfcsr_3290(struc
@@ -6127,6 +6127,12 @@ static void rt2800_init_rfcsr_3290(struc
static void rt2800_init_rfcsr_3352(struct rt2x00_dev *rt2x00dev)
{
@ -46,7 +46,7 @@
rt2800_rf_init_calibration(rt2x00dev, 30);
rt2800_rfcsr_write(rt2x00dev, 0, 0xf0);
@@ -6128,15 +6134,30 @@ static void rt2800_init_rfcsr_3352(struc
@@ -6162,15 +6168,30 @@ static void rt2800_init_rfcsr_3352(struc
rt2800_rfcsr_write(rt2x00dev, 31, 0x80);
rt2800_rfcsr_write(rt2x00dev, 32, 0x80);
rt2800_rfcsr_write(rt2x00dev, 33, 0x00);
@ -80,7 +80,7 @@
rt2800_rfcsr_write(rt2x00dev, 43, 0xdb);
rt2800_rfcsr_write(rt2x00dev, 44, 0xdb);
rt2800_rfcsr_write(rt2x00dev, 45, 0xdb);
@@ -6144,15 +6165,20 @@ static void rt2800_init_rfcsr_3352(struc
@@ -6178,15 +6199,20 @@ static void rt2800_init_rfcsr_3352(struc
rt2800_rfcsr_write(rt2x00dev, 47, 0x0d);
rt2800_rfcsr_write(rt2x00dev, 48, 0x14);
rt2800_rfcsr_write(rt2x00dev, 49, 0x00);
@ -110,7 +110,7 @@
rt2800_rfcsr_write(rt2x00dev, 59, 0x00);
rt2800_rfcsr_write(rt2x00dev, 60, 0x00);
rt2800_rfcsr_write(rt2x00dev, 61, 0x00);
@@ -7004,6 +7030,7 @@ static int rt2800_init_eeprom(struct rt2
@@ -7046,6 +7072,7 @@ static int rt2800_init_eeprom(struct rt2
* RT53xx: defined in "EEPROM_CHIP_ID" field
*/
if (rt2x00_rt(rt2x00dev, RT3290) ||
@ -118,7 +118,7 @@
rt2x00_rt(rt2x00dev, RT5390) ||
rt2x00_rt(rt2x00dev, RT5392))
rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
@@ -7094,7 +7121,8 @@ static int rt2800_init_eeprom(struct rt2
@@ -7137,7 +7164,8 @@ static int rt2800_init_eeprom(struct rt2
/*
* Detect if this device has Bluetooth co-existence.
*/
@ -128,7 +128,7 @@
__set_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags);
/*
@@ -7123,6 +7151,22 @@ static int rt2800_init_eeprom(struct rt2
@@ -7166,6 +7194,22 @@ static int rt2800_init_eeprom(struct rt2
EIRP_MAX_TX_POWER_LIMIT)
__set_bit(CAPABILITY_POWER_LIMIT, &rt2x00dev->cap_flags);
@ -153,7 +153,7 @@
--- a/drivers/net/wireless/rt2x00/rt2800.h
+++ b/drivers/net/wireless/rt2x00/rt2800.h
@@ -2299,6 +2299,12 @@ struct mac_iveiv_entry {
@@ -2301,6 +2301,12 @@ struct mac_iveiv_entry {
#define RFCSR36_RF_BS FIELD8(0x80)
/*
@ -166,7 +166,7 @@
* RFCSR 38:
*/
#define RFCSR38_RX_LO1_EN FIELD8(0x20)
@@ -2310,6 +2316,18 @@ struct mac_iveiv_entry {
@@ -2312,6 +2318,18 @@ struct mac_iveiv_entry {
#define RFCSR39_RX_LO2_EN FIELD8(0x80)
/*
@ -185,7 +185,7 @@
* RFCSR 49:
*/
#define RFCSR49_TX FIELD8(0x3f)
@@ -2322,6 +2340,8 @@ struct mac_iveiv_entry {
@@ -2324,6 +2342,8 @@ struct mac_iveiv_entry {
* RFCSR 50:
*/
#define RFCSR50_TX FIELD8(0x3f)
@ -194,7 +194,7 @@
#define RFCSR50_EP FIELD8(0xc0)
/* bits for RT3593 */
#define RFCSR50_TX_LO1_EN FIELD8(0x20)
@@ -2469,6 +2489,8 @@ enum rt2800_eeprom_word {
@@ -2471,6 +2491,8 @@ enum rt2800_eeprom_word {
* INTERNAL_TX_ALC: 0: disable, 1: enable
* BT_COEXIST: 0: disable, 1: enable
* DAC_TEST: 0: disable, 1: enable
@ -202,9 +202,9 @@
+ * EXTERNAL_TX1_PA: 0: disable, 1: enable (only on RT3352)
*/
#define EEPROM_NIC_CONF1_HW_RADIO FIELD16(0x0001)
#define EEPROM_NIC_CONF1_EXTERNAL_TX_ALC FIELD16(0x0002)
@@ -2485,6 +2507,8 @@ enum rt2800_eeprom_word {
#define EEPROM_NIC_CONF1_INTERNAL_TX_ALC FIELD16(0x2000)
#define EEPROM_NIC_CONF1_EXTERNAL_TX_ALC FIELD16(0x0002)
@@ -2487,6 +2509,8 @@ enum rt2800_eeprom_word {
#define EEPROM_NIC_CONF1_INTERNAL_TX_ALC FIELD16(0x2000)
#define EEPROM_NIC_CONF1_BT_COEXIST FIELD16(0x4000)
#define EEPROM_NIC_CONF1_DAC_TEST FIELD16(0x8000)
+#define EEPROM_NIC_CONF1_EXTERNAL_TX0_PA_3352 FIELD16(0x4000)
@ -214,7 +214,7 @@
* EEPROM frequency
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -727,6 +727,8 @@ enum rt2x00_capability_flags {
@@ -716,6 +716,8 @@ enum rt2x00_capability_flags {
CAPABILITY_DOUBLE_ANTENNA,
CAPABILITY_BT_COEXIST,
CAPABILITY_VCO_RECALIBRATION,

View file

@ -1,7 +1,7 @@
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -7509,6 +7509,27 @@ static const struct rf_channel rf_vals_3
{173, 0x61, 0, 9},
@@ -7486,6 +7486,27 @@ static const struct rf_channel rf_vals_5
{196, 83, 0, 12, 1},
};
+/*
@ -28,28 +28,19 @@
static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
{
struct hw_mode_spec *spec = &rt2x00dev->spec;
@@ -7589,7 +7610,6 @@ static int rt2800_probe_hw_mode(struct r
rt2x00_rf(rt2x00dev, RF3022) ||
rt2x00_rf(rt2x00dev, RF3290) ||
rt2x00_rf(rt2x00dev, RF3320) ||
- rt2x00_rf(rt2x00dev, RF3322) ||
rt2x00_rf(rt2x00dev, RF5360) ||
rt2x00_rf(rt2x00dev, RF5370) ||
rt2x00_rf(rt2x00dev, RF5372) ||
@@ -7597,6 +7617,12 @@ static int rt2800_probe_hw_mode(struct r
rt2x00_rf(rt2x00dev, RF5392)) {
@@ -7574,7 +7595,10 @@ static int rt2800_probe_hw_mode(struct r
case RF5390:
case RF5392:
spec->num_channels = 14;
spec->channels = rf_vals_3x;
+ } else if (rt2x00_rf(rt2x00dev, RF3322)) {
+ spec->num_channels = 14;
- spec->channels = rf_vals_3x;
+ if (spec->clk_is_20mhz)
+ spec->channels = rf_vals_xtal20mhz_3x;
+ else
+ spec->channels = rf_vals_3x;
} else if (rt2x00_rf(rt2x00dev, RF3052)) {
spec->supported_bands |= SUPPORT_BAND_5GHZ;
spec->num_channels = ARRAY_SIZE(rf_vals_3x);
@@ -7769,6 +7795,19 @@ static int rt2800_probe_rt(struct rt2x00
break;
case RF3052:
@@ -7750,6 +7774,19 @@ static int rt2800_probe_rt(struct rt2x00
return 0;
}
@ -69,7 +60,7 @@
int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
{
int retval;
@@ -7798,6 +7837,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
@@ -7779,6 +7816,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
rt2800_register_write(rt2x00dev, GPIO_CTRL, reg);
/*
@ -87,7 +78,7 @@
retval = rt2800_probe_hw_mode(rt2x00dev);
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -410,6 +410,7 @@ static inline struct rt2x00_intf* vif_to
@@ -400,6 +400,7 @@ static inline struct rt2x00_intf* vif_to
* @channels: Device/chipset specific channel values (See &struct rf_channel).
* @channels_info: Additional information for channels (See &struct channel_info).
* @ht: Driver HT Capabilities (See &ieee80211_sta_ht_cap).
@ -95,7 +86,7 @@
*/
struct hw_mode_spec {
unsigned int supported_bands;
@@ -426,6 +427,7 @@ struct hw_mode_spec {
@@ -416,6 +417,7 @@ struct hw_mode_spec {
const struct channel_info *channels_info;
struct ieee80211_sta_ht_cap ht;

View file

@ -11,10 +11,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
drivers/net/wireless/rt2x00/rt2800pci.c | 7 +++++++
1 file changed, 7 insertions(+)
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -1318,11 +1318,18 @@ static int rt2800soc_probe(struct platfo
return rt2x00soc_probe(pdev, &rt2800pci_ops);
--- a/drivers/net/wireless/rt2x00/rt2800soc.c
+++ b/drivers/net/wireless/rt2x00/rt2800soc.c
@@ -229,11 +229,18 @@ static int rt2800soc_probe(struct platfo
return rt2x00soc_probe(pdev, &rt2800soc_ops);
}
+static const struct of_device_id rt2880_wmac_match[] = {

View file

@ -1,28 +0,0 @@
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -39,6 +39,7 @@
#include <linux/pci.h>
#include <linux/platform_device.h>
#include <linux/eeprom_93cx6.h>
+#include <linux/of.h>
#include "rt2x00.h"
#include "rt2x00mmio.h"
@@ -323,11 +324,17 @@ static int rt2800pci_write_firmware(stru
static char *rt2800pci_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev)
{
struct rt2x00_platform_data *pdata;
+ struct device_node *np;
+ char *eep;
pdata = rt2x00dev->dev->platform_data;
if (pdata)
return pdata->eeprom_file_name;
+ np = rt2x00dev->dev->of_node;
+ if (np && !of_property_read_string(np, "ralink,eeprom", &eep))
+ return eep;
+
return NULL;
}

View file

@ -8,7 +8,7 @@
#include "rt2x00.h"
#include "rt2800lib.h"
@@ -7797,13 +7798,14 @@ static int rt2800_probe_rt(struct rt2x00
@@ -7776,13 +7777,14 @@ static int rt2800_probe_rt(struct rt2x00
int rt2800_probe_clk(struct rt2x00_dev *rt2x00dev)
{

View file

@ -1,8 +1,8 @@
--- a/drivers/net/wireless/rt2x00/rt2800.h
+++ b/drivers/net/wireless/rt2x00/rt2800.h
@@ -71,6 +71,7 @@
#define RF3053 0x000d
@@ -73,6 +73,7 @@
#define RF5592 0x000f
#define RF3070 0x3070
#define RF3290 0x3290
+#define RF5350 0x5350
#define RF5360 0x5360
@ -10,39 +10,37 @@
#define RF5372 0x5372
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -2675,6 +2675,15 @@ static void rt2800_config_channel_rf53xx
if (rf->channel <= 14) {
int idx = rf->channel-1;
@@ -2707,6 +2707,13 @@ static void rt2800_config_channel_rf53xx
+ if (rt2x00_rt(rt2x00dev, RT5350)) {
+ static const char r59_non_bt[] = {0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a,
+ 0x0a, 0x09, 0x08, 0x07, 0x07, 0x06};
rt2800_rfcsr_write(rt2x00dev, 59,
r59_non_bt[idx]);
+ } else if (rt2x00_rt(rt2x00dev, RT5350)) {
+ static const char r59_non_bt[] = {0x0b, 0x0b,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a,
+ 0x0a, 0x09, 0x08, 0x07, 0x07, 0x06};
+
+ rt2800_rfcsr_write(rt2x00dev, 59,
+ r59_non_bt[idx]);
+ }
+
if (test_bit(CAPABILITY_BT_COEXIST, &rt2x00dev->cap_flags)) {
if (rt2x00_rt_rev_gte(rt2x00dev, RT5390, REV_RT5390F)) {
/* r55/r59 value array of channel 1~14 */
@@ -3153,6 +3162,7 @@ static void rt2800_config_channel(struct
case RF3322:
+ rt2800_rfcsr_write(rt2x00dev, 59,
+ r59_non_bt[idx]);
}
}
}
@@ -3144,6 +3151,7 @@ static void rt2800_config_channel(struct
rt2800_config_channel_rf3322(rt2x00dev, conf, rf, info);
break;
case RF3070:
+ case RF5350:
case RF5360:
case RF5370:
case RF5372:
@@ -3169,6 +3179,7 @@ static void rt2800_config_channel(struct
if (rt2x00_rf(rt2x00dev, RF3290) ||
@@ -3161,6 +3169,7 @@ static void rt2800_config_channel(struct
if (rt2x00_rf(rt2x00dev, RF3070) ||
rt2x00_rf(rt2x00dev, RF3290) ||
rt2x00_rf(rt2x00dev, RF3322) ||
+ rt2x00_rf(rt2x00dev, RF5350) ||
rt2x00_rf(rt2x00dev, RF5360) ||
rt2x00_rf(rt2x00dev, RF5370) ||
rt2x00_rf(rt2x00dev, RF5372) ||
@@ -3393,7 +3404,8 @@ static void rt2800_config_channel(struct
@@ -3401,7 +3410,8 @@ static void rt2800_config_channel(struct
/*
* Clear update flag
*/
@ -52,15 +50,15 @@
rt2800_bbp_read(rt2x00dev, 49, &bbp);
rt2x00_set_field8(&bbp, BBP49_UPDATE_FLAG, 0);
rt2800_bbp_write(rt2x00dev, 49, bbp);
@@ -4266,6 +4278,7 @@ void rt2800_vco_calibration(struct rt2x0
break;
@@ -4275,6 +4285,7 @@ void rt2800_vco_calibration(struct rt2x0
case RF3053:
case RF3070:
case RF3290:
+ case RF5350:
case RF5360:
case RF5370:
case RF5372:
@@ -4637,6 +4650,8 @@ static int rt2800_init_registers(struct
@@ -4671,6 +4682,8 @@ static int rt2800_init_registers(struct
rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
@ -69,7 +67,7 @@
} else {
rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000000);
rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
@@ -5278,9 +5293,13 @@ static void rt2800_init_bbp_3352(struct
@@ -5312,9 +5325,13 @@ static void rt2800_init_bbp_3352(struct
rt2800_bbp_write(rt2x00dev, 82, 0x62);
@ -86,7 +84,7 @@
rt2800_bbp_write(rt2x00dev, 86, 0x38);
@@ -5294,9 +5313,13 @@ static void rt2800_init_bbp_3352(struct
@@ -5328,9 +5345,13 @@ static void rt2800_init_bbp_3352(struct
rt2800_bbp_write(rt2x00dev, 104, 0x92);
@ -103,7 +101,7 @@
rt2800_bbp_write(rt2x00dev, 120, 0x50);
@@ -5321,6 +5344,13 @@ static void rt2800_init_bbp_3352(struct
@@ -5355,6 +5376,13 @@ static void rt2800_init_bbp_3352(struct
rt2800_bbp_write(rt2x00dev, 143, 0xa2);
rt2800_bbp_write(rt2x00dev, 148, 0xc8);
@ -117,7 +115,7 @@
}
static void rt2800_init_bbp_3390(struct rt2x00_dev *rt2x00dev)
@@ -5621,6 +5651,7 @@ static void rt2800_init_bbp(struct rt2x0
@@ -5655,6 +5683,7 @@ static void rt2800_init_bbp(struct rt2x0
rt2800_init_bbp_3290(rt2x00dev);
break;
case RT3352:
@ -125,7 +123,7 @@
rt2800_init_bbp_3352(rt2x00dev);
break;
case RT3390:
@@ -6431,6 +6462,76 @@ static void rt2800_init_rfcsr_3593(struc
@@ -6465,6 +6494,76 @@ static void rt2800_init_rfcsr_3593(struc
/* TODO: enable stream mode support */
}
@ -202,7 +200,7 @@
static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
{
rt2800_rf_init_calibration(rt2x00dev, 2);
@@ -6662,6 +6763,9 @@ static void rt2800_init_rfcsr(struct rt2
@@ -6695,6 +6794,9 @@ static void rt2800_init_rfcsr(struct rt2
case RT3593:
rt2800_init_rfcsr_3593(rt2x00dev);
break;
@ -212,7 +210,7 @@
case RT5390:
rt2800_init_rfcsr_5390(rt2x00dev);
break;
@@ -6902,6 +7006,12 @@ static int rt2800_validate_eeprom(struct
@@ -6944,6 +7046,12 @@ static int rt2800_validate_eeprom(struct
rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RF_TYPE, RF2820);
rt2800_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word);
rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word);
@ -225,7 +223,7 @@
} else if (rt2x00_rt(rt2x00dev, RT2860) ||
rt2x00_rt(rt2x00dev, RT2872)) {
/*
@@ -7035,6 +7145,8 @@ static int rt2800_init_eeprom(struct rt2
@@ -7077,6 +7185,8 @@ static int rt2800_init_eeprom(struct rt2
rt2x00_rt(rt2x00dev, RT5390) ||
rt2x00_rt(rt2x00dev, RT5392))
rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
@ -234,7 +232,7 @@
else
rf = rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RF_TYPE);
@@ -7052,6 +7164,7 @@ static int rt2800_init_eeprom(struct rt2
@@ -7095,6 +7205,7 @@ static int rt2800_init_eeprom(struct rt2
case RF3290:
case RF3320:
case RF3322:
@ -242,25 +240,23 @@
case RF5360:
case RF5370:
case RF5372:
@@ -7618,7 +7731,8 @@ static int rt2800_probe_hw_mode(struct r
rt2x00_rf(rt2x00dev, RF5392)) {
spec->num_channels = 14;
spec->channels = rf_vals_3x;
- } else if (rt2x00_rf(rt2x00dev, RF3322)) {
+ } else if (rt2x00_rf(rt2x00dev, RF3322) ||
+ rt2x00_rf(rt2x00dev, RF5350)) {
spec->num_channels = 14;
if (spec->clk_is_20mhz)
spec->channels = rf_vals_xtal20mhz_3x;
@@ -7743,6 +7857,7 @@ static int rt2800_probe_hw_mode(struct r
case RF3052:
@@ -7590,6 +7701,7 @@ static int rt2800_probe_hw_mode(struct r
case RF3290:
case RF3320:
case RF3322:
+ case RF5350:
case RF5360:
case RF5370:
case RF5372:
@@ -7722,6 +7834,7 @@ static int rt2800_probe_hw_mode(struct r
case RF3053:
case RF3070:
case RF3290:
+ case RF5350:
case RF5360:
case RF5370:
case RF5372:
@@ -7781,6 +7896,7 @@ static int rt2800_probe_rt(struct rt2x00
@@ -7760,6 +7873,7 @@ static int rt2800_probe_rt(struct rt2x00
case RT3390:
case RT3572:
case RT3593:
@ -270,7 +266,7 @@
case RT5592:
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -181,6 +181,7 @@ struct rt2x00_chip {
@@ -171,6 +171,7 @@ struct rt2x00_chip {
#define RT3572 0x3572
#define RT3593 0x3593
#define RT3883 0x3883 /* WSOC */

View file

@ -1,32 +0,0 @@
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -108,7 +108,9 @@ int rt2x00pci_probe(struct pci_dev *pci_
goto exit_release_regions;
}
+#ifdef CONFIG_PCI_MSI
pci_enable_msi(pci_dev);
+#endif
hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw);
if (!hw) {
@@ -162,7 +164,9 @@ exit_free_device:
ieee80211_free_hw(hw);
exit_disable_msi:
+#ifdef CONFIG_PCI_SET_MWI
pci_disable_msi(pci_dev);
+#endif
exit_release_regions:
pci_release_regions(pci_dev);
@@ -188,7 +192,9 @@ void rt2x00pci_remove(struct pci_dev *pc
rt2x00pci_free_reg(rt2x00dev);
ieee80211_free_hw(hw);
+#ifdef CONFIG_PCI_MSI
pci_disable_msi(pci_dev);
+#endif
/*
* Free the PCI device data.

View file

@ -8,7 +8,7 @@
#include "rt2x00.h"
#include "rt2800lib.h"
@@ -7253,6 +7254,17 @@ static int rt2800_init_eeprom(struct rt2
@@ -7294,6 +7295,17 @@ static int rt2800_init_eeprom(struct rt2
rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC);
rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY);

View file

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -7142,10 +7142,11 @@ static int rt2800_init_eeprom(struct rt2
@@ -7182,10 +7182,11 @@ static int rt2800_init_eeprom(struct rt2
* RT53xx: defined in "EEPROM_CHIP_ID" field
*/
if (rt2x00_rt(rt2x00dev, RT3290) ||

View file

@ -1,27 +0,0 @@
From 60ce314d1750fef843e9db70050e09e49f838b69 Mon Sep 17 00:00:00 2001
From: Larry Finger <Larry.Finger@lwfinger.net>
Date: Thu, 19 Sep 2013 02:21:35 +0000
Subject: rtlwifi: Align private space in rtl_priv struct
The private array at the end of the rtl_priv struct is not aligned.
On ARM architecture, this causes an alignment trap and is fixed by aligning
that array with __align(sizeof(void *)). That should properly align that
space according to the requirements of all architectures.
Reported-by: Jason Andrews <jasona@cadence.com>
Tested-by: Jason Andrews <jasona@cadence.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -2057,7 +2057,7 @@ struct rtl_priv {
that it points to the data allocated
beyond this structure like:
rtl_pci_priv or rtl_usb_priv */
- u8 priv[0];
+ u8 priv[0] __aligned(sizeof(void *));
};
#define rtl_priv(hw) (((struct rtl_priv *)(hw)->priv))

View file

@ -42,7 +42,7 @@
if (wl->radio_enabled != phy->radio_on) {
if (wl->radio_enabled) {
@@ -5028,6 +5025,47 @@ static int b43_op_get_survey(struct ieee
@@ -5029,6 +5026,47 @@ static int b43_op_get_survey(struct ieee
return 0;
}
@ -90,7 +90,7 @@
static const struct ieee80211_ops b43_hw_ops = {
.tx = b43_op_tx,
.conf_tx = b43_op_conf_tx,
@@ -5049,6 +5087,8 @@ static const struct ieee80211_ops b43_hw
@@ -5050,6 +5088,8 @@ static const struct ieee80211_ops b43_hw
.sw_scan_complete = b43_op_sw_scan_complete_notifier,
.get_survey = b43_op_get_survey,
.rfkill_poll = b43_rfkill_poll,
@ -99,7 +99,7 @@
};
/* Hard-reset the chip. Do not call this directly.
@@ -5295,6 +5335,8 @@ static int b43_one_core_attach(struct b4
@@ -5292,6 +5332,8 @@ static int b43_one_core_attach(struct b4
if (!wldev)
goto out;
@ -108,7 +108,7 @@
wldev->use_pio = b43_modparam_pio;
wldev->dev = dev;
wldev->wl = wl;
@@ -5385,6 +5427,9 @@ static struct b43_wl *b43_wireless_init(
@@ -5382,6 +5424,9 @@ static struct b43_wl *b43_wireless_init(
hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;

View file

@ -19,7 +19,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -1061,6 +1061,32 @@ static inline bool b43_using_pio_transfe
@@ -1058,6 +1058,32 @@ static inline bool b43_using_pio_transfe
return dev->__using_pio_transfers;
}
@ -88,7 +88,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
dev->phy.writes_counter = 0;
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -5417,14 +5417,14 @@ static inline void check_phyreg(struct b
@@ -5418,14 +5418,14 @@ static inline void check_phyreg(struct b
static u16 b43_nphy_op_read(struct b43_wldev *dev, u16 reg)
{
check_phyreg(dev, reg);
@ -105,7 +105,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
b43_write16(dev, B43_MMIO_PHY_DATA, value);
}
@@ -5432,7 +5432,7 @@ static void b43_nphy_op_maskset(struct b
@@ -5433,7 +5433,7 @@ static void b43_nphy_op_maskset(struct b
u16 set)
{
check_phyreg(dev, reg);
@ -114,7 +114,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
b43_maskset16(dev, B43_MMIO_PHY_DATA, mask, set);
}
@@ -5443,7 +5443,7 @@ static u16 b43_nphy_op_radio_read(struct
@@ -5444,7 +5444,7 @@ static u16 b43_nphy_op_radio_read(struct
/* N-PHY needs 0x100 for read access */
reg |= 0x100;
@ -123,7 +123,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
return b43_read16(dev, B43_MMIO_RADIO_DATA_LOW);
}
@@ -5452,7 +5452,7 @@ static void b43_nphy_op_radio_write(stru
@@ -5453,7 +5453,7 @@ static void b43_nphy_op_radio_write(stru
/* Register 1 is a 32-bit register. */
B43_WARN_ON(reg == 1);

View file

@ -0,0 +1,29 @@
--- a/drivers/net/wireless/brcm80211/brcmsmac/channel.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/channel.c
@@ -58,21 +58,12 @@
(((c) < 149) ? 3 : 4))))
#define BRCM_2GHZ_2412_2462 REG_RULE(2412-10, 2462+10, 40, 0, 19, 0)
-#define BRCM_2GHZ_2467_2472 REG_RULE(2467-10, 2472+10, 20, 0, 19, \
- NL80211_RRF_NO_IR)
+#define BRCM_2GHZ_2467_2472 REG_RULE(2467-10, 2472+10, 20, 0, 19, 0)
-#define BRCM_5GHZ_5180_5240 REG_RULE(5180-10, 5240+10, 40, 0, 21, \
- NL80211_RRF_NO_IR)
-#define BRCM_5GHZ_5260_5320 REG_RULE(5260-10, 5320+10, 40, 0, 21, \
- NL80211_RRF_NO_IR | \
- NL80211_RRF_DFS | \
- NL80211_RRF_NO_IR)
-#define BRCM_5GHZ_5500_5700 REG_RULE(5500-10, 5700+10, 40, 0, 21, \
- NL80211_RRF_NO_IR | \
- NL80211_RRF_DFS | \
- NL80211_RRF_NO_IR)
-#define BRCM_5GHZ_5745_5825 REG_RULE(5745-10, 5825+10, 40, 0, 21, \
- NL80211_RRF_NO_IR)
+#define BRCM_5GHZ_5180_5240 REG_RULE(5180-10, 5240+10, 40, 0, 21, 0)
+#define BRCM_5GHZ_5260_5320 REG_RULE(5260-10, 5320+10, 40, 0, 21, 0)
+#define BRCM_5GHZ_5500_5700 REG_RULE(5500-10, 5700+10, 40, 0, 21, 0)
+#define BRCM_5GHZ_5745_5825 REG_RULE(5745-10, 5825+10, 40, 0, 21, 0)
static const struct ieee80211_regdomain brcms_regdom_x2 = {
.n_reg_rules = 6,

View file

@ -1,31 +0,0 @@
--- a/drivers/net/wireless/brcm80211/brcmsmac/channel.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/channel.c
@@ -59,23 +59,16 @@
#define BRCM_2GHZ_2412_2462 REG_RULE(2412-10, 2462+10, 40, 0, 19, 0)
#define BRCM_2GHZ_2467_2472 REG_RULE(2467-10, 2472+10, 20, 0, 19, \
- NL80211_RRF_PASSIVE_SCAN | \
- NL80211_RRF_NO_IBSS)
+ 0)
#define BRCM_5GHZ_5180_5240 REG_RULE(5180-10, 5240+10, 40, 0, 21, \
- NL80211_RRF_PASSIVE_SCAN | \
- NL80211_RRF_NO_IBSS)
+ 0)
#define BRCM_5GHZ_5260_5320 REG_RULE(5260-10, 5320+10, 40, 0, 21, \
- NL80211_RRF_PASSIVE_SCAN | \
- NL80211_RRF_DFS | \
- NL80211_RRF_NO_IBSS)
+ 0)
#define BRCM_5GHZ_5500_5700 REG_RULE(5500-10, 5700+10, 40, 0, 21, \
- NL80211_RRF_PASSIVE_SCAN | \
- NL80211_RRF_DFS | \
- NL80211_RRF_NO_IBSS)
+ 0)
#define BRCM_5GHZ_5745_5825 REG_RULE(5745-10, 5825+10, 40, 0, 21, \
- NL80211_RRF_PASSIVE_SCAN | \
- NL80211_RRF_NO_IBSS)
+ 0)
static const struct ieee80211_regdomain brcms_regdom_x2 = {
.n_reg_rules = 6,

View file

@ -1,84 +0,0 @@
brcmsmac: use bcma PCIe up and down functions
replace the calls to bcma_core_pci_extend_L1timer() by calls to the
newly introduced bcma_core_pci_ip() and bcma_core_pci_down()
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
@@ -679,27 +679,6 @@ bool ai_clkctl_cc(struct si_pub *sih, en
return mode == BCMA_CLKMODE_FAST;
}
-void ai_pci_up(struct si_pub *sih)
-{
- struct si_info *sii;
-
- sii = container_of(sih, struct si_info, pub);
-
- if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI)
- bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci[0], true);
-}
-
-/* Unconfigure and/or apply various WARs when going down */
-void ai_pci_down(struct si_pub *sih)
-{
- struct si_info *sii;
-
- sii = container_of(sih, struct si_info, pub);
-
- if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI)
- bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci[0], false);
-}
-
/* Enable BT-COEX & Ex-PA for 4313 */
void ai_epa_4313war(struct si_pub *sih)
{
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h
@@ -183,9 +183,6 @@ extern u16 ai_clkctl_fast_pwrup_delay(st
extern bool ai_clkctl_cc(struct si_pub *sih, enum bcma_clkmode mode);
extern bool ai_deviceremoved(struct si_pub *sih);
-extern void ai_pci_down(struct si_pub *sih);
-extern void ai_pci_up(struct si_pub *sih);
-
/* Enable Ex-PA for 4313 */
extern void ai_epa_4313war(struct si_pub *sih);
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -4667,7 +4667,7 @@ static int brcms_b_attach(struct brcms_c
brcms_c_coredisable(wlc_hw);
/* Match driver "down" state */
- ai_pci_down(wlc_hw->sih);
+ bcma_core_pci_down(wlc_hw->d11core->bus);
/* turn off pll and xtal to match driver "down" state */
brcms_b_xtal(wlc_hw, OFF);
@@ -5010,12 +5010,12 @@ static int brcms_b_up_prep(struct brcms_
*/
if (brcms_b_radio_read_hwdisabled(wlc_hw)) {
/* put SB PCI in down state again */
- ai_pci_down(wlc_hw->sih);
+ bcma_core_pci_down(wlc_hw->d11core->bus);
brcms_b_xtal(wlc_hw, OFF);
return -ENOMEDIUM;
}
- ai_pci_up(wlc_hw->sih);
+ bcma_core_pci_up(wlc_hw->d11core->bus);
/* reset the d11 core */
brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS);
@@ -5212,7 +5212,7 @@ static int brcms_b_down_finish(struct br
/* turn off primary xtal and pll */
if (!wlc_hw->noreset) {
- ai_pci_down(wlc_hw->sih);
+ bcma_core_pci_down(wlc_hw->d11core->bus);
brcms_b_xtal(wlc_hw, OFF);
}
}

View file

@ -1,36 +0,0 @@
b43: call PCIe up and down functions
Tell the PCIe host core when the wifi is activated.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -4670,6 +4670,19 @@ static void b43_wireless_core_exit(struc
b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_PSM_RUN,
B43_MACCTL_PSM_JMP0);
+ switch (dev->dev->bus_type) {
+#ifdef CPTCFG_B43_BCMA
+ case B43_BUS_BCMA:
+ bcma_core_pci_down(dev->dev->bdev->bus);
+ break;
+#endif
+#ifdef CPTCFG_B43_SSB
+ case B43_BUS_SSB:
+ /* TODO */
+ break;
+#endif
+ }
+
b43_dma_free(dev);
b43_pio_free(dev);
b43_chip_exit(dev);
@@ -4709,6 +4722,7 @@ static int b43_wireless_core_init(struct
case B43_BUS_BCMA:
bcma_core_pci_irq_ctl(&dev->dev->bdev->bus->drv_pci[0],
dev->dev->bdev, true);
+ bcma_core_pci_up(dev->dev->bdev->bus);
break;
#endif
#ifdef CPTCFG_B43_SSB