[s3c24xx] bump to 2.6.30-rc6
[openwrt/svn-archive/archive.git] / target / linux / s3c24xx / files-2.6.30 / drivers / ar6000 / hif / hif_internal.h
1 /*
2 * @file: hif_internal.h
3 *
4 * @abstract: internal header file for hif layer
5 *
6 * @notice: Copyright (c) 2004-2006 Atheros Communications Inc.
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation;
12 *
13 * Software distributed under the License is distributed on an "AS
14 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
15 * implied. See the License for the specific language governing
16 * rights and limitations under the License.
17 *
18 *
19 *
20 */
21
22 #include <linux/sdio/ctsystem.h>
23 #include <linux/sdio/sdio_busdriver.h>
24 #include <linux/sdio/_sdio_defs.h>
25 #include <linux/sdio/sdio_lib.h>
26 #include "a_config.h"
27 #include "athdefs.h"
28 #include "a_types.h"
29 #include "a_osapi.h"
30 #include "hif.h"
31
32 #define MANUFACTURER_ID_AR6001_BASE 0x100
33 #define MANUFACTURER_ID_AR6002_BASE 0x200
34 #define FUNCTION_CLASS 0x0
35 #define MANUFACTURER_CODE 0x271
36
37 #define BUS_REQUEST_MAX_NUM 64
38
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
43
44 #define HIF_MBOX_BLOCK_SIZE 128
45 #define HIF_MBOX_BASE_ADDR 0x800
46 #define HIF_MBOX_WIDTH 0x800
47 #define HIF_MBOX0_BLOCK_SIZE 1
48 #define HIF_MBOX1_BLOCK_SIZE HIF_MBOX_BLOCK_SIZE
49 #define HIF_MBOX2_BLOCK_SIZE HIF_MBOX_BLOCK_SIZE
50 #define HIF_MBOX3_BLOCK_SIZE HIF_MBOX_BLOCK_SIZE
51
52 #define HIF_MBOX_START_ADDR(mbox) \
53 HIF_MBOX_BASE_ADDR + mbox * HIF_MBOX_WIDTH
54
55 #define HIF_MBOX_END_ADDR(mbox) \
56 HIF_MBOX_START_ADDR(mbox) + HIF_MBOX_WIDTH - 1
57
58 struct hif_device {
59 SDDEVICE *handle;
60 void *htc_handle;
61 OSKERNEL_HELPER insert_helper;
62 BOOL helper_started;
63 };
64
65 typedef struct target_function_context {
66 SDFUNCTION function; /* function description of the bus driver */
67 OS_SEMAPHORE instanceSem; /* instance lock. Unused */
68 SDLIST instanceList; /* list of instances. Unused */
69 } TARGET_FUNCTION_CONTEXT;
70
71 typedef struct bus_request {
72 struct bus_request *next;
73 SDREQUEST *request;
74 void *context;
75 } BUS_REQUEST;
76
77 BOOL
78 hifDeviceInserted(SDFUNCTION *function, SDDEVICE *device);
79
80 void
81 hifDeviceRemoved(SDFUNCTION *function, SDDEVICE *device);
82
83 SDREQUEST *
84 hifAllocateDeviceRequest(SDDEVICE *device);
85
86 void
87 hifFreeDeviceRequest(SDREQUEST *request);
88
89 void
90 hifRWCompletionHandler(SDREQUEST *request);
91
92 void
93 hifIRQHandler(void *context);
94
95 HIF_DEVICE *
96 addHifDevice(SDDEVICE *handle);
97
98 HIF_DEVICE *
99 getHifDevice(SDDEVICE *handle);
100
101 void
102 delHifDevice(SDDEVICE *handle);