Vasanthakumar Thiagarajan | 17d50d1 | 2009-08-26 21:08:44 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2009 Atheros Communications Inc. |
| 3 | * |
| 4 | * Permission to use, copy, modify, and/or distribute this software for any |
| 5 | * purpose with or without fee is hereby granted, provided that the above |
| 6 | * copyright notice and this permission notice appear in all copies. |
| 7 | * |
| 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | */ |
| 16 | |
| 17 | #include "ath9k.h" |
| 18 | |
| 19 | void ath9k_hw_btcoex_init(struct ath_hw *ah) |
| 20 | { |
Vasanthakumar Thiagarajan | f14462c | 2009-08-26 21:08:46 +0530 | [diff] [blame] | 21 | struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info; |
| 22 | |
Vasanthakumar Thiagarajan | 17d50d1 | 2009-08-26 21:08:44 +0530 | [diff] [blame] | 23 | /* connect bt_active to baseband */ |
| 24 | REG_CLR_BIT(ah, AR_GPIO_INPUT_EN_VAL, |
| 25 | (AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_DEF | |
| 26 | AR_GPIO_INPUT_EN_VAL_BT_FREQUENCY_DEF)); |
| 27 | |
| 28 | REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, |
| 29 | AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB); |
| 30 | |
| 31 | /* Set input mux for bt_active to gpio pin */ |
| 32 | REG_RMW_FIELD(ah, AR_GPIO_INPUT_MUX1, |
| 33 | AR_GPIO_INPUT_MUX1_BT_ACTIVE, |
Vasanthakumar Thiagarajan | f14462c | 2009-08-26 21:08:46 +0530 | [diff] [blame] | 34 | btcoex_info->btactive_gpio); |
Vasanthakumar Thiagarajan | 17d50d1 | 2009-08-26 21:08:44 +0530 | [diff] [blame] | 35 | |
| 36 | /* Configure the desired gpio port for input */ |
Vasanthakumar Thiagarajan | f14462c | 2009-08-26 21:08:46 +0530 | [diff] [blame] | 37 | ath9k_hw_cfg_gpio_input(ah, btcoex_info->btactive_gpio); |
Vasanthakumar Thiagarajan | 17d50d1 | 2009-08-26 21:08:44 +0530 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | void ath9k_hw_btcoex_enable(struct ath_hw *ah) |
| 41 | { |
Vasanthakumar Thiagarajan | f14462c | 2009-08-26 21:08:46 +0530 | [diff] [blame] | 42 | struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info; |
| 43 | |
Vasanthakumar Thiagarajan | 17d50d1 | 2009-08-26 21:08:44 +0530 | [diff] [blame] | 44 | /* Configure the desired GPIO port for TX_FRAME output */ |
Vasanthakumar Thiagarajan | f14462c | 2009-08-26 21:08:46 +0530 | [diff] [blame] | 45 | ath9k_hw_cfg_output(ah, btcoex_info->wlanactive_gpio, |
Vasanthakumar Thiagarajan | 17d50d1 | 2009-08-26 21:08:44 +0530 | [diff] [blame] | 46 | AR_GPIO_OUTPUT_MUX_AS_TX_FRAME); |
| 47 | |
| 48 | ah->ah_sc->sc_flags |= SC_OP_BTCOEX_ENABLED; |
| 49 | } |
| 50 | |
| 51 | void ath9k_hw_btcoex_disable(struct ath_hw *ah) |
| 52 | { |
Vasanthakumar Thiagarajan | f14462c | 2009-08-26 21:08:46 +0530 | [diff] [blame] | 53 | struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info; |
Vasanthakumar Thiagarajan | 17d50d1 | 2009-08-26 21:08:44 +0530 | [diff] [blame] | 54 | |
Vasanthakumar Thiagarajan | f14462c | 2009-08-26 21:08:46 +0530 | [diff] [blame] | 55 | ath9k_hw_set_gpio(ah, btcoex_info->wlanactive_gpio, 0); |
| 56 | |
| 57 | ath9k_hw_cfg_output(ah, btcoex_info->wlanactive_gpio, |
Vasanthakumar Thiagarajan | 17d50d1 | 2009-08-26 21:08:44 +0530 | [diff] [blame] | 58 | AR_GPIO_OUTPUT_MUX_AS_OUTPUT); |
| 59 | |
| 60 | ah->ah_sc->sc_flags &= ~SC_OP_BTCOEX_ENABLED; |
| 61 | } |