blob: 694fe75168f7ea1187bc5e470a16ec8bd9e07395 [file] [log] [blame]
Satish kumar sugasie6b07af2018-05-25 17:48:45 -07001/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
Mahesh Kumar Sharma41a4d382017-01-17 17:00:51 -08002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12#ifndef BTFM_SLIM_WCN3990_H
13#define BTFM_SLIM_WCN3990_H
14//#ifdef CONFIG_BTFM_SLIM_WCN3990
15#include <btfm_slim.h>
16
17/* Registers Address */
18#define CHRK_SB_COMP_TEST 0x00000000
19#define CHRK_SB_SLAVE_HW_REV_MSB 0x00000001
20#define CHRK_SB_SLAVE_HW_REV_LSB 0x00000002
21#define CHRK_SB_DEBUG_FEATURES 0x00000005
22#define CHRK_SB_INTF_INT_EN 0x00000010
23#define CHRK_SB_INTF_INT_STATUS 0x00000011
24#define CHRK_SB_INTF_INT_CLR 0x00000012
25#define CHRK_SB_FRM_CFG 0x00000013
26#define CHRK_SB_FRM_STATUS 0x00000014
27#define CHRK_SB_FRM_INT_EN 0x00000015
28#define CHRK_SB_FRM_INT_STATUS 0x00000016
29#define CHRK_SB_FRM_INT_CLR 0x00000017
30#define CHRK_SB_FRM_WAKEUP 0x00000018
31#define CHRK_SB_FRM_CLKCTL_DONE 0x00000019
32#define CHRK_SB_FRM_IE_STATUS 0x0000001A
33#define CHRK_SB_FRM_VE_STATUS 0x0000001B
34#define CHRK_SB_PGD_TX_CFG_STATUS 0x00000020
35#define CHRK_SB_PGD_RX_CFG_STATUS 0x00000021
36#define CHRK_SB_PGD_DEV_INT_EN 0x00000022
37#define CHRK_SB_PGD_DEV_INT_STATUS 0x00000023
38#define CHRK_SB_PGD_DEV_INT_CLR 0x00000024
39#define CHRK_SB_PGD_PORT_INT_EN_RX_0 0x00000030
40#define CHRK_SB_PGD_PORT_INT_EN_RX_1 0x00000031
41#define CHRK_SB_PGD_PORT_INT_EN_TX_0 0x00000032
42#define CHRK_SB_PGD_PORT_INT_EN_TX_1 0x00000033
43#define CHRK_SB_PGD_PORT_INT_STATUS_RX_0 0x00000034
44#define CHRK_SB_PGD_PORT_INT_STATUS_RX_1 0x00000035
45#define CHRK_SB_PGD_PORT_INT_STATUS_TX_0 0x00000036
46#define CHRK_SB_PGD_PORT_INT_STATUS_TX_1 0x00000037
47#define CHRK_SB_PGD_PORT_INT_CLR_RX_0 0x00000038
48#define CHRK_SB_PGD_PORT_INT_CLR_RX_1 0x00000039
49#define CHRK_SB_PGD_PORT_INT_CLR_TX_0 0x0000003A
50#define CHRK_SB_PGD_PORT_INT_CLR_TX_1 0x0000003B
51#define CHRK_SB_PGD_PORT_RX_CFGN(n) (0x00000040 + n)
52#define CHRK_SB_PGD_PORT_TX_CFGN(n) (0x00000050 + n)
53#define CHRK_SB_PGD_PORT_INT_RX_SOURCEN(n) (0x00000060 + n)
54#define CHRK_SB_PGD_PORT_INT_TX_SOURCEN(n) (0x00000070 + n)
55#define CHRK_SB_PGD_PORT_RX_STATUSN(n) (0x00000080 + n)
56#define CHRK_SB_PGD_PORT_TX_STATUSN(n) (0x00000090 + n)
57#define CHRK_SB_PGD_TX_PORTn_MULTI_CHNL_0(n) (0x00000100 + 0x4*n)
58#define CHRK_SB_PGD_TX_PORTn_MULTI_CHNL_1(n) (0x00000101 + 0x4*n)
59#define CHRK_SB_PGD_RX_PORTn_MULTI_CHNL_0(n) (0x00000180 + 0x4*n)
60#define CHRK_SB_PGD_RX_PORTn_MULTI_CHNL_1(n) (0x00000181 + 0x4*n)
61#define CHRK_SB_PGD_PORT_TX_OR_UR_CFGN(n) (0x000001F0 + n)
62
63/* Register Bit Setting */
64#define CHRK_ENABLE_OVERRUN_AUTO_RECOVERY (0x1 << 1)
65#define CHRK_ENABLE_UNDERRUN_AUTO_RECOVERY (0x1 << 0)
66#define CHRK_SB_PGD_PORT_ENABLE (0x1 << 0)
67#define CHRK_SB_PGD_PORT_DISABLE (0x0 << 0)
68#define CHRK_SB_PGD_PORT_WM_L1 (0x1 << 1)
69#define CHRK_SB_PGD_PORT_WM_L2 (0x2 << 1)
70#define CHRK_SB_PGD_PORT_WM_L3 (0x3 << 1)
Rupesh Tatiyafc057b52017-06-20 15:06:29 +053071#define CHRK_SB_PGD_PORT_WM_L8 (0x8 << 1)
Mahesh Kumar Sharma41a4d382017-01-17 17:00:51 -080072#define CHRK_SB_PGD_PORT_WM_LB (0xB << 1)
73
74#define CHRK_SB_PGD_PORT_RX_NUM 16
75#define CHRK_SB_PGD_PORT_TX_NUM 16
76
77/* PGD Port Map */
78#define CHRK_SB_PGD_PORT_TX_SCO 0
79#define CHRK_SB_PGD_PORT_TX1_FM 1
80#define CHRK_SB_PGD_PORT_TX2_FM 2
Satish kumar sugasie6b07af2018-05-25 17:48:45 -070081#define CHRKVER3_SB_PGD_PORT_TX1_FM 4
82#define CHRKVER3_SB_PGD_PORT_TX2_FM 5
Mahesh Kumar Sharma41a4d382017-01-17 17:00:51 -080083#define CHRK_SB_PGD_PORT_RX_SCO 16
84#define CHRK_SB_PGD_PORT_RX_A2P 17
85
Satish kumar sugasie6b07af2018-05-25 17:48:45 -070086enum {
87 QCA_CHEROKEE_SOC_ID_0100 = 0x40010100,
88 QCA_CHEROKEE_SOC_ID_0200 = 0x40010200,
89 QCA_CHEROKEE_SOC_ID_0201 = 0x40010201,
90 QCA_CHEROKEE_SOC_ID_0210 = 0x40010214,
91 QCA_CHEROKEE_SOC_ID_0211 = 0x40010224,
92 QCA_CHEROKEE_SOC_ID_0300 = 0x40010300,
93};
94
95enum{
96 QCA_APACHE_SOC_ID_0005 = 0x40020100,
97 QCA_APACHE_SOC_ID_0006 = 0x40020110,
98 QCA_APACHE_SOC_ID_0100 = 0x40020120,
99 QCA_APACHE_SOC_ID_0101 = 0x40020121,
100 QCA_APACHE_SOC_ID_0102 = 0x40020122,
101 QCA_APACHE_SOC_ID_0103 = 0x40020123,
102 QCA_APACHE_SOC_ID_0110 = 0x40020130,
103 QCA_APACHE_SOC_ID_0111 = 0x40020140,
104};
105
106enum {
107 QCA_COMANCHE_SOC_ID_0100 = 0x40070100,
108 QCA_COMANCHE_SOC_ID_0101 = 0x40070101,
109 QCA_COMANCHE_SOC_ID_0110 = 0x40070110,
110};
Mahesh Kumar Sharma41a4d382017-01-17 17:00:51 -0800111
112/* Function Prototype */
113
114/*
115 * btfm_slim_chrk_hw_init: Initialize wcn3990 specific slimbus slave device
116 * @btfmslim: slimbus slave device data pointer.
117 * Returns:
118 * 0: Success
119 * else: Fail
120 */
121int btfm_slim_chrk_hw_init(struct btfmslim *btfmslim);
122
123/*
124 * btfm_slim_chrk_enable_rxport: Enable wcn3990 Rx port by given port number
125 * @btfmslim: slimbus slave device data pointer.
126 * @portNum: slimbus slave port number to enable
127 * @rxport: rxport or txport
128 * @enable: enable port or disable port
129 * Returns:
130 * 0: Success
131 * else: Fail
132 */
133int btfm_slim_chrk_enable_port(struct btfmslim *btfmslim, uint8_t portNum,
134 uint8_t rxport, uint8_t enable);
135
136/* Specific defines for wcn3990 slimbus device */
137#define WCN3990_SLIM_REG_OFFSET 0x0800
138
139#ifdef SLIM_SLAVE_REG_OFFSET
140#undef SLIM_SLAVE_REG_OFFSET
141#define SLIM_SLAVE_REG_OFFSET WCN3990_SLIM_REG_OFFSET
142#endif
143
144/* Assign vendor specific function */
145extern struct btfmslim_ch wcn3990_txport[];
146extern struct btfmslim_ch wcn3990_rxport[];
147
148#ifdef SLIM_SLAVE_RXPORT
149#undef SLIM_SLAVE_RXPORT
150#define SLIM_SLAVE_RXPORT (&wcn3990_rxport[0])
151#endif
152
153#ifdef SLIM_SLAVE_TXPORT
154#undef SLIM_SLAVE_TXPORT
155#define SLIM_SLAVE_TXPORT (&wcn3990_txport[0])
156#endif
157
158#ifdef SLIM_SLAVE_INIT
159#undef SLIM_SLAVE_INIT
160#define SLIM_SLAVE_INIT btfm_slim_chrk_hw_init
161#endif
162
163#ifdef SLIM_SLAVE_PORT_EN
164#undef SLIM_SLAVE_PORT_EN
165#define SLIM_SLAVE_PORT_EN btfm_slim_chrk_enable_port
166#endif
167//#endif /* CONFIG_BTFM_WCN3990 */
168#endif /* BTFM_SLIM_WCN3990_H */