aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-03-19 08:55:38 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-03-30 14:15:15 -0400
commit691680b8335fa8995b190676f53e3bcef6477b4a (patch)
treeda065593ff7d2fa4dd15b2a9718357cc6872f8e0 /drivers/net
parentc70cab1a45d56395db03957f6504c6b613bece5b (diff)
ath9k: add an interface for overriding the value of specific GPIO pins
Some devices control antenna settings or other things through GPIO pins of the wireless interface. Add a debugfs interface for changing those and keeping them set across card resets. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.c6
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c16
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h2
3 files changed, 24 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index 9fe86939d93e..a762cadb3ab7 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -1119,6 +1119,12 @@ int ath9k_init_debug(struct ath_hw *ah)
1119 debugfs_create_file("regdump", S_IRUSR, sc->debug.debugfs_phy, sc, 1119 debugfs_create_file("regdump", S_IRUSR, sc->debug.debugfs_phy, sc,
1120 &fops_regdump); 1120 &fops_regdump);
1121 1121
1122 debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR,
1123 sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask);
1124
1125 debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR,
1126 sc->debug.debugfs_phy, &sc->sc_ah->gpio_val);
1127
1122 sc->debug.regidx = 0; 1128 sc->debug.regidx = 0;
1123 return 0; 1129 return 0;
1124} 1130}
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 338b07502f1a..b170c455a40b 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1212,6 +1212,20 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah,
1212 return true; 1212 return true;
1213} 1213}
1214 1214
1215static void ath9k_hw_apply_gpio_override(struct ath_hw *ah)
1216{
1217 u32 gpio_mask = ah->gpio_mask;
1218 int i;
1219
1220 for (i = 0; gpio_mask; i++, gpio_mask >>= 1) {
1221 if (!(gpio_mask & 1))
1222 continue;
1223
1224 ath9k_hw_cfg_output(ah, i, AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
1225 ath9k_hw_set_gpio(ah, i, !!(ah->gpio_val & BIT(i)));
1226 }
1227}
1228
1215bool ath9k_hw_check_alive(struct ath_hw *ah) 1229bool ath9k_hw_check_alive(struct ath_hw *ah)
1216{ 1230{
1217 int count = 50; 1231 int count = 50;
@@ -1500,6 +1514,8 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
1500 if (AR_SREV_9300_20_OR_LATER(ah)) 1514 if (AR_SREV_9300_20_OR_LATER(ah))
1501 ar9003_hw_bb_watchdog_config(ah); 1515 ar9003_hw_bb_watchdog_config(ah);
1502 1516
1517 ath9k_hw_apply_gpio_override(ah);
1518
1503 return 0; 1519 return 0;
1504} 1520}
1505EXPORT_SYMBOL(ath9k_hw_reset); 1521EXPORT_SYMBOL(ath9k_hw_reset);
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index c86eea28a88f..775c0eb10b95 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -799,6 +799,8 @@ struct ath_hw {
799 int initPDADC; 799 int initPDADC;
800 int PDADCdelta; 800 int PDADCdelta;
801 u8 led_pin; 801 u8 led_pin;
802 u32 gpio_mask;
803 u32 gpio_val;
802 804
803 struct ar5416IniArray iniModes; 805 struct ar5416IniArray iniModes;
804 struct ar5416IniArray iniCommon; 806 struct ar5416IniArray iniCommon;