staging: ath6kl: Convert A_UINT32 to u32
[pohmelfs.git] / drivers / staging / ath6kl / hif / sdio / linux_sdio / include / hif_internal.h
blob8ea3d02f602ec7beb92ababe539ad276349ab81c
1 //------------------------------------------------------------------------------
2 // <copyright file="hif_internal.h" company="Atheros">
3 // Copyright (c) 2004-2010 Atheros Corporation. All rights reserved.
4 //
5 //
6 // Permission to use, copy, modify, and/or distribute this software for any
7 // purpose with or without fee is hereby granted, provided that the above
8 // copyright notice and this permission notice appear in all copies.
9 //
10 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 //------------------------------------------------------------------------------
20 //==============================================================================
21 // internal header file for hif layer
23 // Author(s): ="Atheros"
24 //==============================================================================
25 #ifndef _HIF_INTERNAL_H_
26 #define _HIF_INTERNAL_H_
28 #include "a_config.h"
29 #include "athdefs.h"
30 #include "a_types.h"
31 #include "a_osapi.h"
32 #include "hif.h"
33 #include "../../../common/hif_sdio_common.h"
34 #include <linux/scatterlist.h>
35 #define HIF_LINUX_MMC_SCATTER_SUPPORT
37 #define BUS_REQUEST_MAX_NUM 64
39 #define SDIO_CLOCK_FREQUENCY_DEFAULT 25000000
40 #define SDWLAN_ENABLE_DISABLE_TIMEOUT 20
41 #define FLAGS_CARD_ENAB 0x02
42 #define FLAGS_CARD_IRQ_UNMSK 0x04
44 #define HIF_MBOX_BLOCK_SIZE HIF_DEFAULT_IO_BLOCK_SIZE
45 #define HIF_MBOX0_BLOCK_SIZE 1
46 #define HIF_MBOX1_BLOCK_SIZE HIF_MBOX_BLOCK_SIZE
47 #define HIF_MBOX2_BLOCK_SIZE HIF_MBOX_BLOCK_SIZE
48 #define HIF_MBOX3_BLOCK_SIZE HIF_MBOX_BLOCK_SIZE
50 struct _HIF_SCATTER_REQ_PRIV;
52 typedef struct bus_request {
53 struct bus_request *next; /* link list of available requests */
54 struct bus_request *inusenext; /* link list of in use requests */
55 struct semaphore sem_req;
56 u32 address; /* request data */
57 A_UCHAR *buffer;
58 u32 length;
59 u32 request;
60 void *context;
61 int status;
62 struct _HIF_SCATTER_REQ_PRIV *pScatterReq; /* this request is a scatter request */
63 } BUS_REQUEST;
65 struct hif_device {
66 struct sdio_func *func;
67 spinlock_t asynclock;
68 struct task_struct* async_task; /* task to handle async commands */
69 struct semaphore sem_async; /* wake up for async task */
70 int async_shutdown; /* stop the async task */
71 struct completion async_completion; /* thread completion */
72 BUS_REQUEST *asyncreq; /* request for async tasklet */
73 BUS_REQUEST *taskreq; /* async tasklet data */
74 spinlock_t lock;
75 BUS_REQUEST *s_busRequestFreeQueue; /* free list */
76 BUS_REQUEST busRequest[BUS_REQUEST_MAX_NUM]; /* available bus requests */
77 void *claimedContext;
78 HTC_CALLBACKS htcCallbacks;
79 u8 *dma_buffer;
80 DL_LIST ScatterReqHead; /* scatter request list head */
81 bool scatter_enabled; /* scatter enabled flag */
82 bool is_suspend;
83 bool is_disabled;
84 atomic_t irqHandling;
85 HIF_DEVICE_POWER_CHANGE_TYPE powerConfig;
86 const struct sdio_device_id *id;
89 #define HIF_DMA_BUFFER_SIZE (32 * 1024)
90 #define CMD53_FIXED_ADDRESS 1
91 #define CMD53_INCR_ADDRESS 2
93 BUS_REQUEST *hifAllocateBusRequest(HIF_DEVICE *device);
94 void hifFreeBusRequest(HIF_DEVICE *device, BUS_REQUEST *busrequest);
95 void AddToAsyncList(HIF_DEVICE *device, BUS_REQUEST *busrequest);
97 #ifdef HIF_LINUX_MMC_SCATTER_SUPPORT
99 #define MAX_SCATTER_REQUESTS 4
100 #define MAX_SCATTER_ENTRIES_PER_REQ 16
101 #define MAX_SCATTER_REQ_TRANSFER_SIZE 32*1024
103 typedef struct _HIF_SCATTER_REQ_PRIV {
104 HIF_SCATTER_REQ *pHifScatterReq; /* HIF scatter request with allocated entries */
105 HIF_DEVICE *device; /* this device */
106 BUS_REQUEST *busrequest; /* request associated with request */
107 /* scatter list for linux */
108 struct scatterlist sgentries[MAX_SCATTER_ENTRIES_PER_REQ];
109 } HIF_SCATTER_REQ_PRIV;
111 #define ATH_DEBUG_SCATTER ATH_DEBUG_MAKE_MODULE_MASK(0)
113 int SetupHIFScatterSupport(HIF_DEVICE *device, HIF_DEVICE_SCATTER_SUPPORT_INFO *pInfo);
114 void CleanupHIFScatterResources(HIF_DEVICE *device);
115 int DoHifReadWriteScatter(HIF_DEVICE *device, BUS_REQUEST *busrequest);
117 #else // HIF_LINUX_MMC_SCATTER_SUPPORT
119 static inline int SetupHIFScatterSupport(HIF_DEVICE *device, HIF_DEVICE_SCATTER_SUPPORT_INFO *pInfo)
121 return A_ENOTSUP;
124 static inline int DoHifReadWriteScatter(HIF_DEVICE *device, BUS_REQUEST *busrequest)
126 return A_ENOTSUP;
129 #define CleanupHIFScatterResources(d) { }
131 #endif // HIF_LINUX_MMC_SCATTER_SUPPORT
133 #endif // _HIF_INTERNAL_H_