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