add rk3288 pinctrl dts code
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / combo_mt66xx / mt6628 / wlan / include / nic / bow.h
1 /*
2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/nic/bow.h#1 $
3 */
4
5
6
7 /*
8 ** $Log: bow.h $
9  *
10  * 01 16 2012 chinghwa.yu
11  * [WCXRP00000065] Update BoW design and settings
12  * Support BOW for 5GHz band.
13  *
14  * 05 25 2011 terry.wu
15  * [WCXRP00000735] [MT6620 Wi-Fi][BoW][FW/Driver] Protect BoW connection establishment
16  * Add BoW Cancel Scan Request and Turn On deactive network function.
17  *
18  * 05 22 2011 terry.wu
19  * [WCXRP00000735] [MT6620 Wi-Fi][BoW][FW/Driver] Protect BoW connection establishment
20  * Submit missing BoW header files.
21  *
22  * 03 27 2011 chinghwa.yu
23  * [WCXRP00000065] Update BoW design and settings
24  * Support multiple physical link.
25  *
26  * 03 06 2011 chinghwa.yu
27  * [WCXRP00000065] Update BoW design and settings
28  * Sync BOW Driver to latest person development branch version..
29  *
30  * 02 10 2011 chinghwa.yu
31  * [WCXRP00000065] Update BoW design and settings
32  * Fix kernel API change issue.
33  * Before ALPS 2.2 (2.2 included), kfifo_alloc() is 
34  * struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask, spinlock_t *lock);
35  * After ALPS 2.3, kfifo_alloc() is changed to
36  * int kfifo_alloc(struct kfifo *fifo, unsigned int size, gfp_t gfp_mask);
37  *
38  * 02 10 2011 chinghwa.yu
39  * [WCXRP00000065] Update BoW design and settings
40  * Update BOW structure.
41  *
42  * 02 09 2011 cp.wu
43  * [WCXRP00000430] [MT6620 Wi-Fi][Firmware][Driver] Create V1.2 branch for MT6620E1 and MT6620E3
44  * create V1.2 driver branch based on label MT6620_WIFI_DRIVER_V1_2_110209_1031 
45  * with BOW and P2P enabled as default
46  *
47  * 02 08 2011 chinghwa.yu
48  * [WCXRP00000065] Update BoW design and settings
49  * Replace kfifo_get and kfifo_put with kfifo_out and kfifo_in.
50  * Update BOW get MAC status, remove returning event for AIS network type.
51  *
52  * 01 11 2011 chinghwa.yu
53  * [WCXRP00000065] Update BoW design and settings
54  * Add Activity Report definition.
55  *
56  * 10 18 2010 chinghwa.yu
57  * [WCXRP00000110] [MT6620 Wi-Fi] [Driver] Fix BoW Connected event size
58  * Fix wrong BoW event size.
59  *
60  * 07 15 2010 cp.wu
61  * 
62  * sync. bluetooth-over-Wi-Fi interface to driver interface document v0.2.6.
63  *
64  * 07 08 2010 cp.wu
65  * 
66  * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
67  *
68  * 06 06 2010 kevin.huang
69  * [WPD00003832][MT6620 5931] Create driver base 
70  * [MT6620 5931] Create driver base
71  *
72  * 05 13 2010 cp.wu
73  * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support 
74  * 1) all BT physical handles shares the same RSSI/Link Quality.
75  * 2) simplify BT command composing
76  *
77  * 04 28 2010 cp.wu
78  * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support 
79  * change prefix for data structure used to communicate with 802.11 PAL
80  * to avoid ambiguous naming with firmware interface
81  *
82  * 04 27 2010 cp.wu
83  * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support 
84  * basic implementation for EVENT_BT_OVER_WIFI
85  *
86  * 04 13 2010 cp.wu
87  * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support 
88  * add framework for BT-over-Wi-Fi support.
89  *  *  *  *  *  *  * 1) prPendingCmdInfo is replaced by queue for multiple handler capability
90  *  *  *  *  *  *  * 2) command sequence number is now increased atomically 
91  *  *  *  *  *  *  * 3) private data could be hold and taken use for other purpose
92  *
93  * 04 09 2010 cp.wu
94  * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support 
95  * sync. with design document for interface change.
96  *
97  * 04 02 2010 cp.wu
98  * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support 
99  * Wi-Fi driver no longer needs to implement 802.11 PAL, thus replaced by wrapping command/event definitions
100  *
101  * 03 16 2010 cp.wu
102  * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support 
103  * correct typo.
104  *
105  * 03 16 2010 cp.wu
106  * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support 
107  * update for all command/event needed to be supported by 802.11 PAL.
108  *
109  * 03 16 2010 cp.wu
110  * [WPD00003823][MT6620 Wi-Fi] Add Bluetooth-over-Wi-Fi support 
111  * build up basic data structure and definitions to support BT-over-WiFi
112  *
113 */
114
115 #ifndef _BOW_H_
116 #define _BOW_H_
117
118 /*******************************************************************************
119 *                         C O M P I L E R   F L A G S
120 ********************************************************************************
121 */
122
123 /*******************************************************************************
124 *                    E X T E R N A L   R E F E R E N C E S
125 ********************************************************************************
126 */
127
128 /*******************************************************************************
129 *                              C O N S T A N T S
130 ********************************************************************************
131 */
132
133 #define BOWDEVNAME          "bow0"
134
135 #define MAX_BOW_NUMBER_OF_CHANNEL_2G4            14
136 #define MAX_BOW_NUMBER_OF_CHANNEL_5G              4
137 #define MAX_BOW_NUMBER_OF_CHANNEL                    18 //(MAX_BOW_NUMBER_OF_CHANNEL_2G4 + MAX_BOW_NUMBER_OF_CHANNEL_5G)
138
139 #define MAX_ACTIVITY_REPORT                                    2
140 #define MAX_ACTIVITY_REPROT_TIME                          660
141
142 #define ACTIVITY_REPORT_STATUS_SUCCESS              0
143 #define ACTIVITY_REPORT_STATUS_FAILURE               1
144 #define ACTIVITY_REPORT_STATUS_TIME_INVALID     2
145 #define ACTIVITY_REPORT_STATUS_OTHERS                3
146
147 #define ACTIVITY_REPORT_SCHEDULE_UNKNOWN        0           //Does not know the schedule of the interference
148 #define ACTIVITY_REPORT_SCHEDULE_KNOWN             1
149
150 /*******************************************************************************
151 *                                 M A C R O S
152 ********************************************************************************
153 */
154
155 /*******************************************************************************
156 *                         D A T A   T Y P E S
157 ********************************************************************************
158 */
159 typedef struct _BT_OVER_WIFI_COMMAND_HEADER_T {
160     UINT_8      ucCommandId;
161     UINT_8      ucSeqNumber;
162     UINT_16     u2PayloadLength;
163 } AMPC_COMMAND_HEADER_T, *P_AMPC_COMMAND_HEADER_T;
164
165 typedef struct _BT_OVER_WIFI_COMMAND {
166     AMPC_COMMAND_HEADER_T   rHeader;
167     UINT_8                  aucPayload[0];
168 } AMPC_COMMAND, *P_AMPC_COMMAND;
169
170 typedef struct _BT_OVER_WIFI_EVENT_HEADER_T {
171     UINT_8      ucEventId;
172     UINT_8      ucSeqNumber;
173     UINT_16     u2PayloadLength;
174 } AMPC_EVENT_HEADER_T, *P_AMPC_EVENT_HEADER_T;
175
176 typedef struct _BT_OVER_WIFI_EVENT {
177     AMPC_EVENT_HEADER_T rHeader;
178     UINT_8                      aucPayload[0];
179 } AMPC_EVENT, *P_AMPC_EVENT;
180
181 typedef struct _CHANNEL_DESC_T {
182     UINT_8     ucChannelBand;
183     UINT_8     ucChannelNum;
184 } CHANNEL_DESC, P_CHANNEL_DESC;
185
186 // Command Structures 
187 typedef struct _BOW_SETUP_CONNECTION {
188 //Fixed to 2.4G
189     UINT_8      ucChannelNum;
190     UINT_8      ucReserved1;
191     UINT_8      aucPeerAddress[6];
192     UINT_16     u2BeaconInterval;
193     UINT_8      ucTimeoutDiscovery;
194     UINT_8      ucTimeoutInactivity;
195     UINT_8      ucRole;
196     UINT_8      ucPAL_Capabilities;
197     INT_8        cMaxTxPower;
198     UINT_8      ucReserved2;
199
200 //Pending, for future BOW 5G supporting.
201 /*    UINT_8          aucPeerAddress[6];
202     UINT_16         u2BeaconInterval;
203     UINT_8          ucTimeoutDiscovery;
204     UINT_8          ucTimeoutInactivity;
205     UINT_8          ucRole;
206     UINT_8          ucPAL_Capabilities;
207     INT_8           cMaxTxPower;
208     UINT_8          ucChannelListNum;
209     CHANNEL_DESC    arChannelList[1];
210 */
211 } BOW_SETUP_CONNECTION, *P_BOW_SETUP_CONNECTION;
212
213 typedef struct _BOW_DESTROY_CONNECTION {
214     UINT_8      aucPeerAddress[6];
215     UINT_8      aucReserved[2];
216 } BOW_DESTROY_CONNECTION, *P_BOW_DESTROY_CONNECTION;
217
218 typedef struct _BOW_SET_PTK {
219     UINT_8      aucPeerAddress[6];
220     UINT_8      aucReserved[2];
221     UINT_8      aucTemporalKey[16];
222 } BOW_SET_PTK, *P_BOW_SET_PTK;
223
224 typedef struct _BOW_READ_RSSI {
225     UINT_8      aucPeerAddress[6];
226     UINT_8      aucReserved[2];
227 } BOW_READ_RSSI, *P_BOW_READ_RSSI;
228
229 typedef struct _BOW_READ_LINK_QUALITY {
230     UINT_8      aucPeerAddress[6];
231     UINT_8      aucReserved[2];
232 } BOW_READ_LINK_QUALITY, *P_BOW_READ_LINK_QUALITY;
233
234 typedef struct _BOW_SHORT_RANGE_MODE {
235     UINT_8      aucPeerAddress[6];
236     INT_8       cTxPower;
237     UINT_8      ucReserved;
238 } BOW_SHORT_RANGE_MODE, *P_BOW_SHORT_RANGE_MODE;
239
240 // Event Structures
241 typedef struct _BOW_COMMAND_STATUS {
242     UINT_8      ucStatus;
243     UINT_8      ucReserved[3];
244 } BOW_COMMAND_STATUS, *P_BOW_COMMAND_STATUS;
245
246 typedef struct _BOW_MAC_STATUS {
247     UINT_8                 aucMacAddr[6];
248     UINT_8                 ucAvailability;
249     UINT_8                 ucNumOfChannel;
250     CHANNEL_DESC    arChannelList[MAX_BOW_NUMBER_OF_CHANNEL];
251 } BOW_MAC_STATUS, *P_BOW_MAC_STATUS;
252
253 typedef struct _BOW_LINK_CONNECTED {
254     CHANNEL_DESC    rChannel;
255     UINT_8          aucReserved;
256     UINT_8          aucPeerAddress[6];
257 } BOW_LINK_CONNECTED, *P_BOW_LINK_CONNECTED;
258
259 typedef struct _BOW_LINK_DISCONNECTED {
260     UINT_8  ucReason;
261     UINT_8  aucReserved;
262     UINT_8  aucPeerAddress[6];
263 } BOW_LINK_DISCONNECTED, *P_BOW_LINK_DISCONNECTED;
264
265 typedef struct _BOW_RSSI {
266     INT_8   cRssi;
267     UINT_8  aucReserved[3];
268 } BOW_RSSI, *P_BOW_RSSI;
269
270 typedef struct _BOW_LINK_QUALITY {
271     UINT_8  ucLinkQuality;
272     UINT_8  aucReserved[3];
273 } BOW_LINK_QUALITY, *P_BOW_LINK_QUALITY;
274
275 typedef enum _ENUM_BOW_CMD_ID_T {
276     BOW_CMD_ID_GET_MAC_STATUS = 1,
277     BOW_CMD_ID_SETUP_CONNECTION,
278     BOW_CMD_ID_DESTROY_CONNECTION,
279     BOW_CMD_ID_SET_PTK,
280     BOW_CMD_ID_READ_RSSI,
281     BOW_CMD_ID_READ_LINK_QUALITY,
282     BOW_CMD_ID_SHORT_RANGE_MODE,
283     BOW_CMD_ID_GET_CHANNEL_LIST,
284 } ENUM_BOW_CMD_ID_T, *P_ENUM_BOW_CMD_ID_T;
285
286 typedef enum _ENUM_BOW_EVENT_ID_T {
287     BOW_EVENT_ID_COMMAND_STATUS = 1,
288     BOW_EVENT_ID_MAC_STATUS,
289     BOW_EVENT_ID_LINK_CONNECTED,
290     BOW_EVENT_ID_LINK_DISCONNECTED,
291     BOW_EVENT_ID_RSSI,
292     BOW_EVENT_ID_LINK_QUALITY,
293     BOW_EVENT_ID_CHANNEL_LIST,
294     BOW_EVENT_ID_CHANNEL_SELECTED,
295 } ENUM_BOW_EVENT_ID_T, *P_ENUM_BOW_EVENT_ID_T;
296
297 typedef enum _ENUM_BOW_DEVICE_STATE {
298     BOW_DEVICE_STATE_DISCONNECTED = 0,
299     BOW_DEVICE_STATE_DISCONNECTING,
300     BOW_DEVICE_STATE_ACQUIRING_CHANNEL,
301     BOW_DEVICE_STATE_STARTING,
302     BOW_DEVICE_STATE_SCANNING,
303     BOW_DEVICE_STATE_CONNECTING,
304     BOW_DEVICE_STATE_CONNECTED,
305     BOW_DEVICE_STATE_NUM
306 } ENUM_BOW_DEVICE_STATE, *P_ENUM_BOW_DEVICE_STATE;
307
308 /*******************************************************************************
309 *                            P U B L I C   D A T A
310 ********************************************************************************
311 */
312
313 /*******************************************************************************
314 *                           P R I V A T E   D A T A
315 ********************************************************************************
316 */
317
318 /*******************************************************************************
319 *                  F U N C T I O N   D E C L A R A T I O N S
320 ********************************************************************************
321 */
322
323 #endif /*_BOW_H */