blob: 9f19cd1c1bef6a98a37a314923918420114d7a09 [file] [log] [blame]
Vasanthakumar Thiagarajan17d50d12009-08-26 21:08:44 +05301/*
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
19void ath9k_hw_btcoex_init(struct ath_hw *ah)
20{
Vasanthakumar Thiagarajanf14462c2009-08-26 21:08:46 +053021 struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info;
22
Vasanthakumar Thiagarajan17d50d12009-08-26 21:08:44 +053023 /* 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 Thiagarajanf14462c2009-08-26 21:08:46 +053034 btcoex_info->btactive_gpio);
Vasanthakumar Thiagarajan17d50d12009-08-26 21:08:44 +053035
36 /* Configure the desired gpio port for input */
Vasanthakumar Thiagarajanf14462c2009-08-26 21:08:46 +053037 ath9k_hw_cfg_gpio_input(ah, btcoex_info->btactive_gpio);
Vasanthakumar Thiagarajan17d50d12009-08-26 21:08:44 +053038}
39
40void ath9k_hw_btcoex_enable(struct ath_hw *ah)
41{
Vasanthakumar Thiagarajanf14462c2009-08-26 21:08:46 +053042 struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info;
43
Vasanthakumar Thiagarajan17d50d12009-08-26 21:08:44 +053044 /* Configure the desired GPIO port for TX_FRAME output */
Vasanthakumar Thiagarajanf14462c2009-08-26 21:08:46 +053045 ath9k_hw_cfg_output(ah, btcoex_info->wlanactive_gpio,
Vasanthakumar Thiagarajan17d50d12009-08-26 21:08:44 +053046 AR_GPIO_OUTPUT_MUX_AS_TX_FRAME);
47
48 ah->ah_sc->sc_flags |= SC_OP_BTCOEX_ENABLED;
49}
50
51void ath9k_hw_btcoex_disable(struct ath_hw *ah)
52{
Vasanthakumar Thiagarajanf14462c2009-08-26 21:08:46 +053053 struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info;
Vasanthakumar Thiagarajan17d50d12009-08-26 21:08:44 +053054
Vasanthakumar Thiagarajanf14462c2009-08-26 21:08:46 +053055 ath9k_hw_set_gpio(ah, btcoex_info->wlanactive_gpio, 0);
56
57 ath9k_hw_cfg_output(ah, btcoex_info->wlanactive_gpio,
Vasanthakumar Thiagarajan17d50d12009-08-26 21:08:44 +053058 AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
59
60 ah->ah_sc->sc_flags &= ~SC_OP_BTCOEX_ENABLED;
61}