diff options
author | Sujith <Sujith.Manoharan@atheros.com> | 2010-06-30 05:16:31 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-06-30 15:00:53 -0400 |
commit | 88c1f4f6dffe66e2fed8e7e3276e091ee850bed0 (patch) | |
tree | af33d9246e53c8c30a0e00b2c91219798cfe5180 /drivers | |
parent | 92b50c4b5b01d0ba4efcff9e85f7a76b620fe789 (diff) |
ath9k_htc: Add LED support for AR7010
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/htc.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/htc_drv_main.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 34 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/reg.h | 23 |
4 files changed, 56 insertions, 4 deletions
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h index 58f52a1dc7ea..3756400e6bf9 100644 --- a/drivers/net/wireless/ath/ath9k/htc.h +++ b/drivers/net/wireless/ath/ath9k/htc.h | |||
@@ -287,6 +287,7 @@ struct ath9k_debug { | |||
287 | #define ATH_LED_PIN_DEF 1 | 287 | #define ATH_LED_PIN_DEF 1 |
288 | #define ATH_LED_PIN_9287 8 | 288 | #define ATH_LED_PIN_9287 8 |
289 | #define ATH_LED_PIN_9271 15 | 289 | #define ATH_LED_PIN_9271 15 |
290 | #define ATH_LED_PIN_7010 12 | ||
290 | #define ATH_LED_ON_DURATION_IDLE 350 /* in msecs */ | 291 | #define ATH_LED_ON_DURATION_IDLE 350 /* in msecs */ |
291 | #define ATH_LED_OFF_DURATION_IDLE 250 /* in msecs */ | 292 | #define ATH_LED_OFF_DURATION_IDLE 250 /* in msecs */ |
292 | 293 | ||
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c index 05445d8a9818..e38ca66db849 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c | |||
@@ -931,6 +931,8 @@ void ath9k_init_leds(struct ath9k_htc_priv *priv) | |||
931 | priv->ah->led_pin = ATH_LED_PIN_9287; | 931 | priv->ah->led_pin = ATH_LED_PIN_9287; |
932 | else if (AR_SREV_9271(priv->ah)) | 932 | else if (AR_SREV_9271(priv->ah)) |
933 | priv->ah->led_pin = ATH_LED_PIN_9271; | 933 | priv->ah->led_pin = ATH_LED_PIN_9271; |
934 | else if (AR_DEVID_7010(priv->ah)) | ||
935 | priv->ah->led_pin = ATH_LED_PIN_7010; | ||
934 | else | 936 | else |
935 | priv->ah->led_pin = ATH_LED_PIN_DEF; | 937 | priv->ah->led_pin = ATH_LED_PIN_DEF; |
936 | 938 | ||
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 6bf7e7ac9874..3ed5c9ec7bc1 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -2176,6 +2176,8 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) | |||
2176 | 2176 | ||
2177 | if (AR_SREV_9271(ah)) | 2177 | if (AR_SREV_9271(ah)) |
2178 | pCap->num_gpio_pins = AR9271_NUM_GPIO; | 2178 | pCap->num_gpio_pins = AR9271_NUM_GPIO; |
2179 | else if (AR_DEVID_7010(ah)) | ||
2180 | pCap->num_gpio_pins = AR7010_NUM_GPIO; | ||
2179 | else if (AR_SREV_9285_10_OR_LATER(ah)) | 2181 | else if (AR_SREV_9285_10_OR_LATER(ah)) |
2180 | pCap->num_gpio_pins = AR9285_NUM_GPIO; | 2182 | pCap->num_gpio_pins = AR9285_NUM_GPIO; |
2181 | else if (AR_SREV_9280_10_OR_LATER(ah)) | 2183 | else if (AR_SREV_9280_10_OR_LATER(ah)) |
@@ -2316,8 +2318,15 @@ void ath9k_hw_cfg_gpio_input(struct ath_hw *ah, u32 gpio) | |||
2316 | 2318 | ||
2317 | BUG_ON(gpio >= ah->caps.num_gpio_pins); | 2319 | BUG_ON(gpio >= ah->caps.num_gpio_pins); |
2318 | 2320 | ||
2319 | gpio_shift = gpio << 1; | 2321 | if (AR_DEVID_7010(ah)) { |
2322 | gpio_shift = gpio; | ||
2323 | REG_RMW(ah, AR7010_GPIO_OE, | ||
2324 | (AR7010_GPIO_OE_AS_INPUT << gpio_shift), | ||
2325 | (AR7010_GPIO_OE_MASK << gpio_shift)); | ||
2326 | return; | ||
2327 | } | ||
2320 | 2328 | ||
2329 | gpio_shift = gpio << 1; | ||
2321 | REG_RMW(ah, | 2330 | REG_RMW(ah, |
2322 | AR_GPIO_OE_OUT, | 2331 | AR_GPIO_OE_OUT, |
2323 | (AR_GPIO_OE_OUT_DRV_NO << gpio_shift), | 2332 | (AR_GPIO_OE_OUT_DRV_NO << gpio_shift), |
@@ -2333,7 +2342,11 @@ u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio) | |||
2333 | if (gpio >= ah->caps.num_gpio_pins) | 2342 | if (gpio >= ah->caps.num_gpio_pins) |
2334 | return 0xffffffff; | 2343 | return 0xffffffff; |
2335 | 2344 | ||
2336 | if (AR_SREV_9300_20_OR_LATER(ah)) | 2345 | if (AR_DEVID_7010(ah)) { |
2346 | u32 val; | ||
2347 | val = REG_READ(ah, AR7010_GPIO_IN); | ||
2348 | return (MS(val, AR7010_GPIO_IN_VAL) & AR_GPIO_BIT(gpio)) == 0; | ||
2349 | } else if (AR_SREV_9300_20_OR_LATER(ah)) | ||
2337 | return MS_REG_READ(AR9300, gpio) != 0; | 2350 | return MS_REG_READ(AR9300, gpio) != 0; |
2338 | else if (AR_SREV_9271(ah)) | 2351 | else if (AR_SREV_9271(ah)) |
2339 | return MS_REG_READ(AR9271, gpio) != 0; | 2352 | return MS_REG_READ(AR9271, gpio) != 0; |
@@ -2353,10 +2366,16 @@ void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio, | |||
2353 | { | 2366 | { |
2354 | u32 gpio_shift; | 2367 | u32 gpio_shift; |
2355 | 2368 | ||
2356 | ath9k_hw_gpio_cfg_output_mux(ah, gpio, ah_signal_type); | 2369 | if (AR_DEVID_7010(ah)) { |
2370 | gpio_shift = gpio; | ||
2371 | REG_RMW(ah, AR7010_GPIO_OE, | ||
2372 | (AR7010_GPIO_OE_AS_OUTPUT << gpio_shift), | ||
2373 | (AR7010_GPIO_OE_MASK << gpio_shift)); | ||
2374 | return; | ||
2375 | } | ||
2357 | 2376 | ||
2377 | ath9k_hw_gpio_cfg_output_mux(ah, gpio, ah_signal_type); | ||
2358 | gpio_shift = 2 * gpio; | 2378 | gpio_shift = 2 * gpio; |
2359 | |||
2360 | REG_RMW(ah, | 2379 | REG_RMW(ah, |
2361 | AR_GPIO_OE_OUT, | 2380 | AR_GPIO_OE_OUT, |
2362 | (AR_GPIO_OE_OUT_DRV_ALL << gpio_shift), | 2381 | (AR_GPIO_OE_OUT_DRV_ALL << gpio_shift), |
@@ -2366,6 +2385,13 @@ EXPORT_SYMBOL(ath9k_hw_cfg_output); | |||
2366 | 2385 | ||
2367 | void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val) | 2386 | void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val) |
2368 | { | 2387 | { |
2388 | if (AR_DEVID_7010(ah)) { | ||
2389 | val = val ? 0 : 1; | ||
2390 | REG_RMW(ah, AR7010_GPIO_OUT, ((val&1) << gpio), | ||
2391 | AR_GPIO_BIT(gpio)); | ||
2392 | return; | ||
2393 | } | ||
2394 | |||
2369 | if (AR_SREV_9271(ah)) | 2395 | if (AR_SREV_9271(ah)) |
2370 | val = ~val; | 2396 | val = ~val; |
2371 | 2397 | ||
diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h index 47be667fe4ff..633e3d949ec0 100644 --- a/drivers/net/wireless/ath/ath9k/reg.h +++ b/drivers/net/wireless/ath/ath9k/reg.h | |||
@@ -882,6 +882,7 @@ | |||
882 | #define AR_SREV_9271_11(_ah) \ | 882 | #define AR_SREV_9271_11(_ah) \ |
883 | (AR_SREV_9271(_ah) && \ | 883 | (AR_SREV_9271(_ah) && \ |
884 | ((_ah)->hw_version.macRev == AR_SREV_REVISION_9271_11)) | 884 | ((_ah)->hw_version.macRev == AR_SREV_REVISION_9271_11)) |
885 | |||
885 | #define AR_SREV_9300(_ah) \ | 886 | #define AR_SREV_9300(_ah) \ |
886 | (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9300)) | 887 | (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9300)) |
887 | #define AR_SREV_9300_20(_ah) \ | 888 | #define AR_SREV_9300_20(_ah) \ |
@@ -896,6 +897,10 @@ | |||
896 | (AR_SREV_9285_12_OR_LATER(_ah) && \ | 897 | (AR_SREV_9285_12_OR_LATER(_ah) && \ |
897 | ((REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1)) | 898 | ((REG_READ(_ah, AR_AN_SYNTH9) & 0x7) == 0x1)) |
898 | 899 | ||
900 | #define AR_DEVID_7010(_ah) \ | ||
901 | (((_ah)->hw_version.devid == 0x7010) || \ | ||
902 | ((_ah)->hw_version.devid == 0x9018)) | ||
903 | |||
899 | #define AR_RADIO_SREV_MAJOR 0xf0 | 904 | #define AR_RADIO_SREV_MAJOR 0xf0 |
900 | #define AR_RAD5133_SREV_MAJOR 0xc0 | 905 | #define AR_RAD5133_SREV_MAJOR 0xc0 |
901 | #define AR_RAD2133_SREV_MAJOR 0xd0 | 906 | #define AR_RAD2133_SREV_MAJOR 0xd0 |
@@ -993,6 +998,7 @@ enum { | |||
993 | #define AR9287_NUM_GPIO 11 | 998 | #define AR9287_NUM_GPIO 11 |
994 | #define AR9271_NUM_GPIO 16 | 999 | #define AR9271_NUM_GPIO 16 |
995 | #define AR9300_NUM_GPIO 17 | 1000 | #define AR9300_NUM_GPIO 17 |
1001 | #define AR7010_NUM_GPIO 16 | ||
996 | 1002 | ||
997 | #define AR_GPIO_IN_OUT 0x4048 | 1003 | #define AR_GPIO_IN_OUT 0x4048 |
998 | #define AR_GPIO_IN_VAL 0x0FFFC000 | 1004 | #define AR_GPIO_IN_VAL 0x0FFFC000 |
@@ -1007,6 +1013,8 @@ enum { | |||
1007 | #define AR9271_GPIO_IN_VAL_S 16 | 1013 | #define AR9271_GPIO_IN_VAL_S 16 |
1008 | #define AR9300_GPIO_IN_VAL 0x0001FFFF | 1014 | #define AR9300_GPIO_IN_VAL 0x0001FFFF |
1009 | #define AR9300_GPIO_IN_VAL_S 0 | 1015 | #define AR9300_GPIO_IN_VAL_S 0 |
1016 | #define AR7010_GPIO_IN_VAL 0x0000FFFF | ||
1017 | #define AR7010_GPIO_IN_VAL_S 0 | ||
1010 | 1018 | ||
1011 | #define AR_GPIO_OE_OUT (AR_SREV_9300_20_OR_LATER(ah) ? 0x4050 : 0x404c) | 1019 | #define AR_GPIO_OE_OUT (AR_SREV_9300_20_OR_LATER(ah) ? 0x4050 : 0x404c) |
1012 | #define AR_GPIO_OE_OUT_DRV 0x3 | 1020 | #define AR_GPIO_OE_OUT_DRV 0x3 |
@@ -1015,6 +1023,21 @@ enum { | |||
1015 | #define AR_GPIO_OE_OUT_DRV_HI 0x2 | 1023 | #define AR_GPIO_OE_OUT_DRV_HI 0x2 |
1016 | #define AR_GPIO_OE_OUT_DRV_ALL 0x3 | 1024 | #define AR_GPIO_OE_OUT_DRV_ALL 0x3 |
1017 | 1025 | ||
1026 | #define AR7010_GPIO_OE 0x52000 | ||
1027 | #define AR7010_GPIO_OE_MASK 0x1 | ||
1028 | #define AR7010_GPIO_OE_AS_OUTPUT 0x0 | ||
1029 | #define AR7010_GPIO_OE_AS_INPUT 0x1 | ||
1030 | #define AR7010_GPIO_IN 0x52004 | ||
1031 | #define AR7010_GPIO_OUT 0x52008 | ||
1032 | #define AR7010_GPIO_SET 0x5200C | ||
1033 | #define AR7010_GPIO_CLEAR 0x52010 | ||
1034 | #define AR7010_GPIO_INT 0x52014 | ||
1035 | #define AR7010_GPIO_INT_TYPE 0x52018 | ||
1036 | #define AR7010_GPIO_INT_POLARITY 0x5201C | ||
1037 | #define AR7010_GPIO_PENDING 0x52020 | ||
1038 | #define AR7010_GPIO_INT_MASK 0x52024 | ||
1039 | #define AR7010_GPIO_FUNCTION 0x52028 | ||
1040 | |||
1018 | #define AR_GPIO_INTR_POL (AR_SREV_9300_20_OR_LATER(ah) ? 0x4058 : 0x4050) | 1041 | #define AR_GPIO_INTR_POL (AR_SREV_9300_20_OR_LATER(ah) ? 0x4058 : 0x4050) |
1019 | #define AR_GPIO_INTR_POL_VAL 0x0001FFFF | 1042 | #define AR_GPIO_INTR_POL_VAL 0x0001FFFF |
1020 | #define AR_GPIO_INTR_POL_VAL_S 0 | 1043 | #define AR_GPIO_INTR_POL_VAL_S 0 |