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