blob: 6d5980c61384c36e20b6dbc50fb40a4f5c9c3763 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
Leo Changac1d3612013-07-01 15:15:51 -070042
Jeff Johnson295189b2012-06-20 16:38:30 -070043#ifndef WLAN_QCT_DXE_I_H
44#define WLAN_QCT_DXE_I_H
45
46/**=========================================================================
47
48 @file wlan_qct_dxe_i.h
49
50 @brief
51
52 This file contains the external API exposed by the wlan data transfer abstraction layer module.
Leo Changac1d3612013-07-01 15:15:51 -070053 Copyright (c) 2011 Qualcomm Technologies, Inc.
Jeff Johnson295189b2012-06-20 16:38:30 -070054 All Rights Reserved.
Leo Changac1d3612013-07-01 15:15:51 -070055 Qualcomm Technologies Confidential and Proprietary
Jeff Johnson295189b2012-06-20 16:38:30 -070056========================================================================*/
57
58/*===========================================================================
59
60 EDIT HISTORY FOR FILE
61
62
63 This section contains comments describing changes made to the module.
64 Notice that changes are listed in reverse chronological order.
65
66
67 $Header:$ $DateTime: $ $Author: $
68
69
70when who what, where, why
71-------- --- ----------------------------------------------------------
7208/03/10 schang Created module.
73
74===========================================================================*/
75
76/*===========================================================================
77
78 INCLUDE FILES FOR MODULE
79
80===========================================================================*/
81
82/*----------------------------------------------------------------------------
83 * Include Files
84 * -------------------------------------------------------------------------*/
85#include "wlan_qct_dxe.h"
86#include "wlan_qct_pal_trace.h"
Madan Mohan Koyyalamudiea777012012-10-31 14:22:34 -070087#include "wlan_qct_pal_timer.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070088#include "vos_trace.h"
89/*----------------------------------------------------------------------------
90 * Preprocessor Definitions and Constants
91 * -------------------------------------------------------------------------*/
92#define WLANDXE_CTXT_COOKIE 0xC00CC111
93
94
Jeff Johnsone7245742012-09-05 17:12:55 -070095/* From here WCNSS DXE register information
Jeff Johnson295189b2012-06-20 16:38:30 -070096 * This is temporary definition location to make compile and unit test
97 * If official msmreg.h integrated, this part will be eliminated */
98/* Start with base address */
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -070099
Jeff Johnsone7245742012-09-05 17:12:55 -0700100#ifdef WCN_PRONTO
101#define WLANDXE_CCU_DXE_INT_SELECT 0xfb2050dc
102#define WLANDXE_CCU_DXE_INT_SELECT_STAT 0xfb2050e0
103#define WLANDXE_CCU_ASIC_INT_ENABLE 0xfb2050e4
104#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700105#define WLANDXE_CCU_DXE_INT_SELECT 0x03200b10
106#define WLANDXE_CCU_DXE_INT_SELECT_STAT 0x03200b14
107#define WLANDXE_CCU_ASIC_INT_ENABLE 0x03200b18
Jeff Johnsone7245742012-09-05 17:12:55 -0700108#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700109
110#ifdef PAL_OS_TYPE_BMP
Jeff Johnsone7245742012-09-05 17:12:55 -0700111#define WLANDXE_WCNSS_BASE_ADDRESS 0xCDD00000
Jeff Johnson295189b2012-06-20 16:38:30 -0700112#else
Jeff Johnsone7245742012-09-05 17:12:55 -0700113#ifdef WCN_PRONTO
114#define WLANDXE_WCNSS_BASE_ADDRESS 0xfb000000
115#else
116#define WLANDXE_WCNSS_BASE_ADDRESS 0x03000000
117#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700118#endif /* PAL_OS_TYPE_BMP */
119
Gopichand Nakkala5ef13c52013-01-07 14:41:35 -0800120#define WLANDXE_BMU_AVAILABLE_BD_PDU (WLANDXE_WCNSS_BASE_ADDRESS + 0x80084)
121
Madan Mohan Koyyalamudia53c4dc2012-11-13 10:35:42 -0800122#define WLANDXE_REGISTER_BASE_ADDRESS (WLANDXE_WCNSS_BASE_ADDRESS + 0x202000)
Jeff Johnson295189b2012-06-20 16:38:30 -0700123
124/* Common over the channels register addresses */
Madan Mohan Koyyalamudia53c4dc2012-11-13 10:35:42 -0800125#define WALNDEX_DMA_CSR_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x00)
126#define WALNDEX_DMA_ENCH_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x04)
127#define WALNDEX_DMA_CH_EN_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x08)
128#define WALNDEX_DMA_CH_DONE_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x0C)
129#define WALNDEX_DMA_CH_ERR_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x10)
130#define WALNDEX_DMA_CH_STOP_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x14)
Jeff Johnson295189b2012-06-20 16:38:30 -0700131
132/* Interrupt Control register address */
Madan Mohan Koyyalamudia53c4dc2012-11-13 10:35:42 -0800133#define WLANDXE_INT_MASK_REG_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x18)
134#define WLANDXE_INT_SRC_MSKD_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x1C)
135#define WLANDXE_INT_SRC_RAW_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x20)
136#define WLANDXE_INT_ED_SRC_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x24)
137#define WLANDXE_INT_DONE_SRC_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x28)
138#define WLANDXE_INT_ERR_SRC_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x2C)
139#define WLANDXE_INT_CLR_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x30)
140#define WLANDXE_INT_ED_CLR_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x34)
141#define WLANDXE_INT_DONE_CLR_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x38)
142#define WLANDXE_INT_ERR_CLR_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x3C)
Jeff Johnson295189b2012-06-20 16:38:30 -0700143
Madan Mohan Koyyalamudia53c4dc2012-11-13 10:35:42 -0800144#define WLANDXE_DMA_CH_PRES_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x40)
145#define WLANDXE_ARB_CH_MSK_CLR_ADDRRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x74)
Jeff Johnson295189b2012-06-20 16:38:30 -0700146
147/* Channel Counter register */
Madan Mohan Koyyalamudia53c4dc2012-11-13 10:35:42 -0800148#define WLANDXE_DMA_COUNTER_0 (WLANDXE_REGISTER_BASE_ADDRESS + 0x200)
149#define WLANDXE_DMA_COUNTER_1 (WLANDXE_REGISTER_BASE_ADDRESS + 0x204)
150#define WLANDXE_DMA_COUNTER_2 (WLANDXE_REGISTER_BASE_ADDRESS + 0x208)
151#define WLANDXE_DMA_COUNTER_3 (WLANDXE_REGISTER_BASE_ADDRESS + 0x20C)
152#define WLANDXE_DMA_COUNTER_4 (WLANDXE_REGISTER_BASE_ADDRESS + 0x210)
153#define WLANDXE_DMA_COUNTER_5 (WLANDXE_REGISTER_BASE_ADDRESS + 0x214)
154#define WLANDXE_DMA_COUNTER_6 (WLANDXE_REGISTER_BASE_ADDRESS + 0x218)
Jeff Johnson295189b2012-06-20 16:38:30 -0700155
Madan Mohan Koyyalamudia53c4dc2012-11-13 10:35:42 -0800156#define WLANDXE_ENGINE_STAT_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x64)
157#define WLANDXE_BMU_SB_QDAT_AV_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x5c)
Jeff Johnson295189b2012-06-20 16:38:30 -0700158
159/* Channel Base address */
Madan Mohan Koyyalamudia53c4dc2012-11-13 10:35:42 -0800160#define WLANDXE_DMA_CHAN0_BASE_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x400)
161#define WLANDXE_DMA_CHAN1_BASE_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x440)
162#define WLANDXE_DMA_CHAN2_BASE_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x480)
163#define WLANDXE_DMA_CHAN3_BASE_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x4C0)
164#define WLANDXE_DMA_CHAN4_BASE_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x500)
165#define WLANDXE_DMA_CHAN5_BASE_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x540)
166#define WLANDXE_DMA_CHAN6_BASE_ADDRESS (WLANDXE_REGISTER_BASE_ADDRESS + 0x580)
Jeff Johnson295189b2012-06-20 16:38:30 -0700167
168/* Channel specific register offset */
169#define WLANDXE_DMA_CH_CTRL_REG 0x0000
170#define WLANDXE_DMA_CH_STATUS_REG 0x0004
171#define WLANDXE_DMA_CH_SZ_REG 0x0008
172#define WLANDXE_DMA_CH_SADRL_REG 0x000C
173#define WLANDXE_DMA_CH_SADRH_REG 0x0010
174#define WLANDXE_DMA_CH_DADRL_REG 0x0014
175#define WLANDXE_DMA_CH_DADRH_REG 0x0018
176#define WLANDXE_DMA_CH_DESCL_REG 0x001C
177#define WLANDXE_DMA_CH_DESCH_REG 0x0020
178#define WLANDXE_DMA_CH_LST_DESCL_REG 0x0024
179#define WLANDXE_DMA_CH_LST_DESCH_REG 0x0028
180#define WLANDXE_DMA_CH_BD_REG 0x002C
181#define WLANDXE_DMA_CH_HEAD_REG 0x0030
182#define WLANDXE_DMA_CH_TAIL_REG 0x0034
183#define WLANDXE_DMA_CH_PDU_REG 0x0038
184#define WLANDXE_DMA_CH_TSTMP_REG 0x003C
185
186/* Common CSR Register Contorol mask and offset */
187#define WLANDXE_DMA_CSR_RESERVED_MASK 0xFFFE0000
188#define WLANDXE_DMA_CSR_RESERVED_OFFSET 0x11
189#define WLANDXE_DMA_CSR_RESERVED_DEFAULT 0x0
190
191#define WLANDXE_DMA_CSR_H2H_SYNC_EN_MASK 0x10000
192#define WLANDXE_DMA_CSR_H2H_SYNC_EN_OFFSET 0x10
193#define WLANDXE_DMA_CSR_H2H_SYNC_EN_DEFAULT 0x0
194
195#define WLANDXE_DMA_CSR_PAUSED_MASK 0x8000
196#define WLANDXE_DMA_CSR_PAUSED_OFFSET 0xF
197#define WLANDXE_DMA_CSR_PAUSED_DEFAULT 0x0
198
199#define WLANDXE_DMA_CSR_ECTR_EN_MASK 0x4000
200#define WLANDXE_DMA_CSR_ECTR_EN_OFFSET 0xE
201#define WLANDXE_DMA_CSR_ECTR_EN_DEFAULT 0x4000
202
203#define WLANDXE_DMA_CSR_B2H_TSTMP_OFF_MASK 0x3E00
204#define WLANDXE_DMA_CSR_B2H_TSTMP_OFF_OFFSET 0x9
205#define WLANDXE_DMA_CSR_B2H_TSTMP_OFF_DEFAULT 0xE00
206
207#define WLANDXE_DMA_CSR_H2B_TSTMP_OFF_MASK 0x1F0
208#define WLANDXE_DMA_CSR_H2B_TSTMP_OFF_OFFSET 0x4
209#define WLANDXE_DMA_CSR_H2B_TSTMP_OFF_DEFAULT 0x50
210
211#define WLANDXE_DMA_CSR_TSTMP_EN_MASK 0x8
212#define WLANDXE_DMA_CSR_TSTMP_EN_OFFSET 0x3
213#define WLANDXE_DMA_CSR_TSTMP_EN_DEFAULT 0x0
214
215#define WLANDXE_DMA_CSR_RESET_MASK 0x4
216#define WLANDXE_DMA_CSR_RESET_OFFSET 0x2
217#define WLANDXE_DMA_CSR_RESET_DEFAULT 0x0
218
219#define WLANDXE_DMA_CSR_PAUSE_MASK 0x2
220#define WLANDXE_DMA_CSR_PAUSE_OFFSET 0x1
221#define WLANDXE_DMA_CSR_PAUSE_DEFAULT 0x0
222
223#define WLANDXE_DMA_CSR_EN_MASK 0x1
224#define WLANDXE_DMA_CSR_EN_OFFSET 0x0
225#define WLANDXE_DMA_CSR_EN_DEFAULT 0x0
226#define WLANDXE_DMA_CSR_DEFAULT 0x4E50
227
228/* Channel CTRL Register Control mask and offset */
229#define WLANDXE_CH_CTRL_RSVD_MASK 0x80000000
230#define WLANDXE_CH_CTRL_RSVD_OFFSET 0x1F
231#define WLANDXE_CH_CTRL_RSVD_DEFAULT 0x0
232
233#define WLANDXE_CH_CTRL_SWAP_MASK 0x80000000
234
235#define WLANDXE_CH_CTRL_BDT_IDX_MASK 0x60000000
236#define WLANDXE_CH_CTRL_BDT_IDX_OFFSET 0x1D
237#define WLANDXE_CH_CTRL_BDT_IDX_DEFAULT 0x0
238
239#define WLANDXE_CH_CTRL_DFMT_MASK 0x10000000
240#define WLANDXE_CH_CTRL_DFMT_OFFSET 0x1C
241#define WLANDXE_CH_CTRL_DFMT_DEFAULT 0x10000000
242#define WLANDXE_CH_CTRL_DFMT_ESHORT 0x0
243#define WLANDXE_CH_CTRL_DFMT_ELONG 0x1
244
245#define WLANDXE_CH_CTRL_ABORT_MASK 0x8000000
246#define WLANDXE_CH_CTRL_ABORT_OFFSET 0x1B
247#define WLANDXE_CH_CTRL_ABORT_DEFAULT 0x0
248
249#define WLANDXE_CH_CTRL_ENDIAN_MASK 0x4000000
250
251#define WLANDXE_CH_CTRL_CTR_SEL_MASK 0x3C00000
252#define WLANDXE_CH_CTRL_CTR_SEL_OFFSET 0x16
253#define WLANDXE_CH_CTRL_CTR_SEL_DEFAULT 0x0
254
255#define WLANDXE_CH_CTRL_EDVEN_MASK 0x200000
256#define WLANDXE_CH_CTRL_EDVEN_OFFSET 0x15
257#define WLANDXE_CH_CTRL_EDVEN_DEFAULT 0x0
258
259#define WLANDXE_CH_CTRL_EDEN_MASK 0x100000
260#define WLANDXE_CH_CTRL_EDEN_OFFSET 0x14
261#define WLANDXE_CH_CTRL_EDEN_DEFAULT 0x0
262
263#define WLANDXE_CH_CTRL_INE_DONE_MASK 0x80000
264#define WLANDXE_CH_CTRL_INE_DONE_OFFSET 0x13
265#define WLANDXE_CH_CTRL_INE_DONE_DEFAULT 0x0
266
267#define WLANDXE_CH_CTRL_INE_ERR_MASK 0x40000
268#define WLANDXE_CH_CTRL_INE_ERR_OFFSET 0x12
269#define WLANDXE_CH_CTRL_INE_ERR_DEFAULT 0x0
270
271#define WLANDXE_CH_CTRL_INE_ED_MASK 0x20000
272#define WLANDXE_CH_CTRL_INE_ED_OFFSET 0x11
273#define WLANDXE_CH_CTRL_INE_ED_DEFAULT 0x0
274
275#define WLANDXE_CH_CTRL_STOP_MASK 0x10000
276#define WLANDXE_CH_CTRL_STOP_OFFSET 0x10
277#define WLANDXE_CH_CTRL_STOP_DEFAULT 0x0
278
279#define WLANDXE_CH_CTRL_PRIO_MASK 0xE000
280#define WLANDXE_CH_CTRL_PRIO_OFFSET 0xD
281#define WLANDXE_CH_CTRL_PRIO_DEFAULT 0x0
282
283#define WLANDXE_CH_CTRL_BTHLD_SEL_MASK 0x1E00
284#define WLANDXE_CH_CTRL_BTHLD_SEL_OFFSET 0x9
285#define WLANDXE_CH_CTRL_BTHLD_SEL_DEFAULT 0x600
286#define WLANDXE_CH_CTRL_BTHLD_SEL_ERSVD0 0x0
287#define WLANDXE_CH_CTRL_BTHLD_SEL_ERSVD1 0x1
288#define WLANDXE_CH_CTRL_BTHLD_SEL_ETHLD2 0x2
289#define WLANDXE_CH_CTRL_BTHLD_SEL_ETHLD3 0x3
290#define WLANDXE_CH_CTRL_BTHLD_SEL_ETHLD4 0x4
291#define WLANDXE_CH_CTRL_BTHLD_SEL_ETHLD5 0x5
292#define WLANDXE_CH_CTRL_BTHLD_SEL_ETHLD6 0x6
293#define WLANDXE_CH_CTRL_BTHLD_SEL_ETHLD7 0x7
294#define WLANDXE_CH_CTRL_BTHLD_SEL_ETHLD8 0x8
295#define WLANDXE_CH_CTRL_BTHLD_SEL_ETHLD9 0x9
296#define WLANDXE_CH_CTRL_BTHLD_SEL_ETHLD10 0xA
297#define WLANDXE_CH_CTRL_BTHLD_SEL_ERSVD11 0xB
298#define WLANDXE_CH_CTRL_BTHLD_SEL_ERSVD12 0xC
299#define WLANDXE_CH_CTRL_BTHLD_SEL_ERSVD13 0xD
300#define WLANDXE_CH_CTRL_BTHLD_SEL_ERSVD14 0xE
301#define WLANDXE_CH_CTRL_BTHLD_SEL_ERSVD15 0xF
302
303#define WLANDXE_CH_CTRL_PDU_REL_MASK 0x100
304#define WLANDXE_CH_CTRL_PDU_REL_OFFSET 0x8
305#define WLANDXE_CH_CTRL_PDU_REL_DEFAULT 0x100
306#define WLANDXE_CH_CTRL_PDU_REL_EKEEP 0x0
307#define WLANDXE_CH_CTRL_PDU_REL_ERELEASE 0x1
308
309#define WLANDXE_CH_CTRL_PIQ_MASK 0x80
310#define WLANDXE_CH_CTRL_PIQ_OFFSET 0x7
311#define WLANDXE_CH_CTRL_PIQ_DEFAULT 0x0
312#define WLANDXE_CH_CTRL_PIQ_EFLAT 0x0
313#define WLANDXE_CH_CTRL_PIQ_EQUEUE 0x1
314
315#define WLANDXE_CH_CTRL_DIQ_MASK 0x40
316#define WLANDXE_CH_CTRL_DIQ_OFFSET 0x6
317#define WLANDXE_CH_CTRL_DIQ_DEFAULT 0x0
318#define WLANDXE_CH_CTRL_DIQ_EFLAT 0x0
319#define WLANDXE_CH_CTRL_DIQ_EQUEUE 0x1
320
321#define WLANDXE_CH_CTRL_SIQ_MASK 0x20
322#define WLANDXE_CH_CTRL_SIQ_OFFSET 0x5
323#define WLANDXE_CH_CTRL_SIQ_DEFAULT 0x0
324#define WLANDXE_CH_CTRL_SIQ_EFLAT 0x0
325#define WLANDXE_CH_CTRL_SIQ_EQUEUE 0x1
326
327#define WLANDXE_CH_CTRL_BDH_MASK 0x10
328#define WLANDXE_CH_CTRL_BDH_OFFSET 0x4
329#define WLANDXE_CH_CTRL_BDH_DEFAULT 0x0
330
331#define WLANDXE_CH_CTRL_EOP_MASK 0x8
332#define WLANDXE_CH_CTRL_EOP_OFFSET 0x3
333#define WLANDXE_CH_CTRL_EOP_DEFAULT 0x8
334
335#define WLANDXE_CH_CTRL_XTYPE_MASK 0x6
336#define WLANDXE_CH_CTRL_XTYPE_OFFSET 0x1
337#define WLANDXE_CH_CTRL_XTYPE_DEFAULT 0x0
338#define WLANDXE_CH_CTRL_XTYPE_EH2H 0x0
339#define WLANDXE_CH_CTRL_XTYPE_EB2B 0x1
340#define WLANDXE_CH_CTRL_XTYPE_EH2B 0x2
341#define WLANDXE_CH_CTRL_XTYPE_EB2H 0x3
342
343#define WLANDXE_CH_CTRL_DONE_MASK 0x4
344
345#define WLANDXE_CH_CTRL_ERR_MASK 0x20
346
347#define WLANDXE_CH_CTRL_MASKED_MASK 0x8
348
349#define WLANDXE_CH_CTRL_EN_MASK 0x1
350#define WLANDXE_CH_CTRL_EN_OFFSET 0x0
351#define WLANDXE_CH_CTRL_EN_DEFAULT 0x0
352#define WLANDXE_CH_CTRL_DEFAULT 0x10000708
353
354
355#define WLANDXE_DESC_CTRL_VALID 0x00000001
356#define WLANDXE_DESC_CTRL_XTYPE_MASK 0x00000006
357#define WLANDXE_DESC_CTRL_XTYPE_H2H 0x00000000
358#define WLANDXE_DESC_CTRL_XTYPE_B2B 0x00000002
359#define WLANDXE_DESC_CTRL_XTYPE_H2B 0x00000004
360#define WLANDXE_DESC_CTRL_XTYPE_B2H 0x00000006
361#define WLANDXE_DESC_CTRL_EOP 0x00000008
362#define WLANDXE_DESC_CTRL_BDH 0x00000010
363#define WLANDXE_DESC_CTRL_SIQ 0x00000020
364#define WLANDXE_DESC_CTRL_DIQ 0x00000040
365#define WLANDXE_DESC_CTRL_PIQ 0x00000080
366#define WLANDXE_DESC_CTRL_PDU_REL 0x00000100
367#define WLANDXE_DESC_CTRL_BTHLD_SEL 0x00001E00
368#define WLANDXE_DESC_CTRL_PRIO 0x0000E000
369#define WLANDXE_DESC_CTRL_STOP 0x00010000
370#define WLANDXE_DESC_CTRL_INT 0x00020000
371#define WLANDXE_DESC_CTRL_BDT_SWAP 0x00100000
372#define WLANDXE_DESC_CTRL_ENDIANNESS 0x00200000
373#define WLANDXE_DESC_CTRL_DFMT 0x10000000
374#define WLANDXE_DESC_CTRL_RSVD 0xfffc0000
375/* CSR Register Control mask and offset */
376
377#define WLANDXE_CH_STAT_INT_DONE_MASK 0x00008000
378#define WLANDXE_CH_STAT_INT_ERR_MASK 0x00004000
379#define WLANDXE_CH_STAT_INT_ED_MASK 0x00002000
380
381#define WLANDXE_CH_STAT_MASKED_MASK 0x00000008
Leo Chang094ece82013-04-23 17:57:41 -0700382#define WLANDXE_CH_STAT_ENABLED_MASK 0x00000001
Jeff Johnsone7245742012-09-05 17:12:55 -0700383/* Till here WCNSS DXE register information
Jeff Johnson295189b2012-06-20 16:38:30 -0700384 * This is temporary definition location to make compile and unit test
385 * If official msmreg.h integrated, this part will be eliminated */
386
387/* Interrupt control channel mask */
388#define WLANDXE_INT_MASK_CHAN_0 0x00000001
389#define WLANDXE_INT_MASK_CHAN_1 0x00000002
390#define WLANDXE_INT_MASK_CHAN_2 0x00000004
391#define WLANDXE_INT_MASK_CHAN_3 0x00000008
392#define WLANDXE_INT_MASK_CHAN_4 0x00000010
393#define WLANDXE_INT_MASK_CHAN_5 0x00000020
394#define WLANDXE_INT_MASK_CHAN_6 0x00000040
395
396#define WLANDXE_TX_LOW_RES_THRESHOLD (5)
397
398/* DXE Descriptor Endian swap macro */
399#ifdef WLANDXE_ENDIAN_SWAP_ENABLE
400#define WLANDXE_U32_SWAP_ENDIAN(a) (((a & 0x000000FF) << 24) | \
401 ((a & 0x0000FF00) << 8) | \
402 ((a & 0x00FF0000) >> 8) | \
403 ((a & 0xFF000000) >> 24))
404#else
405/* If DXE HW does not need endian swap, DO NOTHING */
406#define WLANDXE_U32_SWAP_ENDIAN(a) (a)
407#endif /* WLANDXE_ENDIAN_SWAP_ENABLE */
408
409/* Log Definition will be mappped with PAL MSG */
410#define HDXE_MSG WPAL_TRACE
411#define HDXE_ASSERT(a) VOS_ASSERT(a)
412
413/*----------------------------------------------------------------------------
414 * Type Declarations
415 * -------------------------------------------------------------------------*/
416/* DMA Channel Q handle Method type
417 * Linear handle or circular */
418typedef enum
419{
420 WLANDXE_CHANNEL_HANDLE_LINEAR,
421 WLANDXE_CHANNEL_HANDLE_CIRCULA
422}WLANDXE_ChannelHandleType;
423
424typedef enum
425{
426 WLANDXE_TX_COMP_INT_LR_THRESHOLD,
427 WLANDXE_TX_COMP_INT_PER_K_FRAMES,
428 WLANDXE_TX_COMP_INT_TIMER
429} WLANDXE_TXCompIntEnableType;
430
431typedef enum
432{
433 WLANDXE_SHORT_DESCRIPTOR,
434 WLANDXE_LONG_DESCRIPTOR
435} WLANDXE_DescriptorType;
436
437typedef enum
438{
439 WLANDXE_DMA_CHANNEL_0,
440 WLANDXE_DMA_CHANNEL_1,
441 WLANDXE_DMA_CHANNEL_2,
442 WLANDXE_DMA_CHANNEL_3,
443 WLANDXE_DMA_CHANNEL_4,
444 WLANDXE_DMA_CHANNEL_5,
445 WLANDXE_DMA_CHANNEL_6,
446 WLANDXE_DMA_CHANNEL_MAX
447} WLANDXE_DMAChannelType;
448
449/** DXE HW Long Descriptor format */
450typedef struct
451{
452 wpt_uint32 srcMemAddrL;
453 wpt_uint32 srcMemAddrH;
454 wpt_uint32 dstMemAddrL;
455 wpt_uint32 dstMemAddrH;
456 wpt_uint32 phyNextL;
457 wpt_uint32 phyNextH;
458} WLANDXE_LongDesc;
459
460
461/** DXE HW Short Descriptor format */
462typedef struct tDXEShortDesc
463{
464 wpt_uint32 srcMemAddrL;
465 wpt_uint32 dstMemAddrL;
466 wpt_uint32 phyNextL;
467} WLANDXE_ShortDesc;
468
469
470/* DXE Descriptor Data Type
471 * Pick up from GEN5 */
472typedef struct
473{
474 union
475 {
476 wpt_uint32 ctrl;
477 wpt_uint32 valid :1; //0 = DMA stop, 1 = DMA continue with this descriptor
478 wpt_uint32 transferType :2; //0 = Host to Host space
479 wpt_uint32 eop :1; //End of Packet
480 wpt_uint32 bdHandling :1; //if transferType = Host to BMU, then 0 means first 128 bytes contain BD, and 1 means create new empty BD
481 wpt_uint32 siq :1; // SIQ
482 wpt_uint32 diq :1; // DIQ
483 wpt_uint32 pduRel :1; //0 = don't release BD and PDUs when done, 1 = release them
484 wpt_uint32 bthldSel :4; //BMU Threshold Select
485 wpt_uint32 prio :3; //Specifies the priority level to use for the transfer
486 wpt_uint32 stopChannel :1; //1 = DMA stops processing further, channel requires re-enabling after this
487 wpt_uint32 intr :1; //Interrupt on Descriptor Done
488 wpt_uint32 rsvd :1; //reserved
489 wpt_uint32 transferSize :14; //14 bits used - ignored for BMU transfers, only used for host to host transfers?
490 } descCtrl;
491 wpt_uint32 xfrSize;
492 union
493 {
494 WLANDXE_LongDesc dxe_long_desc;
495 WLANDXE_ShortDesc dxe_short_desc;
496 }dxedesc;
497} WLANDXE_DescType;
498
499typedef struct
500{
501 void *nextCtrlBlk;
502 wpt_packet *xfrFrame;
503 WLANDXE_DescType *linkedDesc;
504 unsigned int linkedDescPhyAddr;
505 wpt_uint32 ctrlBlkOrder;
506#ifdef FEATURE_R33D
507 wpt_uint32 shadowBufferVa;
508#endif /* FEATURE_R33D */
509} WLANDXE_DescCtrlBlkType;
510
511typedef struct
512{
513 /* Q handle method, linear or ring */
514 WLANDXE_ChannelHandleType queueMethod;
515
516 /* Number of descriptors for DXE that can be queued for transfer at one time */
517 wpt_uint32 nDescs;
518
519 /* Maximum number of receive buffers of shared memory to use for this pipe */
520 wpt_uint32 nRxBuffers;
521
522 /* Reference WQ - for H2B and B2H only */
523 wpt_uint32 refWQ;
524
525 /* for usb only, endpoint info for CH_SADR or CH_DADR */
526 wpt_uint32 refEP;
527
528 /* H2B(Tx), B2H(Rx), H2H(SRAM<->HostMem R/W) */
529 wpt_uint32 xfrType;
530
531 /* Channel Priority 7(Highest) - 0(Lowest) */
532 wpt_uint32 chPriority;
533
534 /* 1 = BD attached to frames for this pipe */
535 wpt_boolean bdPresent;
536
537 wpt_uint32 chk_size;
538
539 wpt_uint32 bmuThdSel;
540
541 /* Added in Gen5 for Prefetch */
542 wpt_boolean useLower4G;
543
544 wpt_boolean useShortDescFmt;
545 /* Till here inharited from GEN5 code */
546 /* From now on, added for PRIMA */
547} WLANDXE_ChannelConfigType;
548
549typedef struct
550{
551 wpt_uint32 chDXEBaseAddr;
552 wpt_uint32 chDXEStatusRegAddr;
553 wpt_uint32 chDXEDesclRegAddr;
554 wpt_uint32 chDXEDeschRegAddr;
555 wpt_uint32 chDXELstDesclRegAddr;
556 wpt_uint32 chDXECtrlRegAddr;
557 wpt_uint32 chDXESzRegAddr;
558 wpt_uint32 chDXEDadrlRegAddr;
559 wpt_uint32 chDXEDadrhRegAddr;
560 wpt_uint32 chDXESadrlRegAddr;
561 wpt_uint32 chDXESadrhRegAddr;
562} WLANDXE_ChannelRegisterType;
563
564typedef struct
565{
566 wpt_uint32 refWQ_swapped;
567 wpt_boolean chEnabled;
568 wpt_boolean chConfigured;
569 wpt_uint32 channel;
570 wpt_uint32 chk_size_mask;
571 wpt_uint32 bmuThdSel_mask;
572 wpt_uint32 cw_ctrl_read;
573 wpt_uint32 cw_ctrl_write;
574 wpt_uint32 cw_ctrl_write_valid;
575 wpt_uint32 cw_ctrl_write_eop;
576 wpt_uint32 cw_ctrl_write_eop_int;
577 wpt_uint32 chan_mask;
578 wpt_uint32 chan_mask_read_disable;
579 wpt_uint32 intMask;
580} WLANDXE_ChannelExConfigType;
581
582typedef struct
583{
584 WDTS_ChannelType channelType;
585 WLANDXE_DescCtrlBlkType *headCtrlBlk;
586 WLANDXE_DescCtrlBlkType *tailCtrlBlk;
587#if !(defined(FEATURE_R33D) || defined(WLANDXE_TEST_CHANNEL_ENABLE))
588 WLANDXE_DescType *descriptorAllocation;
589#endif
590 WLANDXE_DescType *DescBottomLoc;
591 unsigned int descBottomLocPhyAddr;
592 wpt_uint32 numDesc;
593 wpt_uint32 numFreeDesc;
594 wpt_uint32 numRsvdDesc;
595 wpt_uint32 maxFrameSize;
596 wpt_uint32 numFragmentCurrentChain;
597 wpt_uint32 numFrameBeforeInt;
598 wpt_uint32 numTotalFrame;
599 wpt_mutex dxeChannelLock;
600 wpt_boolean hitLowResource;
601 WLANDXE_ChannelConfigType channelConfig;
602 WLANDXE_ChannelRegisterType channelRegister;
603 WLANDXE_ChannelExConfigType extraConfig;
604 WLANDXE_DMAChannelType assignedDMAChannel;
605 wpt_uint64 rxDoneHistogram;
Madan Mohan Koyyalamudiea777012012-10-31 14:22:34 -0700606 wpt_timer healthMonitorTimer;
607 wpt_msg *healthMonitorMsg;
Jeff Johnson295189b2012-06-20 16:38:30 -0700608} WLANDXE_ChannelCBType;
609
610typedef struct
611{
612 WLANDXE_TXCompIntEnableType txIntEnable;
613 unsigned int txLowResourceThreshold_LoPriCh;
614 unsigned int txLowResourceThreshold_HiPriCh;
615 unsigned int rxLowResourceThreshold;
616 unsigned int txInterruptEnableFrameCount;
617 unsigned int txInterruptEnablePeriod;
618} WLANDXE_TxCompIntConfigType;
619
620typedef struct
621{
622 WLANDXE_ChannelCBType dxeChannel[WDTS_CHANNEL_MAX];
623 WLANDXE_RxFrameReadyCbType rxReadyCB;
624 WLANDXE_TxCompleteCbType txCompCB;
625 WLANDXE_LowResourceCbType lowResourceCB;
626 WLANDXE_TxCompIntConfigType txCompInt;
627 void *clientCtxt;
628 wpt_uint32 interruptPath;
629 wpt_msg *rxIsrMsg;
630 wpt_msg *txIsrMsg;
631 wpt_msg *rxPktAvailMsg;
632 volatile WLANDXE_PowerStateType hostPowerState;
633 wpt_boolean rxIntDisabledByIMPS;
634 wpt_boolean txIntDisabledByIMPS;
635 WLANDXE_SetPowerStateCbType setPowerStateCb;
636 volatile WLANDXE_RivaPowerStateType rivaPowerState;
637 wpt_boolean ringNotEmpty;
638 wpt_boolean txIntEnable;
639 wpt_uint32 txCompletedFrames;
640 wpt_uint8 ucTxMsgCnt;
641 wpt_uint16 lastKickOffDxe;
642 wpt_uint32 dxeCookie;
643 wpt_packet *freeRXPacket;
644 wpt_boolean rxPalPacketUnavailable;
Jeff Johnsone7245742012-09-05 17:12:55 -0700645 wpt_boolean driverReloadInProcessing;
Leo Changac1d3612013-07-01 15:15:51 -0700646 wpt_boolean smsmToggled;
Leo Chang72cdfd32013-10-17 20:36:30 -0700647 wpt_timer rxResourceAvailableTimer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700648} WLANDXE_CtrlBlkType;
649
650/*==========================================================================
651 @ Function Name
652 dxeCommonDefaultConfig
653
654 @ Description
655
656 @ Parameters
657 WLANDXE_CtrlBlkType *dxeCtrlBlk,
658 DXE host driver main control block
659
660 @ Return
661 wpt_status
662
663===========================================================================*/
664extern wpt_status dxeCommonDefaultConfig
665(
666 WLANDXE_CtrlBlkType *dxeCtrlBlk
667);
668
669/*==========================================================================
670 @ Function Name
671 dxeChannelDefaultConfig
672
673 @ Description
674 Get defualt configuration values from pre defined structure
675 All the channels must have it's own configurations
676
677 @ Parameters
678 WLANDXE_CtrlBlkType *dxeCtrlBlk,
679 DXE host driver main control block
680 WLANDXE_ChannelCBType *channelEntry
681 Channel specific control block
682
683 @ Return
684 wpt_status
685
686===========================================================================*/
687extern wpt_status dxeChannelDefaultConfig
688(
689 WLANDXE_CtrlBlkType *dxeCtrlBlk,
690 WLANDXE_ChannelCBType *channelEntry
691);
692
693#endif /* WLAN_QCT_DXE_I_H */