summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-05-25 22:39:58 +0000
committerFelix Fietkau <nbd@openwrt.org>2014-05-25 22:39:58 +0000
commit48855aab6c02fbe9c2a99d65ff4fe0ca1a1e7e51 (patch)
tree103d73b86e1ad8300289310048ff1963809f7d6d
parent56702140b6ab8af28487f7b55dae611a8e15dcb1 (diff)
downloadopenwrt-48855aab6c02fbe9c2a99d65ff4fe0ca1a1e7e51.tar.gz
openwrt-48855aab6c02fbe9c2a99d65ff4fe0ca1a1e7e51.tar.bz2
openwrt-48855aab6c02fbe9c2a99d65ff4fe0ca1a1e7e51.zip
ath9k: make support for PC-OEM cards optional, reduces module size
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40859
-rw-r--r--package/kernel/mac80211/Makefile9
-rw-r--r--package/kernel/mac80211/patches/560-ath9k_pcoem_optional.patch249
-rw-r--r--package/kernel/mac80211/patches/561-ath9k_remove_gain_tables.patch12
3 files changed, 270 insertions, 0 deletions
diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
index 60a12205ac..8edf0d2226 100644
--- a/package/kernel/mac80211/Makefile
+++ b/package/kernel/mac80211/Makefile
@@ -572,6 +572,14 @@ This module adds support for wireless adapters based on
Atheros IEEE 802.11n AR5008 and AR9001 family of chipsets.
endef
+define KernelPackage/ath9k/config
+
+ config ATH9K_SUPPORT_PCOEM
+ bool "Support chips used in PC OEM cards"
+ depends PACKAGE_kmod-ath9k
+
+endef
+
define KernelPackage/ath9k-htc
$(call KernelPackage/mac80211/Default)
TITLE:=Atheros 802.11n USB device support
@@ -1395,6 +1403,7 @@ config-$(call config_package,ath9k-common) += ATH9K_COMMON
config-$(CONFIG_TARGET_ar71xx) += ATH9K_AHB
config-$(CONFIG_PCI) += ATH9K_PCI
config-$(CONFIG_ATH_USER_REGD) += ATH_USER_REGD
+config-$(CONFIG_ATH9K_SUPPORT_PCOEM) += ATH9K_PCOEM
config-$(call config_package,ath9k-htc) += ATH9K_HTC
config-$(call config_package,ath10k) += ATH10K ATH10K_PCI
diff --git a/package/kernel/mac80211/patches/560-ath9k_pcoem_optional.patch b/package/kernel/mac80211/patches/560-ath9k_pcoem_optional.patch
new file mode 100644
index 0000000000..bbed4e3d9c
--- /dev/null
+++ b/package/kernel/mac80211/patches/560-ath9k_pcoem_optional.patch
@@ -0,0 +1,249 @@
+--- a/drivers/net/wireless/ath/ath9k/Kconfig
++++ b/drivers/net/wireless/ath/ath9k/Kconfig
+@@ -133,6 +133,11 @@ config ATH9K_RFKILL
+ seconds. Turn off to save power, but enable it if you have
+ a platform that can toggle the RF-Kill GPIO.
+
++config ATH9K_PCOEM
++ bool "Atheros ath9k support for PC OEM cards" if EXPERT
++ depends on ATH9K
++ default y
++
+ config ATH9K_HTC
+ tristate "Atheros HTC based wireless cards support"
+ depends on m
+--- a/drivers/net/wireless/ath/ath9k/Makefile
++++ b/drivers/net/wireless/ath/ath9k/Makefile
+@@ -31,7 +31,6 @@ ath9k_hw-y:= \
+ ar5008_phy.o \
+ ar9002_calib.o \
+ ar9003_calib.o \
+- ar9003_rtt.o \
+ calib.o \
+ eeprom.o \
+ eeprom_def.o \
+@@ -48,6 +47,8 @@ ath9k_hw-$(CPTCFG_ATH9K_WOW) += ar9003_w
+
+ ath9k_hw-$(CPTCFG_ATH9K_BTCOEX_SUPPORT) += btcoex.o \
+ ar9003_mci.o
++ath9k-hw-$(CPTCFG_ATH9K_PCOEM) += ar9003_rtt.o
++
+ obj-$(CPTCFG_ATH9K_HW) += ath9k_hw.o
+
+ obj-$(CPTCFG_ATH9K_COMMON) += ath9k_common.o
+--- a/drivers/net/wireless/ath/ath9k/ar9003_rtt.h
++++ b/drivers/net/wireless/ath/ath9k/ar9003_rtt.h
+@@ -17,6 +17,7 @@
+ #ifndef AR9003_RTT_H
+ #define AR9003_RTT_H
+
++#ifdef CPTCFG_ATH9K_PCOEM
+ void ar9003_hw_rtt_enable(struct ath_hw *ah);
+ void ar9003_hw_rtt_disable(struct ath_hw *ah);
+ void ar9003_hw_rtt_set_mask(struct ath_hw *ah, u32 rtt_mask);
+@@ -25,5 +26,40 @@ void ar9003_hw_rtt_load_hist(struct ath_
+ void ar9003_hw_rtt_fill_hist(struct ath_hw *ah);
+ void ar9003_hw_rtt_clear_hist(struct ath_hw *ah);
+ bool ar9003_hw_rtt_restore(struct ath_hw *ah, struct ath9k_channel *chan);
++#else
++static inline void ar9003_hw_rtt_enable(struct ath_hw *ah)
++{
++}
++
++static inline void ar9003_hw_rtt_disable(struct ath_hw *ah)
++{
++}
++
++static inline void ar9003_hw_rtt_set_mask(struct ath_hw *ah, u32 rtt_mask)
++{
++}
++
++static inline bool ar9003_hw_rtt_force_restore(struct ath_hw *ah)
++{
++ return false;
++}
++
++static inline void ar9003_hw_rtt_load_hist(struct ath_hw *ah)
++{
++}
++
++static inline void ar9003_hw_rtt_fill_hist(struct ath_hw *ah)
++{
++}
++
++static inline void ar9003_hw_rtt_clear_hist(struct ath_hw *ah)
++{
++}
++
++static inline bool ar9003_hw_rtt_restore(struct ath_hw *ah, struct ath9k_channel *chan)
++{
++ return false;
++}
++#endif
+
+ #endif
+--- a/drivers/net/wireless/ath/ath9k/hw.h
++++ b/drivers/net/wireless/ath/ath9k/hw.h
+@@ -244,13 +244,20 @@ enum ath9k_hw_caps {
+ ATH9K_HW_CAP_2GHZ = BIT(11),
+ ATH9K_HW_CAP_5GHZ = BIT(12),
+ ATH9K_HW_CAP_APM = BIT(13),
++#ifdef CPTCFG_ATH9K_PCOEM
+ ATH9K_HW_CAP_RTT = BIT(14),
+ ATH9K_HW_CAP_MCI = BIT(15),
+- ATH9K_HW_CAP_DFS = BIT(16),
+- ATH9K_HW_WOW_DEVICE_CAPABLE = BIT(17),
+- ATH9K_HW_CAP_PAPRD = BIT(18),
+- ATH9K_HW_CAP_FCC_BAND_SWITCH = BIT(19),
+- ATH9K_HW_CAP_BT_ANT_DIV = BIT(20),
++ ATH9K_HW_WOW_DEVICE_CAPABLE = BIT(16),
++ ATH9K_HW_CAP_BT_ANT_DIV = BIT(17),
++#else
++ ATH9K_HW_CAP_RTT = 0,
++ ATH9K_HW_CAP_MCI = 0,
++ ATH9K_HW_WOW_DEVICE_CAPABLE = 0,
++ ATH9K_HW_CAP_BT_ANT_DIV = 0,
++#endif
++ ATH9K_HW_CAP_DFS = BIT(18),
++ ATH9K_HW_CAP_PAPRD = BIT(19),
++ ATH9K_HW_CAP_FCC_BAND_SWITCH = BIT(20),
+ };
+
+ /*
+--- a/drivers/net/wireless/ath/ath9k/init.c
++++ b/drivers/net/wireless/ath/ath9k/init.c
+@@ -355,6 +355,9 @@ static void ath9k_init_pcoem_platform(st
+ struct ath9k_hw_capabilities *pCap = &ah->caps;
+ struct ath_common *common = ath9k_hw_common(ah);
+
++ if (!IS_ENABLED(CPTCFG_ATH9K_PCOEM))
++ return;
++
+ if (common->bus_ops->ath_bus_type != ATH_PCI)
+ return;
+
+--- a/drivers/net/wireless/ath/ath9k/pci.c
++++ b/drivers/net/wireless/ath/ath9k/pci.c
+@@ -30,6 +30,7 @@ static DEFINE_PCI_DEVICE_TABLE(ath_pci_i
+ { PCI_VDEVICE(ATHEROS, 0x0029) }, /* PCI */
+ { PCI_VDEVICE(ATHEROS, 0x002A) }, /* PCI-E */
+
++#ifdef CPTCFG_ATH9K_PCOEM
+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
+ 0x002A,
+ PCI_VENDOR_ID_AZWAVE,
+@@ -82,6 +83,7 @@ static DEFINE_PCI_DEVICE_TABLE(ath_pci_i
+ PCI_VENDOR_ID_AZWAVE,
+ 0x2C37),
+ .driver_data = ATH9K_PCI_BT_ANT_DIV },
++#endif
+
+ { PCI_VDEVICE(ATHEROS, 0x002B) }, /* PCI-E */
+ { PCI_VDEVICE(ATHEROS, 0x002C) }, /* PCI-E 802.11n bonded out */
+@@ -102,6 +104,7 @@ static DEFINE_PCI_DEVICE_TABLE(ath_pci_i
+
+ { PCI_VDEVICE(ATHEROS, 0x0030) }, /* PCI-E AR9300 */
+
++#ifdef CPTCFG_ATH9K_PCOEM
+ /* PCI-E CUS198 */
+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
+ 0x0032,
+@@ -294,10 +297,12 @@ static DEFINE_PCI_DEVICE_TABLE(ath_pci_i
+ PCI_VENDOR_ID_ASUSTEK,
+ 0x850D),
+ .driver_data = ATH9K_PCI_NO_PLL_PWRSAVE },
++#endif
+
+ { PCI_VDEVICE(ATHEROS, 0x0032) }, /* PCI-E AR9485 */
+ { PCI_VDEVICE(ATHEROS, 0x0033) }, /* PCI-E AR9580 */
+
++#ifdef CPTCFG_ATH9K_PCOEM
+ /* PCI-E CUS217 */
+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
+ 0x0034,
+@@ -657,6 +662,7 @@ static DEFINE_PCI_DEVICE_TABLE(ath_pci_i
+ /* PCI-E AR9565 (WB335) */
+ { PCI_VDEVICE(ATHEROS, 0x0036),
+ .driver_data = ATH9K_PCI_BT_ANT_DIV },
++#endif
+
+ { PCI_VDEVICE(ATHEROS, 0xabcd) }, /* PCI-E internal chip default ID */
+ { 0 }
+--- a/drivers/net/wireless/ath/ath9k/reg.h
++++ b/drivers/net/wireless/ath/ath9k/reg.h
+@@ -891,10 +891,21 @@
+ (AR_SREV_9330((_ah)) && \
+ ((_ah)->hw_version.macRev == AR_SREV_REVISION_9330_12))
+
++#ifdef CPTCFG_ATH9K_PCOEM
++#define AR_SREV_9462(_ah) \
++ (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462))
+ #define AR_SREV_9485(_ah) \
+ (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9485))
++#define AR_SREV_9565(_ah) \
++ (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565))
++#else
++#define AR_SREV_9462(_ah) 0
++#define AR_SREV_9485(_ah) 0
++#define AR_SREV_9565(_ah) 0
++#endif
++
+ #define AR_SREV_9485_11_OR_LATER(_ah) \
+- (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9485) && \
++ (AR_SREV_9485(_ah) && \
+ ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9485_11))
+ #define AR_SREV_9485_OR_LATER(_ah) \
+ (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9485))
+@@ -910,34 +921,30 @@
+ (AR_SREV_9285_12_OR_LATER(_ah) && \
+ ((REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1))
+
+-#define AR_SREV_9462(_ah) \
+- (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462))
+ #define AR_SREV_9462_20(_ah) \
+- (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462) && \
++ (AR_SREV_9462(_ah) && \
+ ((_ah)->hw_version.macRev == AR_SREV_REVISION_9462_20))
+ #define AR_SREV_9462_21(_ah) \
+- (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462) && \
++ (AR_SREV_9462(_ah) && \
+ ((_ah)->hw_version.macRev == AR_SREV_REVISION_9462_21))
+ #define AR_SREV_9462_20_OR_LATER(_ah) \
+- (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462) && \
++ (AR_SREV_9462(_ah) && \
+ ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9462_20))
+ #define AR_SREV_9462_21_OR_LATER(_ah) \
+- (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9462) && \
++ (AR_SREV_9462(_ah) && \
+ ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9462_21))
+
+-#define AR_SREV_9565(_ah) \
+- (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565))
+ #define AR_SREV_9565_10(_ah) \
+- (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565) && \
++ (AR_SREV_9565(_ah) && \
+ ((_ah)->hw_version.macRev == AR_SREV_REVISION_9565_10))
+ #define AR_SREV_9565_101(_ah) \
+- (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565) && \
++ (AR_SREV_9565(_ah) && \
+ ((_ah)->hw_version.macRev == AR_SREV_REVISION_9565_101))
+ #define AR_SREV_9565_11(_ah) \
+- (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565) && \
++ (AR_SREV_9565(_ah) && \
+ ((_ah)->hw_version.macRev == AR_SREV_REVISION_9565_11))
+ #define AR_SREV_9565_11_OR_LATER(_ah) \
+- (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9565) && \
++ (AR_SREV_9565(_ah) && \
+ ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9565_11))
+
+ #define AR_SREV_9550(_ah) \
+--- a/.local-symbols
++++ b/.local-symbols
+@@ -129,6 +129,7 @@ ATH9K_HW=
+ ATH9K_COMMON=
+ ATH9K_DFS_DEBUGFS=
+ ATH9K_BTCOEX_SUPPORT=
++ATH9K_PCOEM=
+ ATH9K=
+ ATH9K_PCI=
+ ATH9K_AHB=
diff --git a/package/kernel/mac80211/patches/561-ath9k_remove_gain_tables.patch b/package/kernel/mac80211/patches/561-ath9k_remove_gain_tables.patch
new file mode 100644
index 0000000000..852eae32b7
--- /dev/null
+++ b/package/kernel/mac80211/patches/561-ath9k_remove_gain_tables.patch
@@ -0,0 +1,12 @@
+--- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
++++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
+@@ -663,9 +663,6 @@ static void ar9003_tx_gain_table_mode5(s
+ if (AR_SREV_9485_11_OR_LATER(ah))
+ INIT_INI_ARRAY(&ah->iniModesTxGain,
+ ar9485Modes_green_ob_db_tx_gain_1_1);
+- else if (AR_SREV_9340(ah))
+- INIT_INI_ARRAY(&ah->iniModesTxGain,
+- ar9340Modes_ub124_tx_gain_table_1p0);
+ else if (AR_SREV_9580(ah))
+ INIT_INI_ARRAY(&ah->iniModesTxGain,
+ ar9580_1p0_type5_tx_gain_table);