p54: broken out edcf changes
[pandora-kernel.git] / drivers / net / wireless / p54 / p54common.h
1 #ifndef P54COMMON_H
2 #define P54COMMON_H
3
4 /*
5  * Common code specific definitions for mac80211 Prism54 drivers
6  *
7  * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
8  * Copyright (c) 2007, Christian Lamparter <chunkeey@web.de>
9  *
10  * Based on:
11  * - the islsm (softmac prism54) driver, which is:
12  *   Copyright 2004-2006 Jean-Baptiste Note <jbnote@gmail.com>, et al.
13  *
14  * - LMAC API interface header file for STLC4560 (lmac_longbow.h)
15  *   Copyright (C) 2007 Conexant Systems, Inc.
16  *
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License version 2 as
19  * published by the Free Software Foundation.
20  */
21
22 struct bootrec {
23         __le32 code;
24         __le32 len;
25         u32 data[10];
26 } __attribute__((packed));
27
28 struct bootrec_exp_if {
29         __le16 role;
30         __le16 if_id;
31         __le16 variant;
32         __le16 btm_compat;
33         __le16 top_compat;
34 } __attribute__((packed));
35
36 struct bootrec_desc {
37         __le16 modes;
38         __le16 flags;
39         __le32 rx_start;
40         __le32 rx_end;
41         u8 headroom;
42         u8 tailroom;
43         u8 unimportant[6];
44         u8 rates[16];
45         u8 padding2[4];
46         __le16 rx_mtu;
47 } __attribute__((packed));
48
49 #define BR_CODE_MIN                     0x80000000
50 #define BR_CODE_COMPONENT_ID            0x80000001
51 #define BR_CODE_COMPONENT_VERSION       0x80000002
52 #define BR_CODE_DEPENDENT_IF            0x80000003
53 #define BR_CODE_EXPOSED_IF              0x80000004
54 #define BR_CODE_DESCR                   0x80000101
55 #define BR_CODE_MAX                     0x8FFFFFFF
56 #define BR_CODE_END_OF_BRA              0xFF0000FF
57 #define LEGACY_BR_CODE_END_OF_BRA       0xFFFFFFFF
58
59 /* PDA defines are Copyright (C) 2005 Nokia Corporation (taken from islsm_pda.h) */
60
61 struct pda_entry {
62         __le16 len;     /* includes both code and data */
63         __le16 code;
64         u8 data[0];
65 } __attribute__ ((packed));
66
67 struct eeprom_pda_wrap {
68         __le32 magic;
69         __le16 pad;
70         __le16 len;
71         __le32 arm_opcode;
72         u8 data[0];
73 } __attribute__ ((packed));
74
75 struct pda_iq_autocal_entry {
76         __le16 freq;
77         __le16 iq_param[4];
78 } __attribute__ ((packed));
79
80 struct pda_channel_output_limit {
81         __le16 freq;
82         u8 val_bpsk;
83         u8 val_qpsk;
84         u8 val_16qam;
85         u8 val_64qam;
86         u8 rate_set_mask;
87         u8 rate_set_size;
88 } __attribute__ ((packed));
89
90 struct pda_pa_curve_data_sample_rev0 {
91         u8 rf_power;
92         u8 pa_detector;
93         u8 pcv;
94 } __attribute__ ((packed));
95
96 struct pda_pa_curve_data_sample_rev1 {
97         u8 rf_power;
98         u8 pa_detector;
99         u8 data_barker;
100         u8 data_bpsk;
101         u8 data_qpsk;
102         u8 data_16qam;
103         u8 data_64qam;
104 } __attribute__ ((packed));
105
106 struct p54_pa_curve_data_sample {
107         u8 rf_power;
108         u8 pa_detector;
109         u8 data_barker;
110         u8 data_bpsk;
111         u8 data_qpsk;
112         u8 data_16qam;
113         u8 data_64qam;
114         u8 padding;
115 } __attribute__ ((packed));
116
117 struct pda_pa_curve_data {
118         u8 cal_method_rev;
119         u8 channels;
120         u8 points_per_channel;
121         u8 padding;
122         u8 data[0];
123 } __attribute__ ((packed));
124
125 /*
126  * this defines the PDR codes used to build PDAs as defined in document
127  * number 553155. The current implementation mirrors version 1.1 of the
128  * document and lists only PDRs supported by the ARM platform.
129  */
130
131 /* common and choice range (0x0000 - 0x0fff) */
132 #define PDR_END                                 0x0000
133 #define PDR_MANUFACTURING_PART_NUMBER           0x0001
134 #define PDR_PDA_VERSION                         0x0002
135 #define PDR_NIC_SERIAL_NUMBER                   0x0003
136
137 #define PDR_MAC_ADDRESS                         0x0101
138 #define PDR_REGULATORY_DOMAIN_LIST              0x0103
139 #define PDR_TEMPERATURE_TYPE                    0x0107
140
141 #define PDR_PRISM_PCI_IDENTIFIER                0x0402
142
143 /* ARM range (0x1000 - 0x1fff) */
144 #define PDR_COUNTRY_INFORMATION                 0x1000
145 #define PDR_INTERFACE_LIST                      0x1001
146 #define PDR_HARDWARE_PLATFORM_COMPONENT_ID      0x1002
147 #define PDR_OEM_NAME                            0x1003
148 #define PDR_PRODUCT_NAME                        0x1004
149 #define PDR_UTF8_OEM_NAME                       0x1005
150 #define PDR_UTF8_PRODUCT_NAME                   0x1006
151 #define PDR_COUNTRY_LIST                        0x1007
152 #define PDR_DEFAULT_COUNTRY                     0x1008
153
154 #define PDR_ANTENNA_GAIN                        0x1100
155
156 #define PDR_PRISM_INDIGO_PA_CALIBRATION_DATA    0x1901
157 #define PDR_RSSI_LINEAR_APPROXIMATION           0x1902
158 #define PDR_PRISM_PA_CAL_OUTPUT_POWER_LIMITS    0x1903
159 #define PDR_PRISM_PA_CAL_CURVE_DATA             0x1904
160 #define PDR_RSSI_LINEAR_APPROXIMATION_DUAL_BAND 0x1905
161 #define PDR_PRISM_ZIF_TX_IQ_CALIBRATION         0x1906
162 #define PDR_REGULATORY_POWER_LIMITS             0x1907
163 #define PDR_RSSI_LINEAR_APPROXIMATION_EXTENDED  0x1908
164 #define PDR_RADIATED_TRANSMISSION_CORRECTION    0x1909
165 #define PDR_PRISM_TX_IQ_CALIBRATION             0x190a
166
167 /* reserved range (0x2000 - 0x7fff) */
168
169 /* customer range (0x8000 - 0xffff) */
170 #define PDR_BASEBAND_REGISTERS                  0x8000
171 #define PDR_PER_CHANNEL_BASEBAND_REGISTERS      0x8001
172
173 /* stored in skb->cb */
174 struct memrecord {
175         u32 start_addr;
176         u32 end_addr;
177 };
178
179 struct p54_eeprom_lm86 {
180         __le16 offset;
181         __le16 len;
182         u8 data[0];
183 } __attribute__ ((packed));
184
185 struct p54_rx_hdr {
186         __le16 magic;
187         __le16 len;
188         __le16 freq;
189         u8 antenna;
190         u8 rate;
191         u8 rssi;
192         u8 quality;
193         u16 unknown2;
194         __le32 tsf32;
195         __le32 unalloc0;
196         u8 align[0];
197 } __attribute__ ((packed));
198
199 struct p54_frame_sent_hdr {
200         u8 status;
201         u8 retries;
202         __le16 ack_rssi;
203         __le16 seq;
204         u16 rate;
205 } __attribute__ ((packed));
206
207 struct p54_tx_control_allocdata {
208         u8 rateset[8];
209         u8 unalloc0[2];
210         u8 key_type;
211         u8 key_len;
212         u8 key[16];
213         u8 hw_queue;
214         u8 unalloc1[9];
215         u8 tx_antenna;
216         u8 output_power;
217         u8 cts_rate;
218         u8 unalloc2[3];
219         u8 align[0];
220 } __attribute__ ((packed));
221
222 struct p54_tx_control_filter {
223         __le16 filter_type;
224         u8 mac_addr[ETH_ALEN];
225         u8 bssid[ETH_ALEN];
226         u8 rx_antenna;
227         u8 rx_align;
228         union {
229                 struct {
230                         __le32 basic_rate_mask;
231                         u8 rts_rates[8];
232                         __le32 rx_addr;
233                         __le16 max_rx;
234                         __le16 rxhw;
235                         __le16 wakeup_timer;
236                         __le16 unalloc0;
237                 } v1 __attribute__ ((packed));
238                 struct {
239                         __le32 rx_addr;
240                         __le16 max_rx;
241                         __le16 rxhw;
242                         __le16 timer;
243                         __le16 unalloc0;
244                         __le32 unalloc1;
245                 } v2 __attribute__ ((packed));
246         } __attribute__ ((packed));
247 } __attribute__ ((packed));
248
249 #define P54_TX_CONTROL_FILTER_V1_LEN (sizeof(struct p54_tx_control_filter))
250 #define P54_TX_CONTROL_FILTER_V2_LEN (sizeof(struct p54_tx_control_filter)-8)
251
252 struct p54_tx_control_channel {
253         __le16 flags;
254         __le16 dwell;
255         u8 padding1[20];
256         struct pda_iq_autocal_entry iq_autocal;
257         u8 pa_points_per_curve;
258         u8 val_barker;
259         u8 val_bpsk;
260         u8 val_qpsk;
261         u8 val_16qam;
262         u8 val_64qam;
263         struct p54_pa_curve_data_sample curve_data[8];
264         u8 dup_bpsk;
265         u8 dup_qpsk;
266         u8 dup_16qam;
267         u8 dup_64qam;
268         union {
269                 struct {
270                         __le16 rssical_mul;
271                         __le16 rssical_add;
272                 } v1 __attribute__ ((packed));
273
274                 struct {
275                         __le32 basic_rate_mask;
276                          u8 rts_rates[8];
277                         __le16 rssical_mul;
278                         __le16 rssical_add;
279                 } v2 __attribute__ ((packed));
280         } __attribute__ ((packed));
281 } __attribute__ ((packed));
282
283 #define P54_TX_CONTROL_CHANNEL_V1_LEN (sizeof(struct p54_tx_control_channel)-12)
284 #define P54_TX_CONTROL_CHANNEL_V2_LEN (sizeof(struct p54_tx_control_channel))
285
286 struct p54_tx_control_led {
287         __le16 mode;
288         __le16 led_temporary;
289         __le16 led_permanent;
290         __le16 duration;
291 } __attribute__ ((packed));
292
293 struct p54_edcf {
294         u8 flags;
295         u8 slottime;
296         u8 sifs;
297         u8 eofpad;
298         struct p54_edcf_queue_param queue[8];
299         u8 mapping[4];
300         __le16 frameburst;
301         __le16 round_trip_delay;
302 } __attribute__ ((packed));
303
304 struct p54_statistics {
305         __le32 rx_success;
306         __le32 rx_bad_fcs;
307         __le32 rx_abort;
308         __le32 rx_abort_phy;
309         __le32 rts_success;
310         __le32 rts_fail;
311         __le32 tsf32;
312         __le32 airtime;
313         __le32 noise;
314         __le32 unkn[10]; /* CCE / CCA / RADAR */
315 } __attribute__ ((packed));
316
317 struct p54_tx_control_xbow_synth {
318         __le16 magic1;
319         __le16 magic2;
320         __le16 freq;
321         u32 padding[5];
322 } __attribute__ ((packed));
323
324 #endif /* P54COMMON_H */