aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorMiaoqing Pan <miaoqing@qca.qualcomm.com>2015-03-31 22:19:57 -0400
committerKalle Valo <kvalo@codeaurora.org>2015-04-07 13:15:01 -0400
commit61b559dea40ec1712be4a0ea712a2922a8f38588 (patch)
treeafaa7ccd4fbc1e675c7a840532e30c288c23ed6c /drivers/net/wireless
parentfcc658dabf5ef0320de1fbb28a9478e265e60422 (diff)
ath9k: add extra GPIO led support
ar9550 or later chips, the AR_GPIO_IN_OUT register only can control GPIO[0:3]. For the extra GPIO, use standard GPIO calls instead of WMAC internal registers. Signed-off-by: Miaoqing Pan <miaoqing@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/ath/ath9k/gpio.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c17
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/reg.h4
4 files changed, 27 insertions, 3 deletions
diff --git a/drivers/net/wireless/ath/ath9k/gpio.c b/drivers/net/wireless/ath/ath9k/gpio.c
index 86d46c196966..284706798c71 100644
--- a/drivers/net/wireless/ath/ath9k/gpio.c
+++ b/drivers/net/wireless/ath/ath9k/gpio.c
@@ -69,9 +69,15 @@ void ath_fill_led_pin(struct ath_softc *sc)
69{ 69{
70 struct ath_hw *ah = sc->sc_ah; 70 struct ath_hw *ah = sc->sc_ah;
71 71
72 if (AR_SREV_9100(ah) || (ah->led_pin >= 0)) 72 if (AR_SREV_9100(ah))
73 return; 73 return;
74 74
75 if (ah->led_pin >= 0) {
76 if (!((1 << ah->led_pin) & AR_GPIO_OE_OUT_MASK))
77 ath9k_hw_request_gpio(ah, ah->led_pin, "ath9k-led");
78 return;
79 }
80
75 if (AR_SREV_9287(ah)) 81 if (AR_SREV_9287(ah))
76 ah->led_pin = ATH_LED_PIN_9287; 82 ah->led_pin = ATH_LED_PIN_9287;
77 else if (AR_SREV_9485(sc->sc_ah)) 83 else if (AR_SREV_9485(sc->sc_ah))
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 5cdbdb038371..5e15e8e10ed3 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -20,6 +20,7 @@
20#include <linux/time.h> 20#include <linux/time.h>
21#include <linux/bitops.h> 21#include <linux/bitops.h>
22#include <linux/etherdevice.h> 22#include <linux/etherdevice.h>
23#include <linux/gpio.h>
23#include <asm/unaligned.h> 24#include <asm/unaligned.h>
24 25
25#include "hw.h" 26#include "hw.h"
@@ -2711,11 +2712,23 @@ void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val)
2711 if (AR_SREV_9271(ah)) 2712 if (AR_SREV_9271(ah))
2712 val = ~val; 2713 val = ~val;
2713 2714
2714 REG_RMW(ah, AR_GPIO_IN_OUT, ((val & 1) << gpio), 2715 if ((1 << gpio) & AR_GPIO_OE_OUT_MASK)
2715 AR_GPIO_BIT(gpio)); 2716 REG_RMW(ah, AR_GPIO_IN_OUT, ((val & 1) << gpio),
2717 AR_GPIO_BIT(gpio));
2718 else
2719 gpio_set_value(gpio, val & 1);
2716} 2720}
2717EXPORT_SYMBOL(ath9k_hw_set_gpio); 2721EXPORT_SYMBOL(ath9k_hw_set_gpio);
2718 2722
2723void ath9k_hw_request_gpio(struct ath_hw *ah, u32 gpio, const char *label)
2724{
2725 if (gpio >= ah->caps.num_gpio_pins)
2726 return;
2727
2728 gpio_request_one(gpio, GPIOF_DIR_OUT | GPIOF_INIT_LOW, label);
2729}
2730EXPORT_SYMBOL(ath9k_hw_request_gpio);
2731
2719void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna) 2732void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna)
2720{ 2733{
2721 REG_WRITE(ah, AR_DEF_ANTENNA, (antenna & 0x7)); 2734 REG_WRITE(ah, AR_DEF_ANTENNA, (antenna & 0x7));
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 92fab1a54697..c1d2d0340feb 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -1024,6 +1024,7 @@ u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio);
1024void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio, 1024void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio,
1025 u32 ah_signal_type); 1025 u32 ah_signal_type);
1026void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val); 1026void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val);
1027void ath9k_hw_request_gpio(struct ath_hw *ah, u32 gpio, const char *label);
1027void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna); 1028void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna);
1028 1029
1029/* General Operation */ 1030/* General Operation */
diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h
index 1234399a43dd..caba54ddad25 100644
--- a/drivers/net/wireless/ath/ath9k/reg.h
+++ b/drivers/net/wireless/ath/ath9k/reg.h
@@ -958,6 +958,8 @@
958 958
959#define AR_SREV_9550(_ah) \ 959#define AR_SREV_9550(_ah) \
960 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9550)) 960 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9550))
961#define AR_SREV_9550_OR_LATER(_ah) \
962 (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9550))
961 963
962#define AR_SREV_9580(_ah) \ 964#define AR_SREV_9580(_ah) \
963 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9580) && \ 965 (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9580) && \
@@ -1128,6 +1130,8 @@ enum {
1128 1130
1129#define AR_GPIO_OE_OUT (AR_SREV_9340(ah) ? 0x4030 : \ 1131#define AR_GPIO_OE_OUT (AR_SREV_9340(ah) ? 0x4030 : \
1130 (AR_SREV_9300_20_OR_LATER(ah) ? 0x4050 : 0x404c)) 1132 (AR_SREV_9300_20_OR_LATER(ah) ? 0x4050 : 0x404c))
1133#define AR_GPIO_OE_OUT_MASK (AR_SREV_9550_OR_LATER(ah) ? \
1134 0x0000000F : 0xFFFFFFFF)
1131#define AR_GPIO_OE_OUT_DRV 0x3 1135#define AR_GPIO_OE_OUT_DRV 0x3
1132#define AR_GPIO_OE_OUT_DRV_NO 0x0 1136#define AR_GPIO_OE_OUT_DRV_NO 0x0
1133#define AR_GPIO_OE_OUT_DRV_LOW 0x1 1137#define AR_GPIO_OE_OUT_DRV_LOW 0x1