aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--package/mac80211/Makefile6
-rw-r--r--package/mac80211/patches/002-disable_rfkill.patch2
-rw-r--r--package/mac80211/patches/005-disable_ssb_build.patch2
-rw-r--r--package/mac80211/patches/011-no_sdio.patch2
-rw-r--r--package/mac80211/patches/100-disable_pcmcia_compat.patch2
-rw-r--r--package/mac80211/patches/110-disable_usb_compat.patch4
-rw-r--r--package/mac80211/patches/120-compat_rcu_dereference.patch6
-rw-r--r--package/mac80211/patches/408-ath9k_tweak_rx_intr_mitigation.patch2
-rw-r--r--package/mac80211/patches/500-ath9k_debugfs_chainmask.patch130
-rw-r--r--package/mac80211/patches/500-pending_work.patch6880
-rw-r--r--package/mac80211/patches/510-ath9k_debugfs_regaccess.patch128
-rw-r--r--package/mac80211/patches/510-ath9k_use_minstrel.patch (renamed from package/mac80211/patches/540-ath9k_use_minstrel.patch)0
-rw-r--r--package/mac80211/patches/520-cfg80211_get_freq.patch34
-rw-r--r--package/mac80211/patches/530-minstrel_ht.patch1147
-rw-r--r--package/mac80211/patches/550-ath9k_no_multi_desc_frames.patch24
-rw-r--r--package/mac80211/patches/600-rt2x00-disable-pci-code-if-CONFIG_PCI-not-defined.patch4
-rw-r--r--package/mac80211/patches/601-rt2x00-lib-use-rt2x00dev-irq.patch2
17 files changed, 6897 insertions, 1478 deletions
diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile
index a91878178b..b5d8e97cfb 100644
--- a/package/mac80211/Makefile
+++ b/package/mac80211/Makefile
@@ -10,12 +10,12 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=mac80211
-PKG_VERSION:=2010-04-28
+PKG_VERSION:=2010-05-12
PKG_RELEASE:=1
PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
# http://www.orbit-lab.org/kernel/compat-wireless-2.6/2010/11 \
# http://wireless.kernel.org/download/compat-wireless-2.6
-PKG_MD5SUM:=4b8c23ac7f33af7556034635af744c67
+PKG_MD5SUM:=73e2aa6b917bdb0bae079433fe26a500
PKG_SOURCE:=compat-wireless-$(PKG_VERSION).tar.bz2
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/compat-wireless-$(PKG_VERSION)
@@ -779,6 +779,7 @@ BUILDFLAGS:= \
$(if $(CONFIG_PACKAGE_MAC80211_DEBUGFS),-DCONFIG_MAC80211_DEBUGFS -DCONFIG_ATH9K_DEBUGFS) \
$(if $(CONFIG_PACKAGE_ATH_DEBUG),-DCONFIG_ATH_DEBUG) \
-D__CONFIG_MAC80211_RC_DEFAULT=minstrel \
+ -DCONFIG_MAC80211_RC_MINSTREL_HT \
$(if $(CONFIG_ATH_USER_REGD),-DATH_USER_REGD=1) \
$(if $(CONFIG_PACKAGE_ATH9K_USE_MINSTREL),-DATH9K_USE_MINSTREL) \
$(if $(CONFIG_PACKAGE_RT2X00_LIB_DEBUGFS),-DCONFIG_RT2X00_LIB_DEBUGFS) \
@@ -877,6 +878,7 @@ MAKE_OPTS:= \
CONFIG_AR9170_LEDS=$(CONFIG_LEDS_TRIGGERS) \
CONFIG_IWM= \
CONFIG_ATH9K_HTC= \
+ CONFIG_MAC80211_RC_MINSTREL_HT=y \
MADWIFI= \
OLD_IWL= \
KLIB_BUILD="$(LINUX_DIR)" \
diff --git a/package/mac80211/patches/002-disable_rfkill.patch b/package/mac80211/patches/002-disable_rfkill.patch
index 9c6338a9a9..0a11c6171d 100644
--- a/package/mac80211/patches/002-disable_rfkill.patch
+++ b/package/mac80211/patches/002-disable_rfkill.patch
@@ -9,7 +9,7 @@
ifeq ($(CONFIG_MAC80211),y)
$(error "ERROR: you have MAC80211 compiled into the kernel, CONFIG_MAC80211=y, as such you cannot replace its mac80211 driver. You need this set to CONFIG_MAC80211=m. If you are using Fedora upgrade your kernel as later version should this set as modular. For further information on Fedora see https://bugzilla.redhat.com/show_bug.cgi?id=470143. If you are using your own kernel recompile it and make mac80211 modular")
-@@ -481,8 +481,8 @@ endif
+@@ -483,8 +483,8 @@ endif
# We need the backported rfkill module on kernel < 2.6.31.
# In more recent kernel versions use the in kernel rfkill module.
ifdef CONFIG_COMPAT_KERNEL_31
diff --git a/package/mac80211/patches/005-disable_ssb_build.patch b/package/mac80211/patches/005-disable_ssb_build.patch
index 9edb690f2a..3e5cfcb21d 100644
--- a/package/mac80211/patches/005-disable_ssb_build.patch
+++ b/package/mac80211/patches/005-disable_ssb_build.patch
@@ -41,7 +41,7 @@
CONFIG_P54_PCI=m
# CONFIG_B44=m
-@@ -411,7 +395,6 @@ endif # end of SPI driver list
+@@ -413,7 +397,6 @@ endif # end of SPI driver list
ifneq ($(CONFIG_MMC),)
diff --git a/package/mac80211/patches/011-no_sdio.patch b/package/mac80211/patches/011-no_sdio.patch
index d263f4e692..82d8c1b08f 100644
--- a/package/mac80211/patches/011-no_sdio.patch
+++ b/package/mac80211/patches/011-no_sdio.patch
@@ -1,6 +1,6 @@
--- a/config.mk
+++ b/config.mk
-@@ -380,7 +380,7 @@ endif # end of SPI driver list
+@@ -382,7 +382,7 @@ endif # end of SPI driver list
ifneq ($(CONFIG_MMC),)
diff --git a/package/mac80211/patches/100-disable_pcmcia_compat.patch b/package/mac80211/patches/100-disable_pcmcia_compat.patch
index 7e5450a343..8b366ff936 100644
--- a/package/mac80211/patches/100-disable_pcmcia_compat.patch
+++ b/package/mac80211/patches/100-disable_pcmcia_compat.patch
@@ -53,7 +53,7 @@
#include <pcmcia/cs_types.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/ds.h>
-@@ -70,9 +70,9 @@ static inline struct sk_buff *netdev_all
+@@ -67,9 +67,9 @@ static inline struct sk_buff *netdev_all
return skb;
}
diff --git a/package/mac80211/patches/110-disable_usb_compat.patch b/package/mac80211/patches/110-disable_usb_compat.patch
index c895907ecf..d87eb47d40 100644
--- a/package/mac80211/patches/110-disable_usb_compat.patch
+++ b/package/mac80211/patches/110-disable_usb_compat.patch
@@ -11,8 +11,8 @@
{
--- a/compat/compat-2.6.29.c
+++ b/compat/compat-2.6.29.c
-@@ -16,7 +16,7 @@
- #include <linux/etherdevice.h>
+@@ -53,7 +53,7 @@ void netdev_attach_ops(struct net_device
+ EXPORT_SYMBOL(netdev_attach_ops);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23))
-#if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE)
diff --git a/package/mac80211/patches/120-compat_rcu_dereference.patch b/package/mac80211/patches/120-compat_rcu_dereference.patch
index f14a8ddbd4..4540662d2b 100644
--- a/package/mac80211/patches/120-compat_rcu_dereference.patch
+++ b/package/mac80211/patches/120-compat_rcu_dereference.patch
@@ -1,8 +1,8 @@
--- a/include/linux/compat-2.6.34.h
+++ b/include/linux/compat-2.6.34.h
-@@ -197,6 +197,8 @@ do { \
- */
- #define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr)
+@@ -200,6 +200,8 @@ do { \
+ #define usb_alloc_coherent(dev, size, mem_flags, dma) usb_buffer_alloc(dev, size, mem_flags, dma)
+ #define usb_free_coherent(dev, size, addr, dma) usb_buffer_free(dev, size, addr, dma)
+#define rcu_dereference_check(p, c) rcu_dereference(p)
+
diff --git a/package/mac80211/patches/408-ath9k_tweak_rx_intr_mitigation.patch b/package/mac80211/patches/408-ath9k_tweak_rx_intr_mitigation.patch
index f7e7742e1c..6396e25d35 100644
--- a/package/mac80211/patches/408-ath9k_tweak_rx_intr_mitigation.patch
+++ b/package/mac80211/patches/408-ath9k_tweak_rx_intr_mitigation.patch
@@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -1380,7 +1380,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
+@@ -1400,7 +1400,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
if (ah->config.rx_intr_mitigation) {
REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_LAST, 500);
diff --git a/package/mac80211/patches/500-ath9k_debugfs_chainmask.patch b/package/mac80211/patches/500-ath9k_debugfs_chainmask.patch
deleted file mode 100644
index b5f035af75..0000000000
--- a/package/mac80211/patches/500-ath9k_debugfs_chainmask.patch
+++ /dev/null
@@ -1,130 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/debug.c
-+++ b/drivers/net/wireless/ath/ath9k/debug.c
-@@ -78,6 +78,90 @@ static const struct file_operations fops
-
- #define DMA_BUF_LEN 1024
-
-+static ssize_t read_file_tx_chainmask(struct file *file, char __user *user_buf,
-+ size_t count, loff_t *ppos)
-+{
-+ struct ath_softc *sc = file->private_data;
-+ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
-+ char buf[32];
-+ unsigned int len;
-+
-+ len = snprintf(buf, sizeof(buf), "0x%08x\n", common->tx_chainmask);
-+ return simple_read_from_buffer(user_buf, count, ppos, buf, len);
-+}
-+
-+static ssize_t write_file_tx_chainmask(struct file *file, const char __user *user_buf,
-+ size_t count, loff_t *ppos)
-+{
-+ struct ath_softc *sc = file->private_data;
-+ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
-+ unsigned long mask;
-+ char buf[32];
-+ ssize_t len;
-+
-+ len = min(count, sizeof(buf) - 1);
-+ if (copy_from_user(buf, user_buf, len))
-+ return -EINVAL;
-+
-+ buf[len] = '\0';
-+ if (strict_strtoul(buf, 0, &mask))
-+ return -EINVAL;
-+
-+ common->tx_chainmask = mask;
-+ sc->sc_ah->caps.tx_chainmask = mask;
-+ return count;
-+}
-+
-+static const struct file_operations fops_tx_chainmask = {
-+ .read = read_file_tx_chainmask,
-+ .write = write_file_tx_chainmask,
-+ .open = ath9k_debugfs_open,
-+ .owner = THIS_MODULE
-+};
-+
-+
-+static ssize_t read_file_rx_chainmask(struct file *file, char __user *user_buf,
-+ size_t count, loff_t *ppos)
-+{
-+ struct ath_softc *sc = file->private_data;
-+ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
-+ char buf[32];
-+ unsigned int len;
-+
-+ len = snprintf(buf, sizeof(buf), "0x%08x\n", common->rx_chainmask);
-+ return simple_read_from_buffer(user_buf, count, ppos, buf, len);
-+}
-+
-+static ssize_t write_file_rx_chainmask(struct file *file, const char __user *user_buf,
-+ size_t count, loff_t *ppos)
-+{
-+ struct ath_softc *sc = file->private_data;
-+ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
-+ unsigned long mask;
-+ char buf[32];
-+ ssize_t len;
-+
-+ len = min(count, sizeof(buf) - 1);
-+ if (copy_from_user(buf, user_buf, len))
-+ return -EINVAL;
-+
-+ buf[len] = '\0';
-+ if (strict_strtoul(buf, 0, &mask))
-+ return -EINVAL;
-+
-+ common->rx_chainmask = mask;
-+ sc->sc_ah->caps.rx_chainmask = mask;
-+ return count;
-+}
-+
-+static const struct file_operations fops_rx_chainmask = {
-+ .read = read_file_rx_chainmask,
-+ .write = write_file_rx_chainmask,
-+ .open = ath9k_debugfs_open,
-+ .owner = THIS_MODULE
-+};
-+
-+
- static ssize_t read_file_dma(struct file *file, char __user *user_buf,
- size_t count, loff_t *ppos)
- {
-@@ -731,6 +815,16 @@ int ath9k_init_debug(struct ath_hw *ah)
- goto err;
- #endif
-
-+ sc->debug.debugfs_rx_chainmask = debugfs_create_file("rx_chainmask",
-+ S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_rx_chainmask);
-+ if (!sc->debug.debugfs_rx_chainmask)
-+ goto err;
-+
-+ sc->debug.debugfs_tx_chainmask = debugfs_create_file("tx_chainmask",
-+ S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_tx_chainmask);
-+ if (!sc->debug.debugfs_tx_chainmask)
-+ goto err;
-+
- sc->debug.debugfs_dma = debugfs_create_file("dma", S_IRUSR,
- sc->debug.debugfs_phy, sc, &fops_dma);
- if (!sc->debug.debugfs_dma)
-@@ -781,6 +875,8 @@ void ath9k_exit_debug(struct ath_hw *ah)
- struct ath_common *common = ath9k_hw_common(ah);
- struct ath_softc *sc = (struct ath_softc *) common->priv;
-
-+ debugfs_remove(sc->debug.debugfs_tx_chainmask);
-+ debugfs_remove(sc->debug.debugfs_rx_chainmask);
- debugfs_remove(sc->debug.debugfs_recv);
- debugfs_remove(sc->debug.debugfs_xmit);
- debugfs_remove(sc->debug.debugfs_wiphy);
---- a/drivers/net/wireless/ath/ath9k/debug.h
-+++ b/drivers/net/wireless/ath/ath9k/debug.h
-@@ -152,6 +152,8 @@ struct ath_stats {
- };
-
- struct ath9k_debug {
-+ struct dentry *debugfs_rx_chainmask;
-+ struct dentry *debugfs_tx_chainmask;
- struct dentry *debugfs_phy;
- struct dentry *debugfs_debug;
- struct dentry *debugfs_dma;
diff --git a/package/mac80211/patches/500-pending_work.patch b/package/mac80211/patches/500-pending_work.patch
new file mode 100644
index 0000000000..eb5764d357
--- /dev/null
+++ b/package/mac80211/patches/500-pending_work.patch
@@ -0,0 +1,6880 @@
+--- /dev/null
++++ b/drivers/net/wireless/ath/ath9k/ar9003_2p0_initvals.h
+@@ -0,0 +1,1784 @@
++/*
++ * Copyright (c) 2010 Atheros Communications Inc.
++ *
++ * Permission to use, copy, modify, and/or distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ */
++
++#ifndef INITVALS_9003_2P0_H
++#define INITVALS_9003_2P0_H
++
++/* AR9003 2.0 */
++
++static const u32 ar9300_2p0_radio_postamble[][5] = {
++ /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
++ {0x0001609c, 0x0dd08f29, 0x0dd08f29, 0x0b283f31, 0x0b283f31},
++ {0x000160ac, 0xa4653c00, 0xa4653c00, 0x24652800, 0x24652800},
++ {0x000160b0, 0x03284f3e, 0x03284f3e, 0x05d08f20, 0x05d08f20},
++ {0x0001610c, 0x08000000, 0x00000000, 0x00000000, 0x00000000},
++ {0x00016140, 0x10804008, 0x10804008, 0x50804008, 0x50804008},
++ {0x0001650c, 0x08000000, 0x00000000, 0x00000000, 0x00000000},
++ {0x00016540, 0x10804008, 0x10804008, 0x50804008, 0x50804008},
++ {0x0001690c, 0x08000000, 0x00000000, 0x00000000, 0x00000000},
++ {0x00016940, 0x10804008, 0x10804008, 0x50804008, 0x50804008},
++};
++
++static const u32 ar9300Modes_lowest_ob_db_tx_gain_table_2p0[][5] = {
++ /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
++ {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
++ {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
++ {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002},
++ {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004},
++ {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200},
++ {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202},
++ {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400},
++ {0x0000a518, 0x21020220, 0x21020220, 0x16000402, 0x16000402},
++ {0x0000a51c, 0x27020223, 0x27020223, 0x19000404, 0x19000404},
++ {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603},
++ {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02},
++ {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04},
++ {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20},
++ {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20},
++ {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22},
++ {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24},
++ {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640},
++ {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660},
++ {0x0000a544, 0x5302266c, 0x5302266c, 0x3f001861, 0x3f001861},
++ {0x0000a548, 0x5702286c, 0x5702286c, 0x43001a81, 0x43001a81},
++ {0x0000a54c, 0x5c04286b, 0x5c04286b, 0x47001a83, 0x47001a83},
++ {0x0000a550, 0x61042a6c, 0x61042a6c, 0x4a001c84, 0x4a001c84},
++ {0x0000a554, 0x66062a6c, 0x66062a6c, 0x4e001ce3, 0x4e001ce3},
++ {0x0000a558, 0x6b062e6c, 0x6b062e6c, 0x52001ce5, 0x52001ce5},
++ {0x0000a55c, 0x7006308c, 0x7006308c, 0x56001ce9, 0x56001ce9},
++ {0x0000a560, 0x730a308a, 0x730a308a, 0x5a001ceb, 0x5a001ceb},
++ {0x0000a564, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
++ {0x0000a568, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
++ {0x0000a56c, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
++ {0x0000a570, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
++ {0x0000a574, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
++ {0x0000a578, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
++ {0x0000a57c, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
++ {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000},
++ {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002},
++ {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004},
++ {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200},
++ {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202},
++ {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400},
++ {0x0000a598, 0x21820220, 0x21820220, 0x16800402, 0x16800402},
++ {0x0000a59c, 0x27820223, 0x27820223, 0x19800404, 0x19800404},
++ {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603},
++ {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02},
++ {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04},
++ {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20},
++ {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20},
++ {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22},
++ {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24},
++ {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640},
++ {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660},
++ {0x0000a5c4, 0x5382266c, 0x5382266c, 0x3f801861, 0x3f801861},
++ {0x0000a5c8, 0x5782286c, 0x5782286c, 0x43801a81, 0x43801a81},
++ {0x0000a5cc, 0x5c84286b, 0x5c84286b, 0x47801a83, 0x47801a83},
++ {0x0000a5d0, 0x61842a6c, 0x61842a6c, 0x4a801c84, 0x4a801c84},
++ {0x0000a5d4, 0x66862a6c, 0x66862a6c, 0x4e801ce3, 0x4e801ce3},
++ {0x0000a5d8, 0x6b862e6c, 0x6b862e6c, 0x52801ce5, 0x52801ce5},
++ {0x0000a5dc, 0x7086308c, 0x7086308c, 0x56801ce9, 0x56801ce9},
++ {0x0000a5e0, 0x738a308a, 0x738a308a, 0x5a801ceb, 0x5a801ceb},
++ {0x0000a5e4, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5e8, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5ec, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5f0, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5f4, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5f8, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5fc, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
++ {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
++ {0x00016048, 0x62480001, 0x62480001, 0x62480001, 0x62480001},
++ {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
++ {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
++ {0x00016448, 0x62480001, 0x62480001, 0x62480001, 0x62480001},
++ {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
++ {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
++ {0x00016848, 0x62480001, 0x62480001, 0x62480001, 0x62480001},
++ {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
++};
++
++static const u32 ar9300Modes_fast_clock_2p0[][3] = {
++ /* Addr 5G_HT20 5G_HT40 */
++ {0x00001030, 0x00000268, 0x000004d0},
++ {0x00001070, 0x0000018c, 0x00000318},
++ {0x000010b0, 0x00000fd0, 0x00001fa0},
++ {0x00008014, 0x044c044c, 0x08980898},
++ {0x0000801c, 0x148ec02b, 0x148ec057},
++ {0x00008318, 0x000044c0, 0x00008980},
++ {0x00009e00, 0x03721821, 0x03721821},
++ {0x0000a230, 0x0000000b, 0x00000016},
++ {0x0000a254, 0x00000898, 0x00001130},
++};
++
++static const u32 ar9300_2p0_radio_core[][2] = {
++ /* Addr allmodes */
++ {0x00016000, 0x36db6db6},
++ {0x00016004, 0x6db6db40},
++ {0x00016008, 0x73f00000},
++ {0x0001600c, 0x00000000},
++ {0x00016040, 0x7f80fff8},
++ {0x0001604c, 0x76d005b5},
++ {0x00016050, 0x556cf031},
++ {0x00016054, 0x13449440},
++ {0x00016058, 0x0c51c92c},
++ {0x0001605c, 0x3db7fffc},
++ {0x00016060, 0xfffffffc},
++ {0x00016064, 0x000f0278},
++ {0x0001606c, 0x6db60000},
++ {0x00016080, 0x00000000},
++ {0x00016084, 0x0e48048c},
++ {0x00016088, 0x54214514},
++ {0x0001608c, 0x119f481e},
++ {0x00016090, 0x24926490},
++ {0x00016098, 0xd2888888},
++ {0x000160a0, 0x0a108ffe},
++ {0x000160a4, 0x812fc370},
++ {0x000160a8, 0x423c8000},
++ {0x000160b4, 0x92480080},
++ {0x000160c0, 0x00adb6d0},
++ {0x000160c4, 0x6db6db60},
++ {0x000160c8, 0x6db6db6c},
++ {0x000160cc, 0x01e6c000},
++ {0x00016100, 0x3fffbe01},
++ {0x00016104, 0xfff80000},
++ {0x00016108, 0x00080010},
++ {0x00016144, 0x02084080},
++ {0x00016148, 0x00000000},
++ {0x00016280, 0x058a0001},
++ {0x00016284, 0x3d840208},
++ {0x00016288, 0x05a20408},
++ {0x0001628c, 0x00038c07},
++ {0x00016290, 0x40000004},
++ {0x00016294, 0x458aa14f},
++ {0x00016380, 0x00000000},
++ {0x00016384, 0x00000000},
++ {0x00016388, 0x00800700},
++ {0x0001638c, 0x00800700},
++ {0x00016390, 0x00800700},
++ {0x00016394, 0x00000000},
++ {0x00016398, 0x00000000},
++ {0x0001639c, 0x00000000},
++ {0x000163a0, 0x00000001},
++ {0x000163a4, 0x00000001},
++ {0x000163a8, 0x00000000},
++ {0x000163ac, 0x00000000},
++ {0x000163b0, 0x00000000},
++ {0x000163b4, 0x00000000},
++ {0x000163b8, 0x00000000},
++ {0x000163bc, 0x00000000},
++ {0x000163c0, 0x000000a0},
++ {0x000163c4, 0x000c0000},
++ {0x000163c8, 0x14021402},
++ {0x000163cc, 0x00001402},
++ {0x000163d0, 0x00000000},
++ {0x000163d4, 0x00000000},
++ {0x00016400, 0x36db6db6},
++ {0x00016404, 0x6db6db40},
++ {0x00016408, 0x73f00000},
++ {0x0001640c, 0x00000000},
++ {0x00016440, 0x7f80fff8},
++ {0x0001644c, 0x76d005b5},
++ {0x00016450, 0x556cf031},
++ {0x00016454, 0x13449440},
++ {0x00016458, 0x0c51c92c},
++ {0x0001645c, 0x3db7fffc},
++ {0x00016460, 0xfffffffc},
++ {0x00016464, 0x000f0278},
++ {0x0001646c, 0x6db60000},
++ {0x00016500, 0x3fffbe01},
++ {0x00016504, 0xfff80000},
++ {0x00016508, 0x00080010},
++ {0x00016544, 0x02084080},
++ {0x00016548, 0x00000000},
++ {0x00016780, 0x00000000},
++ {0x00016784, 0x00000000},
++ {0x00016788, 0x00800700},
++ {0x0001678c, 0x00800700},
++ {0x00016790, 0x00800700},
++ {0x00016794, 0x00000000},
++ {0x00016798, 0x00000000},
++ {0x0001679c, 0x00000000},
++ {0x000167a0, 0x00000001},
++ {0x000167a4, 0x00000001},
++ {0x000167a8, 0x00000000},
++ {0x000167ac, 0x00000000},
++ {0x000167b0, 0x00000000},
++ {0x000167b4, 0x00000000},
++ {0x000167b8, 0x00000000},
++ {0x000167bc, 0x00000000},
++ {0x000167c0, 0x000000a0},
++ {0x000167c4, 0x000c0000},
++ {0x000167c8, 0x14021402},
++ {0x000167cc, 0x00001402},
++ {0x000167d0, 0x00000000},
++ {0x000167d4, 0x00000000},
++ {0x00016800, 0x36db6db6},
++ {0x00016804, 0x6db6db40},
++ {0x00016808, 0x73f00000},
++ {0x0001680c, 0x00000000},
++ {0x00016840, 0x7f80fff8},
++ {0x0001684c, 0x76d005b5},
++ {0x00016850, 0x556cf031},
++ {0x00016854, 0x13449440},
++ {0x00016858, 0x0c51c92c},
++ {0x0001685c, 0x3db7fffc},
++ {0x00016860, 0xfffffffc},
++ {0x00016864, 0x000f0278},
++ {0x0001686c, 0x6db60000},
++ {0x00016900, 0x3fffbe01},
++ {0x00016904, 0xfff80000},
++ {0x00016908, 0x00080010},
++ {0x00016944, 0x02084080},
++ {0x00016948, 0x00000000},
++ {0x00016b80, 0x00000000},
++ {0x00016b84, 0x00000000},
++ {0x00016b88, 0x00800700},
++ {0x00016b8c, 0x00800700},
++ {0x00016b90, 0x00800700},
++ {0x00016b94, 0x00000000},
++ {0x00016b98, 0x00000000},
++ {0x00016b9c, 0x00000000},
++ {0x00016ba0, 0x00000001},
++ {0x00016ba4, 0x00000001},
++ {0x00016ba8, 0x00000000},
++ {0x00016bac, 0x00000000},
++ {0x00016bb0, 0x00000000},
++ {0x00016bb4, 0x00000000},
++ {0x00016bb8, 0x00000000},
++ {0x00016bbc, 0x00000000},
++ {0x00016bc0, 0x000000a0},
++ {0x00016bc4, 0x000c0000},
++ {0x00016bc8, 0x14021402},
++ {0x00016bcc, 0x00001402},
++ {0x00016bd0, 0x00000000},
++ {0x00016bd4, 0x00000000},
++};
++
++static const u32 ar9300Common_rx_gain_table_merlin_2p0[][2] = {
++ /* Addr allmodes */
++ {0x0000a000, 0x02000101},
++ {0x0000a004, 0x02000102},
++ {0x0000a008, 0x02000103},
++ {0x0000a00c, 0x02000104},
++ {0x0000a010, 0x02000200},
++ {0x0000a014, 0x02000201},
++ {0x0000a018, 0x02000202},
++ {0x0000a01c, 0x02000203},
++ {0x0000a020, 0x02000204},
++ {0x0000a024, 0x02000205},
++ {0x0000a028, 0x02000208},
++ {0x0000a02c, 0x02000302},
++ {0x0000a030, 0x02000303},
++ {0x0000a034, 0x02000304},
++ {0x0000a038, 0x02000400},
++ {0x0000a03c, 0x02010300},
++ {0x0000a040, 0x02010301},
++ {0x0000a044, 0x02010302},
++ {0x0000a048, 0x02000500},
++ {0x0000a04c, 0x02010400},
++ {0x0000a050, 0x02020300},
++ {0x0000a054, 0x02020301},
++ {0x0000a058, 0x02020302},
++ {0x0000a05c, 0x02020303},
++ {0x0000a060, 0x02020400},
++ {0x0000a064, 0x02030300},
++ {0x0000a068, 0x02030301},
++ {0x0000a06c, 0x02030302},
++ {0x0000a070, 0x02030303},
++ {0x0000a074, 0x02030400},
++ {0x0000a078, 0x02040300},
++ {0x0000a07c, 0x02040301},
++ {0x0000a080, 0x02040302},
++ {0x0000a084, 0x02040303},
++ {0x0000a088, 0x02030500},
++ {0x0000a08c, 0x02040400},
++ {0x0000a090, 0x02050203},
++ {0x0000a094, 0x02050204},
++ {0x0000a098, 0x02050205},
++ {0x0000a09c, 0x02040500},
++ {0x0000a0a0, 0x02050301},
++ {0x0000a0a4, 0x02050302},
++ {0x0000a0a8, 0x02050303},
++ {0x0000a0ac, 0x02050400},
++ {0x0000a0b0, 0x02050401},
++ {0x0000a0b4, 0x02050402},
++ {0x0000a0b8, 0x02050403},
++ {0x0000a0bc, 0x02050500},
++ {0x0000a0c0, 0x02050501},
++ {0x0000a0c4, 0x02050502},
++ {0x0000a0c8, 0x02050503},
++ {0x0000a0cc, 0x02050504},
++ {0x0000a0d0, 0x02050600},
++ {0x0000a0d4, 0x02050601},
++ {0x0000a0d8, 0x02050602},
++ {0x0000a0dc, 0x02050603},
++ {0x0000a0e0, 0x02050604},
++ {0x0000a0e4, 0x02050700},
++ {0x0000a0e8, 0x02050701},
++ {0x0000a0ec, 0x02050702},
++ {0x0000a0f0, 0x02050703},
++ {0x0000a0f4, 0x02050704},
++ {0x0000a0f8, 0x02050705},
++ {0x0000a0fc, 0x02050708},
++ {0x0000a100, 0x02050709},
++ {0x0000a104, 0x0205070a},
++ {0x0000a108, 0x0205070b},
++ {0x0000a10c, 0x0205070c},
++ {0x0000a110, 0x0205070d},
++ {0x0000a114, 0x02050710},
++ {0x0000a118, 0x02050711},
++ {0x0000a11c, 0x02050712},
++ {0x0000a120, 0x02050713},
++ {0x0000a124, 0x02050714},
++ {0x0000a128, 0x02050715},
++ {0x0000a12c, 0x02050730},
++ {0x0000a130, 0x02050731},
++ {0x0000a134, 0x02050732},
++ {0x0000a138, 0x02050733},
++ {0x0000a13c, 0x02050734},
++ {0x0000a140, 0x02050735},
++ {0x0000a144, 0x02050750},
++ {0x0000a148, 0x02050751},
++ {0x0000a14c, 0x02050752},
++ {0x0000a150, 0x02050753},
++ {0x0000a154, 0x02050754},
++ {0x0000a158, 0x02050755},
++ {0x0000a15c, 0x02050770},
++ {0x0000a160, 0x02050771},
++ {0x0000a164, 0x02050772},
++ {0x0000a168, 0x02050773},
++ {0x0000a16c, 0x02050774},
++ {0x0000a170, 0x02050775},
++ {0x0000a174, 0x00000776},
++ {0x0000a178, 0x00000776},
++ {0x0000a17c, 0x00000776},
++ {0x0000a180, 0x00000776},
++ {0x0000a184, 0x00000776},
++ {0x0000a188, 0x00000776},
++ {0x0000a18c, 0x00000776},
++ {0x0000a190, 0x00000776},
++ {0x0000a194, 0x00000776},
++ {0x0000a198, 0x00000776},
++ {0x0000a19c, 0x00000776},
++ {0x0000a1a0, 0x00000776},
++ {0x0000a1a4, 0x00000776},
++ {0x0000a1a8, 0x00000776},
++ {0x0000a1ac, 0x00000776},
++ {0x0000a1b0, 0x00000776},
++ {0x0000a1b4, 0x00000776},
++ {0x0000a1b8, 0x00000776},
++ {0x0000a1bc, 0x00000776},
++ {0x0000a1c0, 0x00000776},
++ {0x0000a1c4, 0x00000776},
++ {0x0000a1c8, 0x00000776},
++ {0x0000a1cc, 0x00000776},
++ {0x0000a1d0, 0x00000776},
++ {0x0000a1d4, 0x00000776},
++ {0x0000a1d8, 0x00000776},
++ {0x0000a1dc, 0x00000776},
++ {0x0000a1e0, 0x00000776},
++ {0x0000a1e4, 0x00000776},
++ {0x0000a1e8, 0x00000776},
++ {0x0000a1ec, 0x00000776},
++ {0x0000a1f0, 0x00000776},
++ {0x0000a1f4, 0x00000776},
++ {0x0000a1f8, 0x00000776},
++ {0x0000a1fc, 0x00000776},
++ {0x0000b000, 0x02000101},
++ {0x0000b004, 0x02000102},
++ {0x0000b008, 0x02000103},
++ {0x0000b00c, 0x02000104},
++ {0x0000b010, 0x02000200},
++ {0x0000b014, 0x02000201},
++ {0x0000b018, 0x02000202},
++ {0x0000b01c, 0x02000203},
++ {0x0000b020, 0x02000204},
++ {0x0000b024, 0x02000205},
++ {0x0000b028, 0x02000208},
++ {0x0000b02c, 0x02000302},
++ {0x0000b030, 0x02000303},
++ {0x0000b034, 0x02000304},
++ {0x0000b038, 0x02000400},
++ {0x0000b03c, 0x02010300},
++ {0x0000b040, 0x02010301},
++ {0x0000b044, 0x02010302},
++ {0x0000b048, 0x02000500},
++ {0x0000b04c, 0x02010400},
++ {0x0000b050, 0x02020300},
++ {0x0000b054, 0x02020301},
++ {0x0000b058, 0x02020302},
++ {0x0000b05c, 0x02020303},
++ {0x0000b060, 0x02020400},
++ {0x0000b064, 0x02030300},
++ {0x0000b068, 0x02030301},
++ {0x0000b06c, 0x02030302},
++ {0x0000b070, 0x02030303},
++ {0x0000b074, 0x02030400},
++ {0x0000b078, 0x02040300},
++ {0x0000b07c, 0x02040301},
++ {0x0000b080, 0x02040302},
++ {0x0000b084, 0x02040303},
++ {0x0000b088, 0x02030500},
++ {0x0000b08c, 0x02040400},
++ {0x0000b090, 0x02050203},
++ {0x0000b094, 0x02050204},
++ {0x0000b098, 0x02050205},
++ {0x0000b09c, 0x02040500},
++ {0x0000b0a0, 0x02050301},
++ {0x0000b0a4, 0x02050302},
++ {0x0000b0a8, 0x02050303},
++ {0x0000b0ac, 0x02050400},
++ {0x0000b0b0, 0x02050401},
++ {0x0000b0b4, 0x02050402},
++ {0x0000b0b8, 0x02050403},
++ {0x0000b0bc, 0x02050500},
++ {0x0000b0c0, 0x02050501},
++ {0x0000b0c4, 0x02050502},
++ {0x0000b0c8, 0x02050503},
++ {0x0000b0cc, 0x02050504},
++ {0x0000b0d0, 0x02050600},
++ {0x0000b0d4, 0x02050601},
++ {0x0000b0d8, 0x02050602},
++ {0x0000b0dc, 0x02050603},
++ {0x0000b0e0, 0x02050604},
++ {0x0000b0e4, 0x02050700},
++ {0x0000b0e8, 0x02050701},
++ {0x0000b0ec, 0x02050702},
++ {0x0000b0f0, 0x02050703},
++ {0x0000b0f4, 0x02050704},
++ {0x0000b0f8, 0x02050705},
++ {0x0000b0fc, 0x02050708},
++ {0x0000b100, 0x02050709},
++ {0x0000b104, 0x0205070a},
++ {0x0000b108, 0x0205070b},
++ {0x0000b10c, 0x0205070c},
++ {0x0000b110, 0x0205070d},
++ {0x0000b114, 0x02050710},
++ {0x0000b118, 0x02050711},
++ {0x0000b11c, 0x02050712},
++ {0x0000b120, 0x02050713},
++ {0x0000b124, 0x02050714},
++ {0x0000b128, 0x02050715},
++ {0x0000b12c, 0x02050730},
++ {0x0000b130, 0x02050731},
++ {0x0000b134, 0x02050732},
++ {0x0000b138, 0x02050733},
++ {0x0000b13c, 0x02050734},
++ {0x0000b140, 0x02050735},
++ {0x0000b144, 0x02050750},
++ {0x0000b148, 0x02050751},
++ {0x0000b14c, 0x02050752},
++ {0x0000b150, 0x02050753},
++ {0x0000b154, 0x02050754},
++ {0x0000b158, 0x02050755},
++ {0x0000b15c, 0x02050770},
++ {0x0000b160, 0x02050771},
++ {0x0000b164, 0x02050772},
++ {0x0000b168, 0x02050773},
++ {0x0000b16c, 0x02050774},
++ {0x0000b170, 0x02050775},
++ {0x0000b174, 0x00000776},
++ {0x0000b178, 0x00000776},
++ {0x0000b17c, 0x00000776},
++ {0x0000b180, 0x00000776},
++ {0x0000b184, 0x00000776},
++ {0x0000b188, 0x00000776},
++ {0x0000b18c, 0x00000776},
++ {0x0000b190, 0x00000776},
++ {0x0000b194, 0x00000776},
++ {0x0000b198, 0x00000776},
++ {0x0000b19c, 0x00000776},
++ {0x0000b1a0, 0x00000776},
++ {0x0000b1a4, 0x00000776},
++ {0x0000b1a8, 0x00000776},
++ {0x0000b1ac, 0x00000776},
++ {0x0000b1b0, 0x00000776},
++ {0x0000b1b4, 0x00000776},
++ {0x0000b1b8, 0x00000776},
++ {0x0000b1bc, 0x00000776},
++ {0x0000b1c0, 0x00000776},
++ {0x0000b1c4, 0x00000776},
++ {0x0000b1c8, 0x00000776},
++ {0x0000b1cc, 0x00000776},
++ {0x0000b1d0, 0x00000776},
++ {0x0000b1d4, 0x00000776},
++ {0x0000b1d8, 0x00000776},
++ {0x0000b1dc, 0x00000776},
++ {0x0000b1e0, 0x00000776},
++ {0x0000b1e4, 0x00000776},
++ {0x0000b1e8, 0x00000776},
++ {0x0000b1ec, 0x00000776},
++ {0x0000b1f0, 0x00000776},
++ {0x0000b1f4, 0x00000776},
++ {0x0000b1f8, 0x00000776},
++ {0x0000b1fc, 0x00000776},
++};
++
++static const u32 ar9300_2p0_mac_postamble[][5] = {
++ /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
++ {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160},
++ {0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c},
++ {0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38},
++ {0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00},
++ {0x0000801c, 0x128d8027, 0x128d804f, 0x12e00057, 0x12e0002b},
++ {0x00008120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810},
++ {0x000081d0, 0x00003210, 0x00003210, 0x0000320a, 0x0000320a},
++ {0x00008318, 0x00003e80, 0x00007d00, 0x00006880, 0x00003440},
++};
++
++static const u32 ar9300_2p0_soc_postamble[][5] = {
++ /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
++ {0x00007010, 0x00000023, 0x00000023, 0x00000023, 0x00000023},
++};
++
++static const u32 ar9200_merlin_2p0_radio_core[][2] = {
++ /* Addr allmodes */
++ {0x00007800, 0x00040000},
++ {0x00007804, 0xdb005012},
++ {0x00007808, 0x04924914},
++ {0x0000780c, 0x21084210},
++ {0x00007810, 0x6d801300},
++ {0x00007814, 0x0019beff},
++ {0x00007818, 0x07e41000},
++ {0x0000781c, 0x00392000},
++ {0x00007820, 0x92592480},
++ {0x00007824, 0x00040000},
++ {0x00007828, 0xdb005012},
++ {0x0000782c, 0x04924914},
++ {0x00007830, 0x21084210},
++ {0x00007834, 0x6d801300},
++ {0x00007838, 0x0019beff},
++ {0x0000783c, 0x07e40000},
++ {0x00007840, 0x00392000},
++ {0x00007844, 0x92592480},
++ {0x00007848, 0x00100000},
++ {0x0000784c, 0x773f0567},
++ {0x00007850, 0x54214514},
++ {0x00007854, 0x12035828},
++ {0x00007858, 0x92592692},
++ {0x0000785c, 0x00000000},
++ {0x00007860, 0x56400000},
++ {0x00007864, 0x0a8e370e},
++ {0x00007868, 0xc0102850},
++ {0x0000786c, 0x812d4000},
++ {0x00007870, 0x807ec400},
++ {0x00007874, 0x001b6db0},
++ {0x00007878, 0x00376b63},
++ {0x0000787c, 0x06db6db6},
++ {0x00007880, 0x006d8000},
++ {0x00007884, 0xffeffffe},
++ {0x00007888, 0xffeffffe},
++ {0x0000788c, 0x00010000},
++ {0x00007890, 0x02060aeb},
++ {0x00007894, 0x5a108000},
++};
++
++static const u32 ar9300_2p0_baseband_postamble[][5] = {
++ /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
++ {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8011, 0xd00a8011},
++ {0x00009820, 0x206a022e, 0x206a022e, 0x206a012e, 0x206a012e},
++ {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0},
++ {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x06903881},
++ {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4},
++ {0x00009830, 0x0000059c, 0x0000059c, 0x0000119c, 0x0000119c},
++ {0x00009c00, 0x00000044, 0x000000c4, 0x000000c4, 0x00000044},
++ {0x00009e00, 0x0372161e, 0x0372161e, 0x037216a0, 0x037216a0},
++ {0x00009e04, 0x00802020, 0x00802020, 0x00802020, 0x00802020},
++ {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2},
++ {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec84d2e, 0x7ec84d2e},
++ {0x00009e14, 0x31395d5e, 0x3139605e, 0x3139605e, 0x31395d5e},
++ {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
++ {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c},
++ {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce},
++ {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021},
++ {0x00009e44, 0x02321e27, 0x02321e27, 0x02291e27, 0x02291e27},
++ {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012},
++ {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000},
++ {0x0000a204, 0x000037c0, 0x000037c4, 0x000037c4, 0x000037c0},
++ {0x0000a208, 0x00000104, 0x00000104, 0x00000004, 0x00000004},
++ {0x0000a230, 0x0000000a, 0x00000014, 0x00000016, 0x0000000b},
++ {0x0000a238, 0xffb81018, 0xffb81018, 0xffb81018, 0xffb81018},
++ {0x0000a250, 0x00000000, 0x00000000, 0x00000210, 0x00000108},
++ {0x0000a254, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898},
++ {0x0000a258, 0x02020002, 0x02020002, 0x02020002, 0x02020002},
++ {0x0000a25c, 0x01000e0e, 0x01000e0e, 0x01000e0e, 0x01000e0e},
++ {0x0000a260, 0x0a021501, 0x0a021501, 0x3a021501, 0x3a021501},
++ {0x0000a264, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e},
++ {0x0000a280, 0x00000007, 0x00000007, 0x0000000b, 0x0000000b},
++ {0x0000a284, 0x00000000, 0x00000000, 0x00000150, 0x00000150},
++ {0x0000a288, 0x00000110, 0x00000110, 0x00000110, 0x00000110},
++ {0x0000a28c, 0x00022222, 0x00022222, 0x00022222, 0x00022222},
++ {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18},
++ {0x0000a2d0, 0x00071981, 0x00071981, 0x00071981, 0x00071982},
++ {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a},
++ {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
++ {0x0000a830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c},
++ {0x0000ae04, 0x00800000, 0x00800000, 0x00800000, 0x00800000},
++ {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
++ {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c},
++ {0x0000ae20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce},
++ {0x0000b284, 0x00000000, 0x00000000, 0x00000150, 0x00000150},
++ {0x0000b830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c},
++ {0x0000be04, 0x00800000, 0x00800000, 0x00800000, 0x00800000},
++ {0x0000be18, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
++ {0x0000be1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c},
++ {0x0000be20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce},
++ {0x0000c284, 0x00000000, 0x00000000, 0x00000150, 0x00000150},
++};
++
++static const u32 ar9300_2p0_baseband_core[][2] = {
++ /* Addr allmodes */
++ {0x00009800, 0xafe68e30},
++ {0x00009804, 0xfd14e000},
++ {0x00009808, 0x9c0a9f6b},
++ {0x0000980c, 0x04900000},
++ {0x00009814, 0x9280c00a},
++ {0x00009818, 0x00000000},
++ {0x0000981c, 0x00020028},
++ {0x00009834, 0x5f3ca3de},
++ {0x00009838, 0x0108ecff},
++ {0x0000983c, 0x14750600},
++ {0x00009880, 0x201fff00},
++ {0x00009884, 0x00001042},
++ {0x000098a4, 0x00200400},
++ {0x000098b0, 0x52440bbe},
++ {0x000098d0, 0x004b6a8e},
++ {0x000098d4, 0x00000820},
++ {0x000098dc, 0x00000000},
++ {0x000098f0, 0x00000000},
++ {0x000098f4, 0x00000000},
++ {0x00009c04, 0xff55ff55},
++ {0x00009c08, 0x0320ff55},
++ {0x00009c0c, 0x00000000},
++ {0x00009c10, 0x00000000},
++ {0x00009c14, 0x00046384},
++ {0x00009c18, 0x05b6b440},
++ {0x00009c1c, 0x00b6b440},
++ {0x00009d00, 0xc080a333},
++ {0x00009d04, 0x40206c10},
++ {0x00009d08, 0x009c4060},
++ {0x00009d0c, 0x9883800a},
++ {0x00009d10, 0x01834061},
++ {0x00009d14, 0x00c0040b},
++ {0x00009d18, 0x00000000},
++ {0x00009e08, 0x0038230c},
++ {0x00009e24, 0x990bb515},
++ {0x00009e28, 0x0c6f0000},
++ {0x00009e30, 0x06336f77},
++ {0x00009e34, 0x6af6532f},
++ {0x00009e38, 0x0cc80c00},
++ {0x00009e3c, 0xcf946222},
++ {0x00009e40, 0x0d261820},
++ {0x00009e4c, 0x00001004},
++ {0x00009e50, 0x00ff03f1},
++ {0x00009e54, 0x00000000},
++ {0x00009fc0, 0x803e4788},
++ {0x00009fc4, 0x0001efb5},
++ {0x00009fcc, 0x40000014},
++ {0x00009fd0, 0x01193b93},
++ {0x0000a20c, 0x00000000},
++ {0x0000a220, 0x00000000},
++ {0x0000a224, 0x00000000},
++ {0x0000a228, 0x10002310},
++ {0x0000a22c, 0x01036a1e},
++ {0x0000a234, 0x10000fff},
++ {0x0000a23c, 0x00000000},
++ {0x0000a244, 0x0c000000},
++ {0x0000a2a0, 0x00000001},
++ {0x0000a2c0, 0x00000001},
++ {0x0000a2c8, 0x00000000},
++ {0x0000a2cc, 0x18c43433},
++ {0x0000a2d4, 0x00000000},
++ {0x0000a2dc, 0x00000000},
++ {0x0000a2e0, 0x00000000},
++ {0x0000a2e4, 0x00000000},
++ {0x0000a2e8, 0x00000000},
++ {0x0000a2ec, 0x00000000},
++ {0x0000a2f0, 0x00000000},
++ {0x0000a2f4, 0x00000000},
++ {0x0000a2f8, 0x00000000},
++ {0x0000a344, 0x00000000},
++ {0x0000a34c, 0x00000000},
++ {0x0000a350, 0x0000a000},
++ {0x0000a364, 0x00000000},
++ {0x0000a370, 0x00000000},
++ {0x0000a390, 0x00000001},
++ {0x0000a394, 0x00000444},
++ {0x0000a398, 0x001f0e0f},
++ {0x0000a39c, 0x0075393f},
++ {0x0000a3a0, 0xb79f6427},
++ {0x0000a3a4, 0x00000000},
++ {0x0000a3a8, 0xaaaaaaaa},
++ {0x0000a3ac, 0x3c466478},
++ {0x0000a3c0, 0x20202020},
++ {0x0000a3c4, 0x22222220},
++ {0x0000a3c8, 0x20200020},
++ {0x0000a3cc, 0x20202020},
++ {0x0000a3d0, 0x20202020},
++ {0x0000a3d4, 0x20202020},
++ {0x0000a3d8, 0x20202020},
++ {0x0000a3dc, 0x20202020},
++ {0x0000a3e0, 0x20202020},
++ {0x0000a3e4, 0x20202020},
++ {0x0000a3e8, 0x20202020},
++ {0x0000a3ec, 0x20202020},
++ {0x0000a3f0, 0x00000000},
++ {0x0000a3f4, 0x00000246},
++ {0x0000a3f8, 0x0cdbd380},
++ {0x0000a3fc, 0x000f0f01},
++ {0x0000a400, 0x8fa91f01},
++ {0x0000a404, 0x00000000},
++ {0x0000a408, 0x0e79e5c6},
++ {0x0000a40c, 0x00820820},
++ {0x0000a414, 0x1ce739ce},
++ {0x0000a418, 0x2d001dce},
++ {0x0000a41c, 0x1ce739ce},
++ {0x0000a420, 0x000001ce},
++ {0x0000a424, 0x1ce739ce},
++ {0x0000a428, 0x000001ce},
++ {0x0000a42c, 0x1ce739ce},
++ {0x0000a430, 0x1ce739ce},
++ {0x0000a434, 0x00000000},
++ {0x0000a438, 0x00001801},
++ {0x0000a43c, 0x00000000},
++ {0x0000a440, 0x00000000},
++ {0x0000a444, 0x00000000},
++ {0x0000a448, 0x04000080},
++ {0x0000a44c, 0x00000001},
++ {0x0000a450, 0x00010000},
++ {0x0000a458, 0x00000000},
++ {0x0000a600, 0x00000000},
++ {0x0000a604, 0x00000000},
++ {0x0000a608, 0x00000000},
++ {0x0000a60c, 0x00000000},
++ {0x0000a610, 0x00000000},
++ {0x0000a614, 0x00000000},
++ {0x0000a618, 0x00000000},
++ {0x0000a61c, 0x00000000},
++ {0x0000a620, 0x00000000},
++ {0x0000a624, 0x00000000},
++ {0x0000a628, 0x00000000},
++ {0x0000a62c, 0x00000000},
++ {0x0000a630, 0x00000000},
++ {0x0000a634, 0x00000000},
++ {0x0000a638, 0x00000000},
++ {0x0000a63c, 0x00000000},
++ {0x0000a640, 0x00000000},
++ {0x0000a644, 0x3fad9d74},
++ {0x0000a648, 0x0048060a},
++ {0x0000a64c, 0x00000637},
++ {0x0000a670, 0x03020100},
++ {0x0000a674, 0x09080504},
++ {0x0000a678, 0x0d0c0b0a},
++ {0x0000a67c, 0x13121110},
++ {0x0000a680, 0x31301514},
++ {0x0000a684, 0x35343332},
++ {0x0000a688, 0x00000036},
++ {0x0000a690, 0x00000838},
++ {0x0000a7c0, 0x00000000},
++ {0x0000a7c4, 0xfffffffc},
++ {0x0000a7c8, 0x00000000},
++ {0x0000a7cc, 0x00000000},
++ {0x0000a7d0, 0x00000000},
++ {0x0000a7d4, 0x00000004},
++ {0x0000a7dc, 0x00000001},
++ {0x0000a8d0, 0x004b6a8e},
++ {0x0000a8d4, 0x00000820},
++ {0x0000a8dc, 0x00000000},
++ {0x0000a8f0, 0x00000000},
++ {0x0000a8f4, 0x00000000},
++ {0x0000b2d0, 0x00000080},
++ {0x0000b2d4, 0x00000000},
++ {0x0000b2dc, 0x00000000},
++ {0x0000b2e0, 0x00000000},
++ {0x0000b2e4, 0x00000000},
++ {0x0000b2e8, 0x00000000},
++ {0x0000b2ec, 0x00000000},
++ {0x0000b2f0, 0x00000000},
++ {0x0000b2f4, 0x00000000},
++ {0x0000b2f8, 0x00000000},
++ {0x0000b408, 0x0e79e5c0},
++ {0x0000b40c, 0x00820820},
++ {0x0000b420, 0x00000000},
++ {0x0000b8d0, 0x004b6a8e},
++ {0x0000b8d4, 0x00000820},
++ {0x0000b8dc, 0x00000000},
++ {0x0000b8f0, 0x00000000},
++ {0x0000b8f4, 0x00000000},
++ {0x0000c2d0, 0x00000080},
++ {0x0000c2d4, 0x00000000},
++ {0x0000c2dc, 0x00000000},
++ {0x0000c2e0, 0x00000000},
++ {0x0000c2e4, 0x00000000},
++ {0x0000c2e8, 0x00000000},
++ {0x0000c2ec, 0x00000000},
++ {0x0000c2f0, 0x00000000},
++ {0x0000c2f4, 0x00000000},
++ {0x0000c2f8, 0x00000000},
++ {0x0000c408, 0x0e79e5c0},
++ {0x0000c40c, 0x00820820},
++ {0x0000c420, 0x00000000},
++};
++
++static const u32 ar9300Modes_high_power_tx_gain_table_2p0[][5] = {
++ /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
++ {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
++ {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000},
++ {0x0000a504, 0x06002223, 0x06002223, 0x04000002, 0x04000002},
++ {0x0000a508, 0x0a022220, 0x0a022220, 0x08000004, 0x08000004},
++ {0x0000a50c, 0x0f022223, 0x0f022223, 0x0b000200, 0x0b000200},
++ {0x0000a510, 0x14022620, 0x14022620, 0x0f000202, 0x0f000202},
++ {0x0000a514, 0x18022622, 0x18022622, 0x11000400, 0x11000400},
++ {0x0000a518, 0x1b022822, 0x1b022822, 0x15000402, 0x15000402},
++ {0x0000a51c, 0x20022842, 0x20022842, 0x19000404, 0x19000404},
++ {0x0000a520, 0x22022c41, 0x22022c41, 0x1b000603, 0x1b000603},
++ {0x0000a524, 0x28023042, 0x28023042, 0x1f000a02, 0x1f000a02},
++ {0x0000a528, 0x2c023044, 0x2c023044, 0x23000a04, 0x23000a04},
++ {0x0000a52c, 0x2f023644, 0x2f023644, 0x26000a20, 0x26000a20},
++ {0x0000a530, 0x34025643, 0x34025643, 0x2a000e20, 0x2a000e20},
++ {0x0000a534, 0x38025a44, 0x38025a44, 0x2e000e22, 0x2e000e22},
++ {0x0000a538, 0x3b025e45, 0x3b025e45, 0x31000e24, 0x31000e24},
++ {0x0000a53c, 0x41025e4a, 0x41025e4a, 0x34001640, 0x34001640},
++ {0x0000a540, 0x48025e6c, 0x48025e6c, 0x38001660, 0x38001660},
++ {0x0000a544, 0x4e025e8e, 0x4e025e8e, 0x3b001861, 0x3b001861},
++ {0x0000a548, 0x53025eb2, 0x53025eb2, 0x3e001a81, 0x3e001a81},
++ {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83},
++ {0x0000a550, 0x5f025ef6, 0x5f025ef6, 0x44001c84, 0x44001c84},
++ {0x0000a554, 0x62025f56, 0x62025f56, 0x48001ce3, 0x48001ce3},
++ {0x0000a558, 0x66027f56, 0x66027f56, 0x4c001ce5, 0x4c001ce5},
++ {0x0000a55c, 0x6a029f56, 0x6a029f56, 0x50001ce9, 0x50001ce9},
++ {0x0000a560, 0x70049f56, 0x70049f56, 0x54001ceb, 0x54001ceb},
++ {0x0000a564, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a568, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a56c, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a570, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a574, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a578, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a57c, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000},
++ {0x0000a584, 0x06802223, 0x06802223, 0x04800002, 0x04800002},
++ {0x0000a588, 0x0a822220, 0x0a822220, 0x08800004, 0x08800004},
++ {0x0000a58c, 0x0f822223, 0x0f822223, 0x0b800200, 0x0b800200},
++ {0x0000a590, 0x14822620, 0x14822620, 0x0f800202, 0x0f800202},
++ {0x0000a594, 0x18822622, 0x18822622, 0x11800400, 0x11800400},
++ {0x0000a598, 0x1b822822, 0x1b822822, 0x15800402, 0x15800402},
++ {0x0000a59c, 0x20822842, 0x20822842, 0x19800404, 0x19800404},
++ {0x0000a5a0, 0x22822c41, 0x22822c41, 0x1b800603, 0x1b800603},
++ {0x0000a5a4, 0x28823042, 0x28823042, 0x1f800a02, 0x1f800a02},
++ {0x0000a5a8, 0x2c823044, 0x2c823044, 0x23800a04, 0x23800a04},
++ {0x0000a5ac, 0x2f823644, 0x2f823644, 0x26800a20, 0x26800a20},
++ {0x0000a5b0, 0x34825643, 0x34825643, 0x2a800e20, 0x2a800e20},
++ {0x0000a5b4, 0x38825a44, 0x38825a44, 0x2e800e22, 0x2e800e22},
++ {0x0000a5b8, 0x3b825e45, 0x3b825e45, 0x31800e24, 0x31800e24},
++ {0x0000a5bc, 0x41825e4a, 0x41825e4a, 0x34801640, 0x34801640},
++ {0x0000a5c0, 0x48825e6c, 0x48825e6c, 0x38801660, 0x38801660},
++ {0x0000a5c4, 0x4e825e8e, 0x4e825e8e, 0x3b801861, 0x3b801861},
++ {0x0000a5c8, 0x53825eb2, 0x53825eb2, 0x3e801a81, 0x3e801a81},
++ {0x0000a5cc, 0x59825eb5, 0x59825eb5, 0x42801a83, 0x42801a83},
++ {0x0000a5d0, 0x5f825ef6, 0x5f825ef6, 0x44801c84, 0x44801c84},
++ {0x0000a5d4, 0x62825f56, 0x62825f56, 0x48801ce3, 0x48801ce3},
++ {0x0000a5d8, 0x66827f56, 0x66827f56, 0x4c801ce5, 0x4c801ce5},
++ {0x0000a5dc, 0x6a829f56, 0x6a829f56, 0x50801ce9, 0x50801ce9},
++ {0x0000a5e0, 0x70849f56, 0x70849f56, 0x54801ceb, 0x54801ceb},
++ {0x0000a5e4, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5e8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5ec, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5f0, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5f4, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5f8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5fc, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x00016044, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6},
++ {0x00016048, 0xae480001, 0xae480001, 0xae480001, 0xae480001},
++ {0x00016068, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c},
++ {0x00016444, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6},
++ {0x00016448, 0xae480001, 0xae480001, 0xae480001, 0xae480001},
++ {0x00016468, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c},
++ {0x00016844, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6},
++ {0x00016848, 0xae480001, 0xae480001, 0xae480001, 0xae480001},
++ {0x00016868, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c},
++};
++
++static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p0[][5] = {
++ /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
++ {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
++ {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000},
++ {0x0000a504, 0x06002223, 0x06002223, 0x04000002, 0x04000002},
++ {0x0000a508, 0x0a022220, 0x0a022220, 0x08000004, 0x08000004},
++ {0x0000a50c, 0x0f022223, 0x0f022223, 0x0b000200, 0x0b000200},
++ {0x0000a510, 0x14022620, 0x14022620, 0x0f000202, 0x0f000202},
++ {0x0000a514, 0x18022622, 0x18022622, 0x11000400, 0x11000400},
++ {0x0000a518, 0x1b022822, 0x1b022822, 0x15000402, 0x15000402},
++ {0x0000a51c, 0x20022842, 0x20022842, 0x19000404, 0x19000404},
++ {0x0000a520, 0x22022c41, 0x22022c41, 0x1b000603, 0x1b000603},
++ {0x0000a524, 0x28023042, 0x28023042, 0x1f000a02, 0x1f000a02},
++ {0x0000a528, 0x2c023044, 0x2c023044, 0x23000a04, 0x23000a04},
++ {0x0000a52c, 0x2f023644, 0x2f023644, 0x26000a20, 0x26000a20},
++ {0x0000a530, 0x34025643, 0x34025643, 0x2a000e20, 0x2a000e20},
++ {0x0000a534, 0x38025a44, 0x38025a44, 0x2e000e22, 0x2e000e22},
++ {0x0000a538, 0x3b025e45, 0x3b025e45, 0x31000e24, 0x31000e24},
++ {0x0000a53c, 0x41025e4a, 0x41025e4a, 0x34001640, 0x34001640},
++ {0x0000a540, 0x48025e6c, 0x48025e6c, 0x38001660, 0x38001660},
++ {0x0000a544, 0x4e025e8e, 0x4e025e8e, 0x3b001861, 0x3b001861},
++ {0x0000a548, 0x53025eb2, 0x53025eb2, 0x3e001a81, 0x3e001a81},
++ {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83},
++ {0x0000a550, 0x5f025ef6, 0x5f025ef6, 0x44001c84, 0x44001c84},
++ {0x0000a554, 0x62025f56, 0x62025f56, 0x48001ce3, 0x48001ce3},
++ {0x0000a558, 0x66027f56, 0x66027f56, 0x4c001ce5, 0x4c001ce5},
++ {0x0000a55c, 0x6a029f56, 0x6a029f56, 0x50001ce9, 0x50001ce9},
++ {0x0000a560, 0x70049f56, 0x70049f56, 0x54001ceb, 0x54001ceb},
++ {0x0000a564, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a568, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a56c, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a570, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a574, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a578, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a57c, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000},
++ {0x0000a584, 0x06802223, 0x06802223, 0x04800002, 0x04800002},
++ {0x0000a588, 0x0a822220, 0x0a822220, 0x08800004, 0x08800004},
++ {0x0000a58c, 0x0f822223, 0x0f822223, 0x0b800200, 0x0b800200},
++ {0x0000a590, 0x14822620, 0x14822620, 0x0f800202, 0x0f800202},
++ {0x0000a594, 0x18822622, 0x18822622, 0x11800400, 0x11800400},
++ {0x0000a598, 0x1b822822, 0x1b822822, 0x15800402, 0x15800402},
++ {0x0000a59c, 0x20822842, 0x20822842, 0x19800404, 0x19800404},
++ {0x0000a5a0, 0x22822c41, 0x22822c41, 0x1b800603, 0x1b800603},
++ {0x0000a5a4, 0x28823042, 0x28823042, 0x1f800a02, 0x1f800a02},
++ {0x0000a5a8, 0x2c823044, 0x2c823044, 0x23800a04, 0x23800a04},
++ {0x0000a5ac, 0x2f823644, 0x2f823644, 0x26800a20, 0x26800a20},
++ {0x0000a5b0, 0x34825643, 0x34825643, 0x2a800e20, 0x2a800e20},
++ {0x0000a5b4, 0x38825a44, 0x38825a44, 0x2e800e22, 0x2e800e22},
++ {0x0000a5b8, 0x3b825e45, 0x3b825e45, 0x31800e24, 0x31800e24},
++ {0x0000a5bc, 0x41825e4a, 0x41825e4a, 0x34801640, 0x34801640},
++ {0x0000a5c0, 0x48825e6c, 0x48825e6c, 0x38801660, 0x38801660},
++ {0x0000a5c4, 0x4e825e8e, 0x4e825e8e, 0x3b801861, 0x3b801861},
++ {0x0000a5c8, 0x53825eb2, 0x53825eb2, 0x3e801a81, 0x3e801a81},
++ {0x0000a5cc, 0x59825eb5, 0x59825eb5, 0x42801a83, 0x42801a83},
++ {0x0000a5d0, 0x5f825ef6, 0x5f825ef6, 0x44801c84, 0x44801c84},
++ {0x0000a5d4, 0x62825f56, 0x62825f56, 0x48801ce3, 0x48801ce3},
++ {0x0000a5d8, 0x66827f56, 0x66827f56, 0x4c801ce5, 0x4c801ce5},
++ {0x0000a5dc, 0x6a829f56, 0x6a829f56, 0x50801ce9, 0x50801ce9},
++ {0x0000a5e0, 0x70849f56, 0x70849f56, 0x54801ceb, 0x54801ceb},
++ {0x0000a5e4, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5e8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5ec, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5f0, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5f4, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5f8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5fc, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x00016044, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4},
++ {0x00016048, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001},
++ {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
++ {0x00016444, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4},
++ {0x00016448, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001},
++ {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
++ {0x00016844, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4},
++ {0x00016848, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001},
++ {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
++};
++
++static const u32 ar9300Common_rx_gain_table_2p0[][2] = {
++ /* Addr allmodes */
++ {0x0000a000, 0x00010000},
++ {0x0000a004, 0x00030002},
++ {0x0000a008, 0x00050004},
++ {0x0000a00c, 0x00810080},
++ {0x0000a010, 0x00830082},
++ {0x0000a014, 0x01810180},
++ {0x0000a018, 0x01830182},
++ {0x0000a01c, 0x01850184},
++ {0x0000a020, 0x01890188},
++ {0x0000a024, 0x018b018a},
++ {0x0000a028, 0x018d018c},
++ {0x0000a02c, 0x01910190},
++ {0x0000a030, 0x01930192},
++ {0x0000a034, 0x01950194},
++ {0x0000a038, 0x038a0196},
++ {0x0000a03c, 0x038c038b},
++ {0x0000a040, 0x0390038d},
++ {0x0000a044, 0x03920391},
++ {0x0000a048, 0x03940393},
++ {0x0000a04c, 0x03960395},
++ {0x0000a050, 0x00000000},
++ {0x0000a054, 0x00000000},
++ {0x0000a058, 0x00000000},
++ {0x0000a05c, 0x00000000},
++ {0x0000a060, 0x00000000},
++ {0x0000a064, 0x00000000},
++ {0x0000a068, 0x00000000},
++ {0x0000a06c, 0x00000000},
++ {0x0000a070, 0x00000000},
++ {0x0000a074, 0x00000000},
++ {0x0000a078, 0x00000000},
++ {0x0000a07c, 0x00000000},
++ {0x0000a080, 0x22222229},
++ {0x0000a084, 0x1d1d1d1d},
++ {0x0000a088, 0x1d1d1d1d},
++ {0x0000a08c, 0x1d1d1d1d},
++ {0x0000a090, 0x171d1d1d},
++ {0x0000a094, 0x11111717},
++ {0x0000a098, 0x00030311},
++ {0x0000a09c, 0x00000000},
++ {0x0000a0a0, 0x00000000},
++ {0x0000a0a4, 0x00000000},
++ {0x0000a0a8, 0x00000000},
++ {0x0000a0ac, 0x00000000},
++ {0x0000a0b0, 0x00000000},
++ {0x0000a0b4, 0x00000000},
++ {0x0000a0b8, 0x00000000},
++ {0x0000a0bc, 0x00000000},
++ {0x0000a0c0, 0x001f0000},
++ {0x0000a0c4, 0x01000101},
++ {0x0000a0c8, 0x011e011f},
++ {0x0000a0cc, 0x011c011d},
++ {0x0000a0d0, 0x02030204},
++ {0x0000a0d4, 0x02010202},
++ {0x0000a0d8, 0x021f0200},
++ {0x0000a0dc, 0x0302021e},
++ {0x0000a0e0, 0x03000301},
++ {0x0000a0e4, 0x031e031f},
++ {0x0000a0e8, 0x0402031d},
++ {0x0000a0ec, 0x04000401},
++ {0x0000a0f0, 0x041e041f},
++ {0x0000a0f4, 0x0502041d},
++ {0x0000a0f8, 0x05000501},
++ {0x0000a0fc, 0x051e051f},
++ {0x0000a100, 0x06010602},
++ {0x0000a104, 0x061f0600},
++ {0x0000a108, 0x061d061e},
++ {0x0000a10c, 0x07020703},
++ {0x0000a110, 0x07000701},
++ {0x0000a114, 0x00000000},
++ {0x0000a118, 0x00000000},
++ {0x0000a11c, 0x00000000},
++ {0x0000a120, 0x00000000},
++ {0x0000a124, 0x00000000},
++ {0x0000a128, 0x00000000},
++ {0x0000a12c, 0x00000000},
++ {0x0000a130, 0x00000000},
++ {0x0000a134, 0x00000000},
++ {0x0000a138, 0x00000000},
++ {0x0000a13c, 0x00000000},
++ {0x0000a140, 0x001f0000},
++ {0x0000a144, 0x01000101},
++ {0x0000a148, 0x011e011f},
++ {0x0000a14c, 0x011c011d},
++ {0x0000a150, 0x02030204},
++ {0x0000a154, 0x02010202},
++ {0x0000a158, 0x021f0200},
++ {0x0000a15c, 0x0302021e},
++ {0x0000a160, 0x03000301},
++ {0x0000a164, 0x031e031f},
++ {0x0000a168, 0x0402031d},
++ {0x0000a16c, 0x04000401},
++ {0x0000a170, 0x041e041f},
++ {0x0000a174, 0x0502041d},
++ {0x0000a178, 0x05000501},
++ {0x0000a17c, 0x051e051f},
++ {0x0000a180, 0x06010602},
++ {0x0000a184, 0x061f0600},
++ {0x0000a188, 0x061d061e},
++ {0x0000a18c, 0x07020703},
++ {0x0000a190, 0x07000701},
++ {0x0000a194, 0x00000000},
++ {0x0000a198, 0x00000000},
++ {0x0000a19c, 0x00000000},
++ {0x0000a1a0, 0x00000000},
++ {0x0000a1a4, 0x00000000},
++ {0x0000a1a8, 0x00000000},
++ {0x0000a1ac, 0x00000000},
++ {0x0000a1b0, 0x00000000},
++ {0x0000a1b4, 0x00000000},
++ {0x0000a1b8, 0x00000000},
++ {0x0000a1bc, 0x00000000},
++ {0x0000a1c0, 0x00000000},
++ {0x0000a1c4, 0x00000000},
++ {0x0000a1c8, 0x00000000},
++ {0x0000a1cc, 0x00000000},
++ {0x0000a1d0, 0x00000000},
++ {0x0000a1d4, 0x00000000},
++ {0x0000a1d8, 0x00000000},
++ {0x0000a1dc, 0x00000000},
++ {0x0000a1e0, 0x00000000},
++ {0x0000a1e4, 0x00000000},
++ {0x0000a1e8, 0x00000000},
++ {0x0000a1ec, 0x00000000},
++ {0x0000a1f0, 0x00000396},
++ {0x0000a1f4, 0x00000396},
++ {0x0000a1f8, 0x00000396},
++ {0x0000a1fc, 0x00000196},
++ {0x0000b000, 0x00010000},
++ {0x0000b004, 0x00030002},
++ {0x0000b008, 0x00050004},
++ {0x0000b00c, 0x00810080},
++ {0x0000b010, 0x00830082},
++ {0x0000b014, 0x01810180},
++ {0x0000b018, 0x01830182},
++ {0x0000b01c, 0x01850184},
++ {0x0000b020, 0x02810280},
++ {0x0000b024, 0x02830282},
++ {0x0000b028, 0x02850284},
++ {0x0000b02c, 0x02890288},
++ {0x0000b030, 0x028b028a},
++ {0x0000b034, 0x0388028c},
++ {0x0000b038, 0x038a0389},
++ {0x0000b03c, 0x038c038b},
++ {0x0000b040, 0x0390038d},
++ {0x0000b044, 0x03920391},
++ {0x0000b048, 0x03940393},
++ {0x0000b04c, 0x03960395},
++ {0x0000b050, 0x00000000},
++ {0x0000b054, 0x00000000},
++ {0x0000b058, 0x00000000},
++ {0x0000b05c, 0x00000000},
++ {0x0000b060, 0x00000000},
++ {0x0000b064, 0x00000000},
++ {0x0000b068, 0x00000000},
++ {0x0000b06c, 0x00000000},
++ {0x0000b070, 0x00000000},
++ {0x0000b074, 0x00000000},
++ {0x0000b078, 0x00000000},
++ {0x0000b07c, 0x00000000},
++ {0x0000b080, 0x32323232},
++ {0x0000b084, 0x2f2f3232},
++ {0x0000b088, 0x23282a2d},
++ {0x0000b08c, 0x1c1e2123},
++ {0x0000b090, 0x14171919},
++ {0x0000b094, 0x0e0e1214},
++ {0x0000b098, 0x03050707},
++ {0x0000b09c, 0x00030303},
++ {0x0000b0a0, 0x00000000},
++ {0x0000b0a4, 0x00000000},
++ {0x0000b0a8, 0x00000000},
++ {0x0000b0ac, 0x00000000},
++ {0x0000b0b0, 0x00000000},
++ {0x0000b0b4, 0x00000000},
++ {0x0000b0b8, 0x00000000},
++ {0x0000b0bc, 0x00000000},
++ {0x0000b0c0, 0x003f0020},
++ {0x0000b0c4, 0x00400041},
++ {0x0000b0c8, 0x0140005f},
++ {0x0000b0cc, 0x0160015f},
++ {0x0000b0d0, 0x017e017f},
++ {0x0000b0d4, 0x02410242},
++ {0x0000b0d8, 0x025f0240},
++ {0x0000b0dc, 0x027f0260},
++ {0x0000b0e0, 0x0341027e},
++ {0x0000b0e4, 0x035f0340},
++ {0x0000b0e8, 0x037f0360},
++ {0x0000b0ec, 0x04400441},
++ {0x0000b0f0, 0x0460045f},
++ {0x0000b0f4, 0x0541047f},
++ {0x0000b0f8, 0x055f0540},
++ {0x0000b0fc, 0x057f0560},
++ {0x0000b100, 0x06400641},
++ {0x0000b104, 0x0660065f},
++ {0x0000b108, 0x067e067f},
++ {0x0000b10c, 0x07410742},
++ {0x0000b110, 0x075f0740},
++ {0x0000b114, 0x077f0760},
++ {0x0000b118, 0x07800781},
++ {0x0000b11c, 0x07a0079f},
++ {0x0000b120, 0x07c107bf},
++ {0x0000b124, 0x000007c0},
++ {0x0000b128, 0x00000000},
++ {0x0000b12c, 0x00000000},
++ {0x0000b130, 0x00000000},
++ {0x0000b134, 0x00000000},
++ {0x0000b138, 0x00000000},
++ {0x0000b13c, 0x00000000},
++ {0x0000b140, 0x003f0020},
++ {0x0000b144, 0x00400041},
++ {0x0000b148, 0x0140005f},
++ {0x0000b14c, 0x0160015f},
++ {0x0000b150, 0x017e017f},
++ {0x0000b154, 0x02410242},
++ {0x0000b158, 0x025f0240},
++ {0x0000b15c, 0x027f0260},
++ {0x0000b160, 0x0341027e},
++ {0x0000b164, 0x035f0340},
++ {0x0000b168, 0x037f0360},
++ {0x0000b16c, 0x04400441},
++ {0x0000b170, 0x0460045f},
++ {0x0000b174, 0x0541047f},
++ {0x0000b178, 0x055f0540},
++ {0x0000b17c, 0x057f0560},
++ {0x0000b180, 0x06400641},
++ {0x0000b184, 0x0660065f},
++ {0x0000b188, 0x067e067f},
++ {0x0000b18c, 0x07410742},
++ {0x0000b190, 0x075f0740},
++ {0x0000b194, 0x077f0760},
++ {0x0000b198, 0x07800781},
++ {0x0000b19c, 0x07a0079f},
++ {0x0000b1a0, 0x07c107bf},
++ {0x0000b1a4, 0x000007c0},
++ {0x0000b1a8, 0x00000000},
++ {0x0000b1ac, 0x00000000},
++ {0x0000b1b0, 0x00000000},
++ {0x0000b1b4, 0x00000000},
++ {0x0000b1b8, 0x00000000},
++ {0x0000b1bc, 0x00000000},
++ {0x0000b1c0, 0x00000000},
++ {0x0000b1c4, 0x00000000},
++ {0x0000b1c8, 0x00000000},
++ {0x0000b1cc, 0x00000000},
++ {0x0000b1d0, 0x00000000},
++ {0x0000b1d4, 0x00000000},
++ {0x0000b1d8, 0x00000000},
++ {0x0000b1dc, 0x00000000},
++ {0x0000b1e0, 0x00000000},
++ {0x0000b1e4, 0x00000000},
++ {0x0000b1e8, 0x00000000},
++ {0x0000b1ec, 0x00000000},
++ {0x0000b1f0, 0x00000396},
++ {0x0000b1f4, 0x00000396},
++ {0x0000b1f8, 0x00000396},
++ {0x0000b1fc, 0x00000196},
++};
++
++static const u32 ar9300Modes_low_ob_db_tx_gain_table_2p0[][5] = {
++ /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
++ {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
++ {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
++ {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002},
++ {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004},
++ {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200},
++ {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202},
++ {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400},
++ {0x0000a518, 0x21020220, 0x21020220, 0x16000402, 0x16000402},
++ {0x0000a51c, 0x27020223, 0x27020223, 0x19000404, 0x19000404},
++ {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603},
++ {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02},
++ {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04},
++ {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20},
++ {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20},
++ {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22},
++ {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24},
++ {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640},
++ {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660},
++ {0x0000a544, 0x5302266c, 0x5302266c, 0x3f001861, 0x3f001861},
++ {0x0000a548, 0x5702286c, 0x5702286c, 0x43001a81, 0x43001a81},
++ {0x0000a54c, 0x5c04286b, 0x5c04286b, 0x47001a83, 0x47001a83},
++ {0x0000a550, 0x61042a6c, 0x61042a6c, 0x4a001c84, 0x4a001c84},
++ {0x0000a554, 0x66062a6c, 0x66062a6c, 0x4e001ce3, 0x4e001ce3},
++ {0x0000a558, 0x6b062e6c, 0x6b062e6c, 0x52001ce5, 0x52001ce5},
++ {0x0000a55c, 0x7006308c, 0x7006308c, 0x56001ce9, 0x56001ce9},
++ {0x0000a560, 0x730a308a, 0x730a308a, 0x5a001ceb, 0x5a001ceb},
++ {0x0000a564, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
++ {0x0000a568, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
++ {0x0000a56c, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
++ {0x0000a570, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
++ {0x0000a574, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
++ {0x0000a578, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
++ {0x0000a57c, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
++ {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000},
++ {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002},
++ {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004},
++ {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200},
++ {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202},
++ {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400},
++ {0x0000a598, 0x21820220, 0x21820220, 0x16800402, 0x16800402},
++ {0x0000a59c, 0x27820223, 0x27820223, 0x19800404, 0x19800404},
++ {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603},
++ {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02},
++ {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04},
++ {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20},
++ {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20},
++ {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22},
++ {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24},
++ {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640},
++ {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660},
++ {0x0000a5c4, 0x5382266c, 0x5382266c, 0x3f801861, 0x3f801861},
++ {0x0000a5c8, 0x5782286c, 0x5782286c, 0x43801a81, 0x43801a81},
++ {0x0000a5cc, 0x5c84286b, 0x5c84286b, 0x47801a83, 0x47801a83},
++ {0x0000a5d0, 0x61842a6c, 0x61842a6c, 0x4a801c84, 0x4a801c84},
++ {0x0000a5d4, 0x66862a6c, 0x66862a6c, 0x4e801ce3, 0x4e801ce3},
++ {0x0000a5d8, 0x6b862e6c, 0x6b862e6c, 0x52801ce5, 0x52801ce5},
++ {0x0000a5dc, 0x7086308c, 0x7086308c, 0x56801ce9, 0x56801ce9},
++ {0x0000a5e0, 0x738a308a, 0x738a308a, 0x5a801ceb, 0x5a801ceb},
++ {0x0000a5e4, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5e8, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5ec, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5f0, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5f4, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5f8, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5fc, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
++ {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
++ {0x00016048, 0x64000001, 0x64000001, 0x64000001, 0x64000001},
++ {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
++ {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
++ {0x00016448, 0x64000001, 0x64000001, 0x64000001, 0x64000001},
++ {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
++ {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
++ {0x00016848, 0x64000001, 0x64000001, 0x64000001, 0x64000001},
++ {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
++};
++
++static const u32 ar9300_2p0_mac_core[][2] = {
++ /* Addr allmodes */
++ {0x00000008, 0x00000000},
++ {0x00000030, 0x00020085},
++ {0x00000034, 0x00000005},
++ {0x00000040, 0x00000000},
++ {0x00000044, 0x00000000},
++ {0x00000048, 0x00000008},
++ {0x0000004c, 0x00000010},
++ {0x00000050, 0x00000000},
++ {0x00001040, 0x002ffc0f},
++ {0x00001044, 0x002ffc0f},
++ {0x00001048, 0x002ffc0f},
++ {0x0000104c, 0x002ffc0f},
++ {0x00001050, 0x002ffc0f},
++ {0x00001054, 0x002ffc0f},
++ {0x00001058, 0x002ffc0f},
++ {0x0000105c, 0x002ffc0f},
++ {0x00001060, 0x002ffc0f},
++ {0x00001064, 0x002ffc0f},
++ {0x000010f0, 0x00000100},
++ {0x00001270, 0x00000000},
++ {0x000012b0, 0x00000000},
++ {0x000012f0, 0x00000000},
++ {0x0000143c, 0x00000000},
++ {0x0000147c, 0x00000000},
++ {0x00008000, 0x00000000},
++ {0x00008004, 0x00000000},
++ {0x00008008, 0x00000000},
++ {0x0000800c, 0x00000000},
++ {0x00008018, 0x00000000},
++ {0x00008020, 0x00000000},
++ {0x00008038, 0x00000000},
++ {0x0000803c, 0x00000000},
++ {0x00008040, 0x00000000},
++ {0x00008044, 0x00000000},
++ {0x00008048, 0x00000000},
++ {0x0000804c, 0xffffffff},
++ {0x00008054, 0x00000000},
++ {0x00008058, 0x00000000},
++ {0x0000805c, 0x000fc78f},
++ {0x00008060, 0x0000000f},
++ {0x00008064, 0x00000000},
++ {0x00008070, 0x00000310},
++ {0x00008074, 0x00000020},
++ {0x00008078, 0x00000000},
++ {0x0000809c, 0x0000000f},
++ {0x000080a0, 0x00000000},
++ {0x000080a4, 0x02ff0000},
++ {0x000080a8, 0x0e070605},
++ {0x000080ac, 0x0000000d},
++ {0x000080b0, 0x00000000},
++ {0x000080b4, 0x00000000},
++ {0x000080b8, 0x00000000},
++ {0x000080bc, 0x00000000},
++ {0x000080c0, 0x2a800000},
++ {0x000080c4, 0x06900168},
++ {0x000080c8, 0x13881c20},
++ {0x000080cc, 0x01f40000},
++ {0x000080d0, 0x00252500},
++ {0x000080d4, 0x00a00000},
++ {0x000080d8, 0x00400000},
++ {0x000080dc, 0x00000000},
++ {0x000080e0, 0xffffffff},
++ {0x000080e4, 0x0000ffff},
++ {0x000080e8, 0x3f3f3f3f},
++ {0x000080ec, 0x00000000},
++ {0x000080f0, 0x00000000},
++ {0x000080f4, 0x00000000},
++ {0x000080fc, 0x00020000},
++ {0x00008100, 0x00000000},
++ {0x00008108, 0x00000052},
++ {0x0000810c, 0x00000000},
++ {0x00008110, 0x00000000},
++ {0x00008114, 0x000007ff},
++ {0x00008118, 0x000000aa},
++ {0x0000811c, 0x00003210},
++ {0x00008124, 0x00000000},
++ {0x00008128, 0x00000000},
++ {0x0000812c, 0x00000000},
++ {0x00008130, 0x00000000},
++ {0x00008134, 0x00000000},
++ {0x00008138, 0x00000000},
++ {0x0000813c, 0x0000ffff},
++ {0x00008144, 0xffffffff},
++ {0x00008168, 0x00000000},
++ {0x0000816c, 0x00000000},
++ {0x00008170, 0x18486200},
++ {0x00008174, 0x33332210},
++ {0x00008178, 0x00000000},
++ {0x0000817c, 0x00020000},
++ {0x000081c0, 0x00000000},
++ {0x000081c4, 0x33332210},
++ {0x000081c8, 0x00000000},
++ {0x000081cc, 0x00000000},
++ {0x000081d4, 0x00000000},
++ {0x000081ec, 0x00000000},
++ {0x000081f0, 0x00000000},
++ {0x000081f4, 0x00000000},
++ {0x000081f8, 0x00000000},
++ {0x000081fc, 0x00000000},
++ {0x00008240, 0x00100000},
++ {0x00008244, 0x0010f424},
++ {0x00008248, 0x00000800},
++ {0x0000824c, 0x0001e848},
++ {0x00008250, 0x00000000},
++ {0x00008254, 0x00000000},
++ {0x00008258, 0x00000000},
++ {0x0000825c, 0x40000000},
++ {0x00008260, 0x00080922},
++ {0x00008264, 0x98a00010},
++ {0x00008268, 0xffffffff},
++ {0x0000826c, 0x0000ffff},
++ {0x00008270, 0x00000000},
++ {0x00008274, 0x40000000},
++ {0x00008278, 0x003e4180},
++ {0x0000827c, 0x00000004},
++ {0x00008284, 0x0000002c},
++ {0x00008288, 0x0000002c},
++ {0x0000828c, 0x000000ff},
++ {0x00008294, 0x00000000},
++ {0x00008298, 0x00000000},
++ {0x0000829c, 0x00000000},
++ {0x00008300, 0x00000140},
++ {0x00008314, 0x00000000},
++ {0x0000831c, 0x0000010d},
++ {0x00008328, 0x00000000},
++ {0x0000832c, 0x00000007},
++ {0x00008330, 0x00000302},
++ {0x00008334, 0x00000700},
++ {0x00008338, 0x00ff0000},
++ {0x0000833c, 0x02400000},
++ {0x00008340, 0x000107ff},
++ {0x00008344, 0xaa48105b},
++ {0x00008348, 0x008f0000},
++ {0x0000835c, 0x00000000},
++ {0x00008360, 0xffffffff},
++ {0x00008364, 0xffffffff},
++ {0x00008368, 0x00000000},
++ {0x00008370, 0x00000000},
++ {0x00008374, 0x000000ff},
++ {0x00008378, 0x00000000},
++ {0x0000837c, 0x00000000},
++ {0x00008380, 0xffffffff},
++ {0x00008384, 0xffffffff},
++ {0x00008390, 0xffffffff},
++ {0x00008394, 0xffffffff},
++ {0x00008398, 0x00000000},
++ {0x0000839c, 0x00000000},
++ {0x000083a0, 0x00000000},
++ {0x000083a4, 0x0000fa14},
++ {0x000083a8, 0x000f0c00},
++ {0x000083ac, 0x33332210},
++ {0x000083b0, 0x33332210},
++ {0x000083b4, 0x33332210},
++ {0x000083b8, 0x33332210},
++ {0x000083bc, 0x00000000},
++ {0x000083c0, 0x00000000},
++ {0x000083c4, 0x00000000},
++ {0x000083c8, 0x00000000},
++ {0x000083cc, 0x00000200},
++ {0x000083d0, 0x000301ff},
++};
++
++static const u32 ar9300Common_wo_xlna_rx_gain_table_2p0[][2] = {
++ /* Addr allmodes */
++ {0x0000a000, 0x00010000},
++ {0x0000a004, 0x00030002},
++ {0x0000a008, 0x00050004},
++ {0x0000a00c, 0x00810080},
++ {0x0000a010, 0x00830082},
++ {0x0000a014, 0x01810180},
++ {0x0000a018, 0x01830182},
++ {0x0000a01c, 0x01850184},
++ {0x0000a020, 0x01890188},
++ {0x0000a024, 0x018b018a},
++ {0x0000a028, 0x018d018c},
++ {0x0000a02c, 0x03820190},
++ {0x0000a030, 0x03840383},
++ {0x0000a034, 0x03880385},
++ {0x0000a038, 0x038a0389},
++ {0x0000a03c, 0x038c038b},
++ {0x0000a040, 0x0390038d},
++ {0x0000a044, 0x03920391},
++ {0x0000a048, 0x03940393},
++ {0x0000a04c, 0x03960395},
++ {0x0000a050, 0x00000000},
++ {0x0000a054, 0x00000000},
++ {0x0000a058, 0x00000000},
++ {0x0000a05c, 0x00000000},
++ {0x0000a060, 0x00000000},
++ {0x0000a064, 0x00000000},
++ {0x0000a068, 0x00000000},
++ {0x0000a06c, 0x00000000},
++ {0x0000a070, 0x00000000},
++ {0x0000a074, 0x00000000},
++ {0x0000a078, 0x00000000},
++ {0x0000a07c, 0x00000000},
++ {0x0000a080, 0x29292929},
++ {0x0000a084, 0x29292929},
++ {0x0000a088, 0x29292929},
++ {0x0000a08c, 0x29292929},
++ {0x0000a090, 0x22292929},
++ {0x0000a094, 0x1d1d2222},
++ {0x0000a098, 0x0c111117},
++ {0x0000a09c, 0x00030303},
++ {0x0000a0a0, 0x00000000},
++ {0x0000a0a4, 0x00000000},
++ {0x0000a0a8, 0x00000000},
++ {0x0000a0ac, 0x00000000},
++ {0x0000a0b0, 0x00000000},
++ {0x0000a0b4, 0x00000000},
++ {0x0000a0b8, 0x00000000},
++ {0x0000a0bc, 0x00000000},
++ {0x0000a0c0, 0x001f0000},
++ {0x0000a0c4, 0x01000101},
++ {0x0000a0c8, 0x011e011f},
++ {0x0000a0cc, 0x011c011d},
++ {0x0000a0d0, 0x02030204},
++ {0x0000a0d4, 0x02010202},
++ {0x0000a0d8, 0x021f0200},
++ {0x0000a0dc, 0x0302021e},
++ {0x0000a0e0, 0x03000301},
++ {0x0000a0e4, 0x031e031f},
++ {0x0000a0e8, 0x0402031d},
++ {0x0000a0ec, 0x04000401},
++ {0x0000a0f0, 0x041e041f},
++ {0x0000a0f4, 0x0502041d},
++ {0x0000a0f8, 0x05000501},
++ {0x0000a0fc, 0x051e051f},
++ {0x0000a100, 0x06010602},
++ {0x0000a104, 0x061f0600},
++ {0x0000a108, 0x061d061e},
++ {0x0000a10c, 0x07020703},
++ {0x0000a110, 0x07000701},
++ {0x0000a114, 0x00000000},
++ {0x0000a118, 0x00000000},
++ {0x0000a11c, 0x00000000},
++ {0x0000a120, 0x00000000},
++ {0x0000a124, 0x00000000},
++ {0x0000a128, 0x00000000},
++ {0x0000a12c, 0x00000000},
++ {0x0000a130, 0x00000000},
++ {0x0000a134, 0x00000000},
++ {0x0000a138, 0x00000000},
++ {0x0000a13c, 0x00000000},
++ {0x0000a140, 0x001f0000},
++ {0x0000a144, 0x01000101},
++ {0x0000a148, 0x011e011f},
++ {0x0000a14c, 0x011c011d},
++ {0x0000a150, 0x02030204},
++ {0x0000a154, 0x02010202},
++ {0x0000a158, 0x021f0200},
++ {0x0000a15c, 0x0302021e},
++ {0x0000a160, 0x03000301},
++ {0x0000a164, 0x031e031f},
++ {0x0000a168, 0x0402031d},
++ {0x0000a16c, 0x04000401},
++ {0x0000a170, 0x041e041f},
++ {0x0000a174, 0x0502041d},
++ {0x0000a178, 0x05000501},
++ {0x0000a17c, 0x051e051f},
++ {0x0000a180, 0x06010602},
++ {0x0000a184, 0x061f0600},
++ {0x0000a188, 0x061d061e},
++ {0x0000a18c, 0x07020703},
++ {0x0000a190, 0x07000701},
++ {0x0000a194, 0x00000000},
++ {0x0000a198, 0x00000000},
++ {0x0000a19c, 0x00000000},
++ {0x0000a1a0, 0x00000000},
++ {0x0000a1a4, 0x00000000},
++ {0x0000a1a8, 0x00000000},
++ {0x0000a1ac, 0x00000000},
++ {0x0000a1b0, 0x00000000},
++ {0x0000a1b4, 0x00000000},
++ {0x0000a1b8, 0x00000000},
++ {0x0000a1bc, 0x00000000},
++ {0x0000a1c0, 0x00000000},
++ {0x0000a1c4, 0x00000000},
++ {0x0000a1c8, 0x00000000},
++ {0x0000a1cc, 0x00000000},
++ {0x0000a1d0, 0x00000000},
++ {0x0000a1d4, 0x00000000},
++ {0x0000a1d8, 0x00000000},
++ {0x0000a1dc, 0x00000000},
++ {0x0000a1e0, 0x00000000},
++ {0x0000a1e4, 0x00000000},
++ {0x0000a1e8, 0x00000000},
++ {0x0000a1ec, 0x00000000},
++ {0x0000a1f0, 0x00000396},
++ {0x0000a1f4, 0x00000396},
++ {0x0000a1f8, 0x00000396},
++ {0x0000a1fc, 0x00000196},
++ {0x0000b000, 0x00010000},
++ {0x0000b004, 0x00030002},
++ {0x0000b008, 0x00050004},
++ {0x0000b00c, 0x00810080},
++ {0x0000b010, 0x00830082},
++ {0x0000b014, 0x01810180},
++ {0x0000b018, 0x01830182},
++ {0x0000b01c, 0x01850184},
++ {0x0000b020, 0x02810280},
++ {0x0000b024, 0x02830282},
++ {0x0000b028, 0x02850284},
++ {0x0000b02c, 0x02890288},
++ {0x0000b030, 0x028b028a},
++ {0x0000b034, 0x0388028c},
++ {0x0000b038, 0x038a0389},
++ {0x0000b03c, 0x038c038b},
++ {0x0000b040, 0x0390038d},
++ {0x0000b044, 0x03920391},
++ {0x0000b048, 0x03940393},
++ {0x0000b04c, 0x03960395},
++ {0x0000b050, 0x00000000},
++ {0x0000b054, 0x00000000},
++ {0x0000b058, 0x00000000},
++ {0x0000b05c, 0x00000000},
++ {0x0000b060, 0x00000000},
++ {0x0000b064, 0x00000000},
++ {0x0000b068, 0x00000000},
++ {0x0000b06c, 0x00000000},
++ {0x0000b070, 0x00000000},
++ {0x0000b074, 0x00000000},
++ {0x0000b078, 0x00000000},
++ {0x0000b07c, 0x00000000},
++ {0x0000b080, 0x32323232},
++ {0x0000b084, 0x2f2f3232},
++ {0x0000b088, 0x23282a2d},
++ {0x0000b08c, 0x1c1e2123},
++ {0x0000b090, 0x14171919},
++ {0x0000b094, 0x0e0e1214},
++ {0x0000b098, 0x03050707},
++ {0x0000b09c, 0x00030303},
++ {0x0000b0a0, 0x00000000},
++ {0x0000b0a4, 0x00000000},
++ {0x0000b0a8, 0x00000000},
++ {0x0000b0ac, 0x00000000},
++ {0x0000b0b0, 0x00000000},
++ {0x0000b0b4, 0x00000000},
++ {0x0000b0b8, 0x00000000},
++ {0x0000b0bc, 0x00000000},
++ {0x0000b0c0, 0x003f0020},
++ {0x0000b0c4, 0x00400041},
++ {0x0000b0c8, 0x0140005f},
++ {0x0000b0cc, 0x0160015f},
++ {0x0000b0d0, 0x017e017f},
++ {0x0000b0d4, 0x02410242},
++ {0x0000b0d8, 0x025f0240},
++ {0x0000b0dc, 0x027f0260},
++ {0x0000b0e0, 0x0341027e},
++ {0x0000b0e4, 0x035f0340},
++ {0x0000b0e8, 0x037f0360},
++ {0x0000b0ec, 0x04400441},
++ {0x0000b0f0, 0x0460045f},
++ {0x0000b0f4, 0x0541047f},
++ {0x0000b0f8, 0x055f0540},
++ {0x0000b0fc, 0x057f0560},
++ {0x0000b100, 0x06400641},
++ {0x0000b104, 0x0660065f},
++ {0x0000b108, 0x067e067f},
++ {0x0000b10c, 0x07410742},
++ {0x0000b110, 0x075f0740},
++ {0x0000b114, 0x077f0760},
++ {0x0000b118, 0x07800781},
++ {0x0000b11c, 0x07a0079f},
++ {0x0000b120, 0x07c107bf},
++ {0x0000b124, 0x000007c0},
++ {0x0000b128, 0x00000000},
++ {0x0000b12c, 0x00000000},
++ {0x0000b130, 0x00000000},
++ {0x0000b134, 0x00000000},
++ {0x0000b138, 0x00000000},
++ {0x0000b13c, 0x00000000},
++ {0x0000b140, 0x003f0020},
++ {0x0000b144, 0x00400041},
++ {0x0000b148, 0x0140005f},
++ {0x0000b14c, 0x0160015f},
++ {0x0000b150, 0x017e017f},
++ {0x0000b154, 0x02410242},
++ {0x0000b158, 0x025f0240},
++ {0x0000b15c, 0x027f0260},
++ {0x0000b160, 0x0341027e},
++ {0x0000b164, 0x035f0340},
++ {0x0000b168, 0x037f0360},
++ {0x0000b16c, 0x04400441},
++ {0x0000b170, 0x0460045f},
++ {0x0000b174, 0x0541047f},
++ {0x0000b178, 0x055f0540},
++ {0x0000b17c, 0x057f0560},
++ {0x0000b180, 0x06400641},
++ {0x0000b184, 0x0660065f},
++ {0x0000b188, 0x067e067f},
++ {0x0000b18c, 0x07410742},
++ {0x0000b190, 0x075f0740},
++ {0x0000b194, 0x077f0760},
++ {0x0000b198, 0x07800781},
++ {0x0000b19c, 0x07a0079f},
++ {0x0000b1a0, 0x07c107bf},
++ {0x0000b1a4, 0x000007c0},
++ {0x0000b1a8, 0x00000000},
++ {0x0000b1ac, 0x00000000},
++ {0x0000b1b0, 0x00000000},
++ {0x0000b1b4, 0x00000000},
++ {0x0000b1b8, 0x00000000},
++ {0x0000b1bc, 0x00000000},
++ {0x0000b1c0, 0x00000000},
++ {0x0000b1c4, 0x00000000},
++ {0x0000b1c8, 0x00000000},
++ {0x0000b1cc, 0x00000000},
++ {0x0000b1d0, 0x00000000},
++ {0x0000b1d4, 0x00000000},
++ {0x0000b1d8, 0x00000000},
++ {0x0000b1dc, 0x00000000},
++ {0x0000b1e0, 0x00000000},
++ {0x0000b1e4, 0x00000000},
++ {0x0000b1e8, 0x00000000},
++ {0x0000b1ec, 0x00000000},
++ {0x0000b1f0, 0x00000396},
++ {0x0000b1f4, 0x00000396},
++ {0x0000b1f8, 0x00000396},
++ {0x0000b1fc, 0x00000196},
++};
++
++static const u32 ar9300_2p0_soc_preamble[][2] = {
++ /* Addr allmodes */
++ {0x000040a4, 0x00a0c1c9},
++ {0x00007008, 0x00000000},
++ {0x00007020, 0x00000000},
++ {0x00007034, 0x00000002},
++ {0x00007038, 0x000004c2},
++};
++
++static const u32 ar9300PciePhy_pll_on_clkreq_disable_L1_2p0[][2] = {
++ /* Addr allmodes */
++ {0x00004040, 0x08212e5e},
++ {0x00004040, 0x0008003b},
++ {0x00004044, 0x00000000},
++};
++
++static const u32 ar9300PciePhy_clkreq_enable_L1_2p0[][2] = {
++ /* Addr allmodes */
++ {0x00004040, 0x08253e5e},
++ {0x00004040, 0x0008003b},
++ {0x00004044, 0x00000000},
++};
++
++static const u32 ar9300PciePhy_clkreq_disable_L1_2p0[][2] = {
++ /* Addr allmodes */
++ {0x00004040, 0x08213e5e},
++ {0x00004040, 0x0008003b},
++ {0x00004044, 0x00000000},
++};
++
++#endif /* INITVALS_9003_2P0_H */
+--- /dev/null
++++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
+@@ -0,0 +1,1785 @@
++/*
++ * Copyright (c) 2010 Atheros Communications Inc.
++ *
++ * Permission to use, copy, modify, and/or distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ */
++
++#ifndef INITVALS_9003_2P2_H
++#define INITVALS_9003_2P2_H
++
++/* AR9003 2.2 */
++
++static const u32 ar9300_2p2_radio_postamble[][5] = {
++ /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
++ {0x0001609c, 0x0dd08f29, 0x0dd08f29, 0x0b283f31, 0x0b283f31},
++ {0x000160ac, 0xa4653c00, 0xa4653c00, 0x24652800, 0x24652800},
++ {0x000160b0, 0x03284f3e, 0x03284f3e, 0x05d08f20, 0x05d08f20},
++ {0x0001610c, 0x08000000, 0x00000000, 0x00000000, 0x00000000},
++ {0x00016140, 0x10804008, 0x10804008, 0x50804008, 0x50804008},
++ {0x0001650c, 0x08000000, 0x00000000, 0x00000000, 0x00000000},
++ {0x00016540, 0x10804008, 0x10804008, 0x50804008, 0x50804008},
++ {0x0001690c, 0x08000000, 0x00000000, 0x00000000, 0x00000000},
++ {0x00016940, 0x10804008, 0x10804008, 0x50804008, 0x50804008},
++};
++
++static const u32 ar9300Modes_lowest_ob_db_tx_gain_table_2p2[][5] = {
++ /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
++ {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
++ {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
++ {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002},
++ {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004},
++ {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200},
++ {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202},
++ {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400},
++ {0x0000a518, 0x21002220, 0x21002220, 0x16000402, 0x16000402},
++ {0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404},
++ {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603},
++ {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02},
++ {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04},
++ {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20},
++ {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20},
++ {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22},
++ {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24},
++ {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640},
++ {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660},
++ {0x0000a544, 0x5302266c, 0x5302266c, 0x3f001861, 0x3f001861},
++ {0x0000a548, 0x5702286c, 0x5702286c, 0x43001a81, 0x43001a81},
++ {0x0000a54c, 0x5c02486b, 0x5c02486b, 0x47001a83, 0x47001a83},
++ {0x0000a550, 0x61024a6c, 0x61024a6c, 0x4a001c84, 0x4a001c84},
++ {0x0000a554, 0x66026a6c, 0x66026a6c, 0x4e001ce3, 0x4e001ce3},
++ {0x0000a558, 0x6b026e6c, 0x6b026e6c, 0x52001ce5, 0x52001ce5},
++ {0x0000a55c, 0x7002708c, 0x7002708c, 0x56001ce9, 0x56001ce9},
++ {0x0000a560, 0x7302b08a, 0x7302b08a, 0x5a001ceb, 0x5a001ceb},
++ {0x0000a564, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec},
++ {0x0000a568, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec},
++ {0x0000a56c, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec},
++ {0x0000a570, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec},
++ {0x0000a574, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec},
++ {0x0000a578, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec},
++ {0x0000a57c, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec},
++ {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000},
++ {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002},
++ {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004},
++ {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200},
++ {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202},
++ {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400},
++ {0x0000a598, 0x21802220, 0x21802220, 0x16800402, 0x16800402},
++ {0x0000a59c, 0x27802223, 0x27802223, 0x19800404, 0x19800404},
++ {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603},
++ {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02},
++ {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04},
++ {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20},
++ {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20},
++ {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22},
++ {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24},
++ {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640},
++ {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660},
++ {0x0000a5c4, 0x5382266c, 0x5382266c, 0x3f801861, 0x3f801861},
++ {0x0000a5c8, 0x5782286c, 0x5782286c, 0x43801a81, 0x43801a81},
++ {0x0000a5cc, 0x5c82486b, 0x5c82486b, 0x47801a83, 0x47801a83},
++ {0x0000a5d0, 0x61824a6c, 0x61824a6c, 0x4a801c84, 0x4a801c84},
++ {0x0000a5d4, 0x66826a6c, 0x66826a6c, 0x4e801ce3, 0x4e801ce3},
++ {0x0000a5d8, 0x6b826e6c, 0x6b826e6c, 0x52801ce5, 0x52801ce5},
++ {0x0000a5dc, 0x7082708c, 0x7082708c, 0x56801ce9, 0x56801ce9},
++ {0x0000a5e0, 0x7382b08a, 0x7382b08a, 0x5a801ceb, 0x5a801ceb},
++ {0x0000a5e4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5e8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5ec, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5f0, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5f4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5f8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5fc, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
++ {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
++ {0x00016048, 0x62480001, 0x62480001, 0x62480001, 0x62480001},
++ {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
++ {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
++ {0x00016448, 0x62480001, 0x62480001, 0x62480001, 0x62480001},
++ {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
++ {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
++ {0x00016848, 0x62480001, 0x62480001, 0x62480001, 0x62480001},
++ {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
++};
++
++static const u32 ar9300Modes_fast_clock_2p2[][3] = {
++ /* Addr 5G_HT20 5G_HT40 */
++ {0x00001030, 0x00000268, 0x000004d0},
++ {0x00001070, 0x0000018c, 0x00000318},
++ {0x000010b0, 0x00000fd0, 0x00001fa0},
++ {0x00008014, 0x044c044c, 0x08980898},
++ {0x0000801c, 0x148ec02b, 0x148ec057},
++ {0x00008318, 0x000044c0, 0x00008980},
++ {0x00009e00, 0x03721821, 0x03721821},
++ {0x0000a230, 0x0000000b, 0x00000016},
++ {0x0000a254, 0x00000898, 0x00001130},
++};
++
++static const u32 ar9300_2p2_radio_core[][2] = {
++ /* Addr allmodes */
++ {0x00016000, 0x36db6db6},
++ {0x00016004, 0x6db6db40},
++ {0x00016008, 0x73f00000},
++ {0x0001600c, 0x00000000},
++ {0x00016040, 0x7f80fff8},
++ {0x0001604c, 0x76d005b5},
++ {0x00016050, 0x556cf031},
++ {0x00016054, 0x13449440},
++ {0x00016058, 0x0c51c92c},
++ {0x0001605c, 0x3db7fffc},
++ {0x00016060, 0xfffffffc},
++ {0x00016064, 0x000f0278},
++ {0x0001606c, 0x6db60000},
++ {0x00016080, 0x00000000},
++ {0x00016084, 0x0e48048c},
++ {0x00016088, 0x54214514},
++ {0x0001608c, 0x119f481e},
++ {0x00016090, 0x24926490},
++ {0x00016098, 0xd2888888},
++ {0x000160a0, 0x0a108ffe},
++ {0x000160a4, 0x812fc370},
++ {0x000160a8, 0x423c8000},
++ {0x000160b4, 0x92480080},
++ {0x000160c0, 0x00adb6d0},
++ {0x000160c4, 0x6db6db60},
++ {0x000160c8, 0x6db6db6c},
++ {0x000160cc, 0x01e6c000},
++ {0x00016100, 0x3fffbe01},
++ {0x00016104, 0xfff80000},
++ {0x00016108, 0x00080010},
++ {0x00016144, 0x02084080},
++ {0x00016148, 0x00000000},
++ {0x00016280, 0x058a0001},
++ {0x00016284, 0x3d840208},
++ {0x00016288, 0x05a20408},
++ {0x0001628c, 0x00038c07},
++ {0x00016290, 0x00000004},
++ {0x00016294, 0x458aa14f},
++ {0x00016380, 0x00000000},
++ {0x00016384, 0x00000000},
++ {0x00016388, 0x00800700},
++ {0x0001638c, 0x00800700},
++ {0x00016390, 0x00800700},
++ {0x00016394, 0x00000000},
++ {0x00016398, 0x00000000},
++ {0x0001639c, 0x00000000},
++ {0x000163a0, 0x00000001},
++ {0x000163a4, 0x00000001},
++ {0x000163a8, 0x00000000},
++ {0x000163ac, 0x00000000},
++ {0x000163b0, 0x00000000},
++ {0x000163b4, 0x00000000},
++ {0x000163b8, 0x00000000},
++ {0x000163bc, 0x00000000},
++ {0x000163c0, 0x000000a0},
++ {0x000163c4, 0x000c0000},
++ {0x000163c8, 0x14021402},
++ {0x000163cc, 0x00001402},
++ {0x000163d0, 0x00000000},
++ {0x000163d4, 0x00000000},
++ {0x00016400, 0x36db6db6},
++ {0x00016404, 0x6db6db40},
++ {0x00016408, 0x73f00000},
++ {0x0001640c, 0x00000000},
++ {0x00016440, 0x7f80fff8},
++ {0x0001644c, 0x76d005b5},
++ {0x00016450, 0x556cf031},
++ {0x00016454, 0x13449440},
++ {0x00016458, 0x0c51c92c},
++ {0x0001645c, 0x3db7fffc},
++ {0x00016460, 0xfffffffc},
++ {0x00016464, 0x000f0278},
++ {0x0001646c, 0x6db60000},
++ {0x00016500, 0x3fffbe01},
++ {0x00016504, 0xfff80000},
++ {0x00016508, 0x00080010},
++ {0x00016544, 0x02084080},
++ {0x00016548, 0x00000000},
++ {0x00016780, 0x00000000},
++ {0x00016784, 0x00000000},
++ {0x00016788, 0x00800700},
++ {0x0001678c, 0x00800700},
++ {0x00016790, 0x00800700},
++ {0x00016794, 0x00000000},
++ {0x00016798, 0x00000000},
++ {0x0001679c, 0x00000000},
++ {0x000167a0, 0x00000001},
++ {0x000167a4, 0x00000001},
++ {0x000167a8, 0x00000000},
++ {0x000167ac, 0x00000000},
++ {0x000167b0, 0x00000000},
++ {0x000167b4, 0x00000000},
++ {0x000167b8, 0x00000000},
++ {0x000167bc, 0x00000000},
++ {0x000167c0, 0x000000a0},
++ {0x000167c4, 0x000c0000},
++ {0x000167c8, 0x14021402},
++ {0x000167cc, 0x00001402},
++ {0x000167d0, 0x00000000},
++ {0x000167d4, 0x00000000},
++ {0x00016800, 0x36db6db6},
++ {0x00016804, 0x6db6db40},
++ {0x00016808, 0x73f00000},
++ {0x0001680c, 0x00000000},
++ {0x00016840, 0x7f80fff8},
++ {0x0001684c, 0x76d005b5},
++ {0x00016850, 0x556cf031},
++ {0x00016854, 0x13449440},
++ {0x00016858, 0x0c51c92c},
++ {0x0001685c, 0x3db7fffc},
++ {0x00016860, 0xfffffffc},
++ {0x00016864, 0x000f0278},
++ {0x0001686c, 0x6db60000},
++ {0x00016900, 0x3fffbe01},
++ {0x00016904, 0xfff80000},
++ {0x00016908, 0x00080010},
++ {0x00016944, 0x02084080},
++ {0x00016948, 0x00000000},
++ {0x00016b80, 0x00000000},
++ {0x00016b84, 0x00000000},
++ {0x00016b88, 0x00800700},
++ {0x00016b8c, 0x00800700},
++ {0x00016b90, 0x00800700},
++ {0x00016b94, 0x00000000},
++ {0x00016b98, 0x00000000},
++ {0x00016b9c, 0x00000000},
++ {0x00016ba0, 0x00000001},
++ {0x00016ba4, 0x00000001},
++ {0x00016ba8, 0x00000000},
++ {0x00016bac, 0x00000000},
++ {0x00016bb0, 0x00000000},
++ {0x00016bb4, 0x00000000},
++ {0x00016bb8, 0x00000000},
++ {0x00016bbc, 0x00000000},
++ {0x00016bc0, 0x000000a0},
++ {0x00016bc4, 0x000c0000},
++ {0x00016bc8, 0x14021402},
++ {0x00016bcc, 0x00001402},
++ {0x00016bd0, 0x00000000},
++ {0x00016bd4, 0x00000000},
++};
++
++static const u32 ar9300Common_rx_gain_table_merlin_2p2[][2] = {
++ /* Addr allmodes */
++ {0x0000a000, 0x02000101},
++ {0x0000a004, 0x02000102},
++ {0x0000a008, 0x02000103},
++ {0x0000a00c, 0x02000104},
++ {0x0000a010, 0x02000200},
++ {0x0000a014, 0x02000201},
++ {0x0000a018, 0x02000202},
++ {0x0000a01c, 0x02000203},
++ {0x0000a020, 0x02000204},
++ {0x0000a024, 0x02000205},
++ {0x0000a028, 0x02000208},
++ {0x0000a02c, 0x02000302},
++ {0x0000a030, 0x02000303},
++ {0x0000a034, 0x02000304},
++ {0x0000a038, 0x02000400},
++ {0x0000a03c, 0x02010300},
++ {0x0000a040, 0x02010301},
++ {0x0000a044, 0x02010302},
++ {0x0000a048, 0x02000500},
++ {0x0000a04c, 0x02010400},
++ {0x0000a050, 0x02020300},
++ {0x0000a054, 0x02020301},
++ {0x0000a058, 0x02020302},
++ {0x0000a05c, 0x02020303},
++ {0x0000a060, 0x02020400},
++ {0x0000a064, 0x02030300},
++ {0x0000a068, 0x02030301},
++ {0x0000a06c, 0x02030302},
++ {0x0000a070, 0x02030303},
++ {0x0000a074, 0x02030400},
++ {0x0000a078, 0x02040300},
++ {0x0000a07c, 0x02040301},
++ {0x0000a080, 0x02040302},
++ {0x0000a084, 0x02040303},
++ {0x0000a088, 0x02030500},
++ {0x0000a08c, 0x02040400},
++ {0x0000a090, 0x02050203},
++ {0x0000a094, 0x02050204},
++ {0x0000a098, 0x02050205},
++ {0x0000a09c, 0x02040500},
++ {0x0000a0a0, 0x02050301},
++ {0x0000a0a4, 0x02050302},
++ {0x0000a0a8, 0x02050303},
++ {0x0000a0ac, 0x02050400},
++ {0x0000a0b0, 0x02050401},
++ {0x0000a0b4, 0x02050402},
++ {0x0000a0b8, 0x02050403},
++ {0x0000a0bc, 0x02050500},
++ {0x0000a0c0, 0x02050501},
++ {0x0000a0c4, 0x02050502},
++ {0x0000a0c8, 0x02050503},
++ {0x0000a0cc, 0x02050504},
++ {0x0000a0d0, 0x02050600},
++ {0x0000a0d4, 0x02050601},
++ {0x0000a0d8, 0x02050602},
++ {0x0000a0dc, 0x02050603},
++ {0x0000a0e0, 0x02050604},
++ {0x0000a0e4, 0x02050700},
++ {0x0000a0e8, 0x02050701},
++ {0x0000a0ec, 0x02050702},
++ {0x0000a0f0, 0x02050703},
++ {0x0000a0f4, 0x02050704},
++ {0x0000a0f8, 0x02050705},
++ {0x0000a0fc, 0x02050708},
++ {0x0000a100, 0x02050709},
++ {0x0000a104, 0x0205070a},
++ {0x0000a108, 0x0205070b},
++ {0x0000a10c, 0x0205070c},
++ {0x0000a110, 0x0205070d},
++ {0x0000a114, 0x02050710},
++ {0x0000a118, 0x02050711},
++ {0x0000a11c, 0x02050712},
++ {0x0000a120, 0x02050713},
++ {0x0000a124, 0x02050714},
++ {0x0000a128, 0x02050715},
++ {0x0000a12c, 0x02050730},
++ {0x0000a130, 0x02050731},
++ {0x0000a134, 0x02050732},
++ {0x0000a138, 0x02050733},
++ {0x0000a13c, 0x02050734},
++ {0x0000a140, 0x02050735},
++ {0x0000a144, 0x02050750},
++ {0x0000a148, 0x02050751},
++ {0x0000a14c, 0x02050752},
++ {0x0000a150, 0x02050753},
++ {0x0000a154, 0x02050754},
++ {0x0000a158, 0x02050755},
++ {0x0000a15c, 0x02050770},
++ {0x0000a160, 0x02050771},
++ {0x0000a164, 0x02050772},
++ {0x0000a168, 0x02050773},
++ {0x0000a16c, 0x02050774},
++ {0x0000a170, 0x02050775},
++ {0x0000a174, 0x00000776},
++ {0x0000a178, 0x00000776},
++ {0x0000a17c, 0x00000776},
++ {0x0000a180, 0x00000776},
++ {0x0000a184, 0x00000776},
++ {0x0000a188, 0x00000776},
++ {0x0000a18c, 0x00000776},
++ {0x0000a190, 0x00000776},
++ {0x0000a194, 0x00000776},
++ {0x0000a198, 0x00000776},
++ {0x0000a19c, 0x00000776},
++ {0x0000a1a0, 0x00000776},
++ {0x0000a1a4, 0x00000776},
++ {0x0000a1a8, 0x00000776},
++ {0x0000a1ac, 0x00000776},
++ {0x0000a1b0, 0x00000776},
++ {0x0000a1b4, 0x00000776},
++ {0x0000a1b8, 0x00000776},
++ {0x0000a1bc, 0x00000776},
++ {0x0000a1c0, 0x00000776},
++ {0x0000a1c4, 0x00000776},
++ {0x0000a1c8, 0x00000776},
++ {0x0000a1cc, 0x00000776},
++ {0x0000a1d0, 0x00000776},
++ {0x0000a1d4, 0x00000776},
++ {0x0000a1d8, 0x00000776},
++ {0x0000a1dc, 0x00000776},
++ {0x0000a1e0, 0x00000776},
++ {0x0000a1e4, 0x00000776},
++ {0x0000a1e8, 0x00000776},
++ {0x0000a1ec, 0x00000776},
++ {0x0000a1f0, 0x00000776},
++ {0x0000a1f4, 0x00000776},
++ {0x0000a1f8, 0x00000776},
++ {0x0000a1fc, 0x00000776},
++ {0x0000b000, 0x02000101},
++ {0x0000b004, 0x02000102},
++ {0x0000b008, 0x02000103},
++ {0x0000b00c, 0x02000104},
++ {0x0000b010, 0x02000200},
++ {0x0000b014, 0x02000201},
++ {0x0000b018, 0x02000202},
++ {0x0000b01c, 0x02000203},
++ {0x0000b020, 0x02000204},
++ {0x0000b024, 0x02000205},
++ {0x0000b028, 0x02000208},
++ {0x0000b02c, 0x02000302},
++ {0x0000b030, 0x02000303},
++ {0x0000b034, 0x02000304},
++ {0x0000b038, 0x02000400},
++ {0x0000b03c, 0x02010300},
++ {0x0000b040, 0x02010301},
++ {0x0000b044, 0x02010302},
++ {0x0000b048, 0x02000500},
++ {0x0000b04c, 0x02010400},
++ {0x0000b050, 0x02020300},
++ {0x0000b054, 0x02020301},
++ {0x0000b058, 0x02020302},
++ {0x0000b05c, 0x02020303},
++ {0x0000b060, 0x02020400},
++ {0x0000b064, 0x02030300},
++ {0x0000b068, 0x02030301},
++ {0x0000b06c, 0x02030302},
++ {0x0000b070, 0x02030303},
++ {0x0000b074, 0x02030400},
++ {0x0000b078, 0x02040300},
++ {0x0000b07c, 0x02040301},
++ {0x0000b080, 0x02040302},
++ {0x0000b084, 0x02040303},
++ {0x0000b088, 0x02030500},
++ {0x0000b08c, 0x02040400},
++ {0x0000b090, 0x02050203},
++ {0x0000b094, 0x02050204},
++ {0x0000b098, 0x02050205},
++ {0x0000b09c, 0x02040500},
++ {0x0000b0a0, 0x02050301},
++ {0x0000b0a4, 0x02050302},
++ {0x0000b0a8, 0x02050303},
++ {0x0000b0ac, 0x02050400},
++ {0x0000b0b0, 0x02050401},
++ {0x0000b0b4, 0x02050402},
++ {0x0000b0b8, 0x02050403},
++ {0x0000b0bc, 0x02050500},
++ {0x0000b0c0, 0x02050501},
++ {0x0000b0c4, 0x02050502},
++ {0x0000b0c8, 0x02050503},
++ {0x0000b0cc, 0x02050504},
++ {0x0000b0d0, 0x02050600},
++ {0x0000b0d4, 0x02050601},
++ {0x0000b0d8, 0x02050602},
++ {0x0000b0dc, 0x02050603},
++ {0x0000b0e0, 0x02050604},
++ {0x0000b0e4, 0x02050700},
++ {0x0000b0e8, 0x02050701},
++ {0x0000b0ec, 0x02050702},
++ {0x0000b0f0, 0x02050703},
++ {0x0000b0f4, 0x02050704},
++ {0x0000b0f8, 0x02050705},
++ {0x0000b0fc, 0x02050708},
++ {0x0000b100, 0x02050709},
++ {0x0000b104, 0x0205070a},
++ {0x0000b108, 0x0205070b},
++ {0x0000b10c, 0x0205070c},
++ {0x0000b110, 0x0205070d},
++ {0x0000b114, 0x02050710},
++ {0x0000b118, 0x02050711},
++ {0x0000b11c, 0x02050712},
++ {0x0000b120, 0x02050713},
++ {0x0000b124, 0x02050714},
++ {0x0000b128, 0x02050715},
++ {0x0000b12c, 0x02050730},
++ {0x0000b130, 0x02050731},
++ {0x0000b134, 0x02050732},
++ {0x0000b138, 0x02050733},
++ {0x0000b13c, 0x02050734},
++ {0x0000b140, 0x02050735},
++ {0x0000b144, 0x02050750},
++ {0x0000b148, 0x02050751},
++ {0x0000b14c, 0x02050752},
++ {0x0000b150, 0x02050753},
++ {0x0000b154, 0x02050754},
++ {0x0000b158, 0x02050755},
++ {0x0000b15c, 0x02050770},
++ {0x0000b160, 0x02050771},
++ {0x0000b164, 0x02050772},
++ {0x0000b168, 0x02050773},
++ {0x0000b16c, 0x02050774},
++ {0x0000b170, 0x02050775},
++ {0x0000b174, 0x00000776},
++ {0x0000b178, 0x00000776},
++ {0x0000b17c, 0x00000776},
++ {0x0000b180, 0x00000776},
++ {0x0000b184, 0x00000776},
++ {0x0000b188, 0x00000776},
++ {0x0000b18c, 0x00000776},
++ {0x0000b190, 0x00000776},
++ {0x0000b194, 0x00000776},
++ {0x0000b198, 0x00000776},
++ {0x0000b19c, 0x00000776},
++ {0x0000b1a0, 0x00000776},
++ {0x0000b1a4, 0x00000776},
++ {0x0000b1a8, 0x00000776},
++ {0x0000b1ac, 0x00000776},
++ {0x0000b1b0, 0x00000776},
++ {0x0000b1b4, 0x00000776},
++ {0x0000b1b8, 0x00000776},
++ {0x0000b1bc, 0x00000776},
++ {0x0000b1c0, 0x00000776},
++ {0x0000b1c4, 0x00000776},
++ {0x0000b1c8, 0x00000776},
++ {0x0000b1cc, 0x00000776},
++ {0x0000b1d0, 0x00000776},
++ {0x0000b1d4, 0x00000776},
++ {0x0000b1d8, 0x00000776},
++ {0x0000b1dc, 0x00000776},
++ {0x0000b1e0, 0x00000776},
++ {0x0000b1e4, 0x00000776},
++ {0x0000b1e8, 0x00000776},
++ {0x0000b1ec, 0x00000776},
++ {0x0000b1f0, 0x00000776},
++ {0x0000b1f4, 0x00000776},
++ {0x0000b1f8, 0x00000776},
++ {0x0000b1fc, 0x00000776},
++};
++
++static const u32 ar9300_2p2_mac_postamble[][5] = {
++ /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
++ {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160},
++ {0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c},
++ {0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38},
++ {0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00},
++ {0x0000801c, 0x128d8027, 0x128d804f, 0x12e00057, 0x12e0002b},
++ {0x00008120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810},
++ {0x000081d0, 0x00003210, 0x00003210, 0x0000320a, 0x0000320a},
++ {0x00008318, 0x00003e80, 0x00007d00, 0x00006880, 0x00003440},
++};
++
++static const u32 ar9300_2p2_soc_postamble[][5] = {
++ /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
++ {0x00007010, 0x00000023, 0x00000023, 0x00000023, 0x00000023},
++};
++
++static const u32 ar9200_merlin_2p2_radio_core[][2] = {
++ /* Addr allmodes */
++ {0x00007800, 0x00040000},
++ {0x00007804, 0xdb005012},
++ {0x00007808, 0x04924914},
++ {0x0000780c, 0x21084210},
++ {0x00007810, 0x6d801300},
++ {0x00007814, 0x0019beff},
++ {0x00007818, 0x07e41000},
++ {0x0000781c, 0x00392000},
++ {0x00007820, 0x92592480},
++ {0x00007824, 0x00040000},
++ {0x00007828, 0xdb005012},
++ {0x0000782c, 0x04924914},
++ {0x00007830, 0x21084210},
++ {0x00007834, 0x6d801300},
++ {0x00007838, 0x0019beff},
++ {0x0000783c, 0x07e40000},
++ {0x00007840, 0x00392000},
++ {0x00007844, 0x92592480},
++ {0x00007848, 0x00100000},
++ {0x0000784c, 0x773f0567},
++ {0x00007850, 0x54214514},
++ {0x00007854, 0x12035828},
++ {0x00007858, 0x92592692},
++ {0x0000785c, 0x00000000},
++ {0x00007860, 0x56400000},
++ {0x00007864, 0x0a8e370e},
++ {0x00007868, 0xc0102850},
++ {0x0000786c, 0x812d4000},
++ {0x00007870, 0x807ec400},
++ {0x00007874, 0x001b6db0},
++ {0x00007878, 0x00376b63},
++ {0x0000787c, 0x06db6db6},
++ {0x00007880, 0x006d8000},
++ {0x00007884, 0xffeffffe},
++ {0x00007888, 0xffeffffe},
++ {0x0000788c, 0x00010000},
++ {0x00007890, 0x02060aeb},
++ {0x00007894, 0x5a108000},
++};
++
++static const u32 ar9300_2p2_baseband_postamble[][5] = {
++ /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
++ {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8011, 0xd00a8011},
++ {0x00009820, 0x206a022e, 0x206a022e, 0x206a012e, 0x206a012e},
++ {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0},
++ {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x06903881},
++ {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4},
++ {0x00009830, 0x0000059c, 0x0000059c, 0x0000119c, 0x0000119c},
++ {0x00009c00, 0x000000c4, 0x000000c4, 0x000000c4, 0x000000c4},
++ {0x00009e00, 0x0372161e, 0x0372161e, 0x037216a0, 0x037216a0},
++ {0x00009e04, 0x00802020, 0x00802020, 0x00802020, 0x00802020},
++ {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2},
++ {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec84d2e, 0x7ec84d2e},
++ {0x00009e14, 0x31395d5e, 0x3139605e, 0x3139605e, 0x31395d5e},
++ {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
++ {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c},
++ {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce},
++ {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021},
++ {0x00009e44, 0x02321e27, 0x02321e27, 0x02291e27, 0x02291e27},
++ {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012},
++ {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000},
++ {0x0000a204, 0x000037c0, 0x000037c4, 0x000037c4, 0x000037c0},
++ {0x0000a208, 0x00000104, 0x00000104, 0x00000004, 0x00000004},
++ {0x0000a230, 0x0000000a, 0x00000014, 0x00000016, 0x0000000b},
++ {0x0000a234, 0x00000fff, 0x10000fff, 0x10000fff, 0x00000fff},
++ {0x0000a238, 0xffb81018, 0xffb81018, 0xffb81018, 0xffb81018},
++ {0x0000a250, 0x00000000, 0x00000000, 0x00000210, 0x00000108},
++ {0x0000a254, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898},
++ {0x0000a258, 0x02020002, 0x02020002, 0x02020002, 0x02020002},
++ {0x0000a25c, 0x01000e0e, 0x01000e0e, 0x01000e0e, 0x01000e0e},
++ {0x0000a260, 0x0a021501, 0x0a021501, 0x3a021501, 0x3a021501},
++ {0x0000a264, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e},
++ {0x0000a280, 0x00000007, 0x00000007, 0x0000000b, 0x0000000b},
++ {0x0000a284, 0x00000000, 0x00000000, 0x00000150, 0x00000150},
++ {0x0000a288, 0x00000110, 0x00000110, 0x00000110, 0x00000110},
++ {0x0000a28c, 0x00022222, 0x00022222, 0x00022222, 0x00022222},
++ {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18},
++ {0x0000a2d0, 0x00071981, 0x00071981, 0x00071981, 0x00071982},
++ {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a},
++ {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
++ {0x0000a830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c},
++ {0x0000ae04, 0x00800000, 0x00800000, 0x00800000, 0x00800000},
++ {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
++ {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c},
++ {0x0000ae20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce},
++ {0x0000b284, 0x00000000, 0x00000000, 0x00000150, 0x00000150},
++ {0x0000b830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c},
++ {0x0000be04, 0x00800000, 0x00800000, 0x00800000, 0x00800000},
++ {0x0000be18, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
++ {0x0000be1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c},
++ {0x0000be20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce},
++ {0x0000c284, 0x00000000, 0x00000000, 0x00000150, 0x00000150},
++};
++
++static const u32 ar9300_2p2_baseband_core[][2] = {
++ /* Addr allmodes */
++ {0x00009800, 0xafe68e30},
++ {0x00009804, 0xfd14e000},
++ {0x00009808, 0x9c0a9f6b},
++ {0x0000980c, 0x04900000},
++ {0x00009814, 0x9280c00a},
++ {0x00009818, 0x00000000},
++ {0x0000981c, 0x00020028},
++ {0x00009834, 0x5f3ca3de},
++ {0x00009838, 0x0108ecff},
++ {0x0000983c, 0x14750600},
++ {0x00009880, 0x201fff00},
++ {0x00009884, 0x00001042},
++ {0x000098a4, 0x00200400},
++ {0x000098b0, 0x52440bbe},
++ {0x000098d0, 0x004b6a8e},
++ {0x000098d4, 0x00000820},
++ {0x000098dc, 0x00000000},
++ {0x000098f0, 0x00000000},
++ {0x000098f4, 0x00000000},
++ {0x00009c04, 0xff55ff55},
++ {0x00009c08, 0x0320ff55},
++ {0x00009c0c, 0x00000000},
++ {0x00009c10, 0x00000000},
++ {0x00009c14, 0x00046384},
++ {0x00009c18, 0x05b6b440},
++ {0x00009c1c, 0x00b6b440},
++ {0x00009d00, 0xc080a333},
++ {0x00009d04, 0x40206c10},
++ {0x00009d08, 0x009c4060},
++ {0x00009d0c, 0x9883800a},
++ {0x00009d10, 0x01834061},
++ {0x00009d14, 0x00c0040b},
++ {0x00009d18, 0x00000000},
++ {0x00009e08, 0x0038230c},
++ {0x00009e24, 0x990bb515},
++ {0x00009e28, 0x0c6f0000},
++ {0x00009e30, 0x06336f77},
++ {0x00009e34, 0x6af6532f},
++ {0x00009e38, 0x0cc80c00},
++ {0x00009e3c, 0xcf946222},
++ {0x00009e40, 0x0d261820},
++ {0x00009e4c, 0x00001004},
++ {0x00009e50, 0x00ff03f1},
++ {0x00009e54, 0x00000000},
++ {0x00009fc0, 0x803e4788},
++ {0x00009fc4, 0x0001efb5},
++ {0x00009fcc, 0x40000014},
++ {0x00009fd0, 0x01193b93},
++ {0x0000a20c, 0x00000000},
++ {0x0000a220, 0x00000000},
++ {0x0000a224, 0x00000000},
++ {0x0000a228, 0x10002310},
++ {0x0000a22c, 0x01036a1e},
++ {0x0000a23c, 0x00000000},
++ {0x0000a244, 0x0c000000},
++ {0x0000a2a0, 0x00000001},
++ {0x0000a2c0, 0x00000001},
++ {0x0000a2c8, 0x00000000},
++ {0x0000a2cc, 0x18c43433},
++ {0x0000a2d4, 0x00000000},
++ {0x0000a2dc, 0x00000000},
++ {0x0000a2e0, 0x00000000},
++ {0x0000a2e4, 0x00000000},
++ {0x0000a2e8, 0x00000000},
++ {0x0000a2ec, 0x00000000},
++ {0x0000a2f0, 0x00000000},
++ {0x0000a2f4, 0x00000000},
++ {0x0000a2f8, 0x00000000},
++ {0x0000a344, 0x00000000},
++ {0x0000a34c, 0x00000000},
++ {0x0000a350, 0x0000a000},
++ {0x0000a364, 0x00000000},
++ {0x0000a370, 0x00000000},
++ {0x0000a390, 0x00000001},
++ {0x0000a394, 0x00000444},
++ {0x0000a398, 0x001f0e0f},
++ {0x0000a39c, 0x0075393f},
++ {0x0000a3a0, 0xb79f6427},
++ {0x0000a3a4, 0x00000000},
++ {0x0000a3a8, 0xaaaaaaaa},
++ {0x0000a3ac, 0x3c466478},
++ {0x0000a3c0, 0x20202020},
++ {0x0000a3c4, 0x22222220},
++ {0x0000a3c8, 0x20200020},
++ {0x0000a3cc, 0x20202020},
++ {0x0000a3d0, 0x20202020},
++ {0x0000a3d4, 0x20202020},
++ {0x0000a3d8, 0x20202020},
++ {0x0000a3dc, 0x20202020},
++ {0x0000a3e0, 0x20202020},
++ {0x0000a3e4, 0x20202020},
++ {0x0000a3e8, 0x20202020},
++ {0x0000a3ec, 0x20202020},
++ {0x0000a3f0, 0x00000000},
++ {0x0000a3f4, 0x00000246},
++ {0x0000a3f8, 0x0cdbd380},
++ {0x0000a3fc, 0x000f0f01},
++ {0x0000a400, 0x8fa91f01},
++ {0x0000a404, 0x00000000},
++ {0x0000a408, 0x0e79e5c6},
++ {0x0000a40c, 0x00820820},
++ {0x0000a414, 0x1ce739ce},
++ {0x0000a418, 0x2d001dce},
++ {0x0000a41c, 0x1ce739ce},
++ {0x0000a420, 0x000001ce},
++ {0x0000a424, 0x1ce739ce},
++ {0x0000a428, 0x000001ce},
++ {0x0000a42c, 0x1ce739ce},
++ {0x0000a430, 0x1ce739ce},
++ {0x0000a434, 0x00000000},
++ {0x0000a438, 0x00001801},
++ {0x0000a43c, 0x00000000},
++ {0x0000a440, 0x00000000},
++ {0x0000a444, 0x00000000},
++ {0x0000a448, 0x06000080},
++ {0x0000a44c, 0x00000001},
++ {0x0000a450, 0x00010000},
++ {0x0000a458, 0x00000000},
++ {0x0000a600, 0x00000000},
++ {0x0000a604, 0x00000000},
++ {0x0000a608, 0x00000000},
++ {0x0000a60c, 0x00000000},
++ {0x0000a610, 0x00000000},
++ {0x0000a614, 0x00000000},
++ {0x0000a618, 0x00000000},
++ {0x0000a61c, 0x00000000},
++ {0x0000a620, 0x00000000},
++ {0x0000a624, 0x00000000},
++ {0x0000a628, 0x00000000},
++ {0x0000a62c, 0x00000000},
++ {0x0000a630, 0x00000000},
++ {0x0000a634, 0x00000000},
++ {0x0000a638, 0x00000000},
++ {0x0000a63c, 0x00000000},
++ {0x0000a640, 0x00000000},
++ {0x0000a644, 0x3fad9d74},
++ {0x0000a648, 0x0048060a},
++ {0x0000a64c, 0x00000637},
++ {0x0000a670, 0x03020100},
++ {0x0000a674, 0x09080504},
++ {0x0000a678, 0x0d0c0b0a},
++ {0x0000a67c, 0x13121110},
++ {0x0000a680, 0x31301514},
++ {0x0000a684, 0x35343332},
++ {0x0000a688, 0x00000036},
++ {0x0000a690, 0x00000838},
++ {0x0000a7c0, 0x00000000},
++ {0x0000a7c4, 0xfffffffc},
++ {0x0000a7c8, 0x00000000},
++ {0x0000a7cc, 0x00000000},
++ {0x0000a7d0, 0x00000000},
++ {0x0000a7d4, 0x00000004},
++ {0x0000a7dc, 0x00000001},
++ {0x0000a8d0, 0x004b6a8e},
++ {0x0000a8d4, 0x00000820},
++ {0x0000a8dc, 0x00000000},
++ {0x0000a8f0, 0x00000000},
++ {0x0000a8f4, 0x00000000},
++ {0x0000b2d0, 0x00000080},
++ {0x0000b2d4, 0x00000000},
++ {0x0000b2dc, 0x00000000},
++ {0x0000b2e0, 0x00000000},
++ {0x0000b2e4, 0x00000000},
++ {0x0000b2e8, 0x00000000},
++ {0x0000b2ec, 0x00000000},
++ {0x0000b2f0, 0x00000000},
++ {0x0000b2f4, 0x00000000},
++ {0x0000b2f8, 0x00000000},
++ {0x0000b408, 0x0e79e5c0},
++ {0x0000b40c, 0x00820820},
++ {0x0000b420, 0x00000000},
++ {0x0000b8d0, 0x004b6a8e},
++ {0x0000b8d4, 0x00000820},
++ {0x0000b8dc, 0x00000000},
++ {0x0000b8f0, 0x00000000},
++ {0x0000b8f4, 0x00000000},
++ {0x0000c2d0, 0x00000080},
++ {0x0000c2d4, 0x00000000},
++ {0x0000c2dc, 0x00000000},
++ {0x0000c2e0, 0x00000000},
++ {0x0000c2e4, 0x00000000},
++ {0x0000c2e8, 0x00000000},
++ {0x0000c2ec, 0x00000000},
++ {0x0000c2f0, 0x00000000},
++ {0x0000c2f4, 0x00000000},
++ {0x0000c2f8, 0x00000000},
++ {0x0000c408, 0x0e79e5c0},
++ {0x0000c40c, 0x00820820},
++ {0x0000c420, 0x00000000},
++};
++
++static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = {
++ /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
++ {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
++ {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000},
++ {0x0000a504, 0x06002223, 0x06002223, 0x04000002, 0x04000002},
++ {0x0000a508, 0x0a022220, 0x0a022220, 0x08000004, 0x08000004},
++ {0x0000a50c, 0x0f022223, 0x0f022223, 0x0b000200, 0x0b000200},
++ {0x0000a510, 0x14022620, 0x14022620, 0x0f000202, 0x0f000202},
++ {0x0000a514, 0x18022622, 0x18022622, 0x11000400, 0x11000400},
++ {0x0000a518, 0x1b022822, 0x1b022822, 0x15000402, 0x15000402},
++ {0x0000a51c, 0x20022842, 0x20022842, 0x19000404, 0x19000404},
++ {0x0000a520, 0x22022c41, 0x22022c41, 0x1b000603, 0x1b000603},
++ {0x0000a524, 0x28023042, 0x28023042, 0x1f000a02, 0x1f000a02},
++ {0x0000a528, 0x2c023044, 0x2c023044, 0x23000a04, 0x23000a04},
++ {0x0000a52c, 0x2f023644, 0x2f023644, 0x26000a20, 0x26000a20},
++ {0x0000a530, 0x34025643, 0x34025643, 0x2a000e20, 0x2a000e20},
++ {0x0000a534, 0x38025a44, 0x38025a44, 0x2e000e22, 0x2e000e22},
++ {0x0000a538, 0x3b025e45, 0x3b025e45, 0x31000e24, 0x31000e24},
++ {0x0000a53c, 0x41025e4a, 0x41025e4a, 0x34001640, 0x34001640},
++ {0x0000a540, 0x48025e6c, 0x48025e6c, 0x38001660, 0x38001660},
++ {0x0000a544, 0x4e025e8e, 0x4e025e8e, 0x3b001861, 0x3b001861},
++ {0x0000a548, 0x53025eb2, 0x53025eb2, 0x3e001a81, 0x3e001a81},
++ {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83},
++ {0x0000a550, 0x5f025ef6, 0x5f025ef6, 0x44001c84, 0x44001c84},
++ {0x0000a554, 0x62025f56, 0x62025f56, 0x48001ce3, 0x48001ce3},
++ {0x0000a558, 0x66027f56, 0x66027f56, 0x4c001ce5, 0x4c001ce5},
++ {0x0000a55c, 0x6a029f56, 0x6a029f56, 0x50001ce9, 0x50001ce9},
++ {0x0000a560, 0x70049f56, 0x70049f56, 0x54001ceb, 0x54001ceb},
++ {0x0000a564, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a568, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a56c, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a570, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a574, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a578, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a57c, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000},
++ {0x0000a584, 0x06802223, 0x06802223, 0x04800002, 0x04800002},
++ {0x0000a588, 0x0a822220, 0x0a822220, 0x08800004, 0x08800004},
++ {0x0000a58c, 0x0f822223, 0x0f822223, 0x0b800200, 0x0b800200},
++ {0x0000a590, 0x14822620, 0x14822620, 0x0f800202, 0x0f800202},
++ {0x0000a594, 0x18822622, 0x18822622, 0x11800400, 0x11800400},
++ {0x0000a598, 0x1b822822, 0x1b822822, 0x15800402, 0x15800402},
++ {0x0000a59c, 0x20822842, 0x20822842, 0x19800404, 0x19800404},
++ {0x0000a5a0, 0x22822c41, 0x22822c41, 0x1b800603, 0x1b800603},
++ {0x0000a5a4, 0x28823042, 0x28823042, 0x1f800a02, 0x1f800a02},
++ {0x0000a5a8, 0x2c823044, 0x2c823044, 0x23800a04, 0x23800a04},
++ {0x0000a5ac, 0x2f823644, 0x2f823644, 0x26800a20, 0x26800a20},
++ {0x0000a5b0, 0x34825643, 0x34825643, 0x2a800e20, 0x2a800e20},
++ {0x0000a5b4, 0x38825a44, 0x38825a44, 0x2e800e22, 0x2e800e22},
++ {0x0000a5b8, 0x3b825e45, 0x3b825e45, 0x31800e24, 0x31800e24},
++ {0x0000a5bc, 0x41825e4a, 0x41825e4a, 0x34801640, 0x34801640},
++ {0x0000a5c0, 0x48825e6c, 0x48825e6c, 0x38801660, 0x38801660},
++ {0x0000a5c4, 0x4e825e8e, 0x4e825e8e, 0x3b801861, 0x3b801861},
++ {0x0000a5c8, 0x53825eb2, 0x53825eb2, 0x3e801a81, 0x3e801a81},
++ {0x0000a5cc, 0x59825eb5, 0x59825eb5, 0x42801a83, 0x42801a83},
++ {0x0000a5d0, 0x5f825ef6, 0x5f825ef6, 0x44801c84, 0x44801c84},
++ {0x0000a5d4, 0x62825f56, 0x62825f56, 0x48801ce3, 0x48801ce3},
++ {0x0000a5d8, 0x66827f56, 0x66827f56, 0x4c801ce5, 0x4c801ce5},
++ {0x0000a5dc, 0x6a829f56, 0x6a829f56, 0x50801ce9, 0x50801ce9},
++ {0x0000a5e0, 0x70849f56, 0x70849f56, 0x54801ceb, 0x54801ceb},
++ {0x0000a5e4, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5e8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5ec, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5f0, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5f4, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5f8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5fc, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x00016044, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6},
++ {0x00016048, 0xae480001, 0xae480001, 0xae480001, 0xae480001},
++ {0x00016068, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c},
++ {0x00016444, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6},
++ {0x00016448, 0xae480001, 0xae480001, 0xae480001, 0xae480001},
++ {0x00016468, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c},
++ {0x00016844, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6},
++ {0x00016848, 0xae480001, 0xae480001, 0xae480001, 0xae480001},
++ {0x00016868, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c},
++};
++
++static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p2[][5] = {
++ /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
++ {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
++ {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000},
++ {0x0000a504, 0x06002223, 0x06002223, 0x04000002, 0x04000002},
++ {0x0000a508, 0x0a022220, 0x0a022220, 0x08000004, 0x08000004},
++ {0x0000a50c, 0x0f022223, 0x0f022223, 0x0b000200, 0x0b000200},
++ {0x0000a510, 0x14022620, 0x14022620, 0x0f000202, 0x0f000202},
++ {0x0000a514, 0x18022622, 0x18022622, 0x11000400, 0x11000400},
++ {0x0000a518, 0x1b022822, 0x1b022822, 0x15000402, 0x15000402},
++ {0x0000a51c, 0x20022842, 0x20022842, 0x19000404, 0x19000404},
++ {0x0000a520, 0x22022c41, 0x22022c41, 0x1b000603, 0x1b000603},
++ {0x0000a524, 0x28023042, 0x28023042, 0x1f000a02, 0x1f000a02},
++ {0x0000a528, 0x2c023044, 0x2c023044, 0x23000a04, 0x23000a04},
++ {0x0000a52c, 0x2f023644, 0x2f023644, 0x26000a20, 0x26000a20},
++ {0x0000a530, 0x34025643, 0x34025643, 0x2a000e20, 0x2a000e20},
++ {0x0000a534, 0x38025a44, 0x38025a44, 0x2e000e22, 0x2e000e22},
++ {0x0000a538, 0x3b025e45, 0x3b025e45, 0x31000e24, 0x31000e24},
++ {0x0000a53c, 0x41025e4a, 0x41025e4a, 0x34001640, 0x34001640},
++ {0x0000a540, 0x48025e6c, 0x48025e6c, 0x38001660, 0x38001660},
++ {0x0000a544, 0x4e025e8e, 0x4e025e8e, 0x3b001861, 0x3b001861},
++ {0x0000a548, 0x53025eb2, 0x53025eb2, 0x3e001a81, 0x3e001a81},
++ {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83},
++ {0x0000a550, 0x5f025ef6, 0x5f025ef6, 0x44001c84, 0x44001c84},
++ {0x0000a554, 0x62025f56, 0x62025f56, 0x48001ce3, 0x48001ce3},
++ {0x0000a558, 0x66027f56, 0x66027f56, 0x4c001ce5, 0x4c001ce5},
++ {0x0000a55c, 0x6a029f56, 0x6a029f56, 0x50001ce9, 0x50001ce9},
++ {0x0000a560, 0x70049f56, 0x70049f56, 0x54001ceb, 0x54001ceb},
++ {0x0000a564, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a568, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a56c, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a570, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a574, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a578, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a57c, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
++ {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000},
++ {0x0000a584, 0x06802223, 0x06802223, 0x04800002, 0x04800002},
++ {0x0000a588, 0x0a822220, 0x0a822220, 0x08800004, 0x08800004},
++ {0x0000a58c, 0x0f822223, 0x0f822223, 0x0b800200, 0x0b800200},
++ {0x0000a590, 0x14822620, 0x14822620, 0x0f800202, 0x0f800202},
++ {0x0000a594, 0x18822622, 0x18822622, 0x11800400, 0x11800400},
++ {0x0000a598, 0x1b822822, 0x1b822822, 0x15800402, 0x15800402},
++ {0x0000a59c, 0x20822842, 0x20822842, 0x19800404, 0x19800404},
++ {0x0000a5a0, 0x22822c41, 0x22822c41, 0x1b800603, 0x1b800603},
++ {0x0000a5a4, 0x28823042, 0x28823042, 0x1f800a02, 0x1f800a02},
++ {0x0000a5a8, 0x2c823044, 0x2c823044, 0x23800a04, 0x23800a04},
++ {0x0000a5ac, 0x2f823644, 0x2f823644, 0x26800a20, 0x26800a20},
++ {0x0000a5b0, 0x34825643, 0x34825643, 0x2a800e20, 0x2a800e20},
++ {0x0000a5b4, 0x38825a44, 0x38825a44, 0x2e800e22, 0x2e800e22},
++ {0x0000a5b8, 0x3b825e45, 0x3b825e45, 0x31800e24, 0x31800e24},
++ {0x0000a5bc, 0x41825e4a, 0x41825e4a, 0x34801640, 0x34801640},
++ {0x0000a5c0, 0x48825e6c, 0x48825e6c, 0x38801660, 0x38801660},
++ {0x0000a5c4, 0x4e825e8e, 0x4e825e8e, 0x3b801861, 0x3b801861},
++ {0x0000a5c8, 0x53825eb2, 0x53825eb2, 0x3e801a81, 0x3e801a81},
++ {0x0000a5cc, 0x59825eb5, 0x59825eb5, 0x42801a83, 0x42801a83},
++ {0x0000a5d0, 0x5f825ef6, 0x5f825ef6, 0x44801c84, 0x44801c84},
++ {0x0000a5d4, 0x62825f56, 0x62825f56, 0x48801ce3, 0x48801ce3},
++ {0x0000a5d8, 0x66827f56, 0x66827f56, 0x4c801ce5, 0x4c801ce5},
++ {0x0000a5dc, 0x6a829f56, 0x6a829f56, 0x50801ce9, 0x50801ce9},
++ {0x0000a5e0, 0x70849f56, 0x70849f56, 0x54801ceb, 0x54801ceb},
++ {0x0000a5e4, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5e8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5ec, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5f0, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5f4, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5f8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x0000a5fc, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
++ {0x00016044, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4},
++ {0x00016048, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001},
++ {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
++ {0x00016444, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4},
++ {0x00016448, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001},
++ {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
++ {0x00016844, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4},
++ {0x00016848, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001},
++ {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
++};
++
++static const u32 ar9300Common_rx_gain_table_2p2[][2] = {
++ /* Addr allmodes */
++ {0x0000a000, 0x00010000},
++ {0x0000a004, 0x00030002},
++ {0x0000a008, 0x00050004},
++ {0x0000a00c, 0x00810080},
++ {0x0000a010, 0x00830082},
++ {0x0000a014, 0x01810180},
++ {0x0000a018, 0x01830182},
++ {0x0000a01c, 0x01850184},
++ {0x0000a020, 0x01890188},
++ {0x0000a024, 0x018b018a},
++ {0x0000a028, 0x018d018c},
++ {0x0000a02c, 0x01910190},
++ {0x0000a030, 0x01930192},
++ {0x0000a034, 0x01950194},
++ {0x0000a038, 0x038a0196},
++ {0x0000a03c, 0x038c038b},
++ {0x0000a040, 0x0390038d},
++ {0x0000a044, 0x03920391},
++ {0x0000a048, 0x03940393},
++ {0x0000a04c, 0x03960395},
++ {0x0000a050, 0x00000000},
++ {0x0000a054, 0x00000000},
++ {0x0000a058, 0x00000000},
++ {0x0000a05c, 0x00000000},
++ {0x0000a060, 0x00000000},
++ {0x0000a064, 0x00000000},
++ {0x0000a068, 0x00000000},
++ {0x0000a06c, 0x00000000},
++ {0x0000a070, 0x00000000},
++ {0x0000a074, 0x00000000},
++ {0x0000a078, 0x00000000},
++ {0x0000a07c, 0x00000000},
++ {0x0000a080, 0x22222229},
++ {0x0000a084, 0x1d1d1d1d},
++ {0x0000a088, 0x1d1d1d1d},
++ {0x0000a08c, 0x1d1d1d1d},
++ {0x0000a090, 0x171d1d1d},
++ {0x0000a094, 0x11111717},
++ {0x0000a098, 0x00030311},
++ {0x0000a09c, 0x00000000},
++ {0x0000a0a0, 0x00000000},
++ {0x0000a0a4, 0x00000000},
++ {0x0000a0a8, 0x00000000},
++ {0x0000a0ac, 0x00000000},
++ {0x0000a0b0, 0x00000000},
++ {0x0000a0b4, 0x00000000},
++ {0x0000a0b8, 0x00000000},
++ {0x0000a0bc, 0x00000000},
++ {0x0000a0c0, 0x001f0000},
++ {0x0000a0c4, 0x01000101},
++ {0x0000a0c8, 0x011e011f},
++ {0x0000a0cc, 0x011c011d},
++ {0x0000a0d0, 0x02030204},
++ {0x0000a0d4, 0x02010202},
++ {0x0000a0d8, 0x021f0200},
++ {0x0000a0dc, 0x0302021e},
++ {0x0000a0e0, 0x03000301},
++ {0x0000a0e4, 0x031e031f},
++ {0x0000a0e8, 0x0402031d},
++ {0x0000a0ec, 0x04000401},
++ {0x0000a0f0, 0x041e041f},
++ {0x0000a0f4, 0x0502041d},
++ {0x0000a0f8, 0x05000501},
++ {0x0000a0fc, 0x051e051f},
++ {0x0000a100, 0x06010602},
++ {0x0000a104, 0x061f0600},
++ {0x0000a108, 0x061d061e},
++ {0x0000a10c, 0x07020703},
++ {0x0000a110, 0x07000701},
++ {0x0000a114, 0x00000000},
++ {0x0000a118, 0x00000000},
++ {0x0000a11c, 0x00000000},
++ {0x0000a120, 0x00000000},
++ {0x0000a124, 0x00000000},
++ {0x0000a128, 0x00000000},
++ {0x0000a12c, 0x00000000},
++ {0x0000a130, 0x00000000},
++ {0x0000a134, 0x00000000},
++ {0x0000a138, 0x00000000},
++ {0x0000a13c, 0x00000000},
++ {0x0000a140, 0x001f0000},
++ {0x0000a144, 0x01000101},
++ {0x0000a148, 0x011e011f},
++ {0x0000a14c, 0x011c011d},
++ {0x0000a150, 0x02030204},
++ {0x0000a154, 0x02010202},
++ {0x0000a158, 0x021f0200},
++ {0x0000a15c, 0x0302021e},
++ {0x0000a160, 0x03000301},
++ {0x0000a164, 0x031e031f},
++ {0x0000a168, 0x0402031d},
++ {0x0000a16c, 0x04000401},
++ {0x0000a170, 0x041e041f},
++ {0x0000a174, 0x0502041d},
++ {0x0000a178, 0x05000501},
++ {0x0000a17c, 0x051e051f},
++ {0x0000a180, 0x06010602},
++ {0x0000a184, 0x061f0600},
++ {0x0000a188, 0x061d061e},
++ {0x0000a18c, 0x07020703},
++ {0x0000a190, 0x07000701},
++ {0x0000a194, 0x00000000},
++ {0x0000a198, 0x00000000},
++ {0x0000a19c, 0x00000000},
++ {0x0000a1a0, 0x00000000},
++ {0x0000a1a4, 0x00000000},
++ {0x0000a1a8, 0x00000000},
++ {0x0000a1ac, 0x00000000},
++ {0x0000a1b0, 0x00000000},
++ {0x0000a1b4, 0x00000000},
++ {0x0000a1b8, 0x00000000},
++ {0x0000a1bc, 0x00000000},
++ {0x0000a1c0, 0x00000000},
++ {0x0000a1c4, 0x00000000},
++ {0x0000a1c8, 0x00000000},
++ {0x0000a1cc, 0x00000000},
++ {0x0000a1d0, 0x00000000},
++ {0x0000a1d4, 0x00000000},
++ {0x0000a1d8, 0x00000000},
++ {0x0000a1dc, 0x00000000},
++ {0x0000a1e0, 0x00000000},
++ {0x0000a1e4, 0x00000000},
++ {0x0000a1e8, 0x00000000},
++ {0x0000a1ec, 0x00000000},
++ {0x0000a1f0, 0x00000396},
++ {0x0000a1f4, 0x00000396},
++ {0x0000a1f8, 0x00000396},
++ {0x0000a1fc, 0x00000196},
++ {0x0000b000, 0x00010000},
++ {0x0000b004, 0x00030002},
++ {0x0000b008, 0x00050004},
++ {0x0000b00c, 0x00810080},
++ {0x0000b010, 0x00830082},
++ {0x0000b014, 0x01810180},
++ {0x0000b018, 0x01830182},
++ {0x0000b01c, 0x01850184},
++ {0x0000b020, 0x02810280},
++ {0x0000b024, 0x02830282},
++ {0x0000b028, 0x02850284},
++ {0x0000b02c, 0x02890288},
++ {0x0000b030, 0x028b028a},
++ {0x0000b034, 0x0388028c},
++ {0x0000b038, 0x038a0389},
++ {0x0000b03c, 0x038c038b},
++ {0x0000b040, 0x0390038d},
++ {0x0000b044, 0x03920391},
++ {0x0000b048, 0x03940393},
++ {0x0000b04c, 0x03960395},
++ {0x0000b050, 0x00000000},
++ {0x0000b054, 0x00000000},
++ {0x0000b058, 0x00000000},
++ {0x0000b05c, 0x00000000},
++ {0x0000b060, 0x00000000},
++ {0x0000b064, 0x00000000},
++ {0x0000b068, 0x00000000},
++ {0x0000b06c, 0x00000000},
++ {0x0000b070, 0x00000000},
++ {0x0000b074, 0x00000000},
++ {0x0000b078, 0x00000000},
++ {0x0000b07c, 0x00000000},
++ {0x0000b080, 0x32323232},
++ {0x0000b084, 0x2f2f3232},
++ {0x0000b088, 0x23282a2d},
++ {0x0000b08c, 0x1c1e2123},
++ {0x0000b090, 0x14171919},
++ {0x0000b094, 0x0e0e1214},
++ {0x0000b098, 0x03050707},
++ {0x0000b09c, 0x00030303},
++ {0x0000b0a0, 0x00000000},
++ {0x0000b0a4, 0x00000000},
++ {0x0000b0a8, 0x00000000},
++ {0x0000b0ac, 0x00000000},
++ {0x0000b0b0, 0x00000000},
++ {0x0000b0b4, 0x00000000},
++ {0x0000b0b8, 0x00000000},
++ {0x0000b0bc, 0x00000000},
++ {0x0000b0c0, 0x003f0020},
++ {0x0000b0c4, 0x00400041},
++ {0x0000b0c8, 0x0140005f},
++ {0x0000b0cc, 0x0160015f},
++ {0x0000b0d0, 0x017e017f},
++ {0x0000b0d4, 0x02410242},
++ {0x0000b0d8, 0x025f0240},
++ {0x0000b0dc, 0x027f0260},
++ {0x0000b0e0, 0x0341027e},
++ {0x0000b0e4, 0x035f0340},
++ {0x0000b0e8, 0x037f0360},
++ {0x0000b0ec, 0x04400441},
++ {0x0000b0f0, 0x0460045f},
++ {0x0000b0f4, 0x0541047f},
++ {0x0000b0f8, 0x055f0540},
++ {0x0000b0fc, 0x057f0560},
++ {0x0000b100, 0x06400641},
++ {0x0000b104, 0x0660065f},
++ {0x0000b108, 0x067e067f},
++ {0x0000b10c, 0x07410742},
++ {0x0000b110, 0x075f0740},
++ {0x0000b114, 0x077f0760},
++ {0x0000b118, 0x07800781},
++ {0x0000b11c, 0x07a0079f},
++ {0x0000b120, 0x07c107bf},
++ {0x0000b124, 0x000007c0},
++ {0x0000b128, 0x00000000},
++ {0x0000b12c, 0x00000000},
++ {0x0000b130, 0x00000000},
++ {0x0000b134, 0x00000000},
++ {0x0000b138, 0x00000000},
++ {0x0000b13c, 0x00000000},
++ {0x0000b140, 0x003f0020},
++ {0x0000b144, 0x00400041},
++ {0x0000b148, 0x0140005f},
++ {0x0000b14c, 0x0160015f},
++ {0x0000b150, 0x017e017f},
++ {0x0000b154, 0x02410242},
++ {0x0000b158, 0x025f0240},
++ {0x0000b15c, 0x027f0260},
++ {0x0000b160, 0x0341027e},
++ {0x0000b164, 0x035f0340},
++ {0x0000b168, 0x037f0360},
++ {0x0000b16c, 0x04400441},
++ {0x0000b170, 0x0460045f},
++ {0x0000b174, 0x0541047f},
++ {0x0000b178, 0x055f0540},
++ {0x0000b17c, 0x057f0560},
++ {0x0000b180, 0x06400641},
++ {0x0000b184, 0x0660065f},
++ {0x0000b188, 0x067e067f},
++ {0x0000b18c, 0x07410742},
++ {0x0000b190, 0x075f0740},
++ {0x0000b194, 0x077f0760},
++ {0x0000b198, 0x07800781},
++ {0x0000b19c, 0x07a0079f},
++ {0x0000b1a0, 0x07c107bf},
++ {0x0000b1a4, 0x000007c0},
++ {0x0000b1a8, 0x00000000},
++ {0x0000b1ac, 0x00000000},
++ {0x0000b1b0, 0x00000000},
++ {0x0000b1b4, 0x00000000},
++ {0x0000b1b8, 0x00000000},
++ {0x0000b1bc, 0x00000000},
++ {0x0000b1c0, 0x00000000},
++ {0x0000b1c4, 0x00000000},
++ {0x0000b1c8, 0x00000000},
++ {0x0000b1cc, 0x00000000},
++ {0x0000b1d0, 0x00000000},
++ {0x0000b1d4, 0x00000000},
++ {0x0000b1d8, 0x00000000},
++ {0x0000b1dc, 0x00000000},
++ {0x0000b1e0, 0x00000000},
++ {0x0000b1e4, 0x00000000},
++ {0x0000b1e8, 0x00000000},
++ {0x0000b1ec, 0x00000000},
++ {0x0000b1f0, 0x00000396},
++ {0x0000b1f4, 0x00000396},
++ {0x0000b1f8, 0x00000396},
++ {0x0000b1fc, 0x00000196},
++};
++
++static const u32 ar9300Modes_low_ob_db_tx_gain_table_2p2[][5] = {
++ /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
++ {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
++ {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
++ {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002},
++ {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004},
++ {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200},
++ {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202},
++ {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400},
++ {0x0000a518, 0x21002220, 0x21002220, 0x16000402, 0x16000402},
++ {0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404},
++ {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603},
++ {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02},
++ {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04},
++ {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20},
++ {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20},
++ {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22},
++ {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24},
++ {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640},
++ {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660},
++ {0x0000a544, 0x5302266c, 0x5302266c, 0x3f001861, 0x3f001861},
++ {0x0000a548, 0x5702286c, 0x5702286c, 0x43001a81, 0x43001a81},
++ {0x0000a54c, 0x5c02486b, 0x5c02486b, 0x47001a83, 0x47001a83},
++ {0x0000a550, 0x61024a6c, 0x61024a6c, 0x4a001c84, 0x4a001c84},
++ {0x0000a554, 0x66026a6c, 0x66026a6c, 0x4e001ce3, 0x4e001ce3},
++ {0x0000a558, 0x6b026e6c, 0x6b026e6c, 0x52001ce5, 0x52001ce5},
++ {0x0000a55c, 0x7002708c, 0x7002708c, 0x56001ce9, 0x56001ce9},
++ {0x0000a560, 0x7302b08a, 0x7302b08a, 0x5a001ceb, 0x5a001ceb},
++ {0x0000a564, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec},
++ {0x0000a568, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec},
++ {0x0000a56c, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec},
++ {0x0000a570, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec},
++ {0x0000a574, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec},
++ {0x0000a578, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec},
++ {0x0000a57c, 0x7702b08c, 0x7702b08c, 0x5d001eec, 0x5d001eec},
++ {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000},
++ {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002},
++ {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004},
++ {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200},
++ {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202},
++ {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400},
++ {0x0000a598, 0x21802220, 0x21802220, 0x16800402, 0x16800402},
++ {0x0000a59c, 0x27802223, 0x27802223, 0x19800404, 0x19800404},
++ {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603},
++ {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02},
++ {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04},
++ {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20},
++ {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20},
++ {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22},
++ {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24},
++ {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640},
++ {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660},
++ {0x0000a5c4, 0x5382266c, 0x5382266c, 0x3f801861, 0x3f801861},
++ {0x0000a5c8, 0x5782286c, 0x5782286c, 0x43801a81, 0x43801a81},
++ {0x0000a5cc, 0x5c82486b, 0x5c82486b, 0x47801a83, 0x47801a83},
++ {0x0000a5d0, 0x61824a6c, 0x61824a6c, 0x4a801c84, 0x4a801c84},
++ {0x0000a5d4, 0x66826a6c, 0x66826a6c, 0x4e801ce3, 0x4e801ce3},
++ {0x0000a5d8, 0x6b826e6c, 0x6b826e6c, 0x52801ce5, 0x52801ce5},
++ {0x0000a5dc, 0x7082708c, 0x7082708c, 0x56801ce9, 0x56801ce9},
++ {0x0000a5e0, 0x7382b08a, 0x7382b08a, 0x5a801ceb, 0x5a801ceb},
++ {0x0000a5e4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5e8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5ec, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5f0, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5f4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5f8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
++ {0x0000a5fc, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec},
++ {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
++ {0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001},
++ {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
++ {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
++ {0x00016448, 0x66480001, 0x66480001, 0x66480001, 0x66480001},
++ {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
++ {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
++ {0x00016848, 0x66480001, 0x66480001, 0x66480001, 0x66480001},
++ {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
++};
++
++static const u32 ar9300_2p2_mac_core[][2] = {
++ /* Addr allmodes */
++ {0x00000008, 0x00000000},
++ {0x00000030, 0x00020085},
++ {0x00000034, 0x00000005},
++ {0x00000040, 0x00000000},
++ {0x00000044, 0x00000000},
++ {0x00000048, 0x00000008},
++ {0x0000004c, 0x00000010},
++ {0x00000050, 0x00000000},
++ {0x00001040, 0x002ffc0f},
++ {0x00001044, 0x002ffc0f},
++ {0x00001048, 0x002ffc0f},
++ {0x0000104c, 0x002ffc0f},
++ {0x00001050, 0x002ffc0f},
++ {0x00001054, 0x002ffc0f},
++ {0x00001058, 0x002ffc0f},
++ {0x0000105c, 0x002ffc0f},
++ {0x00001060, 0x002ffc0f},
++ {0x00001064, 0x002ffc0f},
++ {0x000010f0, 0x00000100},
++ {0x00001270, 0x00000000},
++ {0x000012b0, 0x00000000},
++ {0x000012f0, 0x00000000},
++ {0x0000143c, 0x00000000},
++ {0x0000147c, 0x00000000},
++ {0x00008000, 0x00000000},
++ {0x00008004, 0x00000000},
++ {0x00008008, 0x00000000},
++ {0x0000800c, 0x00000000},
++ {0x00008018, 0x00000000},
++ {0x00008020, 0x00000000},
++ {0x00008038, 0x00000000},
++ {0x0000803c, 0x00000000},
++ {0x00008040, 0x00000000},
++ {0x00008044, 0x00000000},
++ {0x00008048, 0x00000000},
++ {0x0000804c, 0xffffffff},
++ {0x00008054, 0x00000000},
++ {0x00008058, 0x00000000},
++ {0x0000805c, 0x000fc78f},
++ {0x00008060, 0x0000000f},
++ {0x00008064, 0x00000000},
++ {0x00008070, 0x00000310},
++ {0x00008074, 0x00000020},
++ {0x00008078, 0x00000000},
++ {0x0000809c, 0x0000000f},
++ {0x000080a0, 0x00000000},
++ {0x000080a4, 0x02ff0000},
++ {0x000080a8, 0x0e070605},
++ {0x000080ac, 0x0000000d},
++ {0x000080b0, 0x00000000},
++ {0x000080b4, 0x00000000},
++ {0x000080b8, 0x00000000},
++ {0x000080bc, 0x00000000},
++ {0x000080c0, 0x2a800000},
++ {0x000080c4, 0x06900168},
++ {0x000080c8, 0x13881c20},
++ {0x000080cc, 0x01f40000},
++ {0x000080d0, 0x00252500},
++ {0x000080d4, 0x00a00000},
++ {0x000080d8, 0x00400000},
++ {0x000080dc, 0x00000000},
++ {0x000080e0, 0xffffffff},
++ {0x000080e4, 0x0000ffff},
++ {0x000080e8, 0x3f3f3f3f},
++ {0x000080ec, 0x00000000},
++ {0x000080f0, 0x00000000},
++ {0x000080f4, 0x00000000},
++ {0x000080fc, 0x00020000},
++ {0x00008100, 0x00000000},
++ {0x00008108, 0x00000052},
++ {0x0000810c, 0x00000000},
++ {0x00008110, 0x00000000},
++ {0x00008114, 0x000007ff},
++ {0x00008118, 0x000000aa},
++ {0x0000811c, 0x00003210},
++ {0x00008124, 0x00000000},
++ {0x00008128, 0x00000000},
++ {0x0000812c, 0x00000000},
++ {0x00008130, 0x00000000},
++ {0x00008134, 0x00000000},
++ {0x00008138, 0x00000000},
++ {0x0000813c, 0x0000ffff},
++ {0x00008144, 0xffffffff},
++ {0x00008168, 0x00000000},
++ {0x0000816c, 0x00000000},
++ {0x00008170, 0x18486200},
++ {0x00008174, 0x33332210},
++ {0x00008178, 0x00000000},
++ {0x0000817c, 0x00020000},
++ {0x000081c0, 0x00000000},
++ {0x000081c4, 0x33332210},
++ {0x000081c8, 0x00000000},
++ {0x000081cc, 0x00000000},
++ {0x000081d4, 0x00000000},
++ {0x000081ec, 0x00000000},
++ {0x000081f0, 0x00000000},
++ {0x000081f4, 0x00000000},
++ {0x000081f8, 0x00000000},
++ {0x000081fc, 0x00000000},
++ {0x00008240, 0x00100000},
++ {0x00008244, 0x0010f424},
++ {0x00008248, 0x00000800},
++ {0x0000824c, 0x0001e848},
++ {0x00008250, 0x00000000},
++ {0x00008254, 0x00000000},
++ {0x00008258, 0x00000000},
++ {0x0000825c, 0x40000000},
++ {0x00008260, 0x00080922},
++ {0x00008264, 0x9bc00010},
++ {0x00008268, 0xffffffff},
++ {0x0000826c, 0x0000ffff},
++ {0x00008270, 0x00000000},
++ {0x00008274, 0x40000000},
++ {0x00008278, 0x003e4180},
++ {0x0000827c, 0x00000004},
++ {0x00008284, 0x0000002c},
++ {0x00008288, 0x0000002c},
++ {0x0000828c, 0x000000ff},
++ {0x00008294, 0x00000000},
++ {0x00008298, 0x00000000},
++ {0x0000829c, 0x00000000},
++ {0x00008300, 0x00000140},
++ {0x00008314, 0x00000000},
++ {0x0000831c, 0x0000010d},
++ {0x00008328, 0x00000000},
++ {0x0000832c, 0x00000007},
++ {0x00008330, 0x00000302},
++ {0x00008334, 0x00000700},
++ {0x00008338, 0x00ff0000},
++ {0x0000833c, 0x02400000},
++ {0x00008340, 0x000107ff},
++ {0x00008344, 0xaa48105b},
++ {0x00008348, 0x008f0000},
++ {0x0000835c, 0x00000000},
++ {0x00008360, 0xffffffff},
++ {0x00008364, 0xffffffff},
++ {0x00008368, 0x00000000},
++ {0x00008370, 0x00000000},
++ {0x00008374, 0x000000ff},
++ {0x00008378, 0x00000000},
++ {0x0000837c, 0x00000000},
++ {0x00008380, 0xffffffff},
++ {0x00008384, 0xffffffff},
++ {0x00008390, 0xffffffff},
++ {0x00008394, 0xffffffff},
++ {0x00008398, 0x00000000},
++ {0x0000839c, 0x00000000},
++ {0x000083a0, 0x00000000},
++ {0x000083a4, 0x0000fa14},
++ {0x000083a8, 0x000f0c00},
++ {0x000083ac, 0x33332210},
++ {0x000083b0, 0x33332210},
++ {0x000083b4, 0x33332210},
++ {0x000083b8, 0x33332210},
++ {0x000083bc, 0x00000000},
++ {0x000083c0, 0x00000000},
++ {0x000083c4, 0x00000000},
++ {0x000083c8, 0x00000000},
++ {0x000083cc, 0x00000200},
++ {0x000083d0, 0x000301ff},
++};
++
++static const u32 ar9300Common_wo_xlna_rx_gain_table_2p2[][2] = {
++ /* Addr allmodes */
++ {0x0000a000, 0x00010000},
++ {0x0000a004, 0x00030002},
++ {0x0000a008, 0x00050004},
++ {0x0000a00c, 0x00810080},
++ {0x0000a010, 0x00830082},
++ {0x0000a014, 0x01810180},
++ {0x0000a018, 0x01830182},
++ {0x0000a01c, 0x01850184},
++ {0x0000a020, 0x01890188},
++ {0x0000a024, 0x018b018a},
++ {0x0000a028, 0x018d018c},
++ {0x0000a02c, 0x03820190},
++ {0x0000a030, 0x03840383},
++ {0x0000a034, 0x03880385},
++ {0x0000a038, 0x038a0389},
++ {0x0000a03c, 0x038c038b},
++ {0x0000a040, 0x0390038d},
++ {0x0000a044, 0x03920391},
++ {0x0000a048, 0x03940393},
++ {0x0000a04c, 0x03960395},
++ {0x0000a050, 0x00000000},
++ {0x0000a054, 0x00000000},
++ {0x0000a058, 0x00000000},
++ {0x0000a05c, 0x00000000},
++ {0x0000a060, 0x00000000},
++ {0x0000a064, 0x00000000},
++ {0x0000a068, 0x00000000},
++ {0x0000a06c, 0x00000000},
++ {0x0000a070, 0x00000000},
++ {0x0000a074, 0x00000000},
++ {0x0000a078, 0x00000000},
++ {0x0000a07c, 0x00000000},
++ {0x0000a080, 0x29292929},
++ {0x0000a084, 0x29292929},
++ {0x0000a088, 0x29292929},
++ {0x0000a08c, 0x29292929},
++ {0x0000a090, 0x22292929},
++ {0x0000a094, 0x1d1d2222},
++ {0x0000a098, 0x0c111117},
++ {0x0000a09c, 0x00030303},
++ {0x0000a0a0, 0x00000000},
++ {0x0000a0a4, 0x00000000},
++ {0x0000a0a8, 0x00000000},
++ {0x0000a0ac, 0x00000000},
++ {0x0000a0b0, 0x00000000},
++ {0x0000a0b4, 0x00000000},
++ {0x0000a0b8, 0x00000000},
++ {0x0000a0bc, 0x00000000},
++ {0x0000a0c0, 0x001f0000},
++ {0x0000a0c4, 0x01000101},
++ {0x0000a0c8, 0x011e011f},
++ {0x0000a0cc, 0x011c011d},
++ {0x0000a0d0, 0x02030204},
++ {0x0000a0d4, 0x02010202},
++ {0x0000a0d8, 0x021f0200},
++ {0x0000a0dc, 0x0302021e},
++ {0x0000a0e0, 0x03000301},
++ {0x0000a0e4, 0x031e031f},
++ {0x0000a0e8, 0x0402031d},
++ {0x0000a0ec, 0x04000401},
++ {0x0000a0f0, 0x041e041f},
++ {0x0000a0f4, 0x0502041d},
++ {0x0000a0f8, 0x05000501},
++ {0x0000a0fc, 0x051e051f},
++ {0x0000a100, 0x06010602},
++ {0x0000a104, 0x061f0600},
++ {0x0000a108, 0x061d061e},
++ {0x0000a10c, 0x07020703},
++ {0x0000a110, 0x07000701},
++ {0x0000a114, 0x00000000},
++ {0x0000a118, 0x00000000},
++ {0x0000a11c, 0x00000000},
++ {0x0000a120, 0x00000000},
++ {0x0000a124, 0x00000000},
++ {0x0000a128, 0x00000000},
++ {0x0000a12c, 0x00000000},
++ {0x0000a130, 0x00000000},
++ {0x0000a134, 0x00000000},
++ {0x0000a138, 0x00000000},
++ {0x0000a13c, 0x00000000},
++ {0x0000a140, 0x001f0000},
++ {0x0000a144, 0x01000101},
++ {0x0000a148, 0x011e011f},
++ {0x0000a14c, 0x011c011d},
++ {0x0000a150, 0x02030204},
++ {0x0000a154, 0x02010202},
++ {0x0000a158, 0x021f0200},
++ {0x0000a15c, 0x0302021e},
++ {0x0000a160, 0x03000301},
++ {0x0000a164, 0x031e031f},
++ {0x0000a168, 0x0402031d},
++ {0x0000a16c, 0x04000401},
++ {0x0000a170, 0x041e041f},
++ {0x0000a174, 0x0502041d},
++ {0x0000a178, 0x05000501},
++ {0x0000a17c, 0x051e051f},
++ {0x0000a180, 0x06010602},
++ {0x0000a184, 0x061f0600},
++ {0x0000a188, 0x061d061e},
++ {0x0000a18c, 0x07020703},
++ {0x0000a190, 0x07000701},
++ {0x0000a194, 0x00000000},
++ {0x0000a198, 0x00000000},
++ {0x0000a19c, 0x00000000},
++ {0x0000a1a0, 0x00000000},
++ {0x0000a1a4, 0x00000000},
++ {0x0000a1a8, 0x00000000},
++ {0x0000a1ac, 0x00000000},
++ {0x0000a1b0, 0x00000000},
++ {0x0000a1b4, 0x00000000},
++ {0x0000a1b8, 0x00000000},
++ {0x0000a1bc, 0x00000000},
++ {0x0000a1c0, 0x00000000},
++ {0x0000a1c4, 0x00000000},
++ {0x0000a1c8, 0x00000000},
++ {0x0000a1cc, 0x00000000},
++ {0x0000a1d0, 0x00000000},
++ {0x0000a1d4, 0x00000000},
++ {0x0000a1d8, 0x00000000},
++ {0x0000a1dc, 0x00000000},
++ {0x0000a1e0, 0x00000000},
++ {0x0000a1e4, 0x00000000},
++ {0x0000a1e8, 0x00000000},
++ {0x0000a1ec, 0x00000000},
++ {0x0000a1f0, 0x00000396},
++ {0x0000a1f4, 0x00000396},
++ {0x0000a1f8, 0x00000396},
++ {0x0000a1fc, 0x00000196},
++ {0x0000b000, 0x00010000},
++ {0x0000b004, 0x00030002},
++ {0x0000b008, 0x00050004},
++ {0x0000b00c, 0x00810080},
++ {0x0000b010, 0x00830082},
++ {0x0000b014, 0x01810180},
++ {0x0000b018, 0x01830182},
++ {0x0000b01c, 0x01850184},
++ {0x0000b020, 0x02810280},
++ {0x0000b024, 0x02830282},
++ {0x0000b028, 0x02850284},
++ {0x0000b02c, 0x02890288},
++ {0x0000b030, 0x028b028a},
++ {0x0000b034, 0x0388028c},
++ {0x0000b038, 0x038a0389},
++ {0x0000b03c, 0x038c038b},
++ {0x0000b040, 0x0390038d},
++ {0x0000b044, 0x03920391},
++ {0x0000b048, 0x03940393},
++ {0x0000b04c, 0x03960395},
++ {0x0000b050, 0x00000000},
++ {0x0000b054, 0x00000000},
++ {0x0000b058, 0x00000000},
++ {0x0000b05c, 0x00000000},
++ {0x0000b060, 0x00000000},
++ {0x0000b064, 0x00000000},
++ {0x0000b068, 0x00000000},
++ {0x0000b06c, 0x00000000},
++ {0x0000b070, 0x00000000},
++ {0x0000b074, 0x00000000},
++ {0x0000b078, 0x00000000},
++ {0x0000b07c, 0x00000000},
++ {0x0000b080, 0x32323232},
++ {0x0000b084, 0x2f2f3232},
++ {0x0000b088, 0x23282a2d},
++ {0x0000b08c, 0x1c1e2123},
++ {0x0000b090, 0x14171919},
++ {0x0000b094, 0x0e0e1214},
++ {0x0000b098, 0x03050707},
++ {0x0000b09c, 0x00030303},
++ {0x0000b0a0, 0x00000000},
++ {0x0000b0a4, 0x00000000},
++ {0x0000b0a8, 0x00000000},
++ {0x0000b0ac, 0x00000000},
++ {0x0000b0b0, 0x00000000},
++ {0x0000b0b4, 0x00000000},
++ {0x0000b0b8, 0x00000000},
++ {0x0000b0bc, 0x00000000},
++ {0x0000b0c0, 0x003f0020},
++ {0x0000b0c4, 0x00400041},
++ {0x0000b0c8, 0x0140005f},
++ {0x0000b0cc, 0x0160015f},
++ {0x0000b0d0, 0x017e017f},
++ {0x0000b0d4, 0x02410242},
++ {0x0000b0d8, 0x025f0240},
++ {0x0000b0dc, 0x027f0260},
++ {0x0000b0e0, 0x0341027e},
++ {0x0000b0e4, 0x035f0340},
++ {0x0000b0e8, 0x037f0360},
++ {0x0000b0ec, 0x04400441},
++ {0x0000b0f0, 0x0460045f},
++ {0x0000b0f4, 0x0541047f},
++ {0x0000b0f8, 0x055f0540},
++ {0x0000b0fc, 0x057f0560},
++ {0x0000b100, 0x06400641},
++ {0x0000b104, 0x0660065f},
++ {0x0000b108, 0x067e067f},
++ {0x0000b10c, 0x07410742},
++ {0x0000b110, 0x075f0740},
++ {0x0000b114, 0x077f0760},
++ {0x0000b118, 0x07800781},
++ {0x0000b11c, 0x07a0079f},
++ {0x0000b120, 0x07c107bf},
++ {0x0000b124, 0x000007c0},
++ {0x0000b128, 0x00000000},
++ {0x0000b12c, 0x00000000},
++ {0x0000b130, 0x00000000},
++ {0x0000b134, 0x00000000},
++ {0x0000b138, 0x00000000},
++ {0x0000b13c, 0x00000000},
++ {0x0000b140, 0x003f0020},
++ {0x0000b144, 0x00400041},
++ {0x0000b148, 0x0140005f},
++ {0x0000b14c, 0x0160015f},
++ {0x0000b150, 0x017e017f},
++ {0x0000b154, 0x02410242},
++ {0x0000b158, 0x025f0240},
++ {0x0000b15c, 0x027f0260},
++ {0x0000b160, 0x0341027e},
++ {0x0000b164, 0x035f0340},
++ {0x0000b168, 0x037f0360},
++ {0x0000b16c, 0x04400441},
++ {0x0000b170, 0x0460045f},
++ {0x0000b174, 0x0541047f},
++ {0x0000b178, 0x055f0540},
++ {0x0000b17c, 0x057f0560},
++ {0x0000b180, 0x06400641},
++ {0x0000b184, 0x0660065f},
++ {0x0000b188, 0x067e067f},
++ {0x0000b18c, 0x07410742},
++ {0x0000b190, 0x075f0740},
++ {0x0000b194, 0x077f0760},
++ {0x0000b198, 0x07800781},
++ {0x0000b19c, 0x07a0079f},
++ {0x0000b1a0, 0x07c107bf},
++ {0x0000b1a4, 0x000007c0},
++ {0x0000b1a8, 0x00000000},
++ {0x0000b1ac, 0x00000000},
++ {0x0000b1b0, 0x00000000},
++ {0x0000b1b4, 0x00000000},
++ {0x0000b1b8, 0x00000000},
++ {0x0000b1bc, 0x00000000},
++ {0x0000b1c0, 0x00000000},
++ {0x0000b1c4, 0x00000000},
++ {0x0000b1c8, 0x00000000},
++ {0x0000b1cc, 0x00000000},
++ {0x0000b1d0, 0x00000000},
++ {0x0000b1d4, 0x00000000},
++ {0x0000b1d8, 0x00000000},
++ {0x0000b1dc, 0x00000000},
++ {0x0000b1e0, 0x00000000},
++ {0x0000b1e4, 0x00000000},
++ {0x0000b1e8, 0x00000000},
++ {0x0000b1ec, 0x00000000},
++ {0x0000b1f0, 0x00000396},
++ {0x0000b1f4, 0x00000396},
++ {0x0000b1f8, 0x00000396},
++ {0x0000b1fc, 0x00000196},
++};
++
++static const u32 ar9300_2p2_soc_preamble[][2] = {
++ /* Addr allmodes */
++ {0x000040a4, 0x00a0c1c9},
++ {0x00007008, 0x00000000},
++ {0x00007020, 0x00000000},
++ {0x00007034, 0x00000002},
++ {0x00007038, 0x000004c2},
++ {0x00007048, 0x00000008},
++};
++
++static const u32 ar9300PciePhy_pll_on_clkreq_disable_L1_2p2[][2] = {
++ /* Addr allmodes */
++ {0x00004040, 0x08212e5e},
++ {0x00004040, 0x0008003b},
++ {0x00004044, 0x00000000},
++};
++
++static const u32 ar9300PciePhy_clkreq_enable_L1_2p2[][2] = {
++ /* Addr allmodes */
++ {0x00004040, 0x08253e5e},
++ {0x00004040, 0x0008003b},
++ {0x00004044, 0x00000000},
++};
++
++static const u32 ar9300PciePhy_clkreq_disable_L1_2p2[][2] = {
++ /* Addr allmodes */
++ {0x00004040, 0x08213e5e},
++ {0x00004040, 0x0008003b},
++ {0x00004044, 0x00000000},
++};
++
++#endif /* INITVALS_9003_2P2_H */
+--- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
++++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
+@@ -16,7 +16,8 @@
+
+ #include "hw.h"
+ #include "ar9003_mac.h"
+-#include "ar9003_initvals.h"
++#include "ar9003_2p0_initvals.h"
++#include "ar9003_2p2_initvals.h"
+
+ /* General hardware code for the AR9003 hadware family */
+
+@@ -31,12 +32,8 @@ static bool ar9003_hw_macversion_support
+ return false;
+ }
+
+-/* AR9003 2.0 - new INI format (pre, core, post arrays per subsystem) */
+-/*
+- * XXX: move TX/RX gain INI to its own init_mode_gain_regs after
+- * ensuring it does not affect hardware bring up
+- */
+-static void ar9003_hw_init_mode_regs(struct ath_hw *ah)
++/* AR9003 2.0 */
++static void ar9003_2p0_hw_init_mode_regs(struct ath_hw *ah)
+ {
+ /* mac */
+ INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
+@@ -106,27 +103,128 @@ static void ar9003_hw_init_mode_regs(str
+ 3);
+ }
+
++/* AR9003 2.2 */
++static void ar9003_2p2_hw_init_mode_regs(struct ath_hw *ah)
++{
++ /* mac */
++ INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
++ INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE],
++ ar9300_2p2_mac_core,
++ ARRAY_SIZE(ar9300_2p2_mac_core), 2);
++ INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
++ ar9300_2p2_mac_postamble,
++ ARRAY_SIZE(ar9300_2p2_mac_postamble), 5);
++
++ /* bb */
++ INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0);
++ INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
++ ar9300_2p2_baseband_core,
++ ARRAY_SIZE(ar9300_2p2_baseband_core), 2);
++ INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
++ ar9300_2p2_baseband_postamble,
++ ARRAY_SIZE(ar9300_2p2_baseband_postamble), 5);
++
++ /* radio */
++ INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
++ INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
++ ar9300_2p2_radio_core,
++ ARRAY_SIZE(ar9300_2p2_radio_core), 2);
++ INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
++ ar9300_2p2_radio_postamble,
++ ARRAY_SIZE(ar9300_2p2_radio_postamble), 5);
++
++ /* soc */
++ INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
++ ar9300_2p2_soc_preamble,
++ ARRAY_SIZE(ar9300_2p2_soc_preamble), 2);
++ INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
++ INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
++ ar9300_2p2_soc_postamble,
++ ARRAY_SIZE(ar9300_2p2_soc_postamble), 5);
++
++ /* rx/tx gain */
++ INIT_INI_ARRAY(&ah->iniModesRxGain,
++ ar9300Common_rx_gain_table_2p2,
++ ARRAY_SIZE(ar9300Common_rx_gain_table_2p2), 2);
++ INIT_INI_ARRAY(&ah->iniModesTxGain,
++ ar9300Modes_lowest_ob_db_tx_gain_table_2p2,
++ ARRAY_SIZE(ar9300Modes_lowest_ob_db_tx_gain_table_2p2),
++ 5);
++
++ /* Load PCIE SERDES settings from INI */
++
++ /* Awake Setting */
++
++ INIT_INI_ARRAY(&ah->iniPcieSerdes,
++ ar9300PciePhy_pll_on_clkreq_disable_L1_2p2,
++ ARRAY_SIZE(ar9300PciePhy_pll_on_clkreq_disable_L1_2p2),
++ 2);
++
++ /* Sleep Setting */
++
++ INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
++ ar9300PciePhy_clkreq_enable_L1_2p2,
++ ARRAY_SIZE(ar9300PciePhy_clkreq_enable_L1_2p2),
++ 2);
++
++ /* Fast clock modal settings */
++ INIT_INI_ARRAY(&ah->iniModesAdditional,
++ ar9300Modes_fast_clock_2p2,
++ ARRAY_SIZE(ar9300Modes_fast_clock_2p2),
++ 3);
++}
++
++/*
++ * The AR9003 family uses a new INI format (pre, core, post
++ * arrays per subsystem).
++ */
++static void ar9003_hw_init_mode_regs(struct ath_hw *ah)
++{
++ if (AR_SREV_9300_20(ah))
++ ar9003_2p0_hw_init_mode_regs(ah);
++ else
++ ar9003_2p2_hw_init_mode_regs(ah);
++}
++
+ static void ar9003_tx_gain_table_apply(struct ath_hw *ah)
+ {
+ switch (ar9003_hw_get_tx_gain_idx(ah)) {
+ case 0:
+ default:
+- INIT_INI_ARRAY(&ah->iniModesTxGain,
+- ar9300Modes_lowest_ob_db_tx_gain_table_2p0,
+- ARRAY_SIZE(ar9300Modes_lowest_ob_db_tx_gain_table_2p0),
+- 5);
++ if (AR_SREV_9300_20(ah))
++ INIT_INI_ARRAY(&ah->iniModesTxGain,
++ ar9300Modes_lowest_ob_db_tx_gain_table_2p0,
++ ARRAY_SIZE(ar9300Modes_lowest_ob_db_tx_gain_table_2p0),
++ 5);
++ else
++ INIT_INI_ARRAY(&ah->iniModesTxGain,
++ ar9300Modes_lowest_ob_db_tx_gain_table_2p2,
++ ARRAY_SIZE(ar9300Modes_lowest_ob_db_tx_gain_table_2p2),
++ 5);
+ break;
+ case 1:
+- INIT_INI_ARRAY(&ah->iniModesTxGain,
+- ar9300Modes_high_ob_db_tx_gain_table_2p0,
+- ARRAY_SIZE(ar9300Modes_high_ob_db_tx_gain_table_2p0),
+- 5);
++ if (AR_SREV_9300_20(ah))
++ INIT_INI_ARRAY(&ah->iniModesTxGain,
++ ar9300Modes_high_ob_db_tx_gain_table_2p0,
++ ARRAY_SIZE(ar9300Modes_high_ob_db_tx_gain_table_2p0),
++ 5);
++ else
++ INIT_INI_ARRAY(&ah->iniModesTxGain,
++ ar9300Modes_high_ob_db_tx_gain_table_2p2,
++ ARRAY_SIZE(ar9300Modes_high_ob_db_tx_gain_table_2p2),
++ 5);
+ break;
+ case 2:
+- INIT_INI_ARRAY(&ah->iniModesTxGain,
+- ar9300Modes_low_ob_db_tx_gain_table_2p0,
+- ARRAY_SIZE(ar9300Modes_low_ob_db_tx_gain_table_2p0),
+- 5);
++ if (AR_SREV_9300_20(ah))
++ INIT_INI_ARRAY(&ah->iniModesTxGain,
++ ar9300Modes_low_ob_db_tx_gain_table_2p0,
++ ARRAY_SIZE(ar9300Modes_low_ob_db_tx_gain_table_2p0),
++ 5);
++ else
++ INIT_INI_ARRAY(&ah->iniModesTxGain,
++ ar9300Modes_low_ob_db_tx_gain_table_2p2,
++ ARRAY_SIZE(ar9300Modes_low_ob_db_tx_gain_table_2p2),
++ 5);
+ break;
+ }
+ }
+@@ -136,15 +234,28 @@ static void ar9003_rx_gain_table_apply(s
+ switch (ar9003_hw_get_rx_gain_idx(ah)) {
+ case 0:
+ default:
+- INIT_INI_ARRAY(&ah->iniModesRxGain, ar9300Common_rx_gain_table_2p0,
+- ARRAY_SIZE(ar9300Common_rx_gain_table_2p0),
+- 2);
++ if (AR_SREV_9300_20(ah))
++ INIT_INI_ARRAY(&ah->iniModesRxGain,
++ ar9300Common_rx_gain_table_2p0,
++ ARRAY_SIZE(ar9300Common_rx_gain_table_2p0),
++ 2);
++ else
++ INIT_INI_ARRAY(&ah->iniModesRxGain,
++ ar9300Common_rx_gain_table_2p2,
++ ARRAY_SIZE(ar9300Common_rx_gain_table_2p2),
++ 2);
+ break;
+ case 1:
+- INIT_INI_ARRAY(&ah->iniModesRxGain,
+- ar9300Common_wo_xlna_rx_gain_table_2p0,
+- ARRAY_SIZE(ar9300Common_wo_xlna_rx_gain_table_2p0),
+- 2);
++ if (AR_SREV_9300_20(ah))
++ INIT_INI_ARRAY(&ah->iniModesRxGain,
++ ar9300Common_wo_xlna_rx_gain_table_2p0,
++ ARRAY_SIZE(ar9300Common_wo_xlna_rx_gain_table_2p0),
++ 2);
++ else
++ INIT_INI_ARRAY(&ah->iniModesRxGain,
++ ar9300Common_wo_xlna_rx_gain_table_2p2,
++ ARRAY_SIZE(ar9300Common_wo_xlna_rx_gain_table_2p2),
++ 2);
+ break;
+ }
+ }
+--- a/drivers/net/wireless/ath/ath9k/ar9003_initvals.h
++++ /dev/null
+@@ -1,1784 +0,0 @@
+-/*
+- * Copyright (c) 2010 Atheros Communications Inc.
+- *
+- * Permission to use, copy, modify, and/or distribute this software for any
+- * purpose with or without fee is hereby granted, provided that the above
+- * copyright notice and this permission notice appear in all copies.
+- *
+- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+- */
+-
+-#ifndef INITVALS_9003_H
+-#define INITVALS_9003_H
+-
+-/* AR9003 2.0 */
+-
+-static const u32 ar9300_2p0_radio_postamble[][5] = {
+- /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
+- {0x0001609c, 0x0dd08f29, 0x0dd08f29, 0x0b283f31, 0x0b283f31},
+- {0x000160ac, 0xa4653c00, 0xa4653c00, 0x24652800, 0x24652800},
+- {0x000160b0, 0x03284f3e, 0x03284f3e, 0x05d08f20, 0x05d08f20},
+- {0x0001610c, 0x08000000, 0x00000000, 0x00000000, 0x00000000},
+- {0x00016140, 0x10804008, 0x10804008, 0x50804008, 0x50804008},
+- {0x0001650c, 0x08000000, 0x00000000, 0x00000000, 0x00000000},
+- {0x00016540, 0x10804008, 0x10804008, 0x50804008, 0x50804008},
+- {0x0001690c, 0x08000000, 0x00000000, 0x00000000, 0x00000000},
+- {0x00016940, 0x10804008, 0x10804008, 0x50804008, 0x50804008},
+-};
+-
+-static const u32 ar9300Modes_lowest_ob_db_tx_gain_table_2p0[][5] = {
+- /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
+- {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
+- {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
+- {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002},
+- {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004},
+- {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200},
+- {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202},
+- {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400},
+- {0x0000a518, 0x21020220, 0x21020220, 0x16000402, 0x16000402},
+- {0x0000a51c, 0x27020223, 0x27020223, 0x19000404, 0x19000404},
+- {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603},
+- {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02},
+- {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04},
+- {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20},
+- {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20},
+- {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22},
+- {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24},
+- {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640},
+- {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660},
+- {0x0000a544, 0x5302266c, 0x5302266c, 0x3f001861, 0x3f001861},
+- {0x0000a548, 0x5702286c, 0x5702286c, 0x43001a81, 0x43001a81},
+- {0x0000a54c, 0x5c04286b, 0x5c04286b, 0x47001a83, 0x47001a83},
+- {0x0000a550, 0x61042a6c, 0x61042a6c, 0x4a001c84, 0x4a001c84},
+- {0x0000a554, 0x66062a6c, 0x66062a6c, 0x4e001ce3, 0x4e001ce3},
+- {0x0000a558, 0x6b062e6c, 0x6b062e6c, 0x52001ce5, 0x52001ce5},
+- {0x0000a55c, 0x7006308c, 0x7006308c, 0x56001ce9, 0x56001ce9},
+- {0x0000a560, 0x730a308a, 0x730a308a, 0x5a001ceb, 0x5a001ceb},
+- {0x0000a564, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
+- {0x0000a568, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
+- {0x0000a56c, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
+- {0x0000a570, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
+- {0x0000a574, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
+- {0x0000a578, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
+- {0x0000a57c, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
+- {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000},
+- {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002},
+- {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004},
+- {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200},
+- {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202},
+- {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400},
+- {0x0000a598, 0x21820220, 0x21820220, 0x16800402, 0x16800402},
+- {0x0000a59c, 0x27820223, 0x27820223, 0x19800404, 0x19800404},
+- {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603},
+- {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02},
+- {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04},
+- {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20},
+- {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20},
+- {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22},
+- {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24},
+- {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640},
+- {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660},
+- {0x0000a5c4, 0x5382266c, 0x5382266c, 0x3f801861, 0x3f801861},
+- {0x0000a5c8, 0x5782286c, 0x5782286c, 0x43801a81, 0x43801a81},
+- {0x0000a5cc, 0x5c84286b, 0x5c84286b, 0x47801a83, 0x47801a83},
+- {0x0000a5d0, 0x61842a6c, 0x61842a6c, 0x4a801c84, 0x4a801c84},
+- {0x0000a5d4, 0x66862a6c, 0x66862a6c, 0x4e801ce3, 0x4e801ce3},
+- {0x0000a5d8, 0x6b862e6c, 0x6b862e6c, 0x52801ce5, 0x52801ce5},
+- {0x0000a5dc, 0x7086308c, 0x7086308c, 0x56801ce9, 0x56801ce9},
+- {0x0000a5e0, 0x738a308a, 0x738a308a, 0x5a801ceb, 0x5a801ceb},
+- {0x0000a5e4, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
+- {0x0000a5e8, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
+- {0x0000a5ec, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
+- {0x0000a5f0, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
+- {0x0000a5f4, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
+- {0x0000a5f8, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
+- {0x0000a5fc, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
+- {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
+- {0x00016048, 0x62480001, 0x62480001, 0x62480001, 0x62480001},
+- {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
+- {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
+- {0x00016448, 0x62480001, 0x62480001, 0x62480001, 0x62480001},
+- {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
+- {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
+- {0x00016848, 0x62480001, 0x62480001, 0x62480001, 0x62480001},
+- {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
+-};
+-
+-static const u32 ar9300Modes_fast_clock_2p0[][3] = {
+- /* Addr 5G_HT20 5G_HT40 */
+- {0x00001030, 0x00000268, 0x000004d0},
+- {0x00001070, 0x0000018c, 0x00000318},
+- {0x000010b0, 0x00000fd0, 0x00001fa0},
+- {0x00008014, 0x044c044c, 0x08980898},
+- {0x0000801c, 0x148ec02b, 0x148ec057},
+- {0x00008318, 0x000044c0, 0x00008980},
+- {0x00009e00, 0x03721821, 0x03721821},
+- {0x0000a230, 0x0000000b, 0x00000016},
+- {0x0000a254, 0x00000898, 0x00001130},
+-};
+-
+-static const u32 ar9300_2p0_radio_core[][2] = {
+- /* Addr allmodes */
+- {0x00016000, 0x36db6db6},
+- {0x00016004, 0x6db6db40},
+- {0x00016008, 0x73f00000},
+- {0x0001600c, 0x00000000},
+- {0x00016040, 0x7f80fff8},
+- {0x0001604c, 0x76d005b5},
+- {0x00016050, 0x556cf031},
+- {0x00016054, 0x13449440},
+- {0x00016058, 0x0c51c92c},
+- {0x0001605c, 0x3db7fffc},
+- {0x00016060, 0xfffffffc},
+- {0x00016064, 0x000f0278},
+- {0x0001606c, 0x6db60000},
+- {0x00016080, 0x00000000},
+- {0x00016084, 0x0e48048c},
+- {0x00016088, 0x54214514},
+- {0x0001608c, 0x119f481e},
+- {0x00016090, 0x24926490},
+- {0x00016098, 0xd2888888},
+- {0x000160a0, 0x0a108ffe},
+- {0x000160a4, 0x812fc370},
+- {0x000160a8, 0x423c8000},
+- {0x000160b4, 0x92480080},
+- {0x000160c0, 0x00adb6d0},
+- {0x000160c4, 0x6db6db60},
+- {0x000160c8, 0x6db6db6c},
+- {0x000160cc, 0x01e6c000},
+- {0x00016100, 0x3fffbe01},
+- {0x00016104, 0xfff80000},
+- {0x00016108, 0x00080010},
+- {0x00016144, 0x02084080},
+- {0x00016148, 0x00000000},
+- {0x00016280, 0x058a0001},
+- {0x00016284, 0x3d840208},
+- {0x00016288, 0x05a20408},
+- {0x0001628c, 0x00038c07},
+- {0x00016290, 0x40000004},
+- {0x00016294, 0x458aa14f},
+- {0x00016380, 0x00000000},
+- {0x00016384, 0x00000000},
+- {0x00016388, 0x00800700},
+- {0x0001638c, 0x00800700},
+- {0x00016390, 0x00800700},
+- {0x00016394, 0x00000000},
+- {0x00016398, 0x00000000},
+- {0x0001639c, 0x00000000},
+- {0x000163a0, 0x00000001},
+- {0x000163a4, 0x00000001},
+- {0x000163a8, 0x00000000},
+- {0x000163ac, 0x00000000},
+- {0x000163b0, 0x00000000},
+- {0x000163b4, 0x00000000},
+- {0x000163b8, 0x00000000},
+- {0x000163bc, 0x00000000},
+- {0x000163c0, 0x000000a0},
+- {0x000163c4, 0x000c0000},
+- {0x000163c8, 0x14021402},
+- {0x000163cc, 0x00001402},
+- {0x000163d0, 0x00000000},
+- {0x000163d4, 0x00000000},
+- {0x00016400, 0x36db6db6},
+- {0x00016404, 0x6db6db40},
+- {0x00016408, 0x73f00000},
+- {0x0001640c, 0x00000000},
+- {0x00016440, 0x7f80fff8},
+- {0x0001644c, 0x76d005b5},
+- {0x00016450, 0x556cf031},
+- {0x00016454, 0x13449440},
+- {0x00016458, 0x0c51c92c},
+- {0x0001645c, 0x3db7fffc},
+- {0x00016460, 0xfffffffc},
+- {0x00016464, 0x000f0278},
+- {0x0001646c, 0x6db60000},
+- {0x00016500, 0x3fffbe01},
+- {0x00016504, 0xfff80000},
+- {0x00016508, 0x00080010},
+- {0x00016544, 0x02084080},
+- {0x00016548, 0x00000000},
+- {0x00016780, 0x00000000},
+- {0x00016784, 0x00000000},
+- {0x00016788, 0x00800700},
+- {0x0001678c, 0x00800700},
+- {0x00016790, 0x00800700},
+- {0x00016794, 0x00000000},
+- {0x00016798, 0x00000000},
+- {0x0001679c, 0x00000000},
+- {0x000167a0, 0x00000001},
+- {0x000167a4, 0x00000001},
+- {0x000167a8, 0x00000000},
+- {0x000167ac, 0x00000000},
+- {0x000167b0, 0x00000000},
+- {0x000167b4, 0x00000000},
+- {0x000167b8, 0x00000000},
+- {0x000167bc, 0x00000000},
+- {0x000167c0, 0x000000a0},
+- {0x000167c4, 0x000c0000},
+- {0x000167c8, 0x14021402},
+- {0x000167cc, 0x00001402},
+- {0x000167d0, 0x00000000},
+- {0x000167d4, 0x00000000},
+- {0x00016800, 0x36db6db6},
+- {0x00016804, 0x6db6db40},
+- {0x00016808, 0x73f00000},
+- {0x0001680c, 0x00000000},
+- {0x00016840, 0x7f80fff8},
+- {0x0001684c, 0x76d005b5},
+- {0x00016850, 0x556cf031},
+- {0x00016854, 0x13449440},
+- {0x00016858, 0x0c51c92c},
+- {0x0001685c, 0x3db7fffc},
+- {0x00016860, 0xfffffffc},
+- {0x00016864, 0x000f0278},
+- {0x0001686c, 0x6db60000},
+- {0x00016900, 0x3fffbe01},
+- {0x00016904, 0xfff80000},
+- {0x00016908, 0x00080010},
+- {0x00016944, 0x02084080},
+- {0x00016948, 0x00000000},
+- {0x00016b80, 0x00000000},
+- {0x00016b84, 0x00000000},
+- {0x00016b88, 0x00800700},
+- {0x00016b8c, 0x00800700},
+- {0x00016b90, 0x00800700},
+- {0x00016b94, 0x00000000},
+- {0x00016b98, 0x00000000},
+- {0x00016b9c, 0x00000000},
+- {0x00016ba0, 0x00000001},
+- {0x00016ba4, 0x00000001},
+- {0x00016ba8, 0x00000000},
+- {0x00016bac, 0x00000000},
+- {0x00016bb0, 0x00000000},
+- {0x00016bb4, 0x00000000},
+- {0x00016bb8, 0x00000000},
+- {0x00016bbc, 0x00000000},
+- {0x00016bc0, 0x000000a0},
+- {0x00016bc4, 0x000c0000},
+- {0x00016bc8, 0x14021402},
+- {0x00016bcc, 0x00001402},
+- {0x00016bd0, 0x00000000},
+- {0x00016bd4, 0x00000000},
+-};
+-
+-static const u32 ar9300Common_rx_gain_table_merlin_2p0[][2] = {
+- /* Addr allmodes */
+- {0x0000a000, 0x02000101},
+- {0x0000a004, 0x02000102},
+- {0x0000a008, 0x02000103},
+- {0x0000a00c, 0x02000104},
+- {0x0000a010, 0x02000200},
+- {0x0000a014, 0x02000201},
+- {0x0000a018, 0x02000202},
+- {0x0000a01c, 0x02000203},
+- {0x0000a020, 0x02000204},
+- {0x0000a024, 0x02000205},
+- {0x0000a028, 0x02000208},
+- {0x0000a02c, 0x02000302},
+- {0x0000a030, 0x02000303},
+- {0x0000a034, 0x02000304},
+- {0x0000a038, 0x02000400},
+- {0x0000a03c, 0x02010300},
+- {0x0000a040, 0x02010301},
+- {0x0000a044, 0x02010302},
+- {0x0000a048, 0x02000500},
+- {0x0000a04c, 0x02010400},
+- {0x0000a050, 0x02020300},
+- {0x0000a054, 0x02020301},
+- {0x0000a058, 0x02020302},
+- {0x0000a05c, 0x02020303},
+- {0x0000a060, 0x02020400},
+- {0x0000a064, 0x02030300},
+- {0x0000a068, 0x02030301},
+- {0x0000a06c, 0x02030302},
+- {0x0000a070, 0x02030303},
+- {0x0000a074, 0x02030400},
+- {0x0000a078, 0x02040300},
+- {0x0000a07c, 0x02040301},
+- {0x0000a080, 0x02040302},
+- {0x0000a084, 0x02040303},
+- {0x0000a088, 0x02030500},
+- {0x0000a08c, 0x02040400},
+- {0x0000a090, 0x02050203},
+- {0x0000a094, 0x02050204},
+- {0x0000a098, 0x02050205},
+- {0x0000a09c, 0x02040500},
+- {0x0000a0a0, 0x02050301},
+- {0x0000a0a4, 0x02050302},
+- {0x0000a0a8, 0x02050303},
+- {0x0000a0ac, 0x02050400},
+- {0x0000a0b0, 0x02050401},
+- {0x0000a0b4, 0x02050402},
+- {0x0000a0b8, 0x02050403},
+- {0x0000a0bc, 0x02050500},
+- {0x0000a0c0, 0x02050501},
+- {0x0000a0c4, 0x02050502},
+- {0x0000a0c8, 0x02050503},
+- {0x0000a0cc, 0x02050504},
+- {0x0000a0d0, 0x02050600},
+- {0x0000a0d4, 0x02050601},
+- {0x0000a0d8, 0x02050602},
+- {0x0000a0dc, 0x02050603},
+- {0x0000a0e0, 0x02050604},
+- {0x0000a0e4, 0x02050700},
+- {0x0000a0e8, 0x02050701},
+- {0x0000a0ec, 0x02050702},
+- {0x0000a0f0, 0x02050703},
+- {0x0000a0f4, 0x02050704},
+- {0x0000a0f8, 0x02050705},
+- {0x0000a0fc, 0x02050708},
+- {0x0000a100, 0x02050709},
+- {0x0000a104, 0x0205070a},
+- {0x0000a108, 0x0205070b},
+- {0x0000a10c, 0x0205070c},
+- {0x0000a110, 0x0205070d},
+- {0x0000a114, 0x02050710},
+- {0x0000a118, 0x02050711},
+- {0x0000a11c, 0x02050712},
+- {0x0000a120, 0x02050713},
+- {0x0000a124, 0x02050714},
+- {0x0000a128, 0x02050715},
+- {0x0000a12c, 0x02050730},
+- {0x0000a130, 0x02050731},
+- {0x0000a134, 0x02050732},
+- {0x0000a138, 0x02050733},
+- {0x0000a13c, 0x02050734},
+- {0x0000a140, 0x02050735},
+- {0x0000a144, 0x02050750},
+- {0x0000a148, 0x02050751},
+- {0x0000a14c, 0x02050752},
+- {0x0000a150, 0x02050753},
+- {0x0000a154, 0x02050754},
+- {0x0000a158, 0x02050755},
+- {0x0000a15c, 0x02050770},
+- {0x0000a160, 0x02050771},
+- {0x0000a164, 0x02050772},
+- {0x0000a168, 0x02050773},
+- {0x0000a16c, 0x02050774},
+- {0x0000a170, 0x02050775},
+- {0x0000a174, 0x00000776},
+- {0x0000a178, 0x00000776},
+- {0x0000a17c, 0x00000776},
+- {0x0000a180, 0x00000776},
+- {0x0000a184, 0x00000776},
+- {0x0000a188, 0x00000776},
+- {0x0000a18c, 0x00000776},
+- {0x0000a190, 0x00000776},
+- {0x0000a194, 0x00000776},
+- {0x0000a198, 0x00000776},
+- {0x0000a19c, 0x00000776},
+- {0x0000a1a0, 0x00000776},
+- {0x0000a1a4, 0x00000776},
+- {0x0000a1a8, 0x00000776},
+- {0x0000a1ac, 0x00000776},
+- {0x0000a1b0, 0x00000776},
+- {0x0000a1b4, 0x00000776},
+- {0x0000a1b8, 0x00000776},
+- {0x0000a1bc, 0x00000776},
+- {0x0000a1c0, 0x00000776},
+- {0x0000a1c4, 0x00000776},
+- {0x0000a1c8, 0x00000776},
+- {0x0000a1cc, 0x00000776},
+- {0x0000a1d0, 0x00000776},
+- {0x0000a1d4, 0x00000776},
+- {0x0000a1d8, 0x00000776},
+- {0x0000a1dc, 0x00000776},
+- {0x0000a1e0, 0x00000776},
+- {0x0000a1e4, 0x00000776},
+- {0x0000a1e8, 0x00000776},
+- {0x0000a1ec, 0x00000776},
+- {0x0000a1f0, 0x00000776},
+- {0x0000a1f4, 0x00000776},
+- {0x0000a1f8, 0x00000776},
+- {0x0000a1fc, 0x00000776},
+- {0x0000b000, 0x02000101},
+- {0x0000b004, 0x02000102},
+- {0x0000b008, 0x02000103},
+- {0x0000b00c, 0x02000104},
+- {0x0000b010, 0x02000200},
+- {0x0000b014, 0x02000201},
+- {0x0000b018, 0x02000202},
+- {0x0000b01c, 0x02000203},
+- {0x0000b020, 0x02000204},
+- {0x0000b024, 0x02000205},
+- {0x0000b028, 0x02000208},
+- {0x0000b02c, 0x02000302},
+- {0x0000b030, 0x02000303},
+- {0x0000b034, 0x02000304},
+- {0x0000b038, 0x02000400},
+- {0x0000b03c, 0x02010300},
+- {0x0000b040, 0x02010301},
+- {0x0000b044, 0x02010302},
+- {0x0000b048, 0x02000500},
+- {0x0000b04c, 0x02010400},
+- {0x0000b050, 0x02020300},
+- {0x0000b054, 0x02020301},
+- {0x0000b058, 0x02020302},
+- {0x0000b05c, 0x02020303},
+- {0x0000b060, 0x02020400},
+- {0x0000b064, 0x02030300},
+- {0x0000b068, 0x02030301},
+- {0x0000b06c, 0x02030302},
+- {0x0000b070, 0x02030303},
+- {0x0000b074, 0x02030400},
+- {0x0000b078, 0x02040300},
+- {0x0000b07c, 0x02040301},
+- {0x0000b080, 0x02040302},
+- {0x0000b084, 0x02040303},
+- {0x0000b088, 0x02030500},
+- {0x0000b08c, 0x02040400},
+- {0x0000b090, 0x02050203},
+- {0x0000b094, 0x02050204},
+- {0x0000b098, 0x02050205},
+- {0x0000b09c, 0x02040500},
+- {0x0000b0a0, 0x02050301},
+- {0x0000b0a4, 0x02050302},
+- {0x0000b0a8, 0x02050303},
+- {0x0000b0ac, 0x02050400},
+- {0x0000b0b0, 0x02050401},
+- {0x0000b0b4, 0x02050402},
+- {0x0000b0b8, 0x02050403},
+- {0x0000b0bc, 0x02050500},
+- {0x0000b0c0, 0x02050501},
+- {0x0000b0c4, 0x02050502},
+- {0x0000b0c8, 0x02050503},
+- {0x0000b0cc, 0x02050504},
+- {0x0000b0d0, 0x02050600},
+- {0x0000b0d4, 0x02050601},
+- {0x0000b0d8, 0x02050602},
+- {0x0000b0dc, 0x02050603},
+- {0x0000b0e0, 0x02050604},
+- {0x0000b0e4, 0x02050700},
+- {0x0000b0e8, 0x02050701},
+- {0x0000b0ec, 0x02050702},
+- {0x0000b0f0, 0x02050703},
+- {0x0000b0f4, 0x02050704},
+- {0x0000b0f8, 0x02050705},
+- {0x0000b0fc, 0x02050708},
+- {0x0000b100, 0x02050709},
+- {0x0000b104, 0x0205070a},
+- {0x0000b108, 0x0205070b},
+- {0x0000b10c, 0x0205070c},
+- {0x0000b110, 0x0205070d},
+- {0x0000b114, 0x02050710},
+- {0x0000b118, 0x02050711},
+- {0x0000b11c, 0x02050712},
+- {0x0000b120, 0x02050713},
+- {0x0000b124, 0x02050714},
+- {0x0000b128, 0x02050715},
+- {0x0000b12c, 0x02050730},
+- {0x0000b130, 0x02050731},
+- {0x0000b134, 0x02050732},
+- {0x0000b138, 0x02050733},
+- {0x0000b13c, 0x02050734},
+- {0x0000b140, 0x02050735},
+- {0x0000b144, 0x02050750},
+- {0x0000b148, 0x02050751},
+- {0x0000b14c, 0x02050752},
+- {0x0000b150, 0x02050753},
+- {0x0000b154, 0x02050754},
+- {0x0000b158, 0x02050755},
+- {0x0000b15c, 0x02050770},
+- {0x0000b160, 0x02050771},
+- {0x0000b164, 0x02050772},
+- {0x0000b168, 0x02050773},
+- {0x0000b16c, 0x02050774},
+- {0x0000b170, 0x02050775},
+- {0x0000b174, 0x00000776},
+- {0x0000b178, 0x00000776},
+- {0x0000b17c, 0x00000776},
+- {0x0000b180, 0x00000776},
+- {0x0000b184, 0x00000776},
+- {0x0000b188, 0x00000776},
+- {0x0000b18c, 0x00000776},
+- {0x0000b190, 0x00000776},
+- {0x0000b194, 0x00000776},
+- {0x0000b198, 0x00000776},
+- {0x0000b19c, 0x00000776},
+- {0x0000b1a0, 0x00000776},
+- {0x0000b1a4, 0x00000776},
+- {0x0000b1a8, 0x00000776},
+- {0x0000b1ac, 0x00000776},
+- {0x0000b1b0, 0x00000776},
+- {0x0000b1b4, 0x00000776},
+- {0x0000b1b8, 0x00000776},
+- {0x0000b1bc, 0x00000776},
+- {0x0000b1c0, 0x00000776},
+- {0x0000b1c4, 0x00000776},
+- {0x0000b1c8, 0x00000776},
+- {0x0000b1cc, 0x00000776},
+- {0x0000b1d0, 0x00000776},
+- {0x0000b1d4, 0x00000776},
+- {0x0000b1d8, 0x00000776},
+- {0x0000b1dc, 0x00000776},
+- {0x0000b1e0, 0x00000776},
+- {0x0000b1e4, 0x00000776},
+- {0x0000b1e8, 0x00000776},
+- {0x0000b1ec, 0x00000776},
+- {0x0000b1f0, 0x00000776},
+- {0x0000b1f4, 0x00000776},
+- {0x0000b1f8, 0x00000776},
+- {0x0000b1fc, 0x00000776},
+-};
+-
+-static const u32 ar9300_2p0_mac_postamble[][5] = {
+- /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
+- {0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160},
+- {0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c},
+- {0x000010b0, 0x00000e60, 0x00001cc0, 0x00007c70, 0x00003e38},
+- {0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00},
+- {0x0000801c, 0x128d8027, 0x128d804f, 0x12e00057, 0x12e0002b},
+- {0x00008120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810},
+- {0x000081d0, 0x00003210, 0x00003210, 0x0000320a, 0x0000320a},
+- {0x00008318, 0x00003e80, 0x00007d00, 0x00006880, 0x00003440},
+-};
+-
+-static const u32 ar9300_2p0_soc_postamble[][5] = {
+- /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
+- {0x00007010, 0x00000023, 0x00000023, 0x00000023, 0x00000023},
+-};
+-
+-static const u32 ar9200_merlin_2p0_radio_core[][2] = {
+- /* Addr allmodes */
+- {0x00007800, 0x00040000},
+- {0x00007804, 0xdb005012},
+- {0x00007808, 0x04924914},
+- {0x0000780c, 0x21084210},
+- {0x00007810, 0x6d801300},
+- {0x00007814, 0x0019beff},
+- {0x00007818, 0x07e41000},
+- {0x0000781c, 0x00392000},
+- {0x00007820, 0x92592480},
+- {0x00007824, 0x00040000},
+- {0x00007828, 0xdb005012},
+- {0x0000782c, 0x04924914},
+- {0x00007830, 0x21084210},
+- {0x00007834, 0x6d801300},
+- {0x00007838, 0x0019beff},
+- {0x0000783c, 0x07e40000},
+- {0x00007840, 0x00392000},
+- {0x00007844, 0x92592480},
+- {0x00007848, 0x00100000},
+- {0x0000784c, 0x773f0567},
+- {0x00007850, 0x54214514},
+- {0x00007854, 0x12035828},
+- {0x00007858, 0x92592692},
+- {0x0000785c, 0x00000000},
+- {0x00007860, 0x56400000},
+- {0x00007864, 0x0a8e370e},
+- {0x00007868, 0xc0102850},
+- {0x0000786c, 0x812d4000},
+- {0x00007870, 0x807ec400},
+- {0x00007874, 0x001b6db0},
+- {0x00007878, 0x00376b63},
+- {0x0000787c, 0x06db6db6},
+- {0x00007880, 0x006d8000},
+- {0x00007884, 0xffeffffe},
+- {0x00007888, 0xffeffffe},
+- {0x0000788c, 0x00010000},
+- {0x00007890, 0x02060aeb},
+- {0x00007894, 0x5a108000},
+-};
+-
+-static const u32 ar9300_2p0_baseband_postamble[][5] = {
+- /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
+- {0x00009810, 0xd00a8005, 0xd00a8005, 0xd00a8011, 0xd00a8011},
+- {0x00009820, 0x206a022e, 0x206a022e, 0x206a012e, 0x206a012e},
+- {0x00009824, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0},
+- {0x00009828, 0x06903081, 0x06903081, 0x06903881, 0x06903881},
+- {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4},
+- {0x00009830, 0x0000059c, 0x0000059c, 0x0000119c, 0x0000119c},
+- {0x00009c00, 0x00000044, 0x000000c4, 0x000000c4, 0x00000044},
+- {0x00009e00, 0x0372161e, 0x0372161e, 0x037216a0, 0x037216a0},
+- {0x00009e04, 0x00802020, 0x00802020, 0x00802020, 0x00802020},
+- {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2},
+- {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec84d2e, 0x7ec84d2e},
+- {0x00009e14, 0x31395d5e, 0x3139605e, 0x3139605e, 0x31395d5e},
+- {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
+- {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c},
+- {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce},
+- {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021},
+- {0x00009e44, 0x02321e27, 0x02321e27, 0x02291e27, 0x02291e27},
+- {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012},
+- {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000},
+- {0x0000a204, 0x000037c0, 0x000037c4, 0x000037c4, 0x000037c0},
+- {0x0000a208, 0x00000104, 0x00000104, 0x00000004, 0x00000004},
+- {0x0000a230, 0x0000000a, 0x00000014, 0x00000016, 0x0000000b},
+- {0x0000a238, 0xffb81018, 0xffb81018, 0xffb81018, 0xffb81018},
+- {0x0000a250, 0x00000000, 0x00000000, 0x00000210, 0x00000108},
+- {0x0000a254, 0x000007d0, 0x00000fa0, 0x00001130, 0x00000898},
+- {0x0000a258, 0x02020002, 0x02020002, 0x02020002, 0x02020002},
+- {0x0000a25c, 0x01000e0e, 0x01000e0e, 0x01000e0e, 0x01000e0e},
+- {0x0000a260, 0x0a021501, 0x0a021501, 0x3a021501, 0x3a021501},
+- {0x0000a264, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e},
+- {0x0000a280, 0x00000007, 0x00000007, 0x0000000b, 0x0000000b},
+- {0x0000a284, 0x00000000, 0x00000000, 0x00000150, 0x00000150},
+- {0x0000a288, 0x00000110, 0x00000110, 0x00000110, 0x00000110},
+- {0x0000a28c, 0x00022222, 0x00022222, 0x00022222, 0x00022222},
+- {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18},
+- {0x0000a2d0, 0x00071981, 0x00071981, 0x00071981, 0x00071982},
+- {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a},
+- {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
+- {0x0000a830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c},
+- {0x0000ae04, 0x00800000, 0x00800000, 0x00800000, 0x00800000},
+- {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
+- {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c},
+- {0x0000ae20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce},
+- {0x0000b284, 0x00000000, 0x00000000, 0x00000150, 0x00000150},
+- {0x0000b830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c},
+- {0x0000be04, 0x00800000, 0x00800000, 0x00800000, 0x00800000},
+- {0x0000be18, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
+- {0x0000be1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c},
+- {0x0000be20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce},
+- {0x0000c284, 0x00000000, 0x00000000, 0x00000150, 0x00000150},
+-};
+-
+-static const u32 ar9300_2p0_baseband_core[][2] = {
+- /* Addr allmodes */
+- {0x00009800, 0xafe68e30},
+- {0x00009804, 0xfd14e000},
+- {0x00009808, 0x9c0a9f6b},
+- {0x0000980c, 0x04900000},
+- {0x00009814, 0x9280c00a},
+- {0x00009818, 0x00000000},
+- {0x0000981c, 0x00020028},
+- {0x00009834, 0x5f3ca3de},
+- {0x00009838, 0x0108ecff},
+- {0x0000983c, 0x14750600},
+- {0x00009880, 0x201fff00},
+- {0x00009884, 0x00001042},
+- {0x000098a4, 0x00200400},
+- {0x000098b0, 0x52440bbe},
+- {0x000098d0, 0x004b6a8e},
+- {0x000098d4, 0x00000820},
+- {0x000098dc, 0x00000000},
+- {0x000098f0, 0x00000000},
+- {0x000098f4, 0x00000000},
+- {0x00009c04, 0xff55ff55},
+- {0x00009c08, 0x0320ff55},
+- {0x00009c0c, 0x00000000},
+- {0x00009c10, 0x00000000},
+- {0x00009c14, 0x00046384},
+- {0x00009c18, 0x05b6b440},
+- {0x00009c1c, 0x00b6b440},
+- {0x00009d00, 0xc080a333},
+- {0x00009d04, 0x40206c10},
+- {0x00009d08, 0x009c4060},
+- {0x00009d0c, 0x9883800a},
+- {0x00009d10, 0x01834061},
+- {0x00009d14, 0x00c0040b},
+- {0x00009d18, 0x00000000},
+- {0x00009e08, 0x0038230c},
+- {0x00009e24, 0x990bb515},
+- {0x00009e28, 0x0c6f0000},
+- {0x00009e30, 0x06336f77},
+- {0x00009e34, 0x6af6532f},
+- {0x00009e38, 0x0cc80c00},
+- {0x00009e3c, 0xcf946222},
+- {0x00009e40, 0x0d261820},
+- {0x00009e4c, 0x00001004},
+- {0x00009e50, 0x00ff03f1},
+- {0x00009e54, 0x00000000},
+- {0x00009fc0, 0x803e4788},
+- {0x00009fc4, 0x0001efb5},
+- {0x00009fcc, 0x40000014},
+- {0x00009fd0, 0x01193b93},
+- {0x0000a20c, 0x00000000},
+- {0x0000a220, 0x00000000},
+- {0x0000a224, 0x00000000},
+- {0x0000a228, 0x10002310},
+- {0x0000a22c, 0x01036a1e},
+- {0x0000a234, 0x10000fff},
+- {0x0000a23c, 0x00000000},
+- {0x0000a244, 0x0c000000},
+- {0x0000a2a0, 0x00000001},
+- {0x0000a2c0, 0x00000001},
+- {0x0000a2c8, 0x00000000},
+- {0x0000a2cc, 0x18c43433},
+- {0x0000a2d4, 0x00000000},
+- {0x0000a2dc, 0x00000000},
+- {0x0000a2e0, 0x00000000},
+- {0x0000a2e4, 0x00000000},
+- {0x0000a2e8, 0x00000000},
+- {0x0000a2ec, 0x00000000},
+- {0x0000a2f0, 0x00000000},
+- {0x0000a2f4, 0x00000000},
+- {0x0000a2f8, 0x00000000},
+- {0x0000a344, 0x00000000},
+- {0x0000a34c, 0x00000000},
+- {0x0000a350, 0x0000a000},
+- {0x0000a364, 0x00000000},
+- {0x0000a370, 0x00000000},
+- {0x0000a390, 0x00000001},
+- {0x0000a394, 0x00000444},
+- {0x0000a398, 0x001f0e0f},
+- {0x0000a39c, 0x0075393f},
+- {0x0000a3a0, 0xb79f6427},
+- {0x0000a3a4, 0x00000000},
+- {0x0000a3a8, 0xaaaaaaaa},
+- {0x0000a3ac, 0x3c466478},
+- {0x0000a3c0, 0x20202020},
+- {0x0000a3c4, 0x22222220},
+- {0x0000a3c8, 0x20200020},
+- {0x0000a3cc, 0x20202020},
+- {0x0000a3d0, 0x20202020},
+- {0x0000a3d4, 0x20202020},
+- {0x0000a3d8, 0x20202020},
+- {0x0000a3dc, 0x20202020},
+- {0x0000a3e0, 0x20202020},
+- {0x0000a3e4, 0x20202020},
+- {0x0000a3e8, 0x20202020},
+- {0x0000a3ec, 0x20202020},
+- {0x0000a3f0, 0x00000000},
+- {0x0000a3f4, 0x00000246},
+- {0x0000a3f8, 0x0cdbd380},
+- {0x0000a3fc, 0x000f0f01},
+- {0x0000a400, 0x8fa91f01},
+- {0x0000a404, 0x00000000},
+- {0x0000a408, 0x0e79e5c6},
+- {0x0000a40c, 0x00820820},
+- {0x0000a414, 0x1ce739ce},
+- {0x0000a418, 0x2d001dce},
+- {0x0000a41c, 0x1ce739ce},
+- {0x0000a420, 0x000001ce},
+- {0x0000a424, 0x1ce739ce},
+- {0x0000a428, 0x000001ce},
+- {0x0000a42c, 0x1ce739ce},
+- {0x0000a430, 0x1ce739ce},
+- {0x0000a434, 0x00000000},
+- {0x0000a438, 0x00001801},
+- {0x0000a43c, 0x00000000},
+- {0x0000a440, 0x00000000},
+- {0x0000a444, 0x00000000},
+- {0x0000a448, 0x04000080},
+- {0x0000a44c, 0x00000001},
+- {0x0000a450, 0x00010000},
+- {0x0000a458, 0x00000000},
+- {0x0000a600, 0x00000000},
+- {0x0000a604, 0x00000000},
+- {0x0000a608, 0x00000000},
+- {0x0000a60c, 0x00000000},
+- {0x0000a610, 0x00000000},
+- {0x0000a614, 0x00000000},
+- {0x0000a618, 0x00000000},
+- {0x0000a61c, 0x00000000},
+- {0x0000a620, 0x00000000},
+- {0x0000a624, 0x00000000},
+- {0x0000a628, 0x00000000},
+- {0x0000a62c, 0x00000000},
+- {0x0000a630, 0x00000000},
+- {0x0000a634, 0x00000000},
+- {0x0000a638, 0x00000000},
+- {0x0000a63c, 0x00000000},
+- {0x0000a640, 0x00000000},
+- {0x0000a644, 0x3fad9d74},
+- {0x0000a648, 0x0048060a},
+- {0x0000a64c, 0x00000637},
+- {0x0000a670, 0x03020100},
+- {0x0000a674, 0x09080504},
+- {0x0000a678, 0x0d0c0b0a},
+- {0x0000a67c, 0x13121110},
+- {0x0000a680, 0x31301514},
+- {0x0000a684, 0x35343332},
+- {0x0000a688, 0x00000036},
+- {0x0000a690, 0x00000838},
+- {0x0000a7c0, 0x00000000},
+- {0x0000a7c4, 0xfffffffc},
+- {0x0000a7c8, 0x00000000},
+- {0x0000a7cc, 0x00000000},
+- {0x0000a7d0, 0x00000000},
+- {0x0000a7d4, 0x00000004},
+- {0x0000a7dc, 0x00000001},
+- {0x0000a8d0, 0x004b6a8e},
+- {0x0000a8d4, 0x00000820},
+- {0x0000a8dc, 0x00000000},
+- {0x0000a8f0, 0x00000000},
+- {0x0000a8f4, 0x00000000},
+- {0x0000b2d0, 0x00000080},
+- {0x0000b2d4, 0x00000000},
+- {0x0000b2dc, 0x00000000},
+- {0x0000b2e0, 0x00000000},
+- {0x0000b2e4, 0x00000000},
+- {0x0000b2e8, 0x00000000},
+- {0x0000b2ec, 0x00000000},
+- {0x0000b2f0, 0x00000000},
+- {0x0000b2f4, 0x00000000},
+- {0x0000b2f8, 0x00000000},
+- {0x0000b408, 0x0e79e5c0},
+- {0x0000b40c, 0x00820820},
+- {0x0000b420, 0x00000000},
+- {0x0000b8d0, 0x004b6a8e},
+- {0x0000b8d4, 0x00000820},
+- {0x0000b8dc, 0x00000000},
+- {0x0000b8f0, 0x00000000},
+- {0x0000b8f4, 0x00000000},
+- {0x0000c2d0, 0x00000080},
+- {0x0000c2d4, 0x00000000},
+- {0x0000c2dc, 0x00000000},
+- {0x0000c2e0, 0x00000000},
+- {0x0000c2e4, 0x00000000},
+- {0x0000c2e8, 0x00000000},
+- {0x0000c2ec, 0x00000000},
+- {0x0000c2f0, 0x00000000},
+- {0x0000c2f4, 0x00000000},
+- {0x0000c2f8, 0x00000000},
+- {0x0000c408, 0x0e79e5c0},
+- {0x0000c40c, 0x00820820},
+- {0x0000c420, 0x00000000},
+-};
+-
+-static const u32 ar9300Modes_high_power_tx_gain_table_2p0[][5] = {
+- /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
+- {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
+- {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000},
+- {0x0000a504, 0x06002223, 0x06002223, 0x04000002, 0x04000002},
+- {0x0000a508, 0x0a022220, 0x0a022220, 0x08000004, 0x08000004},
+- {0x0000a50c, 0x0f022223, 0x0f022223, 0x0b000200, 0x0b000200},
+- {0x0000a510, 0x14022620, 0x14022620, 0x0f000202, 0x0f000202},
+- {0x0000a514, 0x18022622, 0x18022622, 0x11000400, 0x11000400},
+- {0x0000a518, 0x1b022822, 0x1b022822, 0x15000402, 0x15000402},
+- {0x0000a51c, 0x20022842, 0x20022842, 0x19000404, 0x19000404},
+- {0x0000a520, 0x22022c41, 0x22022c41, 0x1b000603, 0x1b000603},
+- {0x0000a524, 0x28023042, 0x28023042, 0x1f000a02, 0x1f000a02},
+- {0x0000a528, 0x2c023044, 0x2c023044, 0x23000a04, 0x23000a04},
+- {0x0000a52c, 0x2f023644, 0x2f023644, 0x26000a20, 0x26000a20},
+- {0x0000a530, 0x34025643, 0x34025643, 0x2a000e20, 0x2a000e20},
+- {0x0000a534, 0x38025a44, 0x38025a44, 0x2e000e22, 0x2e000e22},
+- {0x0000a538, 0x3b025e45, 0x3b025e45, 0x31000e24, 0x31000e24},
+- {0x0000a53c, 0x41025e4a, 0x41025e4a, 0x34001640, 0x34001640},
+- {0x0000a540, 0x48025e6c, 0x48025e6c, 0x38001660, 0x38001660},
+- {0x0000a544, 0x4e025e8e, 0x4e025e8e, 0x3b001861, 0x3b001861},
+- {0x0000a548, 0x53025eb2, 0x53025eb2, 0x3e001a81, 0x3e001a81},
+- {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83},
+- {0x0000a550, 0x5f025ef6, 0x5f025ef6, 0x44001c84, 0x44001c84},
+- {0x0000a554, 0x62025f56, 0x62025f56, 0x48001ce3, 0x48001ce3},
+- {0x0000a558, 0x66027f56, 0x66027f56, 0x4c001ce5, 0x4c001ce5},
+- {0x0000a55c, 0x6a029f56, 0x6a029f56, 0x50001ce9, 0x50001ce9},
+- {0x0000a560, 0x70049f56, 0x70049f56, 0x54001ceb, 0x54001ceb},
+- {0x0000a564, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
+- {0x0000a568, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
+- {0x0000a56c, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
+- {0x0000a570, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
+- {0x0000a574, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
+- {0x0000a578, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
+- {0x0000a57c, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
+- {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000},
+- {0x0000a584, 0x06802223, 0x06802223, 0x04800002, 0x04800002},
+- {0x0000a588, 0x0a822220, 0x0a822220, 0x08800004, 0x08800004},
+- {0x0000a58c, 0x0f822223, 0x0f822223, 0x0b800200, 0x0b800200},
+- {0x0000a590, 0x14822620, 0x14822620, 0x0f800202, 0x0f800202},
+- {0x0000a594, 0x18822622, 0x18822622, 0x11800400, 0x11800400},
+- {0x0000a598, 0x1b822822, 0x1b822822, 0x15800402, 0x15800402},
+- {0x0000a59c, 0x20822842, 0x20822842, 0x19800404, 0x19800404},
+- {0x0000a5a0, 0x22822c41, 0x22822c41, 0x1b800603, 0x1b800603},
+- {0x0000a5a4, 0x28823042, 0x28823042, 0x1f800a02, 0x1f800a02},
+- {0x0000a5a8, 0x2c823044, 0x2c823044, 0x23800a04, 0x23800a04},
+- {0x0000a5ac, 0x2f823644, 0x2f823644, 0x26800a20, 0x26800a20},
+- {0x0000a5b0, 0x34825643, 0x34825643, 0x2a800e20, 0x2a800e20},
+- {0x0000a5b4, 0x38825a44, 0x38825a44, 0x2e800e22, 0x2e800e22},
+- {0x0000a5b8, 0x3b825e45, 0x3b825e45, 0x31800e24, 0x31800e24},
+- {0x0000a5bc, 0x41825e4a, 0x41825e4a, 0x34801640, 0x34801640},
+- {0x0000a5c0, 0x48825e6c, 0x48825e6c, 0x38801660, 0x38801660},
+- {0x0000a5c4, 0x4e825e8e, 0x4e825e8e, 0x3b801861, 0x3b801861},
+- {0x0000a5c8, 0x53825eb2, 0x53825eb2, 0x3e801a81, 0x3e801a81},
+- {0x0000a5cc, 0x59825eb5, 0x59825eb5, 0x42801a83, 0x42801a83},
+- {0x0000a5d0, 0x5f825ef6, 0x5f825ef6, 0x44801c84, 0x44801c84},
+- {0x0000a5d4, 0x62825f56, 0x62825f56, 0x48801ce3, 0x48801ce3},
+- {0x0000a5d8, 0x66827f56, 0x66827f56, 0x4c801ce5, 0x4c801ce5},
+- {0x0000a5dc, 0x6a829f56, 0x6a829f56, 0x50801ce9, 0x50801ce9},
+- {0x0000a5e0, 0x70849f56, 0x70849f56, 0x54801ceb, 0x54801ceb},
+- {0x0000a5e4, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
+- {0x0000a5e8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
+- {0x0000a5ec, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
+- {0x0000a5f0, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
+- {0x0000a5f4, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
+- {0x0000a5f8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
+- {0x0000a5fc, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
+- {0x00016044, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6},
+- {0x00016048, 0xae480001, 0xae480001, 0xae480001, 0xae480001},
+- {0x00016068, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c},
+- {0x00016444, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6},
+- {0x00016448, 0xae480001, 0xae480001, 0xae480001, 0xae480001},
+- {0x00016468, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c},
+- {0x00016844, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6},
+- {0x00016848, 0xae480001, 0xae480001, 0xae480001, 0xae480001},
+- {0x00016868, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c},
+-};
+-
+-static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p0[][5] = {
+- /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
+- {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
+- {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000},
+- {0x0000a504, 0x06002223, 0x06002223, 0x04000002, 0x04000002},
+- {0x0000a508, 0x0a022220, 0x0a022220, 0x08000004, 0x08000004},
+- {0x0000a50c, 0x0f022223, 0x0f022223, 0x0b000200, 0x0b000200},
+- {0x0000a510, 0x14022620, 0x14022620, 0x0f000202, 0x0f000202},
+- {0x0000a514, 0x18022622, 0x18022622, 0x11000400, 0x11000400},
+- {0x0000a518, 0x1b022822, 0x1b022822, 0x15000402, 0x15000402},
+- {0x0000a51c, 0x20022842, 0x20022842, 0x19000404, 0x19000404},
+- {0x0000a520, 0x22022c41, 0x22022c41, 0x1b000603, 0x1b000603},
+- {0x0000a524, 0x28023042, 0x28023042, 0x1f000a02, 0x1f000a02},
+- {0x0000a528, 0x2c023044, 0x2c023044, 0x23000a04, 0x23000a04},
+- {0x0000a52c, 0x2f023644, 0x2f023644, 0x26000a20, 0x26000a20},
+- {0x0000a530, 0x34025643, 0x34025643, 0x2a000e20, 0x2a000e20},
+- {0x0000a534, 0x38025a44, 0x38025a44, 0x2e000e22, 0x2e000e22},
+- {0x0000a538, 0x3b025e45, 0x3b025e45, 0x31000e24, 0x31000e24},
+- {0x0000a53c, 0x41025e4a, 0x41025e4a, 0x34001640, 0x34001640},
+- {0x0000a540, 0x48025e6c, 0x48025e6c, 0x38001660, 0x38001660},
+- {0x0000a544, 0x4e025e8e, 0x4e025e8e, 0x3b001861, 0x3b001861},
+- {0x0000a548, 0x53025eb2, 0x53025eb2, 0x3e001a81, 0x3e001a81},
+- {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83},
+- {0x0000a550, 0x5f025ef6, 0x5f025ef6, 0x44001c84, 0x44001c84},
+- {0x0000a554, 0x62025f56, 0x62025f56, 0x48001ce3, 0x48001ce3},
+- {0x0000a558, 0x66027f56, 0x66027f56, 0x4c001ce5, 0x4c001ce5},
+- {0x0000a55c, 0x6a029f56, 0x6a029f56, 0x50001ce9, 0x50001ce9},
+- {0x0000a560, 0x70049f56, 0x70049f56, 0x54001ceb, 0x54001ceb},
+- {0x0000a564, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
+- {0x0000a568, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
+- {0x0000a56c, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
+- {0x0000a570, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
+- {0x0000a574, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
+- {0x0000a578, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
+- {0x0000a57c, 0x7504ff56, 0x7504ff56, 0x56001eec, 0x56001eec},
+- {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000},
+- {0x0000a584, 0x06802223, 0x06802223, 0x04800002, 0x04800002},
+- {0x0000a588, 0x0a822220, 0x0a822220, 0x08800004, 0x08800004},
+- {0x0000a58c, 0x0f822223, 0x0f822223, 0x0b800200, 0x0b800200},
+- {0x0000a590, 0x14822620, 0x14822620, 0x0f800202, 0x0f800202},
+- {0x0000a594, 0x18822622, 0x18822622, 0x11800400, 0x11800400},
+- {0x0000a598, 0x1b822822, 0x1b822822, 0x15800402, 0x15800402},
+- {0x0000a59c, 0x20822842, 0x20822842, 0x19800404, 0x19800404},
+- {0x0000a5a0, 0x22822c41, 0x22822c41, 0x1b800603, 0x1b800603},
+- {0x0000a5a4, 0x28823042, 0x28823042, 0x1f800a02, 0x1f800a02},
+- {0x0000a5a8, 0x2c823044, 0x2c823044, 0x23800a04, 0x23800a04},
+- {0x0000a5ac, 0x2f823644, 0x2f823644, 0x26800a20, 0x26800a20},
+- {0x0000a5b0, 0x34825643, 0x34825643, 0x2a800e20, 0x2a800e20},
+- {0x0000a5b4, 0x38825a44, 0x38825a44, 0x2e800e22, 0x2e800e22},
+- {0x0000a5b8, 0x3b825e45, 0x3b825e45, 0x31800e24, 0x31800e24},
+- {0x0000a5bc, 0x41825e4a, 0x41825e4a, 0x34801640, 0x34801640},
+- {0x0000a5c0, 0x48825e6c, 0x48825e6c, 0x38801660, 0x38801660},
+- {0x0000a5c4, 0x4e825e8e, 0x4e825e8e, 0x3b801861, 0x3b801861},
+- {0x0000a5c8, 0x53825eb2, 0x53825eb2, 0x3e801a81, 0x3e801a81},
+- {0x0000a5cc, 0x59825eb5, 0x59825eb5, 0x42801a83, 0x42801a83},
+- {0x0000a5d0, 0x5f825ef6, 0x5f825ef6, 0x44801c84, 0x44801c84},
+- {0x0000a5d4, 0x62825f56, 0x62825f56, 0x48801ce3, 0x48801ce3},
+- {0x0000a5d8, 0x66827f56, 0x66827f56, 0x4c801ce5, 0x4c801ce5},
+- {0x0000a5dc, 0x6a829f56, 0x6a829f56, 0x50801ce9, 0x50801ce9},
+- {0x0000a5e0, 0x70849f56, 0x70849f56, 0x54801ceb, 0x54801ceb},
+- {0x0000a5e4, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
+- {0x0000a5e8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
+- {0x0000a5ec, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
+- {0x0000a5f0, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
+- {0x0000a5f4, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
+- {0x0000a5f8, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
+- {0x0000a5fc, 0x7584ff56, 0x7584ff56, 0x56801eec, 0x56801eec},
+- {0x00016044, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4},
+- {0x00016048, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001},
+- {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
+- {0x00016444, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4},
+- {0x00016448, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001},
+- {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
+- {0x00016844, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4},
+- {0x00016848, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001},
+- {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
+-};
+-
+-static const u32 ar9300Common_rx_gain_table_2p0[][2] = {
+- /* Addr allmodes */
+- {0x0000a000, 0x00010000},
+- {0x0000a004, 0x00030002},
+- {0x0000a008, 0x00050004},
+- {0x0000a00c, 0x00810080},
+- {0x0000a010, 0x00830082},
+- {0x0000a014, 0x01810180},
+- {0x0000a018, 0x01830182},
+- {0x0000a01c, 0x01850184},
+- {0x0000a020, 0x01890188},
+- {0x0000a024, 0x018b018a},
+- {0x0000a028, 0x018d018c},
+- {0x0000a02c, 0x01910190},
+- {0x0000a030, 0x01930192},
+- {0x0000a034, 0x01950194},
+- {0x0000a038, 0x038a0196},
+- {0x0000a03c, 0x038c038b},
+- {0x0000a040, 0x0390038d},
+- {0x0000a044, 0x03920391},
+- {0x0000a048, 0x03940393},
+- {0x0000a04c, 0x03960395},
+- {0x0000a050, 0x00000000},
+- {0x0000a054, 0x00000000},
+- {0x0000a058, 0x00000000},
+- {0x0000a05c, 0x00000000},
+- {0x0000a060, 0x00000000},
+- {0x0000a064, 0x00000000},
+- {0x0000a068, 0x00000000},
+- {0x0000a06c, 0x00000000},
+- {0x0000a070, 0x00000000},
+- {0x0000a074, 0x00000000},
+- {0x0000a078, 0x00000000},
+- {0x0000a07c, 0x00000000},
+- {0x0000a080, 0x22222229},
+- {0x0000a084, 0x1d1d1d1d},
+- {0x0000a088, 0x1d1d1d1d},
+- {0x0000a08c, 0x1d1d1d1d},
+- {0x0000a090, 0x171d1d1d},
+- {0x0000a094, 0x11111717},
+- {0x0000a098, 0x00030311},
+- {0x0000a09c, 0x00000000},
+- {0x0000a0a0, 0x00000000},
+- {0x0000a0a4, 0x00000000},
+- {0x0000a0a8, 0x00000000},
+- {0x0000a0ac, 0x00000000},
+- {0x0000a0b0, 0x00000000},
+- {0x0000a0b4, 0x00000000},
+- {0x0000a0b8, 0x00000000},
+- {0x0000a0bc, 0x00000000},
+- {0x0000a0c0, 0x001f0000},
+- {0x0000a0c4, 0x01000101},
+- {0x0000a0c8, 0x011e011f},
+- {0x0000a0cc, 0x011c011d},
+- {0x0000a0d0, 0x02030204},
+- {0x0000a0d4, 0x02010202},
+- {0x0000a0d8, 0x021f0200},
+- {0x0000a0dc, 0x0302021e},
+- {0x0000a0e0, 0x03000301},
+- {0x0000a0e4, 0x031e031f},
+- {0x0000a0e8, 0x0402031d},
+- {0x0000a0ec, 0x04000401},
+- {0x0000a0f0, 0x041e041f},
+- {0x0000a0f4, 0x0502041d},
+- {0x0000a0f8, 0x05000501},
+- {0x0000a0fc, 0x051e051f},
+- {0x0000a100, 0x06010602},
+- {0x0000a104, 0x061f0600},
+- {0x0000a108, 0x061d061e},
+- {0x0000a10c, 0x07020703},
+- {0x0000a110, 0x07000701},
+- {0x0000a114, 0x00000000},
+- {0x0000a118, 0x00000000},
+- {0x0000a11c, 0x00000000},
+- {0x0000a120, 0x00000000},
+- {0x0000a124, 0x00000000},
+- {0x0000a128, 0x00000000},
+- {0x0000a12c, 0x00000000},
+- {0x0000a130, 0x00000000},
+- {0x0000a134, 0x00000000},
+- {0x0000a138, 0x00000000},
+- {0x0000a13c, 0x00000000},
+- {0x0000a140, 0x001f0000},
+- {0x0000a144, 0x01000101},
+- {0x0000a148, 0x011e011f},
+- {0x0000a14c, 0x011c011d},
+- {0x0000a150, 0x02030204},
+- {0x0000a154, 0x02010202},
+- {0x0000a158, 0x021f0200},
+- {0x0000a15c, 0x0302021e},
+- {0x0000a160, 0x03000301},
+- {0x0000a164, 0x031e031f},
+- {0x0000a168, 0x0402031d},
+- {0x0000a16c, 0x04000401},
+- {0x0000a170, 0x041e041f},
+- {0x0000a174, 0x0502041d},
+- {0x0000a178, 0x05000501},
+- {0x0000a17c, 0x051e051f},
+- {0x0000a180, 0x06010602},
+- {0x0000a184, 0x061f0600},
+- {0x0000a188, 0x061d061e},
+- {0x0000a18c, 0x07020703},
+- {0x0000a190, 0x07000701},
+- {0x0000a194, 0x00000000},
+- {0x0000a198, 0x00000000},
+- {0x0000a19c, 0x00000000},
+- {0x0000a1a0, 0x00000000},
+- {0x0000a1a4, 0x00000000},
+- {0x0000a1a8, 0x00000000},
+- {0x0000a1ac, 0x00000000},
+- {0x0000a1b0, 0x00000000},
+- {0x0000a1b4, 0x00000000},
+- {0x0000a1b8, 0x00000000},
+- {0x0000a1bc, 0x00000000},
+- {0x0000a1c0, 0x00000000},
+- {0x0000a1c4, 0x00000000},
+- {0x0000a1c8, 0x00000000},
+- {0x0000a1cc, 0x00000000},
+- {0x0000a1d0, 0x00000000},
+- {0x0000a1d4, 0x00000000},
+- {0x0000a1d8, 0x00000000},
+- {0x0000a1dc, 0x00000000},
+- {0x0000a1e0, 0x00000000},
+- {0x0000a1e4, 0x00000000},
+- {0x0000a1e8, 0x00000000},
+- {0x0000a1ec, 0x00000000},
+- {0x0000a1f0, 0x00000396},
+- {0x0000a1f4, 0x00000396},
+- {0x0000a1f8, 0x00000396},
+- {0x0000a1fc, 0x00000196},
+- {0x0000b000, 0x00010000},
+- {0x0000b004, 0x00030002},
+- {0x0000b008, 0x00050004},
+- {0x0000b00c, 0x00810080},
+- {0x0000b010, 0x00830082},
+- {0x0000b014, 0x01810180},
+- {0x0000b018, 0x01830182},
+- {0x0000b01c, 0x01850184},
+- {0x0000b020, 0x02810280},
+- {0x0000b024, 0x02830282},
+- {0x0000b028, 0x02850284},
+- {0x0000b02c, 0x02890288},
+- {0x0000b030, 0x028b028a},
+- {0x0000b034, 0x0388028c},
+- {0x0000b038, 0x038a0389},
+- {0x0000b03c, 0x038c038b},
+- {0x0000b040, 0x0390038d},
+- {0x0000b044, 0x03920391},
+- {0x0000b048, 0x03940393},
+- {0x0000b04c, 0x03960395},
+- {0x0000b050, 0x00000000},
+- {0x0000b054, 0x00000000},
+- {0x0000b058, 0x00000000},
+- {0x0000b05c, 0x00000000},
+- {0x0000b060, 0x00000000},
+- {0x0000b064, 0x00000000},
+- {0x0000b068, 0x00000000},
+- {0x0000b06c, 0x00000000},
+- {0x0000b070, 0x00000000},
+- {0x0000b074, 0x00000000},
+- {0x0000b078, 0x00000000},
+- {0x0000b07c, 0x00000000},
+- {0x0000b080, 0x32323232},
+- {0x0000b084, 0x2f2f3232},
+- {0x0000b088, 0x23282a2d},
+- {0x0000b08c, 0x1c1e2123},
+- {0x0000b090, 0x14171919},
+- {0x0000b094, 0x0e0e1214},
+- {0x0000b098, 0x03050707},
+- {0x0000b09c, 0x00030303},
+- {0x0000b0a0, 0x00000000},
+- {0x0000b0a4, 0x00000000},
+- {0x0000b0a8, 0x00000000},
+- {0x0000b0ac, 0x00000000},
+- {0x0000b0b0, 0x00000000},
+- {0x0000b0b4, 0x00000000},
+- {0x0000b0b8, 0x00000000},
+- {0x0000b0bc, 0x00000000},
+- {0x0000b0c0, 0x003f0020},
+- {0x0000b0c4, 0x00400041},
+- {0x0000b0c8, 0x0140005f},
+- {0x0000b0cc, 0x0160015f},
+- {0x0000b0d0, 0x017e017f},
+- {0x0000b0d4, 0x02410242},
+- {0x0000b0d8, 0x025f0240},
+- {0x0000b0dc, 0x027f0260},
+- {0x0000b0e0, 0x0341027e},
+- {0x0000b0e4, 0x035f0340},
+- {0x0000b0e8, 0x037f0360},
+- {0x0000b0ec, 0x04400441},
+- {0x0000b0f0, 0x0460045f},
+- {0x0000b0f4, 0x0541047f},
+- {0x0000b0f8, 0x055f0540},
+- {0x0000b0fc, 0x057f0560},
+- {0x0000b100, 0x06400641},
+- {0x0000b104, 0x0660065f},
+- {0x0000b108, 0x067e067f},
+- {0x0000b10c, 0x07410742},
+- {0x0000b110, 0x075f0740},
+- {0x0000b114, 0x077f0760},
+- {0x0000b118, 0x07800781},
+- {0x0000b11c, 0x07a0079f},
+- {0x0000b120, 0x07c107bf},
+- {0x0000b124, 0x000007c0},
+- {0x0000b128, 0x00000000},
+- {0x0000b12c, 0x00000000},
+- {0x0000b130, 0x00000000},
+- {0x0000b134, 0x00000000},
+- {0x0000b138, 0x00000000},
+- {0x0000b13c, 0x00000000},
+- {0x0000b140, 0x003f0020},
+- {0x0000b144, 0x00400041},
+- {0x0000b148, 0x0140005f},
+- {0x0000b14c, 0x0160015f},
+- {0x0000b150, 0x017e017f},
+- {0x0000b154, 0x02410242},
+- {0x0000b158, 0x025f0240},
+- {0x0000b15c, 0x027f0260},
+- {0x0000b160, 0x0341027e},
+- {0x0000b164, 0x035f0340},
+- {0x0000b168, 0x037f0360},
+- {0x0000b16c, 0x04400441},
+- {0x0000b170, 0x0460045f},
+- {0x0000b174, 0x0541047f},
+- {0x0000b178, 0x055f0540},
+- {0x0000b17c, 0x057f0560},
+- {0x0000b180, 0x06400641},
+- {0x0000b184, 0x0660065f},
+- {0x0000b188, 0x067e067f},
+- {0x0000b18c, 0x07410742},
+- {0x0000b190, 0x075f0740},
+- {0x0000b194, 0x077f0760},
+- {0x0000b198, 0x07800781},
+- {0x0000b19c, 0x07a0079f},
+- {0x0000b1a0, 0x07c107bf},
+- {0x0000b1a4, 0x000007c0},
+- {0x0000b1a8, 0x00000000},
+- {0x0000b1ac, 0x00000000},
+- {0x0000b1b0, 0x00000000},
+- {0x0000b1b4, 0x00000000},
+- {0x0000b1b8, 0x00000000},
+- {0x0000b1bc, 0x00000000},
+- {0x0000b1c0, 0x00000000},
+- {0x0000b1c4, 0x00000000},
+- {0x0000b1c8, 0x00000000},
+- {0x0000b1cc, 0x00000000},
+- {0x0000b1d0, 0x00000000},
+- {0x0000b1d4, 0x00000000},
+- {0x0000b1d8, 0x00000000},
+- {0x0000b1dc, 0x00000000},
+- {0x0000b1e0, 0x00000000},
+- {0x0000b1e4, 0x00000000},
+- {0x0000b1e8, 0x00000000},
+- {0x0000b1ec, 0x00000000},
+- {0x0000b1f0, 0x00000396},
+- {0x0000b1f4, 0x00000396},
+- {0x0000b1f8, 0x00000396},
+- {0x0000b1fc, 0x00000196},
+-};
+-
+-static const u32 ar9300Modes_low_ob_db_tx_gain_table_2p0[][5] = {
+- /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
+- {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
+- {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
+- {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002},
+- {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004},
+- {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200},
+- {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202},
+- {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400},
+- {0x0000a518, 0x21020220, 0x21020220, 0x16000402, 0x16000402},
+- {0x0000a51c, 0x27020223, 0x27020223, 0x19000404, 0x19000404},
+- {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603},
+- {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02},
+- {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04},
+- {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20},
+- {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20},
+- {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22},
+- {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24},
+- {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640},
+- {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660},
+- {0x0000a544, 0x5302266c, 0x5302266c, 0x3f001861, 0x3f001861},
+- {0x0000a548, 0x5702286c, 0x5702286c, 0x43001a81, 0x43001a81},
+- {0x0000a54c, 0x5c04286b, 0x5c04286b, 0x47001a83, 0x47001a83},
+- {0x0000a550, 0x61042a6c, 0x61042a6c, 0x4a001c84, 0x4a001c84},
+- {0x0000a554, 0x66062a6c, 0x66062a6c, 0x4e001ce3, 0x4e001ce3},
+- {0x0000a558, 0x6b062e6c, 0x6b062e6c, 0x52001ce5, 0x52001ce5},
+- {0x0000a55c, 0x7006308c, 0x7006308c, 0x56001ce9, 0x56001ce9},
+- {0x0000a560, 0x730a308a, 0x730a308a, 0x5a001ceb, 0x5a001ceb},
+- {0x0000a564, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
+- {0x0000a568, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
+- {0x0000a56c, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
+- {0x0000a570, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
+- {0x0000a574, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
+- {0x0000a578, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
+- {0x0000a57c, 0x770a308c, 0x770a308c, 0x5d001eec, 0x5d001eec},
+- {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000},
+- {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002},
+- {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004},
+- {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200},
+- {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202},
+- {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400},
+- {0x0000a598, 0x21820220, 0x21820220, 0x16800402, 0x16800402},
+- {0x0000a59c, 0x27820223, 0x27820223, 0x19800404, 0x19800404},
+- {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603},
+- {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02},
+- {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04},
+- {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20},
+- {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20},
+- {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22},
+- {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24},
+- {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640},
+- {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660},
+- {0x0000a5c4, 0x5382266c, 0x5382266c, 0x3f801861, 0x3f801861},
+- {0x0000a5c8, 0x5782286c, 0x5782286c, 0x43801a81, 0x43801a81},
+- {0x0000a5cc, 0x5c84286b, 0x5c84286b, 0x47801a83, 0x47801a83},
+- {0x0000a5d0, 0x61842a6c, 0x61842a6c, 0x4a801c84, 0x4a801c84},
+- {0x0000a5d4, 0x66862a6c, 0x66862a6c, 0x4e801ce3, 0x4e801ce3},
+- {0x0000a5d8, 0x6b862e6c, 0x6b862e6c, 0x52801ce5, 0x52801ce5},
+- {0x0000a5dc, 0x7086308c, 0x7086308c, 0x56801ce9, 0x56801ce9},
+- {0x0000a5e0, 0x738a308a, 0x738a308a, 0x5a801ceb, 0x5a801ceb},
+- {0x0000a5e4, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
+- {0x0000a5e8, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
+- {0x0000a5ec, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
+- {0x0000a5f0, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
+- {0x0000a5f4, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
+- {0x0000a5f8, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
+- {0x0000a5fc, 0x778a308c, 0x778a308c, 0x5d801eec, 0x5d801eec},
+- {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
+- {0x00016048, 0x64000001, 0x64000001, 0x64000001, 0x64000001},
+- {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
+- {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
+- {0x00016448, 0x64000001, 0x64000001, 0x64000001, 0x64000001},
+- {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
+- {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
+- {0x00016848, 0x64000001, 0x64000001, 0x64000001, 0x64000001},
+- {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
+-};
+-
+-static const u32 ar9300_2p0_mac_core[][2] = {
+- /* Addr allmodes */
+- {0x00000008, 0x00000000},
+- {0x00000030, 0x00020085},
+- {0x00000034, 0x00000005},
+- {0x00000040, 0x00000000},
+- {0x00000044, 0x00000000},
+- {0x00000048, 0x00000008},
+- {0x0000004c, 0x00000010},
+- {0x00000050, 0x00000000},
+- {0x00001040, 0x002ffc0f},
+- {0x00001044, 0x002ffc0f},
+- {0x00001048, 0x002ffc0f},
+- {0x0000104c, 0x002ffc0f},
+- {0x00001050, 0x002ffc0f},
+- {0x00001054, 0x002ffc0f},
+- {0x00001058, 0x002ffc0f},
+- {0x0000105c, 0x002ffc0f},
+- {0x00001060, 0x002ffc0f},
+- {0x00001064, 0x002ffc0f},
+- {0x000010f0, 0x00000100},
+- {0x00001270, 0x00000000},
+- {0x000012b0, 0x00000000},
+- {0x000012f0, 0x00000000},
+- {0x0000143c, 0x00000000},
+- {0x0000147c, 0x00000000},
+- {0x00008000, 0x00000000},
+- {0x00008004, 0x00000000},
+- {0x00008008, 0x00000000},
+- {0x0000800c, 0x00000000},
+- {0x00008018, 0x00000000},
+- {0x00008020, 0x00000000},
+- {0x00008038, 0x00000000},
+- {0x0000803c, 0x00000000},
+- {0x00008040, 0x00000000},
+- {0x00008044, 0x00000000},
+- {0x00008048, 0x00000000},
+- {0x0000804c, 0xffffffff},
+- {0x00008054, 0x00000000},
+- {0x00008058, 0x00000000},
+- {0x0000805c, 0x000fc78f},
+- {0x00008060, 0x0000000f},
+- {0x00008064, 0x00000000},
+- {0x00008070, 0x00000310},
+- {0x00008074, 0x00000020},
+- {0x00008078, 0x00000000},
+- {0x0000809c, 0x0000000f},
+- {0x000080a0, 0x00000000},
+- {0x000080a4, 0x02ff0000},
+- {0x000080a8, 0x0e070605},
+- {0x000080ac, 0x0000000d},
+- {0x000080b0, 0x00000000},
+- {0x000080b4, 0x00000000},
+- {0x000080b8, 0x00000000},
+- {0x000080bc, 0x00000000},
+- {0x000080c0, 0x2a800000},
+- {0x000080c4, 0x06900168},
+- {0x000080c8, 0x13881c20},
+- {0x000080cc, 0x01f40000},
+- {0x000080d0, 0x00252500},
+- {0x000080d4, 0x00a00000},
+- {0x000080d8, 0x00400000},
+- {0x000080dc, 0x00000000},
+- {0x000080e0, 0xffffffff},
+- {0x000080e4, 0x0000ffff},
+- {0x000080e8, 0x3f3f3f3f},
+- {0x000080ec, 0x00000000},
+- {0x000080f0, 0x00000000},
+- {0x000080f4, 0x00000000},
+- {0x000080fc, 0x00020000},
+- {0x00008100, 0x00000000},
+- {0x00008108, 0x00000052},
+- {0x0000810c, 0x00000000},
+- {0x00008110, 0x00000000},
+- {0x00008114, 0x000007ff},
+- {0x00008118, 0x000000aa},
+- {0x0000811c, 0x00003210},
+- {0x00008124, 0x00000000},
+- {0x00008128, 0x00000000},
+- {0x0000812c, 0x00000000},
+- {0x00008130, 0x00000000},
+- {0x00008134, 0x00000000},
+- {0x00008138, 0x00000000},
+- {0x0000813c, 0x0000ffff},
+- {0x00008144, 0xffffffff},
+- {0x00008168, 0x00000000},
+- {0x0000816c, 0x00000000},
+- {0x00008170, 0x18486200},
+- {0x00008174, 0x33332210},
+- {0x00008178, 0x00000000},
+- {0x0000817c, 0x00020000},
+- {0x000081c0, 0x00000000},
+- {0x000081c4, 0x33332210},
+- {0x000081c8, 0x00000000},
+- {0x000081cc, 0x00000000},
+- {0x000081d4, 0x00000000},
+- {0x000081ec, 0x00000000},
+- {0x000081f0, 0x00000000},
+- {0x000081f4, 0x00000000},
+- {0x000081f8, 0x00000000},
+- {0x000081fc, 0x00000000},
+- {0x00008240, 0x00100000},
+- {0x00008244, 0x0010f424},
+- {0x00008248, 0x00000800},
+- {0x0000824c, 0x0001e848},
+- {0x00008250, 0x00000000},
+- {0x00008254, 0x00000000},
+- {0x00008258, 0x00000000},
+- {0x0000825c, 0x40000000},
+- {0x00008260, 0x00080922},
+- {0x00008264, 0x98a00010},
+- {0x00008268, 0xffffffff},
+- {0x0000826c, 0x0000ffff},
+- {0x00008270, 0x00000000},
+- {0x00008274, 0x40000000},
+- {0x00008278, 0x003e4180},
+- {0x0000827c, 0x00000004},
+- {0x00008284, 0x0000002c},
+- {0x00008288, 0x0000002c},
+- {0x0000828c, 0x000000ff},
+- {0x00008294, 0x00000000},
+- {0x00008298, 0x00000000},
+- {0x0000829c, 0x00000000},
+- {0x00008300, 0x00000140},
+- {0x00008314, 0x00000000},
+- {0x0000831c, 0x0000010d},
+- {0x00008328, 0x00000000},
+- {0x0000832c, 0x00000007},
+- {0x00008330, 0x00000302},
+- {0x00008334, 0x00000700},
+- {0x00008338, 0x00ff0000},
+- {0x0000833c, 0x02400000},
+- {0x00008340, 0x000107ff},
+- {0x00008344, 0xaa48105b},
+- {0x00008348, 0x008f0000},
+- {0x0000835c, 0x00000000},
+- {0x00008360, 0xffffffff},
+- {0x00008364, 0xffffffff},
+- {0x00008368, 0x00000000},
+- {0x00008370, 0x00000000},
+- {0x00008374, 0x000000ff},
+- {0x00008378, 0x00000000},
+- {0x0000837c, 0x00000000},
+- {0x00008380, 0xffffffff},
+- {0x00008384, 0xffffffff},
+- {0x00008390, 0xffffffff},
+- {0x00008394, 0xffffffff},
+- {0x00008398, 0x00000000},
+- {0x0000839c, 0x00000000},
+- {0x000083a0, 0x00000000},
+- {0x000083a4, 0x0000fa14},
+- {0x000083a8, 0x000f0c00},
+- {0x000083ac, 0x33332210},
+- {0x000083b0, 0x33332210},
+- {0x000083b4, 0x33332210},
+- {0x000083b8, 0x33332210},
+- {0x000083bc, 0x00000000},
+- {0x000083c0, 0x00000000},
+- {0x000083c4, 0x00000000},
+- {0x000083c8, 0x00000000},
+- {0x000083cc, 0x00000200},
+- {0x000083d0, 0x000301ff},
+-};
+-
+-static const u32 ar9300Common_wo_xlna_rx_gain_table_2p0[][2] = {
+- /* Addr allmodes */
+- {0x0000a000, 0x00010000},
+- {0x0000a004, 0x00030002},
+- {0x0000a008, 0x00050004},
+- {0x0000a00c, 0x00810080},
+- {0x0000a010, 0x00830082},
+- {0x0000a014, 0x01810180},
+- {0x0000a018, 0x01830182},
+- {0x0000a01c, 0x01850184},
+- {0x0000a020, 0x01890188},
+- {0x0000a024, 0x018b018a},
+- {0x0000a028, 0x018d018c},
+- {0x0000a02c, 0x03820190},
+- {0x0000a030, 0x03840383},
+- {0x0000a034, 0x03880385},
+- {0x0000a038, 0x038a0389},
+- {0x0000a03c, 0x038c038b},
+- {0x0000a040, 0x0390038d},
+- {0x0000a044, 0x03920391},
+- {0x0000a048, 0x03940393},
+- {0x0000a04c, 0x03960395},
+- {0x0000a050, 0x00000000},
+- {0x0000a054, 0x00000000},
+- {0x0000a058, 0x00000000},
+- {0x0000a05c, 0x00000000},
+- {0x0000a060, 0x00000000},
+- {0x0000a064, 0x00000000},
+- {0x0000a068, 0x00000000},
+- {0x0000a06c, 0x00000000},
+- {0x0000a070, 0x00000000},
+- {0x0000a074, 0x00000000},
+- {0x0000a078, 0x00000000},
+- {0x0000a07c, 0x00000000},
+- {0x0000a080, 0x29292929},
+- {0x0000a084, 0x29292929},
+- {0x0000a088, 0x29292929},
+- {0x0000a08c, 0x29292929},
+- {0x0000a090, 0x22292929},
+- {0x0000a094, 0x1d1d2222},
+- {0x0000a098, 0x0c111117},
+- {0x0000a09c, 0x00030303},
+- {0x0000a0a0, 0x00000000},
+- {0x0000a0a4, 0x00000000},
+- {0x0000a0a8, 0x00000000},
+- {0x0000a0ac, 0x00000000},
+- {0x0000a0b0, 0x00000000},
+- {0x0000a0b4, 0x00000000},
+- {0x0000a0b8, 0x00000000},
+- {0x0000a0bc, 0x00000000},
+- {0x0000a0c0, 0x001f0000},
+- {0x0000a0c4, 0x01000101},
+- {0x0000a0c8, 0x011e011f},
+- {0x0000a0cc, 0x011c011d},
+- {0x0000a0d0, 0x02030204},
+- {0x0000a0d4, 0x02010202},
+- {0x0000a0d8, 0x021f0200},
+- {0x0000a0dc, 0x0302021e},
+- {0x0000a0e0, 0x03000301},
+- {0x0000a0e4, 0x031e031f},
+- {0x0000a0e8, 0x0402031d},
+- {0x0000a0ec, 0x04000401},
+- {0x0000a0f0, 0x041e041f},
+- {0x0000a0f4, 0x0502041d},
+- {0x0000a0f8, 0x05000501},
+- {0x0000a0fc, 0x051e051f},
+- {0x0000a100, 0x06010602},
+- {0x0000a104, 0x061f0600},
+- {0x0000a108, 0x061d061e},
+- {0x0000a10c, 0x07020703},
+- {0x0000a110, 0x07000701},
+- {0x0000a114, 0x00000000},
+- {0x0000a118, 0x00000000},
+- {0x0000a11c, 0x00000000},
+- {0x0000a120, 0x00000000},
+- {0x0000a124, 0x00000000},
+- {0x0000a128, 0x00000000},
+- {0x0000a12c, 0x00000000},
+- {0x0000a130, 0x00000000},
+- {0x0000a134, 0x00000000},
+- {0x0000a138, 0x00000000},
+- {0x0000a13c, 0x00000000},
+- {0x0000a140, 0x001f0000},
+- {0x0000a144, 0x01000101},
+- {0x0000a148, 0x011e011f},
+- {0x0000a14c, 0x011c011d},
+- {0x0000a150, 0x02030204},
+- {0x0000a154, 0x02010202},
+- {0x0000a158, 0x021f0200},
+- {0x0000a15c, 0x0302021e},
+- {0x0000a160, 0x03000301},
+- {0x0000a164, 0x031e031f},
+- {0x0000a168, 0x0402031d},
+- {0x0000a16c, 0x04000401},
+- {0x0000a170, 0x041e041f},
+- {0x0000a174, 0x0502041d},
+- {0x0000a178, 0x05000501},
+- {0x0000a17c, 0x051e051f},
+- {0x0000a180, 0x06010602},
+- {0x0000a184, 0x061f0600},
+- {0x0000a188, 0x061d061e},
+- {0x0000a18c, 0x07020703},
+- {0x0000a190, 0x07000701},
+- {0x0000a194, 0x00000000},
+- {0x0000a198, 0x00000000},
+- {0x0000a19c, 0x00000000},
+- {0x0000a1a0, 0x00000000},
+- {0x0000a1a4, 0x00000000},
+- {0x0000a1a8, 0x00000000},
+- {0x0000a1ac, 0x00000000},
+- {0x0000a1b0, 0x00000000},
+- {0x0000a1b4, 0x00000000},
+- {0x0000a1b8, 0x00000000},
+- {0x0000a1bc, 0x00000000},
+- {0x0000a1c0, 0x00000000},
+- {0x0000a1c4, 0x00000000},
+- {0x0000a1c8, 0x00000000},
+- {0x0000a1cc, 0x00000000},
+- {0x0000a1d0, 0x00000000},
+- {0x0000a1d4, 0x00000000},
+- {0x0000a1d8, 0x00000000},
+- {0x0000a1dc, 0x00000000},
+- {0x0000a1e0, 0x00000000},
+- {0x0000a1e4, 0x00000000},
+- {0x0000a1e8, 0x00000000},
+- {0x0000a1ec, 0x00000000},
+- {0x0000a1f0, 0x00000396},
+- {0x0000a1f4, 0x00000396},
+- {0x0000a1f8, 0x00000396},
+- {0x0000a1fc, 0x00000196},
+- {0x0000b000, 0x00010000},
+- {0x0000b004, 0x00030002},
+- {0x0000b008, 0x00050004},
+- {0x0000b00c, 0x00810080},
+- {0x0000b010, 0x00830082},
+- {0x0000b014, 0x01810180},
+- {0x0000b018, 0x01830182},
+- {0x0000b01c, 0x01850184},
+- {0x0000b020, 0x02810280},
+- {0x0000b024, 0x02830282},
+- {0x0000b028, 0x02850284},
+- {0x0000b02c, 0x02890288},
+- {0x0000b030, 0x028b028a},
+- {0x0000b034, 0x0388028c},
+- {0x0000b038, 0x038a0389},
+- {0x0000b03c, 0x038c038b},
+- {0x0000b040, 0x0390038d},
+- {0x0000b044, 0x03920391},
+- {0x0000b048, 0x03940393},
+- {0x0000b04c, 0x03960395},
+- {0x0000b050, 0x00000000},
+- {0x0000b054, 0x00000000},
+- {0x0000b058, 0x00000000},
+- {0x0000b05c, 0x00000000},
+- {0x0000b060, 0x00000000},
+- {0x0000b064, 0x00000000},
+- {0x0000b068, 0x00000000},
+- {0x0000b06c, 0x00000000},
+- {0x0000b070, 0x00000000},
+- {0x0000b074, 0x00000000},
+- {0x0000b078, 0x00000000},
+- {0x0000b07c, 0x00000000},
+- {0x0000b080, 0x32323232},
+- {0x0000b084, 0x2f2f3232},
+- {0x0000b088, 0x23282a2d},
+- {0x0000b08c, 0x1c1e2123},
+- {0x0000b090, 0x14171919},
+- {0x0000b094, 0x0e0e1214},
+- {0x0000b098, 0x03050707},
+- {0x0000b09c, 0x00030303},
+- {0x0000b0a0, 0x00000000},
+- {0x0000b0a4, 0x00000000},
+- {0x0000b0a8, 0x00000000},
+- {0x0000b0ac, 0x00000000},
+- {0x0000b0b0, 0x00000000},
+- {0x0000b0b4, 0x00000000},
+- {0x0000b0b8, 0x00000000},
+- {0x0000b0bc, 0x00000000},
+- {0x0000b0c0, 0x003f0020},
+- {0x0000b0c4, 0x00400041},
+- {0x0000b0c8, 0x0140005f},
+- {0x0000b0cc, 0x0160015f},
+- {0x0000b0d0, 0x017e017f},
+- {0x0000b0d4, 0x02410242},
+- {0x0000b0d8, 0x025f0240},
+- {0x0000b0dc, 0x027f0260},
+- {0x0000b0e0, 0x0341027e},
+- {0x0000b0e4, 0x035f0340},
+- {0x0000b0e8, 0x037f0360},
+- {0x0000b0ec, 0x04400441},
+- {0x0000b0f0, 0x0460045f},
+- {0x0000b0f4, 0x0541047f},
+- {0x0000b0f8, 0x055f0540},
+- {0x0000b0fc, 0x057f0560},
+- {0x0000b100, 0x06400641},
+- {0x0000b104, 0x0660065f},
+- {0x0000b108, 0x067e067f},
+- {0x0000b10c, 0x07410742},
+- {0x0000b110, 0x075f0740},
+- {0x0000b114, 0x077f0760},
+- {0x0000b118, 0x07800781},
+- {0x0000b11c, 0x07a0079f},
+- {0x0000b120, 0x07c107bf},
+- {0x0000b124, 0x000007c0},
+- {0x0000b128, 0x00000000},
+- {0x0000b12c, 0x00000000},
+- {0x0000b130, 0x00000000},
+- {0x0000b134, 0x00000000},
+- {0x0000b138, 0x00000000},
+- {0x0000b13c, 0x00000000},
+- {0x0000b140, 0x003f0020},
+- {0x0000b144, 0x00400041},
+- {0x0000b148, 0x0140005f},
+- {0x0000b14c, 0x0160015f},
+- {0x0000b150, 0x017e017f},
+- {0x0000b154, 0x02410242},
+- {0x0000b158, 0x025f0240},
+- {0x0000b15c, 0x027f0260},
+- {0x0000b160, 0x0341027e},
+- {0x0000b164, 0x035f0340},
+- {0x0000b168, 0x037f0360},
+- {0x0000b16c, 0x04400441},
+- {0x0000b170, 0x0460045f},
+- {0x0000b174, 0x0541047f},
+- {0x0000b178, 0x055f0540},
+- {0x0000b17c, 0x057f0560},
+- {0x0000b180, 0x06400641},
+- {0x0000b184, 0x0660065f},
+- {0x0000b188, 0x067e067f},
+- {0x0000b18c, 0x07410742},
+- {0x0000b190, 0x075f0740},
+- {0x0000b194, 0x077f0760},
+- {0x0000b198, 0x07800781},
+- {0x0000b19c, 0x07a0079f},
+- {0x0000b1a0, 0x07c107bf},
+- {0x0000b1a4, 0x000007c0},
+- {0x0000b1a8, 0x00000000},
+- {0x0000b1ac, 0x00000000},
+- {0x0000b1b0, 0x00000000},
+- {0x0000b1b4, 0x00000000},
+- {0x0000b1b8, 0x00000000},
+- {0x0000b1bc, 0x00000000},
+- {0x0000b1c0, 0x00000000},
+- {0x0000b1c4, 0x00000000},
+- {0x0000b1c8, 0x00000000},
+- {0x0000b1cc, 0x00000000},
+- {0x0000b1d0, 0x00000000},
+- {0x0000b1d4, 0x00000000},
+- {0x0000b1d8, 0x00000000},
+- {0x0000b1dc, 0x00000000},
+- {0x0000b1e0, 0x00000000},
+- {0x0000b1e4, 0x00000000},
+- {0x0000b1e8, 0x00000000},
+- {0x0000b1ec, 0x00000000},
+- {0x0000b1f0, 0x00000396},
+- {0x0000b1f4, 0x00000396},
+- {0x0000b1f8, 0x00000396},
+- {0x0000b1fc, 0x00000196},
+-};
+-
+-static const u32 ar9300_2p0_soc_preamble[][2] = {
+- /* Addr allmodes */
+- {0x000040a4, 0x00a0c1c9},
+- {0x00007008, 0x00000000},
+- {0x00007020, 0x00000000},
+- {0x00007034, 0x00000002},
+- {0x00007038, 0x000004c2},
+-};
+-
+-static const u32 ar9300PciePhy_pll_on_clkreq_disable_L1_2p0[][2] = {
+- /* Addr allmodes */
+- {0x00004040, 0x08212e5e},
+- {0x00004040, 0x0008003b},
+- {0x00004044, 0x00000000},
+-};
+-
+-static const u32 ar9300PciePhy_clkreq_enable_L1_2p0[][2] = {
+- /* Addr allmodes */
+- {0x00004040, 0x08253e5e},
+- {0x00004040, 0x0008003b},
+- {0x00004044, 0x00000000},
+-};
+-
+-static const u32 ar9300PciePhy_clkreq_disable_L1_2p0[][2] = {
+- /* Addr allmodes */
+- {0x00004040, 0x08213e5e},
+- {0x00004040, 0x0008003b},
+- {0x00004044, 0x00000000},
+-};
+-
+-#endif /* INITVALS_9003_H */
+--- a/drivers/net/wireless/ath/ath9k/beacon.c
++++ b/drivers/net/wireless/ath/ath9k/beacon.c
+@@ -76,22 +76,13 @@ static void ath_beacon_setup(struct ath_
+ ds = bf->bf_desc;
+ flags = ATH9K_TXDESC_NOACK;
+
+- if (((sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) ||
+- (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) &&
+- (ah->caps.hw_caps & ATH9K_HW_CAP_VEOL)) {
+- ds->ds_link = bf->bf_daddr; /* self-linked */
+- flags |= ATH9K_TXDESC_VEOL;
+- /* Let hardware handle antenna switching. */
+- antenna = 0;
+- } else {
+- ds->ds_link = 0;
+- /*
+- * Switch antenna every beacon.
+- * Should only switch every beacon period, not for every SWBA
+- * XXX assumes two antennae
+- */
+- antenna = ((sc->beacon.ast_be_xmit / sc->nbcnvifs) & 1 ? 2 : 1);
+- }
++ ds->ds_link = 0;
++ /*
++ * Switch antenna every beacon.
++ * Should only switch every beacon period, not for every SWBA
++ * XXX assumes two antennae
++ */
++ antenna = ((sc->beacon.ast_be_xmit / sc->nbcnvifs) & 1 ? 2 : 1);
+
+ sband = &sc->sbands[common->hw->conf.channel->band];
+ rate = sband->bitrates[rateidx].hw_value;
+@@ -215,36 +206,6 @@ static struct ath_buf *ath_beacon_genera
+ return bf;
+ }
+
+-/*
+- * Startup beacon transmission for adhoc mode when they are sent entirely
+- * by the hardware using the self-linked descriptor + veol trick.
+-*/
+-static void ath_beacon_start_adhoc(struct ath_softc *sc,
+- struct ieee80211_vif *vif)
+-{
+- struct ath_hw *ah = sc->sc_ah;
+- struct ath_common *common = ath9k_hw_common(ah);
+- struct ath_buf *bf;
+- struct ath_vif *avp;
+- struct sk_buff *skb;
+-
+- avp = (void *)vif->drv_priv;
+-
+- if (avp->av_bcbuf == NULL)
+- return;
+-
+- bf = avp->av_bcbuf;
+- skb = bf->bf_mpdu;
+-
+- ath_beacon_setup(sc, avp, bf, 0);
+-
+- /* NB: caller is known to have already stopped tx dma */
+- ath9k_hw_puttxbuf(ah, sc->beacon.beaconq, bf->bf_daddr);
+- ath9k_hw_txstart(ah, sc->beacon.beaconq);
+- ath_print(common, ATH_DBG_BEACON, "TXDP%u = %llx (%p)\n",
+- sc->beacon.beaconq, ito64(bf->bf_daddr), bf->bf_desc);
+-}
+-
+ int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif)
+ {
+ struct ath_softc *sc = aphy->sc;
+@@ -265,7 +226,8 @@ int ath_beacon_alloc(struct ath_wiphy *a
+ list_del(&avp->av_bcbuf->list);
+
+ if (sc->sc_ah->opmode == NL80211_IFTYPE_AP ||
+- !(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_VEOL)) {
++ sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC ||
++ sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT) {
+ int slot;
+ /*
+ * Assign the vif to a beacon xmit slot. As
+@@ -274,17 +236,11 @@ int ath_beacon_alloc(struct ath_wiphy *a
+ avp->av_bslot = 0;
+ for (slot = 0; slot < ATH_BCBUF; slot++)
+ if (sc->beacon.bslot[slot] == NULL) {
+- /*
+- * XXX hack, space out slots to better
+- * deal with misses
+- */
+- if (slot+1 < ATH_BCBUF &&
+- sc->beacon.bslot[slot+1] == NULL) {
+- avp->av_bslot = slot+1;
+- break;
+- }
+ avp->av_bslot = slot;
++
+ /* NB: keep looking for a double slot */
++ if (slot == 0 || !sc->beacon.bslot[slot-1])
++ break;
+ }
+ BUG_ON(sc->beacon.bslot[avp->av_bslot] != NULL);
+ sc->beacon.bslot[avp->av_bslot] = vif;
+@@ -721,8 +677,7 @@ static void ath_beacon_config_adhoc(stru
+ * self-linked tx descriptor and let the hardware deal with things.
+ */
+ intval |= ATH9K_BEACON_ENA;
+- if (!(ah->caps.hw_caps & ATH9K_HW_CAP_VEOL))
+- ah->imask |= ATH9K_INT_SWBA;
++ ah->imask |= ATH9K_INT_SWBA;
+
+ ath_beaconq_config(sc);
+
+@@ -732,10 +687,6 @@ static void ath_beacon_config_adhoc(stru
+ ath9k_beacon_init(sc, nexttbtt, intval);
+ sc->beacon.bmisscnt = 0;
+ ath9k_hw_set_interrupts(ah, ah->imask);
+-
+- /* FIXME: Handle properly when vif is NULL */
+- if (vif && ah->caps.hw_caps & ATH9K_HW_CAP_VEOL)
+- ath_beacon_start_adhoc(sc, vif);
+ }
+
+ void ath_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif)
+--- a/net/mac80211/Kconfig
++++ b/net/mac80211/Kconfig
+@@ -33,6 +33,13 @@ config MAC80211_RC_MINSTREL
+ ---help---
+ This option enables the 'minstrel' TX rate control algorithm
+
++config MAC80211_RC_MINSTREL_HT
++ bool "Minstrel 802.11n support" if EMBEDDED
++ depends on MAC80211_RC_MINSTREL
++ default y
++ ---help---
++ This option enables the 'minstrel_ht' TX rate control algorithm
++
+ choice
+ prompt "Default rate control algorithm"
+ depends on MAC80211_HAS_RC
+--- a/net/mac80211/Makefile
++++ b/net/mac80211/Makefile
+@@ -51,7 +51,11 @@ rc80211_pid-$(CONFIG_MAC80211_DEBUGFS) +
+ rc80211_minstrel-y := rc80211_minstrel.o
+ rc80211_minstrel-$(CONFIG_MAC80211_DEBUGFS) += rc80211_minstrel_debugfs.o
+
++rc80211_minstrel_ht-y := rc80211_minstrel_ht.o
++rc80211_minstrel_ht-$(CONFIG_MAC80211_DEBUGFS) += rc80211_minstrel_ht_debugfs.o
++
+ mac80211-$(CONFIG_MAC80211_RC_PID) += $(rc80211_pid-y)
+ mac80211-$(CONFIG_MAC80211_RC_MINSTREL) += $(rc80211_minstrel-y)
++mac80211-$(CONFIG_MAC80211_RC_MINSTREL_HT) += $(rc80211_minstrel_ht-y)
+
+ ccflags-y += -D__CHECK_ENDIAN__
+--- a/net/mac80211/main.c
++++ b/net/mac80211/main.c
+@@ -701,6 +701,10 @@ static int __init ieee80211_init(void)
+ if (ret)
+ return ret;
+
++ ret = rc80211_minstrel_ht_init();
++ if (ret)
++ goto err_minstrel;
++
+ ret = rc80211_pid_init();
+ if (ret)
+ goto err_pid;
+@@ -713,6 +717,8 @@ static int __init ieee80211_init(void)
+ err_netdev:
+ rc80211_pid_exit();
+ err_pid:
++ rc80211_minstrel_ht_exit();
++ err_minstrel:
+ rc80211_minstrel_exit();
+
+ return ret;
+@@ -721,6 +727,7 @@ static int __init ieee80211_init(void)
+ static void __exit ieee80211_exit(void)
+ {
+ rc80211_pid_exit();
++ rc80211_minstrel_ht_exit();
+ rc80211_minstrel_exit();
+
+ /*
+--- a/net/mac80211/rate.h
++++ b/net/mac80211/rate.h
+@@ -147,5 +147,18 @@ static inline void rc80211_minstrel_exit
+ }
+ #endif
+
++#ifdef CONFIG_MAC80211_RC_MINSTREL_HT
++extern int rc80211_minstrel_ht_init(void);
++extern void rc80211_minstrel_ht_exit(void);
++#else
++static inline int rc80211_minstrel_ht_init(void)
++{
++ return 0;
++}
++static inline void rc80211_minstrel_ht_exit(void)
++{
++}
++#endif
++
+
+ #endif /* IEEE80211_RATE_H */
+--- /dev/null
++++ b/net/mac80211/rc80211_minstrel_ht.c
+@@ -0,0 +1,824 @@
++/*
++ * Copyright (C) 2010 Felix Fietkau <nbd@openwrt.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ */
++#include <linux/netdevice.h>
++#include <linux/types.h>
++#include <linux/skbuff.h>
++#include <linux/debugfs.h>
++#include <linux/random.h>
++#include <linux/ieee80211.h>
++#include <net/mac80211.h>
++#include "rate.h"
++#include "rc80211_minstrel.h"
++#include "rc80211_minstrel_ht.h"
++
++#define AVG_PKT_SIZE 1200
++#define SAMPLE_COLUMNS 10
++#define EWMA_LEVEL 75
++
++/* Number of bits for an average sized packet */
++#define MCS_NBITS (AVG_PKT_SIZE << 3)
++
++/* Number of symbols for a packet with (bps) bits per symbol */
++#define MCS_NSYMS(bps) ((MCS_NBITS + (bps) - 1) / (bps))
++
++/* Transmission time for a packet containing (syms) symbols */
++#define MCS_SYMBOL_TIME(sgi, syms) \
++ (sgi ? \
++ ((syms) * 18 + 4) / 5 : /* syms * 3.6 us */ \
++ (syms) << 2 /* syms * 4 us */ \
++ )
++
++/* Transmit duration for the raw data part of an average sized packet */
++#define MCS_DURATION(streams, sgi, bps) MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps)))
++
++/* MCS rate information for an MCS group */
++#define MCS_GROUP(_streams, _sgi, _ht40) { \
++ .streams = _streams, \
++ .flags = \
++ (_sgi ? IEEE80211_TX_RC_SHORT_GI : 0) | \
++ (_ht40 ? IEEE80211_TX_RC_40_MHZ_WIDTH : 0), \
++ .duration = { \
++ MCS_DURATION(_streams, _sgi, _ht40 ? 54 : 26), \
++ MCS_DURATION(_streams, _sgi, _ht40 ? 108 : 52), \
++ MCS_DURATION(_streams, _sgi, _ht40 ? 162 : 78), \
++ MCS_DURATION(_streams, _sgi, _ht40 ? 216 : 104), \
++ MCS_DURATION(_streams, _sgi, _ht40 ? 324 : 156), \
++ MCS_DURATION(_streams, _sgi, _ht40 ? 432 : 208), \
++ MCS_DURATION(_streams, _sgi, _ht40 ? 486 : 234), \
++ MCS_DURATION(_streams, _sgi, _ht40 ? 540 : 260) \
++ } \
++}
++
++/*
++ * To enable sufficiently targeted rate sampling, MCS rates are divided into
++ * groups, based on the number of streams and flags (HT40, SGI) that they
++ * use.
++ */
++const struct mcs_group minstrel_mcs_groups[] = {
++ MCS_GROUP(1, 0, 0),
++ MCS_GROUP(2, 0, 0),
++#if MINSTREL_MAX_STREAMS >= 3
++ MCS_GROUP(3, 0, 0),
++#endif
++
++ MCS_GROUP(1, 1, 0),
++ MCS_GROUP(2, 1, 0),
++#if MINSTREL_MAX_STREAMS >= 3
++ MCS_GROUP(3, 1, 0),
++#endif
++
++ MCS_GROUP(1, 0, 1),
++ MCS_GROUP(2, 0, 1),
++#if MINSTREL_MAX_STREAMS >= 3
++ MCS_GROUP(3, 0, 1),
++#endif
++
++ MCS_GROUP(1, 1, 1),
++ MCS_GROUP(2, 1, 1),
++#if MINSTREL_MAX_STREAMS >= 3
++ MCS_GROUP(3, 1, 1),
++#endif
++};
++
++static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES];
++
++/*
++ * Perform EWMA (Exponentially Weighted Moving Average) calculation
++ */
++static int
++minstrel_ewma(int old, int new, int weight)
++{
++ return (new * (100 - weight) + old * weight) / 100;
++}
++
++/*
++ * Look up an MCS group index based on mac80211 rate information
++ */
++static int
++minstrel_ht_get_group_idx(struct ieee80211_tx_rate *rate)
++{
++ int streams = (rate->idx / MCS_GROUP_RATES) + 1;
++ u32 flags = IEEE80211_TX_RC_SHORT_GI | IEEE80211_TX_RC_40_MHZ_WIDTH;
++ int i;
++
++ for (i = 0; i < ARRAY_SIZE(minstrel_mcs_groups); i++) {
++ if (minstrel_mcs_groups[i].streams != streams)
++ continue;
++ if (minstrel_mcs_groups[i].flags != (rate->flags & flags))
++ continue;
++
++ return i;
++ }
++
++ WARN_ON(1);
++ return 0;
++}
++
++static inline struct minstrel_rate_stats *
++minstrel_get_ratestats(struct minstrel_ht_sta *mi, int index)
++{
++ return &mi->groups[index / MCS_GROUP_RATES].rates[index % MCS_GROUP_RATES];
++}
++
++
++/*
++ * Recalculate success probabilities and counters for a rate using EWMA
++ */
++static void
++minstrel_calc_rate_ewma(struct minstrel_priv *mp, struct minstrel_rate_stats *mr)
++{
++ if (unlikely(mr->attempts > 0)) {
++ mr->sample_skipped = 0;
++ mr->cur_prob = MINSTREL_FRAC(mr->success, mr->attempts);
++ if (!mr->att_hist)
++ mr->probability = mr->cur_prob;
++ else
++ mr->probability = minstrel_ewma(mr->probability,
++ mr->cur_prob, EWMA_LEVEL);
++ mr->att_hist += mr->attempts;
++ mr->succ_hist += mr->success;
++ } else {
++ mr->sample_skipped++;
++ }
++ mr->last_success = mr->success;
++ mr->last_attempts = mr->attempts;
++ mr->success = 0;
++ mr->attempts = 0;
++}
++
++/*
++ * Calculate throughput based on the average A-MPDU length, taking into account
++ * the expected number of retransmissions and their expected length
++ */
++static void
++minstrel_ht_calc_tp(struct minstrel_priv *mp, struct minstrel_ht_sta *mi,
++ int group, int rate)
++{
++ struct minstrel_rate_stats *mr;
++ unsigned int usecs;
++
++ mr = &mi->groups[group].rates[rate];
++
++ if (mr->probability < MINSTREL_FRAC(1, 10)) {
++ mr->cur_tp = 0;
++ return;
++ }
++
++ usecs = mi->overhead / MINSTREL_TRUNC(mi->avg_ampdu_len);
++ usecs += minstrel_mcs_groups[group].duration[rate];
++ mr->cur_tp = MINSTREL_TRUNC((1000000 / usecs) * mr->probability);
++}
++
++/*
++ * Update rate statistics and select new primary rates
++ *
++ * Rules for rate selection:
++ * - max_prob_rate must use only one stream, as a tradeoff between delivery
++ * probability and throughput during strong fluctuations
++ * - as long as the max prob rate has a probability of more than 3/4, pick
++ * higher throughput rates, even if the probablity is a bit lower
++ */
++static void
++minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
++{
++ struct minstrel_mcs_group_data *mg;
++ struct minstrel_rate_stats *mr;
++ int cur_prob, cur_prob_tp, cur_tp, cur_tp2;
++ int group, i, index;
++
++ if (mi->ampdu_packets > 0) {
++ mi->avg_ampdu_len = minstrel_ewma(mi->avg_ampdu_len,
++ MINSTREL_FRAC(mi->ampdu_len, mi->ampdu_packets), EWMA_LEVEL);
++ mi->ampdu_len = 0;
++ mi->ampdu_packets = 0;
++ }
++
++ mi->sample_slow = 0;
++ mi->sample_count = 0;
++ mi->max_tp_rate = 0;
++ mi->max_tp_rate2 = 0;
++ mi->max_prob_rate = 0;
++
++ for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) {
++ cur_prob = 0;
++ cur_prob_tp = 0;
++ cur_tp = 0;
++ cur_tp2 = 0;
++
++ mg = &mi->groups[group];
++ if (!mg->supported)
++ continue;
++
++ mg->max_tp_rate = 0;
++ mg->max_tp_rate2 = 0;
++ mg->max_prob_rate = 0;
++ mi->sample_count++;
++
++ for (i = 0; i < MCS_GROUP_RATES; i++) {
++ if (!(mg->supported & BIT(i)))
++ continue;
++
++ mr = &mg->rates[i];
++ mr->retry_updated = false;
++ index = MCS_GROUP_RATES * group + i;
++ minstrel_calc_rate_ewma(mp, mr);
++ minstrel_ht_calc_tp(mp, mi, group, i);
++
++ if (!mr->cur_tp)
++ continue;
++
++ /* ignore the lowest rate of each single-stream group */
++ if (!i && minstrel_mcs_groups[group].streams == 1)
++ continue;
++
++ if ((mr->cur_tp > cur_prob_tp && mr->probability >
++ MINSTREL_FRAC(3, 4)) || mr->probability > cur_prob) {
++ mg->max_prob_rate = index;
++ cur_prob = mr->probability;
++ }
++
++ if (mr->cur_tp > cur_tp) {
++ swap(index, mg->max_tp_rate);
++ cur_tp = mr->cur_tp;
++ mr = minstrel_get_ratestats(mi, index);
++ }
++
++ if (index >= mg->max_tp_rate)
++ continue;
++
++ if (mr->cur_tp > cur_tp2) {
++ mg->max_tp_rate2 = index;
++ cur_tp2 = mr->cur_tp;
++ }
++ }
++ }
++
++ /* try to sample up to half of the availble rates during each interval */
++ mi->sample_count *= 4;
++
++ cur_prob = 0;
++ cur_prob_tp = 0;
++ cur_tp = 0;
++ cur_tp2 = 0;
++ for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) {
++ mg = &mi->groups[group];
++ if (!mg->supported)
++ continue;
++
++ mr = minstrel_get_ratestats(mi, mg->max_prob_rate);
++ if (cur_prob_tp < mr->cur_tp &&
++ minstrel_mcs_groups[group].streams == 1) {
++ mi->max_prob_rate = mg->max_prob_rate;
++ cur_prob = mr->cur_prob;
++ }
++
++ mr = minstrel_get_ratestats(mi, mg->max_tp_rate);
++ if (cur_tp < mr->cur_tp) {
++ mi->max_tp_rate = mg->max_tp_rate;
++ cur_tp = mr->cur_tp;
++ }
++
++ mr = minstrel_get_ratestats(mi, mg->max_tp_rate2);
++ if (cur_tp2 < mr->cur_tp) {
++ mi->max_tp_rate2 = mg->max_tp_rate2;
++ cur_tp2 = mr->cur_tp;
++ }
++ }
++
++ mi->stats_update = jiffies;
++}
++
++static bool
++minstrel_ht_txstat_valid(struct ieee80211_tx_rate *rate)
++{
++ if (!rate->count)
++ return false;
++
++ if (rate->idx < 0)
++ return false;
++
++ return !!(rate->flags & IEEE80211_TX_RC_MCS);
++}
++
++static void
++minstrel_next_sample_idx(struct minstrel_ht_sta *mi)
++{
++ struct minstrel_mcs_group_data *mg;
++
++ for (;;) {
++ mi->sample_group++;
++ mi->sample_group %= ARRAY_SIZE(minstrel_mcs_groups);
++ mg = &mi->groups[mi->sample_group];
++
++ if (!mg->supported)
++ continue;
++
++ if (++mg->index >= MCS_GROUP_RATES) {
++ mg->index = 0;
++ if (++mg->column >= ARRAY_SIZE(sample_table))
++ mg->column = 0;
++ }
++ break;
++ }
++}
++
++static void
++minstrel_downgrade_rate(struct minstrel_ht_sta *mi, int *idx, bool primary)
++{
++ int group, orig_group;
++
++ orig_group = group = *idx / MCS_GROUP_RATES;
++ while (group > 0) {
++ group--;
++
++ if (!mi->groups[group].supported)
++ continue;
++
++ if (minstrel_mcs_groups[group].streams >
++ minstrel_mcs_groups[orig_group].streams)
++ continue;
++
++ if (primary)
++ *idx = mi->groups[group].max_tp_rate;
++ else
++ *idx = mi->groups[group].max_tp_rate2;
++ break;
++ }
++}
++
++static void
++minstrel_aggr_check(struct minstrel_priv *mp, struct ieee80211_sta *pubsta, struct sk_buff *skb)
++{
++ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
++ struct sta_info *sta = container_of(pubsta, struct sta_info, sta);
++ u16 tid;
++
++ if (unlikely(!ieee80211_is_data_qos(hdr->frame_control)))
++ return;
++
++ if (unlikely(skb->protocol == cpu_to_be16(ETH_P_PAE)))
++ return;
++
++ tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK;
++ if (likely(sta->ampdu_mlme.tid_state_tx[tid] != HT_AGG_STATE_IDLE))
++ return;
++
++ ieee80211_start_tx_ba_session(pubsta, tid);
++}
++
++static void
++minstrel_ht_tx_status(void *priv, struct ieee80211_supported_band *sband,
++ struct ieee80211_sta *sta, void *priv_sta,
++ struct sk_buff *skb)
++{
++ struct minstrel_ht_sta_priv *msp = priv_sta;
++ struct minstrel_ht_sta *mi = &msp->ht;
++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
++ struct ieee80211_tx_rate *ar = info->status.rates;
++ struct minstrel_rate_stats *rate, *rate2;
++ struct minstrel_priv *mp = priv;
++ bool last = false;
++ int group;
++ int i = 0;
++
++ if (!msp->is_ht)
++ return mac80211_minstrel.tx_status(priv, sband, sta, &msp->legacy, skb);
++
++ /* This packet was aggregated but doesn't carry status info */
++ if ((info->flags & IEEE80211_TX_CTL_AMPDU) &&
++ !(info->flags & IEEE80211_TX_STAT_AMPDU))
++ return;
++
++ if (!info->status.ampdu_len) {
++ info->status.ampdu_ack_len = 1;
++ info->status.ampdu_len = 1;
++ }
++
++ mi->ampdu_packets++;
++ mi->ampdu_len += info->status.ampdu_len;
++
++ if (!mi->sample_wait && !mi->sample_tries && mi->sample_count > 0) {
++ mi->sample_wait = 4 + 2 * MINSTREL_TRUNC(mi->avg_ampdu_len);
++ mi->sample_tries = 3;
++ mi->sample_count--;
++ }
++
++ if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) {
++ mi->sample_packets += info->status.ampdu_len;
++ minstrel_next_sample_idx(mi);
++ }
++
++ for (i = 0; !last; i++) {
++ last = (i == IEEE80211_TX_MAX_RATES - 1) ||
++ !minstrel_ht_txstat_valid(&ar[i + 1]);
++
++ if (!minstrel_ht_txstat_valid(&ar[i]))
++ break;
++
++ group = minstrel_ht_get_group_idx(&ar[i]);
++ rate = &mi->groups[group].rates[ar[i].idx % 8];
++
++ if (last && (info->flags & IEEE80211_TX_STAT_ACK))
++ rate->success += info->status.ampdu_ack_len;
++
++ rate->attempts += ar[i].count * info->status.ampdu_len;
++ }
++
++ /*
++ * check for sudden death of spatial multiplexing,
++ * downgrade to a lower number of streams if necessary.
++ */
++ rate = minstrel_get_ratestats(mi, mi->max_tp_rate);
++ if (rate->attempts > 30 &&
++ MINSTREL_FRAC(rate->success, rate->attempts) <
++ MINSTREL_FRAC(20, 100))
++ minstrel_downgrade_rate(mi, &mi->max_tp_rate, true);
++
++ rate2 = minstrel_get_ratestats(mi, mi->max_tp_rate2);
++ if (rate->attempts > 30 &&
++ MINSTREL_FRAC(rate->success, rate->attempts) <
++ MINSTREL_FRAC(20, 100))
++ minstrel_downgrade_rate(mi, &mi->max_tp_rate2, false);
++
++ if (time_after(jiffies, mi->stats_update + (mp->update_interval / 2 * HZ) / 1000)) {
++ minstrel_ht_update_stats(mp, mi);
++ minstrel_aggr_check(mp, sta, skb);
++ }
++}
++
++static void
++minstrel_calc_retransmit(struct minstrel_priv *mp, struct minstrel_ht_sta *mi,
++ int index)
++{
++ struct minstrel_rate_stats *mr;
++ const struct mcs_group *group;
++ unsigned int tx_time, tx_time_rtscts, tx_time_data;
++ unsigned int cw = mp->cw_min;
++ unsigned int t_slot = 9; /* FIXME */
++ unsigned int ampdu_len = MINSTREL_TRUNC(mi->avg_ampdu_len);
++
++ mr = minstrel_get_ratestats(mi, index);
++ if (mr->probability < MINSTREL_FRAC(1, 10)) {
++ mr->retry_count = 1;
++ mr->retry_count_rtscts = 1;
++ return;
++ }
++
++ mr->retry_count = 2;
++ mr->retry_count_rtscts = 2;
++ mr->retry_updated = true;
++
++ group = &minstrel_mcs_groups[index / MCS_GROUP_RATES];
++ tx_time_data = group->duration[index % MCS_GROUP_RATES] * ampdu_len;
++ tx_time = 2 * (t_slot + mi->overhead + tx_time_data);
++ tx_time_rtscts = 2 * (t_slot + mi->overhead_rtscts + tx_time_data);
++ do {
++ cw = (cw << 1) | 1;
++ cw = min(cw, mp->cw_max);
++ tx_time += cw + t_slot + mi->overhead;
++ tx_time_rtscts += cw + t_slot + mi->overhead_rtscts;
++ if (tx_time_rtscts < mp->segment_size)
++ mr->retry_count_rtscts++;
++ } while ((tx_time < mp->segment_size) &&
++ (++mr->retry_count < mp->max_retry));
++}
++
++
++static void
++minstrel_ht_set_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi,
++ struct ieee80211_tx_rate *rate, int index,
++ struct ieee80211_tx_rate_control *txrc,
++ bool sample, bool rtscts)
++{
++ const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES];
++ struct minstrel_rate_stats *mr;
++
++ mr = minstrel_get_ratestats(mi, index);
++ if (!mr->retry_updated)
++ minstrel_calc_retransmit(mp, mi, index);
++
++ if (mr->probability < MINSTREL_FRAC(20, 100))
++ rate->count = 2;
++ else if (rtscts)
++ rate->count = mr->retry_count_rtscts;
++ else
++ rate->count = mr->retry_count;
++
++ rate->flags = IEEE80211_TX_RC_MCS | group->flags;
++ if (txrc->short_preamble)
++ rate->flags |= IEEE80211_TX_RC_USE_SHORT_PREAMBLE;
++ if (txrc->rts || rtscts)
++ rate->flags |= IEEE80211_TX_RC_USE_RTS_CTS;
++ rate->idx = index % MCS_GROUP_RATES + (group->streams - 1) * MCS_GROUP_RATES;
++}
++
++static inline int
++minstrel_get_duration(int index)
++{
++ const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES];
++ return group->duration[index % MCS_GROUP_RATES];
++}
++
++static int
++minstrel_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
++{
++ struct minstrel_rate_stats *mr;
++ struct minstrel_mcs_group_data *mg;
++ int sample_idx = 0;
++
++ if (mi->sample_wait > 0) {
++ mi->sample_wait--;
++ return -1;
++ }
++
++ if (!mi->sample_tries)
++ return -1;
++
++ mi->sample_tries--;
++ mg = &mi->groups[mi->sample_group];
++ sample_idx = sample_table[mg->column][mg->index];
++ mr = &mg->rates[sample_idx];
++ sample_idx += mi->sample_group * MCS_GROUP_RATES;
++
++ /*
++ * When not using MRR, do not sample if the probability is already
++ * higher than 95% to avoid wasting airtime
++ */
++ if (!mp->has_mrr && (mr->probability > MINSTREL_FRAC(95, 100)))
++ goto next;
++
++ /*
++ * Make sure that lower rates get sampled only occasionally,
++ * if the link is working perfectly.
++ */
++ if (minstrel_get_duration(sample_idx) >
++ minstrel_get_duration(mi->max_tp_rate)) {
++ if (mr->sample_skipped < 10)
++ goto next;
++
++ if (mi->sample_slow++ > 2)
++ goto next;
++ }
++
++ return sample_idx;
++
++next:
++ minstrel_next_sample_idx(mi);
++ return -1;
++}
++
++static void
++minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
++ struct ieee80211_tx_rate_control *txrc)
++{
++ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb);
++ struct ieee80211_tx_rate *ar = info->status.rates;
++ struct minstrel_ht_sta_priv *msp = priv_sta;
++ struct minstrel_ht_sta *mi = &msp->ht;
++ struct minstrel_priv *mp = priv;
++ int sample_idx;
++
++ if (rate_control_send_low(sta, priv_sta, txrc))
++ return;
++
++ if (!msp->is_ht)
++ return mac80211_minstrel.get_rate(priv, sta, &msp->legacy, txrc);
++
++ info->flags |= mi->tx_flags;
++ sample_idx = minstrel_get_sample_rate(mp, mi);
++ if (sample_idx >= 0) {
++ minstrel_ht_set_rate(mp, mi, &ar[0], sample_idx,
++ txrc, true, false);
++ minstrel_ht_set_rate(mp, mi, &ar[1], mi->max_tp_rate,
++ txrc, false, true);
++ info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE;
++ } else {
++ minstrel_ht_set_rate(mp, mi, &ar[0], mi->max_tp_rate,
++ txrc, false, false);
++ minstrel_ht_set_rate(mp, mi, &ar[1], mi->max_tp_rate2,
++ txrc, false, true);
++ }
++ minstrel_ht_set_rate(mp, mi, &ar[2], mi->max_prob_rate, txrc, false, true);
++
++ ar[3].count = 0;
++ ar[3].idx = -1;
++
++ mi->total_packets++;
++
++ /* wraparound */
++ if (mi->total_packets == ~0) {
++ mi->total_packets = 0;
++ mi->sample_packets = 0;
++ }
++}
++
++static void
++minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband,
++ struct ieee80211_sta *sta, void *priv_sta,
++ enum nl80211_channel_type oper_chan_type)
++{
++ struct minstrel_priv *mp = priv;
++ struct minstrel_ht_sta_priv *msp = priv_sta;
++ struct minstrel_ht_sta *mi = &msp->ht;
++ struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
++ struct ieee80211_local *local = hw_to_local(mp->hw);
++ u16 sta_cap = sta->ht_cap.cap;
++ int ack_dur;
++ int stbc;
++ int i;
++
++ /* fall back to the old minstrel for legacy stations */
++ if (sta && !sta->ht_cap.ht_supported) {
++ msp->is_ht = false;
++ memset(&msp->legacy, 0, sizeof(msp->legacy));
++ msp->legacy.r = msp->ratelist;
++ msp->legacy.sample_table = msp->sample_table;
++ return mac80211_minstrel.rate_init(priv, sband, sta, &msp->legacy);
++ }
++
++ BUILD_BUG_ON(ARRAY_SIZE(minstrel_mcs_groups) !=
++ MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS);
++
++ msp->is_ht = true;
++ memset(mi, 0, sizeof(*mi));
++ mi->stats_update = jiffies;
++
++ ack_dur = ieee80211_frame_duration(local, 10, 60, 1, 1);
++ mi->overhead = ieee80211_frame_duration(local, 0, 60, 1, 1) + ack_dur;
++ mi->overhead_rtscts = mi->overhead + 2 * ack_dur;
++
++ mi->avg_ampdu_len = MINSTREL_FRAC(1, 1);
++
++ /* When using MRR, sample more on the first attempt, without delay */
++ if (mp->has_mrr) {
++ mi->sample_count = 16;
++ mi->sample_wait = 0;
++ } else {
++ mi->sample_count = 8;
++ mi->sample_wait = 8;
++ }
++ mi->sample_tries = 4;
++
++ stbc = (sta_cap & IEEE80211_HT_CAP_RX_STBC) >>
++ IEEE80211_HT_CAP_RX_STBC_SHIFT;
++ mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT;
++
++ if (sta_cap & IEEE80211_HT_CAP_LDPC_CODING)
++ mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
++
++ if (oper_chan_type != NL80211_CHAN_HT40MINUS &&
++ oper_chan_type != NL80211_CHAN_HT40PLUS)
++ sta_cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
++
++ for (i = 0; i < ARRAY_SIZE(mi->groups); i++) {
++ u16 req = 0;
++
++ mi->groups[i].supported = 0;
++ if (minstrel_mcs_groups[i].flags & IEEE80211_TX_RC_SHORT_GI) {
++ if (minstrel_mcs_groups[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
++ req |= IEEE80211_HT_CAP_SGI_40;
++ else
++ req |= IEEE80211_HT_CAP_SGI_20;
++ }
++
++ if (minstrel_mcs_groups[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
++ req |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
++
++ if ((sta_cap & req) != req)
++ continue;
++
++ mi->groups[i].supported =
++ mcs->rx_mask[minstrel_mcs_groups[i].streams - 1];
++ }
++}
++
++static void
++minstrel_ht_rate_init(void *priv, struct ieee80211_supported_band *sband,
++ struct ieee80211_sta *sta, void *priv_sta)
++{
++ struct minstrel_priv *mp = priv;
++
++ minstrel_ht_update_caps(priv, sband, sta, priv_sta, mp->hw->conf.channel_type);
++}
++
++static void
++minstrel_ht_rate_update(void *priv, struct ieee80211_supported_band *sband,
++ struct ieee80211_sta *sta, void *priv_sta,
++ u32 changed, enum nl80211_channel_type oper_chan_type)
++{
++ minstrel_ht_update_caps(priv, sband, sta, priv_sta, oper_chan_type);
++}
++
++static void *
++minstrel_ht_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
++{
++ struct ieee80211_supported_band *sband;
++ struct minstrel_ht_sta_priv *msp;
++ struct minstrel_priv *mp = priv;
++ struct ieee80211_hw *hw = mp->hw;
++ int max_rates = 0;
++ int i;
++
++ for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
++ sband = hw->wiphy->bands[i];
++ if (sband && sband->n_bitrates > max_rates)
++ max_rates = sband->n_bitrates;
++ }
++
++ msp = kzalloc(sizeof(struct minstrel_ht_sta), gfp);
++ if (!msp)
++ return NULL;
++
++ msp->ratelist = kzalloc(sizeof(struct minstrel_rate) * max_rates, gfp);
++ if (!msp->ratelist)
++ goto error;
++
++ msp->sample_table = kmalloc(SAMPLE_COLUMNS * max_rates, gfp);
++ if (!msp->sample_table)
++ goto error1;
++
++ return msp;
++
++error1:
++ kfree(msp->sample_table);
++error:
++ kfree(msp);
++ return NULL;
++}
++
++static void
++minstrel_ht_free_sta(void *priv, struct ieee80211_sta *sta, void *priv_sta)
++{
++ struct minstrel_ht_sta_priv *msp = priv_sta;
++
++ kfree(msp->sample_table);
++ kfree(msp->ratelist);
++ kfree(msp);
++}
++
++static void *
++minstrel_ht_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
++{
++ return mac80211_minstrel.alloc(hw, debugfsdir);
++}
++
++static void
++minstrel_ht_free(void *priv)
++{
++ mac80211_minstrel.free(priv);
++}
++
++static struct rate_control_ops mac80211_minstrel_ht = {
++ .name = "minstrel_ht",
++ .tx_status = minstrel_ht_tx_status,
++ .get_rate = minstrel_ht_get_rate,
++ .rate_init = minstrel_ht_rate_init,
++ .rate_update = minstrel_ht_rate_update,
++ .alloc_sta = minstrel_ht_alloc_sta,
++ .free_sta = minstrel_ht_free_sta,
++ .alloc = minstrel_ht_alloc,
++ .free = minstrel_ht_free,
++#ifdef CONFIG_MAC80211_DEBUGFS
++ .add_sta_debugfs = minstrel_ht_add_sta_debugfs,
++ .remove_sta_debugfs = minstrel_ht_remove_sta_debugfs,
++#endif
++};
++
++
++static void
++init_sample_table(void)
++{
++ int col, i, new_idx;
++ u8 rnd[MCS_GROUP_RATES];
++
++ memset(sample_table, 0xff, sizeof(sample_table));
++ for (col = 0; col < SAMPLE_COLUMNS; col++) {
++ for (i = 0; i < MCS_GROUP_RATES; i++) {
++ get_random_bytes(rnd, sizeof(rnd));
++ new_idx = (i + rnd[i]) % MCS_GROUP_RATES;
++
++ while (sample_table[col][new_idx] != 0xff)
++ new_idx = (new_idx + 1) % MCS_GROUP_RATES;
++
++ sample_table[col][new_idx] = i;
++ }
++ }
++}
++
++int __init
++rc80211_minstrel_ht_init(void)
++{
++ init_sample_table();
++ return ieee80211_rate_control_register(&mac80211_minstrel_ht);
++}
++
++void
++rc80211_minstrel_ht_exit(void)
++{
++ ieee80211_rate_control_unregister(&mac80211_minstrel_ht);
++}
+--- /dev/null
++++ b/net/mac80211/rc80211_minstrel_ht.h
+@@ -0,0 +1,128 @@
++/*
++ * Copyright (C) 2010 Felix Fietkau <nbd@openwrt.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ */
++
++#ifndef __RC_MINSTREL_HT_H
++#define __RC_MINSTREL_HT_H
++
++/*
++ * The number of streams can be changed to 2 to reduce code
++ * size and memory footprint.
++ */
++#define MINSTREL_MAX_STREAMS 3
++#define MINSTREL_STREAM_GROUPS 4
++
++/* scaled fraction values */
++#define MINSTREL_SCALE 16
++#define MINSTREL_FRAC(val, div) (((val) << MINSTREL_SCALE) / div)
++#define MINSTREL_TRUNC(val) ((val) >> MINSTREL_SCALE)
++
++#define MCS_GROUP_RATES 8
++
++struct mcs_group {
++ u32 flags;
++ unsigned int streams;
++ unsigned int duration[MCS_GROUP_RATES];
++};
++
++struct minstrel_rate_stats {
++ /* current / last sampling period attempts/success counters */
++ unsigned int attempts, last_attempts;
++ unsigned int success, last_success;
++
++ /* total attempts/success counters */
++ u64 att_hist, succ_hist;
++
++ /* current throughput */
++ unsigned int cur_tp;
++
++ /* packet delivery probabilities */
++ unsigned int cur_prob, probability;
++
++ /* maximum retry counts */
++ unsigned int retry_count;
++ unsigned int retry_count_rtscts;
++
++ bool retry_updated;
++ u8 sample_skipped;
++};
++
++struct minstrel_mcs_group_data {
++ u8 index;
++ u8 column;
++
++ /* bitfield of supported MCS rates of this group */
++ u8 supported;
++
++ /* selected primary rates */
++ unsigned int max_tp_rate;
++ unsigned int max_tp_rate2;
++ unsigned int max_prob_rate;
++
++ /* MCS rate statistics */
++ struct minstrel_rate_stats rates[MCS_GROUP_RATES];
++};
++
++struct minstrel_ht_sta {
++ /* ampdu length (average, per sampling interval) */
++ unsigned int ampdu_len;
++ unsigned int ampdu_packets;
++
++ /* ampdu length (EWMA) */
++ unsigned int avg_ampdu_len;
++
++ /* best throughput rate */
++ unsigned int max_tp_rate;
++
++ /* second best throughput rate */
++ unsigned int max_tp_rate2;
++
++ /* best probability rate */
++ unsigned int max_prob_rate;
++
++ /* time of last status update */
++ unsigned long stats_update;
++
++ /* overhead time in usec for each frame */
++ unsigned int overhead;
++ unsigned int overhead_rtscts;
++
++ unsigned int total_packets;
++ unsigned int sample_packets;
++
++ /* tx flags to add for frames for this sta */
++ u32 tx_flags;
++
++ u8 sample_wait;
++ u8 sample_tries;
++ u8 sample_count;
++ u8 sample_slow;
++
++ /* current MCS group to be sampled */
++ u8 sample_group;
++
++ /* MCS rate group info and statistics */
++ struct minstrel_mcs_group_data groups[MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS];
++};
++
++struct minstrel_ht_sta_priv {
++ union {
++ struct minstrel_ht_sta ht;
++ struct minstrel_sta_info legacy;
++ };
++#ifdef CONFIG_MAC80211_DEBUGFS
++ struct dentry *dbg_stats;
++#endif
++ void *ratelist;
++ void *sample_table;
++ bool is_ht;
++};
++
++void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir);
++void minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta);
++
++#endif
+--- /dev/null
++++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c
+@@ -0,0 +1,120 @@
++/*
++ * Copyright (C) 2010 Felix Fietkau <nbd@openwrt.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ */
++#include <linux/netdevice.h>
++#include <linux/types.h>
++#include <linux/skbuff.h>
++#include <linux/debugfs.h>
++#include <linux/ieee80211.h>
++#include <net/mac80211.h>
++#include "rc80211_minstrel.h"
++#include "rc80211_minstrel_ht.h"
++
++extern const struct mcs_group minstrel_mcs_groups[];
++
++static int
++minstrel_ht_stats_open(struct inode *inode, struct file *file)
++{
++ struct minstrel_ht_sta_priv *msp = inode->i_private;
++ struct minstrel_ht_sta *mi = &msp->ht;
++ struct minstrel_debugfs_info *ms;
++ unsigned int i, j, tp, prob, eprob;
++ char *p;
++ int ret;
++
++ if (!msp->is_ht) {
++ inode->i_private = &msp->legacy;
++ ret = minstrel_stats_open(inode, file);
++ inode->i_private = msp;
++ return ret;
++ }
++
++ ms = kmalloc(sizeof(*ms) + 8192, GFP_KERNEL);
++ if (!ms)
++ return -ENOMEM;
++
++ file->private_data = ms;
++ p = ms->buf;
++ p += sprintf(p, "type rate throughput ewma prob this prob "
++ "this succ/attempt success attempts\n");
++ for (i = 0; i < MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS; i++) {
++ char htmode = '2';
++ char gimode = 'L';
++
++ if (!mi->groups[i].supported)
++ continue;
++
++ if (minstrel_mcs_groups[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
++ htmode = '4';
++ if (minstrel_mcs_groups[i].flags & IEEE80211_TX_RC_SHORT_GI)
++ gimode = 'S';
++
++ for (j = 0; j < MCS_GROUP_RATES; j++) {
++ struct minstrel_rate_stats *mr = &mi->groups[i].rates[j];
++ int idx = i * MCS_GROUP_RATES + j;
++
++ if (!(mi->groups[i].supported & BIT(j)))
++ continue;
++
++ p += sprintf(p, "HT%c0/%cGI ", htmode, gimode);
++
++ *(p++) = (idx == mi->max_tp_rate) ? 'T' : ' ';
++ *(p++) = (idx == mi->max_tp_rate2) ? 't' : ' ';
++ *(p++) = (idx == mi->max_prob_rate) ? 'P' : ' ';
++ p += sprintf(p, "MCS%-2u", (minstrel_mcs_groups[i].streams - 1) *
++ MCS_GROUP_RATES + j);
++
++ tp = mr->cur_tp / 10;
++ prob = MINSTREL_TRUNC(mr->cur_prob * 1000);
++ eprob = MINSTREL_TRUNC(mr->probability * 1000);
++
++ p += sprintf(p, " %6u.%1u %6u.%1u %6u.%1u "
++ "%3u(%3u) %8llu %8llu\n",
++ tp / 10, tp % 10,
++ eprob / 10, eprob % 10,
++ prob / 10, prob % 10,
++ mr->last_success,
++ mr->last_attempts,
++ (unsigned long long)mr->succ_hist,
++ (unsigned long long)mr->att_hist);
++ }
++ }
++ p += sprintf(p, "\nTotal packet count:: ideal %d "
++ "lookaround %d\n",
++ max(0, (int) mi->total_packets - (int) mi->sample_packets),
++ mi->sample_packets);
++ p += sprintf(p, "Average A-MPDU length: %d.%d\n",
++ MINSTREL_TRUNC(mi->avg_ampdu_len),
++ MINSTREL_TRUNC(mi->avg_ampdu_len * 10) % 10);
++ ms->len = p - ms->buf;
++
++ return 0;
++}
++
++static const struct file_operations minstrel_ht_stat_fops = {
++ .owner = THIS_MODULE,
++ .open = minstrel_ht_stats_open,
++ .read = minstrel_stats_read,
++ .release = minstrel_stats_release,
++};
++
++void
++minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir)
++{
++ struct minstrel_ht_sta_priv *msp = priv_sta;
++
++ msp->dbg_stats = debugfs_create_file("rc_stats", S_IRUGO, dir, msp,
++ &minstrel_ht_stat_fops);
++}
++
++void
++minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta)
++{
++ struct minstrel_ht_sta_priv *msp = priv_sta;
++
++ debugfs_remove(msp->dbg_stats);
++}
+--- a/net/wireless/scan.c
++++ b/net/wireless/scan.c
+@@ -525,7 +525,7 @@ cfg80211_inform_bss(struct wiphy *wiphy,
+
+ privsz = wiphy->bss_priv_size;
+
+- if (WARN_ON(wiphy->signal_type == NL80211_BSS_SIGNAL_UNSPEC &&
++ if (WARN_ON(wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC &&
+ (signal < 0 || signal > 100)))
+ return NULL;
+
+@@ -581,7 +581,7 @@ cfg80211_inform_bss_frame(struct wiphy *
+ u.probe_resp.variable);
+ size_t privsz = wiphy->bss_priv_size;
+
+- if (WARN_ON(wiphy->signal_type == NL80211_BSS_SIGNAL_UNSPEC &&
++ if (WARN_ON(wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC &&
+ (signal < 0 || signal > 100)))
+ return NULL;
+
+--- a/net/wireless/chan.c
++++ b/net/wireless/chan.c
+@@ -50,7 +50,7 @@ int cfg80211_set_freq(struct cfg80211_re
+ struct ieee80211_channel *chan;
+ int result;
+
+- if (wdev->iftype == NL80211_IFTYPE_MONITOR)
++ if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR)
+ wdev = NULL;
+
+ if (wdev) {
diff --git a/package/mac80211/patches/510-ath9k_debugfs_regaccess.patch b/package/mac80211/patches/510-ath9k_debugfs_regaccess.patch
deleted file mode 100644
index 3827ed9c21..0000000000
--- a/package/mac80211/patches/510-ath9k_debugfs_regaccess.patch
+++ /dev/null
@@ -1,128 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/debug.c
-+++ b/drivers/net/wireless/ath/ath9k/debug.c
-@@ -795,6 +795,86 @@ static const struct file_operations fops
- .owner = THIS_MODULE
- };
-
-+static ssize_t read_file_regidx(struct file *file, char __user *user_buf,
-+ size_t count, loff_t *ppos)
-+{
-+ struct ath_softc *sc = file->private_data;
-+ char buf[32];
-+ unsigned int len;
-+
-+ len = snprintf(buf, sizeof(buf), "0x%08x\n", sc->debug.regidx);
-+ return simple_read_from_buffer(user_buf, count, ppos, buf, len);
-+}
-+
-+static ssize_t write_file_regidx(struct file *file, const char __user *user_buf,
-+ size_t count, loff_t *ppos)
-+{
-+ struct ath_softc *sc = file->private_data;
-+ unsigned long regidx;
-+ char buf[32];
-+ ssize_t len;
-+
-+ len = min(count, sizeof(buf) - 1);
-+ if (copy_from_user(buf, user_buf, len))
-+ return -EINVAL;
-+
-+ buf[len] = '\0';
-+ if (strict_strtoul(buf, 0, &regidx))
-+ return -EINVAL;
-+
-+ sc->debug.regidx = regidx;
-+ return count;
-+}
-+
-+static const struct file_operations fops_regidx = {
-+ .read = read_file_regidx,
-+ .write = write_file_regidx,
-+ .open = ath9k_debugfs_open,
-+ .owner = THIS_MODULE
-+};
-+
-+static ssize_t read_file_regval(struct file *file, char __user *user_buf,
-+ size_t count, loff_t *ppos)
-+{
-+ struct ath_softc *sc = file->private_data;
-+ struct ath_hw *ah = sc->sc_ah;
-+ char buf[32];
-+ unsigned int len;
-+ u32 regval;
-+
-+ regval = REG_READ_D(ah, sc->debug.regidx);
-+ len = snprintf(buf, sizeof(buf), "0x%08x\n", regval);
-+ return simple_read_from_buffer(user_buf, count, ppos, buf, len);
-+}
-+
-+static ssize_t write_file_regval(struct file *file, const char __user *user_buf,
-+ size_t count, loff_t *ppos)
-+{
-+ struct ath_softc *sc = file->private_data;
-+ struct ath_hw *ah = sc->sc_ah;
-+ unsigned long regval;
-+ char buf[32];
-+ ssize_t len;
-+
-+ len = min(count, sizeof(buf) - 1);
-+ if (copy_from_user(buf, user_buf, len))
-+ return -EINVAL;
-+
-+ buf[len] = '\0';
-+ if (strict_strtoul(buf, 0, &regval))
-+ return -EINVAL;
-+
-+ REG_WRITE_D(ah, sc->debug.regidx, regval);
-+ return count;
-+}
-+
-+static const struct file_operations fops_regval = {
-+ .read = read_file_regval,
-+ .write = write_file_regval,
-+ .open = ath9k_debugfs_open,
-+ .owner = THIS_MODULE
-+};
-+
- int ath9k_init_debug(struct ath_hw *ah)
- {
- struct ath_common *common = ath9k_hw_common(ah);
-@@ -864,6 +944,17 @@ int ath9k_init_debug(struct ath_hw *ah)
- if (!sc->debug.debugfs_recv)
- goto err;
-
-+ sc->debug.regidx = 0;
-+ sc->debug.debugfs_regidx = debugfs_create_file("regidx",
-+ S_IRUSR|S_IWUSR, sc->debug.debugfs_phy, sc, &fops_regidx);
-+ if (!sc->debug.debugfs_regidx)
-+ goto err;
-+
-+ sc->debug.debugfs_regval = debugfs_create_file("regval",
-+ S_IRUSR|S_IWUSR, sc->debug.debugfs_phy, sc, &fops_regval);
-+ if (!sc->debug.debugfs_regval)
-+ goto err;
-+
- return 0;
- err:
- ath9k_exit_debug(ah);
-@@ -877,6 +968,8 @@ void ath9k_exit_debug(struct ath_hw *ah)
-
- debugfs_remove(sc->debug.debugfs_tx_chainmask);
- debugfs_remove(sc->debug.debugfs_rx_chainmask);
-+ debugfs_remove(sc->debug.debugfs_regval);
-+ debugfs_remove(sc->debug.debugfs_regidx);
- debugfs_remove(sc->debug.debugfs_recv);
- debugfs_remove(sc->debug.debugfs_xmit);
- debugfs_remove(sc->debug.debugfs_wiphy);
---- a/drivers/net/wireless/ath/ath9k/debug.h
-+++ b/drivers/net/wireless/ath/ath9k/debug.h
-@@ -162,6 +162,9 @@ struct ath9k_debug {
- struct dentry *debugfs_wiphy;
- struct dentry *debugfs_xmit;
- struct dentry *debugfs_recv;
-+ struct dentry *debugfs_regidx;
-+ struct dentry *debugfs_regval;
-+ u32 regidx;
- struct ath_stats stats;
- };
-
diff --git a/package/mac80211/patches/540-ath9k_use_minstrel.patch b/package/mac80211/patches/510-ath9k_use_minstrel.patch
index 6f1877f161..6f1877f161 100644
--- a/package/mac80211/patches/540-ath9k_use_minstrel.patch
+++ b/package/mac80211/patches/510-ath9k_use_minstrel.patch
diff --git a/package/mac80211/patches/520-cfg80211_get_freq.patch b/package/mac80211/patches/520-cfg80211_get_freq.patch
deleted file mode 100644
index 26190c63b6..0000000000
--- a/package/mac80211/patches/520-cfg80211_get_freq.patch
+++ /dev/null
@@ -1,34 +0,0 @@
---- a/net/wireless/core.h
-+++ b/net/wireless/core.h
-@@ -76,6 +76,7 @@ struct cfg80211_registered_device {
-
- /* current channel */
- struct ieee80211_channel *channel;
-+ enum nl80211_channel_type channel_type;
-
- /* must be last because of the way we do wiphy_priv(),
- * and it should at least be aligned to NETDEV_ALIGN */
---- a/net/wireless/chan.c
-+++ b/net/wireless/chan.c
-@@ -97,6 +97,7 @@ int rdev_set_freq(struct cfg80211_regist
- return result;
-
- rdev->channel = chan;
-+ rdev->channel_type = channel_type;
-
- return 0;
- }
---- a/net/wireless/nl80211.c
-+++ b/net/wireless/nl80211.c
-@@ -887,6 +887,11 @@ static int nl80211_send_iface(struct sk_
- NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx);
- NLA_PUT_STRING(msg, NL80211_ATTR_IFNAME, dev->name);
- NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, dev->ieee80211_ptr->iftype);
-+ if (rdev->channel) {
-+ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, rdev->channel->center_freq);
-+ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, rdev->channel_type);
-+ }
-+
-
- NLA_PUT_U32(msg, NL80211_ATTR_GENERATION,
- rdev->devlist_generation ^
diff --git a/package/mac80211/patches/530-minstrel_ht.patch b/package/mac80211/patches/530-minstrel_ht.patch
deleted file mode 100644
index 046e91b8cd..0000000000
--- a/package/mac80211/patches/530-minstrel_ht.patch
+++ /dev/null
@@ -1,1147 +0,0 @@
---- a/net/mac80211/Makefile
-+++ b/net/mac80211/Makefile
-@@ -47,8 +47,8 @@ CFLAGS_driver-trace.o := -I$(src)
- rc80211_pid-y := rc80211_pid_algo.o
- rc80211_pid-$(CONFIG_MAC80211_DEBUGFS) += rc80211_pid_debugfs.o
-
--rc80211_minstrel-y := rc80211_minstrel.o
--rc80211_minstrel-$(CONFIG_MAC80211_DEBUGFS) += rc80211_minstrel_debugfs.o
-+rc80211_minstrel-y := rc80211_minstrel.o rc80211_minstrel_ht.o
-+rc80211_minstrel-$(CONFIG_MAC80211_DEBUGFS) += rc80211_minstrel_debugfs.o rc80211_minstrel_ht_debugfs.o
-
- mac80211-$(CONFIG_MAC80211_RC_PID) += $(rc80211_pid-y)
- mac80211-$(CONFIG_MAC80211_RC_MINSTREL) += $(rc80211_minstrel-y)
---- a/net/mac80211/main.c
-+++ b/net/mac80211/main.c
-@@ -716,6 +716,10 @@ static int __init ieee80211_init(void)
- if (ret)
- return ret;
-
-+ ret = rc80211_minstrel_ht_init();
-+ if (ret)
-+ goto err_minstrel;
-+
- ret = rc80211_pid_init();
- if (ret)
- goto err_pid;
-@@ -728,6 +732,8 @@ static int __init ieee80211_init(void)
- err_netdev:
- rc80211_pid_exit();
- err_pid:
-+ rc80211_minstrel_ht_exit();
-+ err_minstrel:
- rc80211_minstrel_exit();
-
- return ret;
-@@ -736,6 +742,7 @@ static int __init ieee80211_init(void)
- static void __exit ieee80211_exit(void)
- {
- rc80211_pid_exit();
-+ rc80211_minstrel_ht_exit();
- rc80211_minstrel_exit();
-
- /*
---- a/net/mac80211/rate.h
-+++ b/net/mac80211/rate.h
-@@ -137,6 +137,8 @@ static inline void rc80211_pid_exit(void
- #ifdef CONFIG_MAC80211_RC_MINSTREL
- extern int rc80211_minstrel_init(void);
- extern void rc80211_minstrel_exit(void);
-+extern int rc80211_minstrel_ht_init(void);
-+extern void rc80211_minstrel_ht_exit(void);
- #else
- static inline int rc80211_minstrel_init(void)
- {
-@@ -145,6 +147,13 @@ static inline int rc80211_minstrel_init(
- static inline void rc80211_minstrel_exit(void)
- {
- }
-+static inline int rc80211_minstrel_ht_init(void)
-+{
-+ return 0;
-+}
-+static inline void rc80211_minstrel_ht_exit(void)
-+{
-+}
- #endif
-
-
---- /dev/null
-+++ b/net/mac80211/rc80211_minstrel_ht.c
-@@ -0,0 +1,822 @@
-+/*
-+ * Copyright (C) 2010 Felix Fietkau <nbd@openwrt.org>
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ */
-+#include <linux/netdevice.h>
-+#include <linux/types.h>
-+#include <linux/skbuff.h>
-+#include <linux/debugfs.h>
-+#include <linux/random.h>
-+#include <linux/ieee80211.h>
-+#include <net/mac80211.h>
-+#include "rate.h"
-+#include "rc80211_minstrel.h"
-+#include "rc80211_minstrel_ht.h"
-+
-+#define AVG_PKT_SIZE 1200
-+#define SAMPLE_COLUMNS 10
-+#define EWMA_LEVEL 75
-+
-+/* Number of bits for an average sized packet */
-+#define MCS_NBITS (AVG_PKT_SIZE << 3)
-+
-+/* Number of symbols for a packet with (bps) bits per symbol */
-+#define MCS_NSYMS(bps) ((MCS_NBITS + (bps) - 1) / (bps))
-+
-+/* Transmission time for a packet containing (syms) symbols */
-+#define MCS_SYMBOL_TIME(sgi, syms) \
-+ (sgi ? \
-+ ((syms) * 18 + 4) / 5 : /* syms * 3.6 us */ \
-+ (syms) << 2 /* syms * 4 us */ \
-+ )
-+
-+/* Transmit duration for the raw data part of an average sized packet */
-+#define MCS_DURATION(streams, sgi, bps) MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps)))
-+
-+/* MCS rate information for an MCS group */
-+#define MCS_GROUP(_streams, _sgi, _ht40) { \
-+ .streams = _streams, \
-+ .flags = \
-+ (_sgi ? IEEE80211_TX_RC_SHORT_GI : 0) | \
-+ (_ht40 ? IEEE80211_TX_RC_40_MHZ_WIDTH : 0), \
-+ .duration = { \
-+ MCS_DURATION(_streams, _sgi, _ht40 ? 54 : 26), \
-+ MCS_DURATION(_streams, _sgi, _ht40 ? 108 : 52), \
-+ MCS_DURATION(_streams, _sgi, _ht40 ? 162 : 78), \
-+ MCS_DURATION(_streams, _sgi, _ht40 ? 216 : 104), \
-+ MCS_DURATION(_streams, _sgi, _ht40 ? 324 : 156), \
-+ MCS_DURATION(_streams, _sgi, _ht40 ? 432 : 208), \
-+ MCS_DURATION(_streams, _sgi, _ht40 ? 486 : 234), \
-+ MCS_DURATION(_streams, _sgi, _ht40 ? 540 : 260) \
-+ } \
-+}
-+
-+/*
-+ * To enable sufficiently targeted rate sampling, MCS rates are divided into
-+ * groups, based on the number of streams and flags (HT40, SGI) that they
-+ * use.
-+ */
-+const struct mcs_group minstrel_mcs_groups[] = {
-+ MCS_GROUP(1, 0, 0),
-+ MCS_GROUP(2, 0, 0),
-+#if MINSTREL_MAX_STREAMS >= 3
-+ MCS_GROUP(3, 0, 0),
-+#endif
-+
-+ MCS_GROUP(1, 1, 0),
-+ MCS_GROUP(2, 1, 0),
-+#if MINSTREL_MAX_STREAMS >= 3
-+ MCS_GROUP(3, 1, 0),
-+#endif
-+
-+ MCS_GROUP(1, 0, 1),
-+ MCS_GROUP(2, 0, 1),
-+#if MINSTREL_MAX_STREAMS >= 3
-+ MCS_GROUP(3, 0, 1),
-+#endif
-+
-+ MCS_GROUP(1, 1, 1),
-+ MCS_GROUP(2, 1, 1),
-+#if MINSTREL_MAX_STREAMS >= 3
-+ MCS_GROUP(3, 1, 1),
-+#endif
-+};
-+
-+static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES];
-+
-+/*
-+ * Perform EWMA (Exponentially Weighted Moving Average) calculation
-+ */
-+static int
-+minstrel_ewma(int old, int new, int weight)
-+{
-+ return (new * (100 - weight) + old * weight) / 100;
-+}
-+
-+/*
-+ * Look up an MCS group index based on mac80211 rate information
-+ */
-+static int
-+minstrel_ht_get_group_idx(struct ieee80211_tx_rate *rate)
-+{
-+ int streams = (rate->idx / MCS_GROUP_RATES) + 1;
-+ u32 flags = IEEE80211_TX_RC_SHORT_GI | IEEE80211_TX_RC_40_MHZ_WIDTH;
-+ int i;
-+
-+ for (i = 0; i < ARRAY_SIZE(minstrel_mcs_groups); i++) {
-+ if (minstrel_mcs_groups[i].streams != streams)
-+ continue;
-+ if (minstrel_mcs_groups[i].flags != (rate->flags & flags))
-+ continue;
-+
-+ return i;
-+ }
-+
-+ WARN_ON(1);
-+ return 0;
-+}
-+
-+static inline struct minstrel_rate_stats *
-+minstrel_get_ratestats(struct minstrel_ht_sta *mi, int index)
-+{
-+ return &mi->groups[index / MCS_GROUP_RATES].rates[index % MCS_GROUP_RATES];
-+}
-+
-+
-+/*
-+ * Recalculate success probabilities and counters for a rate using EWMA
-+ */
-+static void
-+minstrel_calc_rate_ewma(struct minstrel_priv *mp, struct minstrel_rate_stats *mr)
-+{
-+ if (unlikely(mr->attempts > 0)) {
-+ mr->sample_skipped = 0;
-+ mr->cur_prob = MINSTREL_FRAC(mr->success, mr->attempts);
-+ if (!mr->att_hist)
-+ mr->probability = mr->cur_prob;
-+ else
-+ mr->probability = minstrel_ewma(mr->probability,
-+ mr->cur_prob, EWMA_LEVEL);
-+ mr->att_hist += mr->attempts;
-+ mr->succ_hist += mr->success;
-+ } else {
-+ mr->sample_skipped++;
-+ }
-+ mr->last_success = mr->success;
-+ mr->last_attempts = mr->attempts;
-+ mr->success = 0;
-+ mr->attempts = 0;
-+}
-+
-+/*
-+ * Calculate throughput based on the average A-MPDU length, taking into account
-+ * the expected number of retransmissions and their expected length
-+ */
-+static void
-+minstrel_ht_calc_tp(struct minstrel_priv *mp, struct minstrel_ht_sta *mi,
-+ int group, int rate)
-+{
-+ struct minstrel_rate_stats *mr;
-+ unsigned int usecs;
-+
-+ mr = &mi->groups[group].rates[rate];
-+
-+ if (mr->probability < MINSTREL_FRAC(1, 10)) {
-+ mr->cur_tp = 0;
-+ return;
-+ }
-+
-+ usecs = mi->overhead / MINSTREL_TRUNC(mi->avg_ampdu_len);
-+ usecs += minstrel_mcs_groups[group].duration[rate];
-+ mr->cur_tp = MINSTREL_TRUNC((1000000 / usecs) * mr->probability);
-+}
-+
-+/*
-+ * Update rate statistics and select new primary rates
-+ *
-+ * Rules for rate selection:
-+ * - max_prob_rate must use only one stream, as a tradeoff between delivery
-+ * probability and throughput during strong fluctuations
-+ * - as long as the max prob rate has a probability of more than 3/4, pick
-+ * higher throughput rates, even if the probablity is a bit lower
-+ */
-+static void
-+minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
-+{
-+ struct minstrel_mcs_group_data *mg;
-+ struct minstrel_rate_stats *mr;
-+ int cur_prob, cur_prob_tp, cur_tp, cur_tp2;
-+ int group, i, index;
-+
-+ if (mi->ampdu_packets > 0) {
-+ mi->avg_ampdu_len = minstrel_ewma(mi->avg_ampdu_len,
-+ MINSTREL_FRAC(mi->ampdu_len, mi->ampdu_packets), EWMA_LEVEL);
-+ mi->ampdu_len = 0;
-+ mi->ampdu_packets = 0;
-+ }
-+
-+ mi->sample_slow = 0;
-+ mi->sample_count = 0;
-+ mi->max_tp_rate = 0;
-+ mi->max_tp_rate2 = 0;
-+ mi->max_prob_rate = 0;
-+
-+ for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) {
-+ cur_prob = 0;
-+ cur_prob_tp = 0;
-+ cur_tp = 0;
-+ cur_tp2 = 0;
-+
-+ mg = &mi->groups[group];
-+ if (!mg->supported)
-+ continue;
-+
-+ mg->max_tp_rate = 0;
-+ mg->max_tp_rate2 = 0;
-+ mg->max_prob_rate = 0;
-+ mi->sample_count++;
-+
-+ for (i = 0; i < MCS_GROUP_RATES; i++) {
-+ if (!(mg->supported & BIT(i)))
-+ continue;
-+
-+ mr = &mg->rates[i];
-+ mr->retry_updated = false;
-+ index = MCS_GROUP_RATES * group + i;
-+ minstrel_calc_rate_ewma(mp, mr);
-+ minstrel_ht_calc_tp(mp, mi, group, i);
-+
-+ if (!mr->cur_tp)
-+ continue;
-+
-+ /* ignore the lowest rate of each single-stream group */
-+ if (!i && minstrel_mcs_groups[group].streams == 1)
-+ continue;
-+
-+ if ((mr->cur_tp > cur_prob_tp && mr->probability >
-+ MINSTREL_FRAC(3, 4)) || mr->probability > cur_prob) {
-+ mg->max_prob_rate = index;
-+ cur_prob = mr->probability;
-+ }
-+
-+ if (mr->cur_tp > cur_tp) {
-+ swap(index, mg->max_tp_rate);
-+ cur_tp = mr->cur_tp;
-+ mr = minstrel_get_ratestats(mi, index);
-+ }
-+
-+ if (index >= mg->max_tp_rate)
-+ continue;
-+
-+ if (mr->cur_tp > cur_tp2) {
-+ mg->max_tp_rate2 = index;
-+ cur_tp2 = mr->cur_tp;
-+ }
-+ }
-+ }
-+
-+ /* try to sample up to half of the availble rates during each interval */
-+ mi->sample_count *= 4;
-+
-+ cur_prob = 0;
-+ cur_prob_tp = 0;
-+ cur_tp = 0;
-+ cur_tp2 = 0;
-+ for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) {
-+ mg = &mi->groups[group];
-+ if (!mg->supported)
-+ continue;
-+
-+ mr = minstrel_get_ratestats(mi, mg->max_prob_rate);
-+ if (cur_prob_tp < mr->cur_tp &&
-+ minstrel_mcs_groups[group].streams == 1) {
-+ mi->max_prob_rate = mg->max_prob_rate;
-+ cur_prob = mr->cur_prob;
-+ }
-+
-+ mr = minstrel_get_ratestats(mi, mg->max_tp_rate);
-+ if (cur_tp < mr->cur_tp) {
-+ mi->max_tp_rate = mg->max_tp_rate;
-+ cur_tp = mr->cur_tp;
-+ }
-+
-+ mr = minstrel_get_ratestats(mi, mg->max_tp_rate2);
-+ if (cur_tp2 < mr->cur_tp) {
-+ mi->max_tp_rate2 = mg->max_tp_rate2;
-+ cur_tp2 = mr->cur_tp;
-+ }
-+ }
-+
-+ mi->stats_update = jiffies;
-+}
-+
-+static bool
-+minstrel_ht_txstat_valid(struct ieee80211_tx_rate *rate)
-+{
-+ if (!rate->count)
-+ return false;
-+
-+ if (rate->idx < 0)
-+ return false;
-+
-+ return !!(rate->flags & IEEE80211_TX_RC_MCS);
-+}
-+
-+static void
-+minstrel_next_sample_idx(struct minstrel_ht_sta *mi)
-+{
-+ struct minstrel_mcs_group_data *mg;
-+
-+ for (;;) {
-+ mi->sample_group++;
-+ mi->sample_group %= ARRAY_SIZE(minstrel_mcs_groups);
-+ mg = &mi->groups[mi->sample_group];
-+
-+ if (!mg->supported)
-+ continue;
-+
-+ if (++mg->index >= MCS_GROUP_RATES) {
-+ mg->index = 0;
-+ if (++mg->column >= ARRAY_SIZE(sample_table))
-+ mg->column = 0;
-+ }
-+ break;
-+ }
-+}
-+
-+static void
-+minstrel_downgrade_rate(struct minstrel_ht_sta *mi, int *idx, bool primary)
-+{
-+ int group, orig_group;
-+
-+ orig_group = group = *idx / MCS_GROUP_RATES;
-+ while (group > 0) {
-+ group--;
-+
-+ if (!mi->groups[group].supported)
-+ continue;
-+
-+ if (minstrel_mcs_groups[group].streams >
-+ minstrel_mcs_groups[orig_group].streams)
-+ continue;
-+
-+ if (primary)
-+ *idx = mi->groups[group].max_tp_rate;
-+ else
-+ *idx = mi->groups[group].max_tp_rate2;
-+ break;
-+ }
-+}
-+
-+static void
-+minstrel_aggr_check(struct minstrel_priv *mp, struct ieee80211_sta *pubsta, struct sk_buff *skb)
-+{
-+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
-+ struct sta_info *sta = container_of(pubsta, struct sta_info, sta);
-+ u16 tid;
-+
-+ if (unlikely(!ieee80211_is_data_qos(hdr->frame_control)))
-+ return;
-+
-+ if (unlikely(skb->protocol == cpu_to_be16(ETH_P_PAE)))
-+ return;
-+
-+ tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK;
-+ if (likely(sta->ampdu_mlme.tid_state_tx[tid] != HT_AGG_STATE_IDLE))
-+ return;
-+
-+ ieee80211_start_tx_ba_session(pubsta, tid);
-+}
-+
-+static void
-+minstrel_ht_tx_status(void *priv, struct ieee80211_supported_band *sband,
-+ struct ieee80211_sta *sta, void *priv_sta,
-+ struct sk_buff *skb)
-+{
-+ struct minstrel_ht_sta_priv *msp = priv_sta;
-+ struct minstrel_ht_sta *mi = &msp->ht;
-+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-+ struct ieee80211_tx_rate *ar = info->status.rates;
-+ struct minstrel_rate_stats *rate, *rate2;
-+ struct minstrel_priv *mp = priv;
-+ bool last = false;
-+ int group;
-+ int i = 0;
-+
-+ if (!msp->is_ht)
-+ return mac80211_minstrel.tx_status(priv, sband, sta, &msp->legacy, skb);
-+
-+ /* This packet was aggregated but doesn't carry status info */
-+ if ((info->flags & IEEE80211_TX_CTL_AMPDU) &&
-+ !(info->flags & IEEE80211_TX_STAT_AMPDU))
-+ return;
-+
-+ if (!info->status.ampdu_len) {
-+ info->status.ampdu_ack_len = 1;
-+ info->status.ampdu_len = 1;
-+ }
-+
-+ mi->ampdu_packets++;
-+ mi->ampdu_len += info->status.ampdu_len;
-+
-+ if (!mi->sample_wait && !mi->sample_tries && mi->sample_count > 0) {
-+ mi->sample_wait = 4 + 2 * MINSTREL_TRUNC(mi->avg_ampdu_len);
-+ mi->sample_tries = 3;
-+ mi->sample_count--;
-+ }
-+
-+ if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) {
-+ mi->sample_packets += info->status.ampdu_len;
-+ minstrel_next_sample_idx(mi);
-+ }
-+
-+ for (i = 0; !last; i++) {
-+ last = (i == IEEE80211_TX_MAX_RATES - 1) ||
-+ !minstrel_ht_txstat_valid(&ar[i + 1]);
-+
-+ if (!minstrel_ht_txstat_valid(&ar[i]))
-+ break;
-+
-+ group = minstrel_ht_get_group_idx(&ar[i]);
-+ rate = &mi->groups[group].rates[ar[i].idx % 8];
-+
-+ if (last && (info->flags & IEEE80211_TX_STAT_ACK))
-+ rate->success += info->status.ampdu_ack_len;
-+
-+ rate->attempts += ar[i].count * info->status.ampdu_len;
-+ }
-+
-+ /*
-+ * check for sudden death of spatial multiplexing,
-+ * downgrade to a lower number of streams if necessary.
-+ */
-+ rate = minstrel_get_ratestats(mi, mi->max_tp_rate);
-+ if (rate->attempts > 30 &&
-+ MINSTREL_FRAC(rate->success, rate->attempts) <
-+ MINSTREL_FRAC(20, 100))
-+ minstrel_downgrade_rate(mi, &mi->max_tp_rate, true);
-+
-+ rate2 = minstrel_get_ratestats(mi, mi->max_tp_rate2);
-+ if (rate->attempts > 30 &&
-+ MINSTREL_FRAC(rate->success, rate->attempts) <
-+ MINSTREL_FRAC(20, 100))
-+ minstrel_downgrade_rate(mi, &mi->max_tp_rate2, false);
-+
-+ if (time_after(jiffies, mi->stats_update + (mp->update_interval / 2 * HZ) / 1000)) {
-+ minstrel_ht_update_stats(mp, mi);
-+ minstrel_aggr_check(mp, sta, skb);
-+ }
-+}
-+
-+static void
-+minstrel_calc_retransmit(struct minstrel_priv *mp, struct minstrel_ht_sta *mi,
-+ int index)
-+{
-+ struct minstrel_rate_stats *mr;
-+ const struct mcs_group *group;
-+ unsigned int tx_time, tx_time_rtscts, tx_time_data;
-+ unsigned int cw = mp->cw_min;
-+ unsigned int t_slot = 9; /* FIXME */
-+ unsigned int ampdu_len = MINSTREL_TRUNC(mi->avg_ampdu_len);
-+
-+ mr = minstrel_get_ratestats(mi, index);
-+ if (mr->probability < MINSTREL_FRAC(1, 10)) {
-+ mr->retry_count = 1;
-+ mr->retry_count_rtscts = 1;
-+ return;
-+ }
-+
-+ mr->retry_count = 2;
-+ mr->retry_count_rtscts = 2;
-+ mr->retry_updated = true;
-+
-+ group = &minstrel_mcs_groups[index / MCS_GROUP_RATES];
-+ tx_time_data = group->duration[index % MCS_GROUP_RATES] * ampdu_len;
-+ tx_time = 2 * (t_slot + mi->overhead + tx_time_data);
-+ tx_time_rtscts = 2 * (t_slot + mi->overhead_rtscts + tx_time_data);
-+ do {
-+ cw = (cw << 1) | 1;
-+ cw = min(cw, mp->cw_max);
-+ tx_time += cw + t_slot + mi->overhead;
-+ tx_time_rtscts += cw + t_slot + mi->overhead_rtscts;
-+ if (tx_time_rtscts < mp->segment_size)
-+ mr->retry_count_rtscts++;
-+ } while ((tx_time < mp->segment_size) &&
-+ (++mr->retry_count < mp->max_retry));
-+}
-+
-+
-+static void
-+minstrel_ht_set_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi,
-+ struct ieee80211_tx_rate *rate, int index,
-+ struct ieee80211_tx_rate_control *txrc,
-+ bool sample, bool rtscts)
-+{
-+ const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES];
-+ struct minstrel_rate_stats *mr;
-+
-+ mr = minstrel_get_ratestats(mi, index);
-+ if (!mr->retry_updated)
-+ minstrel_calc_retransmit(mp, mi, index);
-+
-+ if (mr->probability < MINSTREL_FRAC(20, 100))
-+ rate->count = 2;
-+ else if (rtscts)
-+ rate->count = mr->retry_count_rtscts;
-+ else
-+ rate->count = mr->retry_count;
-+
-+ rate->flags = IEEE80211_TX_RC_MCS | group->flags;
-+ if (txrc->short_preamble)
-+ rate->flags |= IEEE80211_TX_RC_USE_SHORT_PREAMBLE;
-+ if (txrc->rts || rtscts)
-+ rate->flags |= IEEE80211_TX_RC_USE_RTS_CTS;
-+ rate->idx = index % MCS_GROUP_RATES + (group->streams - 1) * MCS_GROUP_RATES;
-+}
-+
-+static inline int
-+minstrel_get_duration(int index)
-+{
-+ const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES];
-+ return group->duration[index % MCS_GROUP_RATES];
-+}
-+
-+static int
-+minstrel_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
-+{
-+ struct minstrel_rate_stats *mr;
-+ struct minstrel_mcs_group_data *mg;
-+ int sample_idx = 0;
-+
-+ if (mi->sample_wait > 0) {
-+ mi->sample_wait--;
-+ return -1;
-+ }
-+
-+ if (!mi->sample_tries)
-+ return -1;
-+
-+ mi->sample_tries--;
-+ mg = &mi->groups[mi->sample_group];
-+ sample_idx = sample_table[mg->column][mg->index];
-+ mr = &mg->rates[sample_idx];
-+ sample_idx += mi->sample_group * MCS_GROUP_RATES;
-+
-+ /*
-+ * When not using MRR, do not sample if the probability is already
-+ * higher than 95% to avoid wasting airtime
-+ */
-+ if (!mp->has_mrr && (mr->probability > MINSTREL_FRAC(95, 100)))
-+ goto next;
-+
-+ /*
-+ * Make sure that lower rates get sampled only occasionally,
-+ * if the link is working perfectly.
-+ */
-+ if (minstrel_get_duration(sample_idx) >
-+ minstrel_get_duration(mi->max_tp_rate)) {
-+ if (mr->sample_skipped < 10)
-+ goto next;
-+
-+ if (mi->sample_slow++ > 2)
-+ goto next;
-+ }
-+
-+ return sample_idx;
-+
-+next:
-+ minstrel_next_sample_idx(mi);
-+ return -1;
-+}
-+
-+static void
-+minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
-+ struct ieee80211_tx_rate_control *txrc)
-+{
-+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb);
-+ struct ieee80211_tx_rate *ar = info->status.rates;
-+ struct minstrel_ht_sta_priv *msp = priv_sta;
-+ struct minstrel_ht_sta *mi = &msp->ht;
-+ struct minstrel_priv *mp = priv;
-+ int sample_idx;
-+
-+ if (rate_control_send_low(sta, priv_sta, txrc))
-+ return;
-+
-+ if (!msp->is_ht)
-+ return mac80211_minstrel.get_rate(priv, sta, &msp->legacy, txrc);
-+
-+ info->flags |= mi->tx_flags;
-+ sample_idx = minstrel_get_sample_rate(mp, mi);
-+ if (sample_idx >= 0) {
-+ minstrel_ht_set_rate(mp, mi, &ar[0], sample_idx,
-+ txrc, true, false);
-+ minstrel_ht_set_rate(mp, mi, &ar[1], mi->max_tp_rate,
-+ txrc, false, true);
-+ info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE;
-+ } else {
-+ minstrel_ht_set_rate(mp, mi, &ar[0], mi->max_tp_rate,
-+ txrc, false, false);
-+ minstrel_ht_set_rate(mp, mi, &ar[1], mi->max_tp_rate2,
-+ txrc, false, true);
-+ }
-+ minstrel_ht_set_rate(mp, mi, &ar[2], mi->max_prob_rate, txrc, false, true);
-+
-+ ar[3].count = 0;
-+ ar[3].idx = -1;
-+
-+ mi->total_packets++;
-+
-+ /* wraparound */
-+ if (mi->total_packets == ~0) {
-+ mi->total_packets = 0;
-+ mi->sample_packets = 0;
-+ }
-+}
-+
-+static void
-+minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband,
-+ struct ieee80211_sta *sta, void *priv_sta,
-+ enum nl80211_channel_type oper_chan_type)
-+{
-+ struct minstrel_priv *mp = priv;
-+ struct minstrel_ht_sta_priv *msp = priv_sta;
-+ struct minstrel_ht_sta *mi = &msp->ht;
-+ struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
-+ struct ieee80211_local *local = hw_to_local(mp->hw);
-+ u16 sta_cap = sta->ht_cap.cap;
-+ int ack_dur;
-+ int i;
-+
-+ /* fall back to the old minstrel for legacy stations */
-+ if (sta && !sta->ht_cap.ht_supported) {
-+ msp->is_ht = false;
-+ memset(&msp->legacy, 0, sizeof(msp->legacy));
-+ msp->legacy.r = msp->ratelist;
-+ msp->legacy.sample_table = msp->sample_table;
-+ return mac80211_minstrel.rate_init(priv, sband, sta, &msp->legacy);
-+ }
-+
-+ BUILD_BUG_ON(ARRAY_SIZE(minstrel_mcs_groups) !=
-+ MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS);
-+
-+ msp->is_ht = true;
-+ memset(mi, 0, sizeof(*mi));
-+ mi->stats_update = jiffies;
-+
-+ ack_dur = ieee80211_frame_duration(local, 10, 60, 1, 1);
-+ mi->overhead = ieee80211_frame_duration(local, 0, 60, 1, 1) + ack_dur;
-+ mi->overhead_rtscts = mi->overhead + 2 * ack_dur;
-+
-+ mi->avg_ampdu_len = MINSTREL_FRAC(1, 1);
-+
-+ /* When using MRR, sample more on the first attempt, without delay */
-+ if (mp->has_mrr) {
-+ mi->sample_count = 16;
-+ mi->sample_wait = 0;
-+ } else {
-+ mi->sample_count = 8;
-+ mi->sample_wait = 8;
-+ }
-+ mi->sample_tries = 4;
-+
-+ if (sta_cap & IEEE80211_HT_CAP_TX_STBC)
-+ mi->tx_flags |= IEEE80211_TX_CTL_STBC;
-+
-+ if (sta_cap & IEEE80211_HT_CAP_LDPC_CODING)
-+ mi->tx_flags |= IEEE80211_TX_CTL_LDPC;
-+
-+ if (oper_chan_type != NL80211_CHAN_HT40MINUS &&
-+ oper_chan_type != NL80211_CHAN_HT40PLUS)
-+ sta_cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
-+
-+ for (i = 0; i < ARRAY_SIZE(mi->groups); i++) {
-+ u16 req = 0;
-+
-+ mi->groups[i].supported = 0;
-+ if (minstrel_mcs_groups[i].flags & IEEE80211_TX_RC_SHORT_GI) {
-+ if (minstrel_mcs_groups[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
-+ req |= IEEE80211_HT_CAP_SGI_40;
-+ else
-+ req |= IEEE80211_HT_CAP_SGI_20;
-+ }
-+
-+ if (minstrel_mcs_groups[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
-+ req |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
-+
-+ if ((sta_cap & req) != req)
-+ continue;
-+
-+ mi->groups[i].supported =
-+ mcs->rx_mask[minstrel_mcs_groups[i].streams - 1];
-+ }
-+}
-+
-+static void
-+minstrel_ht_rate_init(void *priv, struct ieee80211_supported_band *sband,
-+ struct ieee80211_sta *sta, void *priv_sta)
-+{
-+ struct minstrel_priv *mp = priv;
-+
-+ minstrel_ht_update_caps(priv, sband, sta, priv_sta, mp->hw->conf.channel_type);
-+}
-+
-+static void
-+minstrel_ht_rate_update(void *priv, struct ieee80211_supported_band *sband,
-+ struct ieee80211_sta *sta, void *priv_sta,
-+ u32 changed, enum nl80211_channel_type oper_chan_type)
-+{
-+ minstrel_ht_update_caps(priv, sband, sta, priv_sta, oper_chan_type);
-+}
-+
-+static void *
-+minstrel_ht_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
-+{
-+ struct ieee80211_supported_band *sband;
-+ struct minstrel_ht_sta_priv *msp;
-+ struct minstrel_priv *mp = priv;
-+ struct ieee80211_hw *hw = mp->hw;
-+ int max_rates = 0;
-+ int i;
-+
-+ for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
-+ sband = hw->wiphy->bands[i];
-+ if (sband && sband->n_bitrates > max_rates)
-+ max_rates = sband->n_bitrates;
-+ }
-+
-+ msp = kzalloc(sizeof(struct minstrel_ht_sta), gfp);
-+ if (!msp)
-+ return NULL;
-+
-+ msp->ratelist = kzalloc(sizeof(struct minstrel_rate) * max_rates, gfp);
-+ if (!msp->ratelist)
-+ goto error;
-+
-+ msp->sample_table = kmalloc(SAMPLE_COLUMNS * max_rates, gfp);
-+ if (!msp->sample_table)
-+ goto error1;
-+
-+ return msp;
-+
-+error1:
-+ kfree(msp->sample_table);
-+error:
-+ kfree(msp);
-+ return NULL;
-+}
-+
-+static void
-+minstrel_ht_free_sta(void *priv, struct ieee80211_sta *sta, void *priv_sta)
-+{
-+ struct minstrel_ht_sta_priv *msp = priv_sta;
-+
-+ kfree(msp->sample_table);
-+ kfree(msp->ratelist);
-+ kfree(msp);
-+}
-+
-+static void *
-+minstrel_ht_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
-+{
-+ return mac80211_minstrel.alloc(hw, debugfsdir);
-+}
-+
-+static void
-+minstrel_ht_free(void *priv)
-+{
-+ mac80211_minstrel.free(priv);
-+}
-+
-+static struct rate_control_ops mac80211_minstrel_ht = {
-+ .name = "minstrel_ht",
-+ .tx_status = minstrel_ht_tx_status,
-+ .get_rate = minstrel_ht_get_rate,
-+ .rate_init = minstrel_ht_rate_init,
-+ .rate_update = minstrel_ht_rate_update,
-+ .alloc_sta = minstrel_ht_alloc_sta,
-+ .free_sta = minstrel_ht_free_sta,
-+ .alloc = minstrel_ht_alloc,
-+ .free = minstrel_ht_free,
-+#ifdef CONFIG_MAC80211_DEBUGFS
-+ .add_sta_debugfs = minstrel_ht_add_sta_debugfs,
-+ .remove_sta_debugfs = minstrel_ht_remove_sta_debugfs,
-+#endif
-+};
-+
-+
-+static void
-+init_sample_table(void)
-+{
-+ int col, i, new_idx;
-+ u8 rnd[MCS_GROUP_RATES];
-+
-+ memset(sample_table, 0xff, sizeof(sample_table));
-+ for (col = 0; col < SAMPLE_COLUMNS; col++) {
-+ for (i = 0; i < MCS_GROUP_RATES; i++) {
-+ get_random_bytes(rnd, sizeof(rnd));
-+ new_idx = (i + rnd[i]) % MCS_GROUP_RATES;
-+
-+ while (sample_table[col][new_idx] != 0xff)
-+ new_idx = (new_idx + 1) % MCS_GROUP_RATES;
-+
-+ sample_table[col][new_idx] = i;
-+ }
-+ }
-+}
-+
-+int __init
-+rc80211_minstrel_ht_init(void)
-+{
-+ init_sample_table();
-+ return ieee80211_rate_control_register(&mac80211_minstrel_ht);
-+}
-+
-+void
-+rc80211_minstrel_ht_exit(void)
-+{
-+ ieee80211_rate_control_unregister(&mac80211_minstrel_ht);
-+}
---- /dev/null
-+++ b/net/mac80211/rc80211_minstrel_ht.h
-@@ -0,0 +1,128 @@
-+/*
-+ * Copyright (C) 2010 Felix Fietkau <nbd@openwrt.org>
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ */
-+
-+#ifndef __RC_MINSTREL_HT_H
-+#define __RC_MINSTREL_HT_H
-+
-+/*
-+ * The number of streams can be changed to 2 to reduce code
-+ * size and memory footprint.
-+ */
-+#define MINSTREL_MAX_STREAMS 3
-+#define MINSTREL_STREAM_GROUPS 4
-+
-+/* scaled fraction values */
-+#define MINSTREL_SCALE 16
-+#define MINSTREL_FRAC(val, div) (((val) << MINSTREL_SCALE) / div)
-+#define MINSTREL_TRUNC(val) ((val) >> MINSTREL_SCALE)
-+
-+#define MCS_GROUP_RATES 8
-+
-+struct mcs_group {
-+ u32 flags;
-+ unsigned int streams;
-+ unsigned int duration[MCS_GROUP_RATES];
-+};
-+
-+struct minstrel_rate_stats {
-+ /* current / last sampling period attempts/success counters */
-+ unsigned int attempts, last_attempts;
-+ unsigned int success, last_success;
-+
-+ /* total attempts/success counters */
-+ u64 att_hist, succ_hist;
-+
-+ /* current throughput */
-+ unsigned int cur_tp;
-+
-+ /* packet delivery probabilities */
-+ unsigned int cur_prob, probability;
-+
-+ /* maximum retry counts */
-+ unsigned int retry_count;
-+ unsigned int retry_count_rtscts;
-+
-+ bool retry_updated;
-+ u8 sample_skipped;
-+};
-+
-+struct minstrel_mcs_group_data {
-+ u8 index;
-+ u8 column;
-+
-+ /* bitfield of supported MCS rates of this group */
-+ u8 supported;
-+
-+ /* selected primary rates */
-+ unsigned int max_tp_rate;
-+ unsigned int max_tp_rate2;
-+ unsigned int max_prob_rate;
-+
-+ /* MCS rate statistics */
-+ struct minstrel_rate_stats rates[MCS_GROUP_RATES];
-+};
-+
-+struct minstrel_ht_sta {
-+ /* ampdu length (average, per sampling interval) */
-+ unsigned int ampdu_len;
-+ unsigned int ampdu_packets;
-+
-+ /* ampdu length (EWMA) */
-+ unsigned int avg_ampdu_len;
-+
-+ /* best throughput rate */
-+ unsigned int max_tp_rate;
-+
-+ /* second best throughput rate */
-+ unsigned int max_tp_rate2;
-+
-+ /* best probability rate */
-+ unsigned int max_prob_rate;
-+
-+ /* time of last status update */
-+ unsigned long stats_update;
-+
-+ /* overhead time in usec for each frame */
-+ unsigned int overhead;
-+ unsigned int overhead_rtscts;
-+
-+ unsigned int total_packets;
-+ unsigned int sample_packets;
-+
-+ /* tx flags to add for frames for this sta */
-+ u32 tx_flags;
-+
-+ u8 sample_wait;
-+ u8 sample_tries;
-+ u8 sample_count;
-+ u8 sample_slow;
-+
-+ /* current MCS group to be sampled */
-+ u8 sample_group;
-+
-+ /* MCS rate group info and statistics */
-+ struct minstrel_mcs_group_data groups[MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS];
-+};
-+
-+struct minstrel_ht_sta_priv {
-+ union {
-+ struct minstrel_ht_sta ht;
-+ struct minstrel_sta_info legacy;
-+ };
-+#ifdef CONFIG_MAC80211_DEBUGFS
-+ struct dentry *dbg_stats;
-+#endif
-+ void *ratelist;
-+ void *sample_table;
-+ bool is_ht;
-+};
-+
-+void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir);
-+void minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta);
-+
-+#endif
---- /dev/null
-+++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c
-@@ -0,0 +1,120 @@
-+/*
-+ * Copyright (C) 2010 Felix Fietkau <nbd@openwrt.org>
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ */
-+#include <linux/netdevice.h>
-+#include <linux/types.h>
-+#include <linux/skbuff.h>
-+#include <linux/debugfs.h>
-+#include <linux/ieee80211.h>
-+#include <net/mac80211.h>
-+#include "rc80211_minstrel.h"
-+#include "rc80211_minstrel_ht.h"
-+
-+extern const struct mcs_group minstrel_mcs_groups[];
-+
-+static int
-+minstrel_ht_stats_open(struct inode *inode, struct file *file)
-+{
-+ struct minstrel_ht_sta_priv *msp = inode->i_private;
-+ struct minstrel_ht_sta *mi = &msp->ht;
-+ struct minstrel_debugfs_info *ms;
-+ unsigned int i, j, tp, prob, eprob;
-+ char *p;
-+ int ret;
-+
-+ if (!msp->is_ht) {
-+ inode->i_private = &msp->legacy;
-+ ret = minstrel_stats_open(inode, file);
-+ inode->i_private = msp;
-+ return ret;
-+ }
-+
-+ ms = kmalloc(sizeof(*ms) + 8192, GFP_KERNEL);
-+ if (!ms)
-+ return -ENOMEM;
-+
-+ file->private_data = ms;
-+ p = ms->buf;
-+ p += sprintf(p, "type rate throughput ewma prob this prob "
-+ "this succ/attempt success attempts\n");
-+ for (i = 0; i < MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS; i++) {
-+ char htmode = '2';
-+ char gimode = 'L';
-+
-+ if (!mi->groups[i].supported)
-+ continue;
-+
-+ if (minstrel_mcs_groups[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
-+ htmode = '4';
-+ if (minstrel_mcs_groups[i].flags & IEEE80211_TX_RC_SHORT_GI)
-+ gimode = 'S';
-+
-+ for (j = 0; j < MCS_GROUP_RATES; j++) {
-+ struct minstrel_rate_stats *mr = &mi->groups[i].rates[j];
-+ int idx = i * MCS_GROUP_RATES + j;
-+
-+ if (!(mi->groups[i].supported & BIT(j)))
-+ continue;
-+
-+ p += sprintf(p, "HT%c0/%cGI ", htmode, gimode);
-+
-+ *(p++) = (idx == mi->max_tp_rate) ? 'T' : ' ';
-+ *(p++) = (idx == mi->max_tp_rate2) ? 't' : ' ';
-+ *(p++) = (idx == mi->max_prob_rate) ? 'P' : ' ';
-+ p += sprintf(p, "MCS%-2u", (minstrel_mcs_groups[i].streams - 1) *
-+ MCS_GROUP_RATES + j);
-+
-+ tp = mr->cur_tp / 10;
-+ prob = MINSTREL_TRUNC(mr->cur_prob * 1000);
-+ eprob = MINSTREL_TRUNC(mr->probability * 1000);
-+
-+ p += sprintf(p, " %6u.%1u %6u.%1u %6u.%1u "
-+ "%3u(%3u) %8llu %8llu\n",
-+ tp / 10, tp % 10,
-+ eprob / 10, eprob % 10,
-+ prob / 10, prob % 10,
-+ mr->last_success,
-+ mr->last_attempts,
-+ (unsigned long long)mr->succ_hist,
-+ (unsigned long long)mr->att_hist);
-+ }
-+ }
-+ p += sprintf(p, "\nTotal packet count:: ideal %d "
-+ "lookaround %d\n",
-+ max(0, (int) mi->total_packets - (int) mi->sample_packets),
-+ mi->sample_packets);
-+ p += sprintf(p, "Average A-MPDU length: %d.%d\n",
-+ MINSTREL_TRUNC(mi->avg_ampdu_len),
-+ MINSTREL_TRUNC(mi->avg_ampdu_len * 10) % 10);
-+ ms->len = p - ms->buf;
-+
-+ return 0;
-+}
-+
-+static const struct file_operations minstrel_ht_stat_fops = {
-+ .owner = THIS_MODULE,
-+ .open = minstrel_ht_stats_open,
-+ .read = minstrel_stats_read,
-+ .release = minstrel_stats_release,
-+};
-+
-+void
-+minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir)
-+{
-+ struct minstrel_ht_sta_priv *msp = priv_sta;
-+
-+ msp->dbg_stats = debugfs_create_file("rc_stats", S_IRUGO, dir, msp,
-+ &minstrel_ht_stat_fops);
-+}
-+
-+void
-+minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta)
-+{
-+ struct minstrel_ht_sta_priv *msp = priv_sta;
-+
-+ debugfs_remove(msp->dbg_stats);
-+}
diff --git a/package/mac80211/patches/550-ath9k_no_multi_desc_frames.patch b/package/mac80211/patches/550-ath9k_no_multi_desc_frames.patch
deleted file mode 100644
index 3bc730e32e..0000000000
--- a/package/mac80211/patches/550-ath9k_no_multi_desc_frames.patch
+++ /dev/null
@@ -1,24 +0,0 @@
---- a/drivers/net/wireless/ath/ath9k/common.c
-+++ b/drivers/net/wireless/ath/ath9k/common.c
-@@ -57,13 +57,19 @@ static bool ath9k_rx_accept(struct ath_c
- * rs_more indicates chained descriptors which can be used
- * to link buffers together for a sort of scatter-gather
- * operation.
-- *
-+ * reject the frame, we don't support scatter-gather yet and
-+ * the frame is probably corrupt anyway
-+ */
-+ if (rx_stats->rs_more)
-+ return false;
-+
-+ /*
- * The rx_stats->rs_status will not be set until the end of the
- * chained descriptors so it can be ignored if rs_more is set. The
- * rs_more will be false at the last element of the chained
- * descriptors.
- */
-- if (!rx_stats->rs_more && rx_stats->rs_status != 0) {
-+ if (rx_stats->rs_status != 0) {
- if (rx_stats->rs_status & ATH9K_RXERR_CRC)
- rxs->flag |= RX_FLAG_FAILED_FCS_CRC;
- if (rx_stats->rs_status & ATH9K_RXERR_PHY)
diff --git a/package/mac80211/patches/600-rt2x00-disable-pci-code-if-CONFIG_PCI-not-defined.patch b/package/mac80211/patches/600-rt2x00-disable-pci-code-if-CONFIG_PCI-not-defined.patch
index 8da8cb5da7..cea88ae63a 100644
--- a/package/mac80211/patches/600-rt2x00-disable-pci-code-if-CONFIG_PCI-not-defined.patch
+++ b/package/mac80211/patches/600-rt2x00-disable-pci-code-if-CONFIG_PCI-not-defined.patch
@@ -1,6 +1,6 @@
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
-@@ -225,6 +225,7 @@ void rt2x00pci_uninitialize(struct rt2x0
+@@ -216,6 +216,7 @@ void rt2x00pci_uninitialize(struct rt2x0
}
EXPORT_SYMBOL_GPL(rt2x00pci_uninitialize);
@@ -8,7 +8,7 @@
/*
* PCI driver handlers.
*/
-@@ -399,6 +400,7 @@ int rt2x00pci_resume(struct pci_dev *pci
+@@ -390,6 +391,7 @@ int rt2x00pci_resume(struct pci_dev *pci
}
EXPORT_SYMBOL_GPL(rt2x00pci_resume);
#endif /* CONFIG_PM */
diff --git a/package/mac80211/patches/601-rt2x00-lib-use-rt2x00dev-irq.patch b/package/mac80211/patches/601-rt2x00-lib-use-rt2x00dev-irq.patch
index c04bb2d88c..3921fa0141 100644
--- a/package/mac80211/patches/601-rt2x00-lib-use-rt2x00dev-irq.patch
+++ b/package/mac80211/patches/601-rt2x00-lib-use-rt2x00dev-irq.patch
@@ -1,6 +1,6 @@
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
-@@ -215,7 +215,7 @@ void rt2x00pci_uninitialize(struct rt2x0
+@@ -206,7 +206,7 @@ void rt2x00pci_uninitialize(struct rt2x0
/*
* Free irq line.
*/