162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright (c) 2010-2011 Atheros Communications Inc.
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any
562306a36Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above
662306a36Sopenharmony_ci * copyright notice and this permission notice appear in all copies.
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
962306a36Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1062306a36Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1162306a36Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1262306a36Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1362306a36Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1462306a36Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1562306a36Sopenharmony_ci */
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#ifndef AR9003_MCI_H
1862306a36Sopenharmony_ci#define AR9003_MCI_H
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#define MCI_FLAG_DISABLE_TIMESTAMP      0x00000001      /* Disable time stamp */
2162306a36Sopenharmony_ci#define MCI_RECOVERY_DUR_TSF		(100 * 1000)    /* 100 ms */
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci/* Default remote BT device MCI COEX version */
2462306a36Sopenharmony_ci#define MCI_GPM_COEX_MAJOR_VERSION_DEFAULT  3
2562306a36Sopenharmony_ci#define MCI_GPM_COEX_MINOR_VERSION_DEFAULT  0
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci/* Local WLAN MCI COEX version */
2862306a36Sopenharmony_ci#define MCI_GPM_COEX_MAJOR_VERSION_WLAN     3
2962306a36Sopenharmony_ci#define MCI_GPM_COEX_MINOR_VERSION_WLAN     0
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_cienum mci_gpm_coex_query_type {
3262306a36Sopenharmony_ci	MCI_GPM_COEX_QUERY_BT_ALL_INFO      = BIT(0),
3362306a36Sopenharmony_ci	MCI_GPM_COEX_QUERY_BT_TOPOLOGY      = BIT(1),
3462306a36Sopenharmony_ci	MCI_GPM_COEX_QUERY_BT_DEBUG         = BIT(2),
3562306a36Sopenharmony_ci};
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_cienum mci_gpm_coex_halt_bt_gpm {
3862306a36Sopenharmony_ci	MCI_GPM_COEX_BT_GPM_UNHALT,
3962306a36Sopenharmony_ci	MCI_GPM_COEX_BT_GPM_HALT
4062306a36Sopenharmony_ci};
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_cienum mci_gpm_coex_bt_update_flags_op {
4362306a36Sopenharmony_ci	MCI_GPM_COEX_BT_FLAGS_READ,
4462306a36Sopenharmony_ci	MCI_GPM_COEX_BT_FLAGS_SET,
4562306a36Sopenharmony_ci	MCI_GPM_COEX_BT_FLAGS_CLEAR
4662306a36Sopenharmony_ci};
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci#define MCI_NUM_BT_CHANNELS     79
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci#define MCI_BT_MCI_FLAGS_UPDATE_CORR          0x00000002
5162306a36Sopenharmony_ci#define MCI_BT_MCI_FLAGS_UPDATE_HDR           0x00000004
5262306a36Sopenharmony_ci#define MCI_BT_MCI_FLAGS_UPDATE_PLD           0x00000008
5362306a36Sopenharmony_ci#define MCI_BT_MCI_FLAGS_LNA_CTRL             0x00000010
5462306a36Sopenharmony_ci#define MCI_BT_MCI_FLAGS_DEBUG                0x00000020
5562306a36Sopenharmony_ci#define MCI_BT_MCI_FLAGS_SCHED_MSG            0x00000040
5662306a36Sopenharmony_ci#define MCI_BT_MCI_FLAGS_CONT_MSG             0x00000080
5762306a36Sopenharmony_ci#define MCI_BT_MCI_FLAGS_COEX_GPM             0x00000100
5862306a36Sopenharmony_ci#define MCI_BT_MCI_FLAGS_CPU_INT_MSG          0x00000200
5962306a36Sopenharmony_ci#define MCI_BT_MCI_FLAGS_MCI_MODE             0x00000400
6062306a36Sopenharmony_ci#define MCI_BT_MCI_FLAGS_AR9462_MODE          0x00001000
6162306a36Sopenharmony_ci#define MCI_BT_MCI_FLAGS_OTHER                0x00010000
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci#define MCI_DEFAULT_BT_MCI_FLAGS              0x00011dde
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci#define MCI_TOGGLE_BT_MCI_FLAGS  (MCI_BT_MCI_FLAGS_UPDATE_CORR | \
6662306a36Sopenharmony_ci				  MCI_BT_MCI_FLAGS_UPDATE_HDR  | \
6762306a36Sopenharmony_ci				  MCI_BT_MCI_FLAGS_UPDATE_PLD  | \
6862306a36Sopenharmony_ci				  MCI_BT_MCI_FLAGS_MCI_MODE)
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci#define MCI_2G_FLAGS_CLEAR_MASK   0x00000000
7162306a36Sopenharmony_ci#define MCI_2G_FLAGS_SET_MASK     MCI_TOGGLE_BT_MCI_FLAGS
7262306a36Sopenharmony_ci#define MCI_2G_FLAGS              MCI_DEFAULT_BT_MCI_FLAGS
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci#define MCI_5G_FLAGS_CLEAR_MASK   MCI_TOGGLE_BT_MCI_FLAGS
7562306a36Sopenharmony_ci#define MCI_5G_FLAGS_SET_MASK     0x00000000
7662306a36Sopenharmony_ci#define MCI_5G_FLAGS              (MCI_DEFAULT_BT_MCI_FLAGS & \
7762306a36Sopenharmony_ci				   ~MCI_TOGGLE_BT_MCI_FLAGS)
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci/*
8062306a36Sopenharmony_ci * Default value for AR9462 is 0x00002201
8162306a36Sopenharmony_ci */
8262306a36Sopenharmony_ci#define ATH_MCI_CONFIG_CONCUR_TX            0x00000003
8362306a36Sopenharmony_ci#define ATH_MCI_CONFIG_MCI_OBS_MCI          0x00000004
8462306a36Sopenharmony_ci#define ATH_MCI_CONFIG_MCI_OBS_TXRX         0x00000008
8562306a36Sopenharmony_ci#define ATH_MCI_CONFIG_MCI_OBS_BT           0x00000010
8662306a36Sopenharmony_ci#define ATH_MCI_CONFIG_DISABLE_MCI_CAL      0x00000020
8762306a36Sopenharmony_ci#define ATH_MCI_CONFIG_DISABLE_OSLA         0x00000040
8862306a36Sopenharmony_ci#define ATH_MCI_CONFIG_DISABLE_FTP_STOMP    0x00000080
8962306a36Sopenharmony_ci#define ATH_MCI_CONFIG_AGGR_THRESH          0x00000700
9062306a36Sopenharmony_ci#define ATH_MCI_CONFIG_AGGR_THRESH_S        8
9162306a36Sopenharmony_ci#define ATH_MCI_CONFIG_DISABLE_AGGR_THRESH  0x00000800
9262306a36Sopenharmony_ci#define ATH_MCI_CONFIG_CLK_DIV              0x00003000
9362306a36Sopenharmony_ci#define ATH_MCI_CONFIG_CLK_DIV_S            12
9462306a36Sopenharmony_ci#define ATH_MCI_CONFIG_DISABLE_TUNING       0x00004000
9562306a36Sopenharmony_ci#define ATH_MCI_CONFIG_DISABLE_AIC          0x00008000
9662306a36Sopenharmony_ci#define ATH_MCI_CONFIG_AIC_CAL_NUM_CHAN     0x007f0000
9762306a36Sopenharmony_ci#define ATH_MCI_CONFIG_AIC_CAL_NUM_CHAN_S   16
9862306a36Sopenharmony_ci#define ATH_MCI_CONFIG_NO_QUIET_ACK         0x00800000
9962306a36Sopenharmony_ci#define ATH_MCI_CONFIG_NO_QUIET_ACK_S       23
10062306a36Sopenharmony_ci#define ATH_MCI_CONFIG_ANT_ARCH             0x07000000
10162306a36Sopenharmony_ci#define ATH_MCI_CONFIG_ANT_ARCH_S           24
10262306a36Sopenharmony_ci#define ATH_MCI_CONFIG_FORCE_QUIET_ACK      0x08000000
10362306a36Sopenharmony_ci#define ATH_MCI_CONFIG_FORCE_QUIET_ACK_S    27
10462306a36Sopenharmony_ci#define ATH_MCI_CONFIG_FORCE_2CHAIN_ACK     0x10000000
10562306a36Sopenharmony_ci#define ATH_MCI_CONFIG_MCI_STAT_DBG         0x20000000
10662306a36Sopenharmony_ci#define ATH_MCI_CONFIG_MCI_WEIGHT_DBG       0x40000000
10762306a36Sopenharmony_ci#define ATH_MCI_CONFIG_DISABLE_MCI          0x80000000
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci#define ATH_MCI_CONFIG_MCI_OBS_MASK     (ATH_MCI_CONFIG_MCI_OBS_MCI  | \
11062306a36Sopenharmony_ci					 ATH_MCI_CONFIG_MCI_OBS_TXRX | \
11162306a36Sopenharmony_ci					 ATH_MCI_CONFIG_MCI_OBS_BT)
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci#define ATH_MCI_CONFIG_MCI_OBS_GPIO     0x0000002F
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci#define ATH_MCI_ANT_ARCH_1_ANT_PA_LNA_NON_SHARED 0x00
11662306a36Sopenharmony_ci#define ATH_MCI_ANT_ARCH_1_ANT_PA_LNA_SHARED     0x01
11762306a36Sopenharmony_ci#define ATH_MCI_ANT_ARCH_2_ANT_PA_LNA_NON_SHARED 0x02
11862306a36Sopenharmony_ci#define ATH_MCI_ANT_ARCH_2_ANT_PA_LNA_SHARED     0x03
11962306a36Sopenharmony_ci#define ATH_MCI_ANT_ARCH_3_ANT                   0x04
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci#define MCI_ANT_ARCH_PA_LNA_SHARED(mci)					\
12262306a36Sopenharmony_ci	((MS(mci->config, ATH_MCI_CONFIG_ANT_ARCH) == ATH_MCI_ANT_ARCH_1_ANT_PA_LNA_SHARED) || \
12362306a36Sopenharmony_ci	 (MS(mci->config, ATH_MCI_CONFIG_ANT_ARCH) == ATH_MCI_ANT_ARCH_2_ANT_PA_LNA_SHARED))
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_cienum mci_message_header {		/* length of payload */
12662306a36Sopenharmony_ci	MCI_LNA_CTRL     = 0x10,        /* len = 0 */
12762306a36Sopenharmony_ci	MCI_CONT_NACK    = 0x20,        /* len = 0 */
12862306a36Sopenharmony_ci	MCI_CONT_INFO    = 0x30,        /* len = 4 */
12962306a36Sopenharmony_ci	MCI_CONT_RST     = 0x40,        /* len = 0 */
13062306a36Sopenharmony_ci	MCI_SCHD_INFO    = 0x50,        /* len = 16 */
13162306a36Sopenharmony_ci	MCI_CPU_INT      = 0x60,        /* len = 4 */
13262306a36Sopenharmony_ci	MCI_SYS_WAKING   = 0x70,        /* len = 0 */
13362306a36Sopenharmony_ci	MCI_GPM          = 0x80,        /* len = 16 */
13462306a36Sopenharmony_ci	MCI_LNA_INFO     = 0x90,        /* len = 1 */
13562306a36Sopenharmony_ci	MCI_LNA_STATE    = 0x94,
13662306a36Sopenharmony_ci	MCI_LNA_TAKE     = 0x98,
13762306a36Sopenharmony_ci	MCI_LNA_TRANS    = 0x9c,
13862306a36Sopenharmony_ci	MCI_SYS_SLEEPING = 0xa0,        /* len = 0 */
13962306a36Sopenharmony_ci	MCI_REQ_WAKE     = 0xc0,        /* len = 0 */
14062306a36Sopenharmony_ci	MCI_DEBUG_16     = 0xfe,        /* len = 2 */
14162306a36Sopenharmony_ci	MCI_REMOTE_RESET = 0xff         /* len = 16 */
14262306a36Sopenharmony_ci};
14362306a36Sopenharmony_ci
14462306a36Sopenharmony_cienum ath_mci_gpm_coex_profile_type {
14562306a36Sopenharmony_ci	MCI_GPM_COEX_PROFILE_UNKNOWN,
14662306a36Sopenharmony_ci	MCI_GPM_COEX_PROFILE_RFCOMM,
14762306a36Sopenharmony_ci	MCI_GPM_COEX_PROFILE_A2DP,
14862306a36Sopenharmony_ci	MCI_GPM_COEX_PROFILE_HID,
14962306a36Sopenharmony_ci	MCI_GPM_COEX_PROFILE_BNEP,
15062306a36Sopenharmony_ci	MCI_GPM_COEX_PROFILE_VOICE,
15162306a36Sopenharmony_ci	MCI_GPM_COEX_PROFILE_A2DPVO,
15262306a36Sopenharmony_ci	MCI_GPM_COEX_PROFILE_MAX
15362306a36Sopenharmony_ci};
15462306a36Sopenharmony_ci
15562306a36Sopenharmony_ci/* MCI GPM/Coex opcode/type definitions */
15662306a36Sopenharmony_cienum {
15762306a36Sopenharmony_ci	MCI_GPM_COEX_W_GPM_PAYLOAD      = 1,
15862306a36Sopenharmony_ci	MCI_GPM_COEX_B_GPM_TYPE         = 4,
15962306a36Sopenharmony_ci	MCI_GPM_COEX_B_GPM_OPCODE       = 5,
16062306a36Sopenharmony_ci	/* MCI_GPM_WLAN_CAL_REQ, MCI_GPM_WLAN_CAL_DONE */
16162306a36Sopenharmony_ci	MCI_GPM_WLAN_CAL_W_SEQUENCE     = 2,
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_ci	/* MCI_GPM_COEX_VERSION_QUERY */
16462306a36Sopenharmony_ci	/* MCI_GPM_COEX_VERSION_RESPONSE */
16562306a36Sopenharmony_ci	MCI_GPM_COEX_B_MAJOR_VERSION    = 6,
16662306a36Sopenharmony_ci	MCI_GPM_COEX_B_MINOR_VERSION    = 7,
16762306a36Sopenharmony_ci	/* MCI_GPM_COEX_STATUS_QUERY */
16862306a36Sopenharmony_ci	MCI_GPM_COEX_B_BT_BITMAP        = 6,
16962306a36Sopenharmony_ci	MCI_GPM_COEX_B_WLAN_BITMAP      = 7,
17062306a36Sopenharmony_ci	/* MCI_GPM_COEX_HALT_BT_GPM */
17162306a36Sopenharmony_ci	MCI_GPM_COEX_B_HALT_STATE       = 6,
17262306a36Sopenharmony_ci	/* MCI_GPM_COEX_WLAN_CHANNELS */
17362306a36Sopenharmony_ci	MCI_GPM_COEX_B_CHANNEL_MAP      = 6,
17462306a36Sopenharmony_ci	/* MCI_GPM_COEX_BT_PROFILE_INFO */
17562306a36Sopenharmony_ci	MCI_GPM_COEX_B_PROFILE_TYPE     = 6,
17662306a36Sopenharmony_ci	MCI_GPM_COEX_B_PROFILE_LINKID   = 7,
17762306a36Sopenharmony_ci	MCI_GPM_COEX_B_PROFILE_STATE    = 8,
17862306a36Sopenharmony_ci	MCI_GPM_COEX_B_PROFILE_ROLE     = 9,
17962306a36Sopenharmony_ci	MCI_GPM_COEX_B_PROFILE_RATE     = 10,
18062306a36Sopenharmony_ci	MCI_GPM_COEX_B_PROFILE_VOTYPE   = 11,
18162306a36Sopenharmony_ci	MCI_GPM_COEX_H_PROFILE_T        = 12,
18262306a36Sopenharmony_ci	MCI_GPM_COEX_B_PROFILE_W        = 14,
18362306a36Sopenharmony_ci	MCI_GPM_COEX_B_PROFILE_A        = 15,
18462306a36Sopenharmony_ci	/* MCI_GPM_COEX_BT_STATUS_UPDATE */
18562306a36Sopenharmony_ci	MCI_GPM_COEX_B_STATUS_TYPE      = 6,
18662306a36Sopenharmony_ci	MCI_GPM_COEX_B_STATUS_LINKID    = 7,
18762306a36Sopenharmony_ci	MCI_GPM_COEX_B_STATUS_STATE     = 8,
18862306a36Sopenharmony_ci	/* MCI_GPM_COEX_BT_UPDATE_FLAGS */
18962306a36Sopenharmony_ci	MCI_GPM_COEX_W_BT_FLAGS         = 6,
19062306a36Sopenharmony_ci	MCI_GPM_COEX_B_BT_FLAGS_OP      = 10
19162306a36Sopenharmony_ci};
19262306a36Sopenharmony_ci
19362306a36Sopenharmony_cienum mci_gpm_subtype {
19462306a36Sopenharmony_ci	MCI_GPM_BT_CAL_REQ      = 0,
19562306a36Sopenharmony_ci	MCI_GPM_BT_CAL_GRANT    = 1,
19662306a36Sopenharmony_ci	MCI_GPM_BT_CAL_DONE     = 2,
19762306a36Sopenharmony_ci	MCI_GPM_WLAN_CAL_REQ    = 3,
19862306a36Sopenharmony_ci	MCI_GPM_WLAN_CAL_GRANT  = 4,
19962306a36Sopenharmony_ci	MCI_GPM_WLAN_CAL_DONE   = 5,
20062306a36Sopenharmony_ci	MCI_GPM_COEX_AGENT      = 0x0c,
20162306a36Sopenharmony_ci	MCI_GPM_RSVD_PATTERN    = 0xfe,
20262306a36Sopenharmony_ci	MCI_GPM_RSVD_PATTERN32  = 0xfefefefe,
20362306a36Sopenharmony_ci	MCI_GPM_BT_DEBUG        = 0xff
20462306a36Sopenharmony_ci};
20562306a36Sopenharmony_ci
20662306a36Sopenharmony_cienum mci_bt_state {
20762306a36Sopenharmony_ci	MCI_BT_SLEEP,
20862306a36Sopenharmony_ci	MCI_BT_AWAKE,
20962306a36Sopenharmony_ci	MCI_BT_CAL_START,
21062306a36Sopenharmony_ci	MCI_BT_CAL
21162306a36Sopenharmony_ci};
21262306a36Sopenharmony_ci
21362306a36Sopenharmony_cienum mci_ps_state {
21462306a36Sopenharmony_ci	MCI_PS_DISABLE,
21562306a36Sopenharmony_ci	MCI_PS_ENABLE,
21662306a36Sopenharmony_ci	MCI_PS_ENABLE_OFF,
21762306a36Sopenharmony_ci	MCI_PS_ENABLE_ON
21862306a36Sopenharmony_ci};
21962306a36Sopenharmony_ci
22062306a36Sopenharmony_ci/* Type of state query */
22162306a36Sopenharmony_cienum mci_state_type {
22262306a36Sopenharmony_ci	MCI_STATE_ENABLE,
22362306a36Sopenharmony_ci	MCI_STATE_INIT_GPM_OFFSET,
22462306a36Sopenharmony_ci	MCI_STATE_CHECK_GPM_OFFSET,
22562306a36Sopenharmony_ci	MCI_STATE_NEXT_GPM_OFFSET,
22662306a36Sopenharmony_ci	MCI_STATE_LAST_GPM_OFFSET,
22762306a36Sopenharmony_ci	MCI_STATE_BT,
22862306a36Sopenharmony_ci	MCI_STATE_SET_BT_SLEEP,
22962306a36Sopenharmony_ci	MCI_STATE_SET_BT_AWAKE,
23062306a36Sopenharmony_ci	MCI_STATE_SET_BT_CAL_START,
23162306a36Sopenharmony_ci	MCI_STATE_SET_BT_CAL,
23262306a36Sopenharmony_ci	MCI_STATE_LAST_SCHD_MSG_OFFSET,
23362306a36Sopenharmony_ci	MCI_STATE_REMOTE_SLEEP,
23462306a36Sopenharmony_ci	MCI_STATE_CONT_STATUS,
23562306a36Sopenharmony_ci	MCI_STATE_RESET_REQ_WAKE,
23662306a36Sopenharmony_ci	MCI_STATE_SEND_WLAN_COEX_VERSION,
23762306a36Sopenharmony_ci	MCI_STATE_SET_BT_COEX_VERSION,
23862306a36Sopenharmony_ci	MCI_STATE_SEND_WLAN_CHANNELS,
23962306a36Sopenharmony_ci	MCI_STATE_SEND_VERSION_QUERY,
24062306a36Sopenharmony_ci	MCI_STATE_SEND_STATUS_QUERY,
24162306a36Sopenharmony_ci	MCI_STATE_NEED_FLUSH_BT_INFO,
24262306a36Sopenharmony_ci	MCI_STATE_SET_CONCUR_TX_PRI,
24362306a36Sopenharmony_ci	MCI_STATE_RECOVER_RX,
24462306a36Sopenharmony_ci	MCI_STATE_NEED_FTP_STOMP,
24562306a36Sopenharmony_ci	MCI_STATE_NEED_TUNING,
24662306a36Sopenharmony_ci	MCI_STATE_NEED_STAT_DEBUG,
24762306a36Sopenharmony_ci	MCI_STATE_SHARED_CHAIN_CONCUR_TX,
24862306a36Sopenharmony_ci	MCI_STATE_AIC_CAL,
24962306a36Sopenharmony_ci	MCI_STATE_AIC_START,
25062306a36Sopenharmony_ci	MCI_STATE_AIC_CAL_RESET,
25162306a36Sopenharmony_ci	MCI_STATE_AIC_CAL_SINGLE,
25262306a36Sopenharmony_ci	MCI_STATE_IS_AR9462,
25362306a36Sopenharmony_ci	MCI_STATE_IS_AR9565_1ANT,
25462306a36Sopenharmony_ci	MCI_STATE_IS_AR9565_2ANT,
25562306a36Sopenharmony_ci	MCI_STATE_WLAN_WEAK_SIGNAL,
25662306a36Sopenharmony_ci	MCI_STATE_SET_WLAN_PS_STATE,
25762306a36Sopenharmony_ci	MCI_STATE_GET_WLAN_PS_STATE,
25862306a36Sopenharmony_ci	MCI_STATE_DEBUG,
25962306a36Sopenharmony_ci	MCI_STATE_STAT_DEBUG,
26062306a36Sopenharmony_ci	MCI_STATE_ALLOW_FCS,
26162306a36Sopenharmony_ci	MCI_STATE_SET_2G_CONTENTION,
26262306a36Sopenharmony_ci	MCI_STATE_MAX
26362306a36Sopenharmony_ci};
26462306a36Sopenharmony_ci
26562306a36Sopenharmony_cienum mci_gpm_coex_opcode {
26662306a36Sopenharmony_ci	MCI_GPM_COEX_VERSION_QUERY,
26762306a36Sopenharmony_ci	MCI_GPM_COEX_VERSION_RESPONSE,
26862306a36Sopenharmony_ci	MCI_GPM_COEX_STATUS_QUERY,
26962306a36Sopenharmony_ci	MCI_GPM_COEX_HALT_BT_GPM,
27062306a36Sopenharmony_ci	MCI_GPM_COEX_WLAN_CHANNELS,
27162306a36Sopenharmony_ci	MCI_GPM_COEX_BT_PROFILE_INFO,
27262306a36Sopenharmony_ci	MCI_GPM_COEX_BT_STATUS_UPDATE,
27362306a36Sopenharmony_ci	MCI_GPM_COEX_BT_UPDATE_FLAGS,
27462306a36Sopenharmony_ci	MCI_GPM_COEX_NOOP,
27562306a36Sopenharmony_ci};
27662306a36Sopenharmony_ci
27762306a36Sopenharmony_ci#define MCI_GPM_NOMORE  0
27862306a36Sopenharmony_ci#define MCI_GPM_MORE    1
27962306a36Sopenharmony_ci#define MCI_GPM_INVALID 0xffffffff
28062306a36Sopenharmony_ci
28162306a36Sopenharmony_ci#define MCI_GPM_RECYCLE(_p_gpm)	do {			  \
28262306a36Sopenharmony_ci	*(((u32 *)_p_gpm) + MCI_GPM_COEX_W_GPM_PAYLOAD) = \
28362306a36Sopenharmony_ci				MCI_GPM_RSVD_PATTERN32;   \
28462306a36Sopenharmony_ci} while (0)
28562306a36Sopenharmony_ci
28662306a36Sopenharmony_ci#define MCI_GPM_TYPE(_p_gpm)	\
28762306a36Sopenharmony_ci	(*(((u8 *)(_p_gpm)) + MCI_GPM_COEX_B_GPM_TYPE) & 0xff)
28862306a36Sopenharmony_ci
28962306a36Sopenharmony_ci#define MCI_GPM_OPCODE(_p_gpm)	\
29062306a36Sopenharmony_ci	(*(((u8 *)(_p_gpm)) + MCI_GPM_COEX_B_GPM_OPCODE) & 0xff)
29162306a36Sopenharmony_ci
29262306a36Sopenharmony_ci#define MCI_GPM_SET_CAL_TYPE(_p_gpm, _cal_type)	do {			   \
29362306a36Sopenharmony_ci	*(((u8 *)(_p_gpm)) + MCI_GPM_COEX_B_GPM_TYPE) = (_cal_type) & 0xff;\
29462306a36Sopenharmony_ci} while (0)
29562306a36Sopenharmony_ci
29662306a36Sopenharmony_ci#define MCI_GPM_SET_TYPE_OPCODE(_p_gpm, _type, _opcode) do {		   \
29762306a36Sopenharmony_ci	*(((u8 *)(_p_gpm)) + MCI_GPM_COEX_B_GPM_TYPE) = (_type) & 0xff;	   \
29862306a36Sopenharmony_ci	*(((u8 *)(_p_gpm)) + MCI_GPM_COEX_B_GPM_OPCODE) = (_opcode) & 0xff;\
29962306a36Sopenharmony_ci} while (0)
30062306a36Sopenharmony_ci
30162306a36Sopenharmony_ci#define MCI_GPM_IS_CAL_TYPE(_type) ((_type) <= MCI_GPM_WLAN_CAL_DONE)
30262306a36Sopenharmony_ci
30362306a36Sopenharmony_ci/*
30462306a36Sopenharmony_ci * Functions that are available to the MCI driver core.
30562306a36Sopenharmony_ci */
30662306a36Sopenharmony_cibool ar9003_mci_send_message(struct ath_hw *ah, u8 header, u32 flag,
30762306a36Sopenharmony_ci			     u32 *payload, u8 len, bool wait_done,
30862306a36Sopenharmony_ci			     bool check_bt);
30962306a36Sopenharmony_ciu32 ar9003_mci_state(struct ath_hw *ah, u32 state_type);
31062306a36Sopenharmony_ciint ar9003_mci_setup(struct ath_hw *ah, u32 gpm_addr, void *gpm_buf,
31162306a36Sopenharmony_ci		     u16 len, u32 sched_addr);
31262306a36Sopenharmony_civoid ar9003_mci_cleanup(struct ath_hw *ah);
31362306a36Sopenharmony_civoid ar9003_mci_get_interrupt(struct ath_hw *ah, u32 *raw_intr,
31462306a36Sopenharmony_ci			      u32 *rx_msg_intr);
31562306a36Sopenharmony_ciu32 ar9003_mci_get_next_gpm_offset(struct ath_hw *ah, u32 *more);
31662306a36Sopenharmony_civoid ar9003_mci_set_bt_version(struct ath_hw *ah, u8 major, u8 minor);
31762306a36Sopenharmony_civoid ar9003_mci_send_wlan_channels(struct ath_hw *ah);
31862306a36Sopenharmony_ci/*
31962306a36Sopenharmony_ci * These functions are used by ath9k_hw.
32062306a36Sopenharmony_ci */
32162306a36Sopenharmony_ci
32262306a36Sopenharmony_ci#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
32362306a36Sopenharmony_ci
32462306a36Sopenharmony_civoid ar9003_mci_stop_bt(struct ath_hw *ah, bool save_fullsleep);
32562306a36Sopenharmony_civoid ar9003_mci_init_cal_req(struct ath_hw *ah, bool *is_reusable);
32662306a36Sopenharmony_civoid ar9003_mci_init_cal_done(struct ath_hw *ah);
32762306a36Sopenharmony_civoid ar9003_mci_set_full_sleep(struct ath_hw *ah);
32862306a36Sopenharmony_civoid ar9003_mci_2g5g_switch(struct ath_hw *ah, bool force);
32962306a36Sopenharmony_civoid ar9003_mci_check_bt(struct ath_hw *ah);
33062306a36Sopenharmony_cibool ar9003_mci_start_reset(struct ath_hw *ah, struct ath9k_channel *chan);
33162306a36Sopenharmony_ciint ar9003_mci_end_reset(struct ath_hw *ah, struct ath9k_channel *chan,
33262306a36Sopenharmony_ci			 struct ath9k_hw_cal_data *caldata);
33362306a36Sopenharmony_ciint ar9003_mci_reset(struct ath_hw *ah, bool en_int, bool is_2g,
33462306a36Sopenharmony_ci		     bool is_full_sleep);
33562306a36Sopenharmony_civoid ar9003_mci_get_isr(struct ath_hw *ah, enum ath9k_int *masked);
33662306a36Sopenharmony_civoid ar9003_mci_bt_gain_ctrl(struct ath_hw *ah);
33762306a36Sopenharmony_civoid ar9003_mci_set_power_awake(struct ath_hw *ah);
33862306a36Sopenharmony_civoid ar9003_mci_check_gpm_offset(struct ath_hw *ah);
33962306a36Sopenharmony_ciu16 ar9003_mci_get_max_txpower(struct ath_hw *ah, u8 ctlmode);
34062306a36Sopenharmony_ci
34162306a36Sopenharmony_ci#else
34262306a36Sopenharmony_ci
34362306a36Sopenharmony_cistatic inline void ar9003_mci_stop_bt(struct ath_hw *ah, bool save_fullsleep)
34462306a36Sopenharmony_ci{
34562306a36Sopenharmony_ci}
34662306a36Sopenharmony_cistatic inline void ar9003_mci_init_cal_req(struct ath_hw *ah, bool *is_reusable)
34762306a36Sopenharmony_ci{
34862306a36Sopenharmony_ci}
34962306a36Sopenharmony_cistatic inline void ar9003_mci_init_cal_done(struct ath_hw *ah)
35062306a36Sopenharmony_ci{
35162306a36Sopenharmony_ci}
35262306a36Sopenharmony_cistatic inline void ar9003_mci_set_full_sleep(struct ath_hw *ah)
35362306a36Sopenharmony_ci{
35462306a36Sopenharmony_ci}
35562306a36Sopenharmony_cistatic inline void ar9003_mci_2g5g_switch(struct ath_hw *ah, bool wait_done)
35662306a36Sopenharmony_ci{
35762306a36Sopenharmony_ci}
35862306a36Sopenharmony_cistatic inline void ar9003_mci_check_bt(struct ath_hw *ah)
35962306a36Sopenharmony_ci{
36062306a36Sopenharmony_ci}
36162306a36Sopenharmony_cistatic inline bool ar9003_mci_start_reset(struct ath_hw *ah, struct ath9k_channel *chan)
36262306a36Sopenharmony_ci{
36362306a36Sopenharmony_ci	return false;
36462306a36Sopenharmony_ci}
36562306a36Sopenharmony_cistatic inline int ar9003_mci_end_reset(struct ath_hw *ah, struct ath9k_channel *chan,
36662306a36Sopenharmony_ci				       struct ath9k_hw_cal_data *caldata)
36762306a36Sopenharmony_ci{
36862306a36Sopenharmony_ci	return 0;
36962306a36Sopenharmony_ci}
37062306a36Sopenharmony_cistatic inline void ar9003_mci_reset(struct ath_hw *ah, bool en_int, bool is_2g,
37162306a36Sopenharmony_ci				    bool is_full_sleep)
37262306a36Sopenharmony_ci{
37362306a36Sopenharmony_ci}
37462306a36Sopenharmony_cistatic inline void ar9003_mci_get_isr(struct ath_hw *ah, enum ath9k_int *masked)
37562306a36Sopenharmony_ci{
37662306a36Sopenharmony_ci}
37762306a36Sopenharmony_cistatic inline void ar9003_mci_bt_gain_ctrl(struct ath_hw *ah)
37862306a36Sopenharmony_ci{
37962306a36Sopenharmony_ci}
38062306a36Sopenharmony_cistatic inline void ar9003_mci_set_power_awake(struct ath_hw *ah)
38162306a36Sopenharmony_ci{
38262306a36Sopenharmony_ci}
38362306a36Sopenharmony_cistatic inline void ar9003_mci_check_gpm_offset(struct ath_hw *ah)
38462306a36Sopenharmony_ci{
38562306a36Sopenharmony_ci}
38662306a36Sopenharmony_cistatic inline u16 ar9003_mci_get_max_txpower(struct ath_hw *ah, u8 ctlmode)
38762306a36Sopenharmony_ci{
38862306a36Sopenharmony_ci	return -1;
38962306a36Sopenharmony_ci}
39062306a36Sopenharmony_ci#endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */
39162306a36Sopenharmony_ci
39262306a36Sopenharmony_ci#endif
393