blob: a79c1a146917c9669fc86be2a3ded825034618e6 [file] [log] [blame]
Christian Lamparter32ddf072008-08-08 21:17:37 +02001#ifndef P54COMMON_H
2#define P54COMMON_H
Michael Wueff1a592007-09-25 18:11:01 -07003
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
18struct bootrec {
19 __le32 code;
20 __le32 len;
21 u32 data[0];
22} __attribute__((packed));
23
24struct 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#define BR_CODE_MIN 0x80000000
33#define BR_CODE_COMPONENT_ID 0x80000001
34#define BR_CODE_COMPONENT_VERSION 0x80000002
35#define BR_CODE_DEPENDENT_IF 0x80000003
36#define BR_CODE_EXPOSED_IF 0x80000004
37#define BR_CODE_DESCR 0x80000101
38#define BR_CODE_MAX 0x8FFFFFFF
39#define BR_CODE_END_OF_BRA 0xFF0000FF
40#define LEGACY_BR_CODE_END_OF_BRA 0xFFFFFFFF
41
42#define FW_FMAC 0x464d4143
43#define FW_LM86 0x4c4d3836
44#define FW_LM87 0x4c4d3837
45#define FW_LM20 0x4c4d3230
46
47/* PDA defines are Copyright (C) 2005 Nokia Corporation (taken from islsm_pda.h) */
48
49struct pda_entry {
50 __le16 len; /* includes both code and data */
51 __le16 code;
52 u8 data[0];
53} __attribute__ ((packed));
54
55struct eeprom_pda_wrap {
Johannes Berg8c282932008-02-29 13:56:33 +010056 __le32 magic;
57 __le16 pad;
58 __le16 len;
59 __le32 arm_opcode;
Michael Wueff1a592007-09-25 18:11:01 -070060 u8 data[0];
61} __attribute__ ((packed));
62
63struct pda_iq_autocal_entry {
64 __le16 freq;
65 __le16 iq_param[4];
66} __attribute__ ((packed));
67
68struct pda_channel_output_limit {
69 __le16 freq;
70 u8 val_bpsk;
71 u8 val_qpsk;
72 u8 val_16qam;
73 u8 val_64qam;
74 u8 rate_set_mask;
75 u8 rate_set_size;
76} __attribute__ ((packed));
77
78struct pda_pa_curve_data_sample_rev0 {
79 u8 rf_power;
80 u8 pa_detector;
81 u8 pcv;
82} __attribute__ ((packed));
83
84struct pda_pa_curve_data_sample_rev1 {
85 u8 rf_power;
86 u8 pa_detector;
87 u8 data_barker;
88 u8 data_bpsk;
89 u8 data_qpsk;
90 u8 data_16qam;
91 u8 data_64qam;
Christian Lamparter154e3af2008-08-23 22:15:25 +020092} __attribute__ ((packed));
93
94struct p54_pa_curve_data_sample {
95 u8 rf_power;
96 u8 pa_detector;
97 u8 data_barker;
98 u8 data_bpsk;
99 u8 data_qpsk;
100 u8 data_16qam;
101 u8 data_64qam;
Michael Wueff1a592007-09-25 18:11:01 -0700102 u8 padding;
103} __attribute__ ((packed));
104
105struct pda_pa_curve_data {
106 u8 cal_method_rev;
107 u8 channels;
108 u8 points_per_channel;
109 u8 padding;
110 u8 data[0];
111} __attribute__ ((packed));
112
113/*
114 * this defines the PDR codes used to build PDAs as defined in document
115 * number 553155. The current implementation mirrors version 1.1 of the
116 * document and lists only PDRs supported by the ARM platform.
117 */
118
119/* common and choice range (0x0000 - 0x0fff) */
120#define PDR_END 0x0000
121#define PDR_MANUFACTURING_PART_NUMBER 0x0001
122#define PDR_PDA_VERSION 0x0002
123#define PDR_NIC_SERIAL_NUMBER 0x0003
124
125#define PDR_MAC_ADDRESS 0x0101
126#define PDR_REGULATORY_DOMAIN_LIST 0x0103
127#define PDR_TEMPERATURE_TYPE 0x0107
128
129#define PDR_PRISM_PCI_IDENTIFIER 0x0402
130
131/* ARM range (0x1000 - 0x1fff) */
132#define PDR_COUNTRY_INFORMATION 0x1000
133#define PDR_INTERFACE_LIST 0x1001
134#define PDR_HARDWARE_PLATFORM_COMPONENT_ID 0x1002
135#define PDR_OEM_NAME 0x1003
136#define PDR_PRODUCT_NAME 0x1004
137#define PDR_UTF8_OEM_NAME 0x1005
138#define PDR_UTF8_PRODUCT_NAME 0x1006
139#define PDR_COUNTRY_LIST 0x1007
140#define PDR_DEFAULT_COUNTRY 0x1008
141
142#define PDR_ANTENNA_GAIN 0x1100
143
144#define PDR_PRISM_INDIGO_PA_CALIBRATION_DATA 0x1901
145#define PDR_RSSI_LINEAR_APPROXIMATION 0x1902
146#define PDR_PRISM_PA_CAL_OUTPUT_POWER_LIMITS 0x1903
147#define PDR_PRISM_PA_CAL_CURVE_DATA 0x1904
148#define PDR_RSSI_LINEAR_APPROXIMATION_DUAL_BAND 0x1905
149#define PDR_PRISM_ZIF_TX_IQ_CALIBRATION 0x1906
150#define PDR_REGULATORY_POWER_LIMITS 0x1907
151#define PDR_RSSI_LINEAR_APPROXIMATION_EXTENDED 0x1908
152#define PDR_RADIATED_TRANSMISSION_CORRECTION 0x1909
153#define PDR_PRISM_TX_IQ_CALIBRATION 0x190a
154
155/* reserved range (0x2000 - 0x7fff) */
156
157/* customer range (0x8000 - 0xffff) */
158#define PDR_BASEBAND_REGISTERS 0x8000
159#define PDR_PER_CHANNEL_BASEBAND_REGISTERS 0x8001
160
161/* stored in skb->cb */
162struct memrecord {
163 u32 start_addr;
164 u32 end_addr;
Michael Wueff1a592007-09-25 18:11:01 -0700165};
166
167struct p54_eeprom_lm86 {
168 __le16 offset;
169 __le16 len;
170 u8 data[0];
171} __attribute__ ((packed));
172
173struct p54_rx_hdr {
174 __le16 magic;
175 __le16 len;
176 __le16 freq;
177 u8 antenna;
178 u8 rate;
179 u8 rssi;
180 u8 quality;
181 u16 unknown2;
182 __le64 timestamp;
183 u8 data[0];
184} __attribute__ ((packed));
185
186struct p54_frame_sent_hdr {
187 u8 status;
188 u8 retries;
189 __le16 ack_rssi;
190 __le16 seq;
191 u16 rate;
192} __attribute__ ((packed));
193
194struct p54_tx_control_allocdata {
195 u8 rateset[8];
Christian Lamparteraaa15532008-08-09 19:20:47 -0500196 u8 unalloc0[2];
197 u8 key_type;
198 u8 key_len;
199 u8 key[16];
200 u8 hw_queue;
201 u8 unalloc1[9];
202 u8 tx_antenna;
Michael Wueff1a592007-09-25 18:11:01 -0700203 u8 output_power;
Christian Lamparteraaa15532008-08-09 19:20:47 -0500204 u8 cts_rate;
205 u8 unalloc2[3];
Michael Wueff1a592007-09-25 18:11:01 -0700206 u8 align[0];
207} __attribute__ ((packed));
208
209struct p54_tx_control_filter {
210 __le16 filter_type;
211 u8 dst[ETH_ALEN];
212 u8 src[ETH_ALEN];
213 u8 antenna;
214 u8 debug;
215 __le32 magic3;
216 u8 rates[8]; // FIXME: what's this for?
217 __le32 rx_addr;
218 __le16 max_rx;
219 __le16 rxhw;
220 __le16 magic8;
221 __le16 magic9;
222} __attribute__ ((packed));
223
224struct p54_tx_control_channel {
Christian Lamparter154e3af2008-08-23 22:15:25 +0200225 __le16 flags;
226 __le16 dwell;
Michael Wueff1a592007-09-25 18:11:01 -0700227 u8 padding1[20];
228 struct pda_iq_autocal_entry iq_autocal;
229 u8 pa_points_per_curve;
230 u8 val_barker;
231 u8 val_bpsk;
232 u8 val_qpsk;
233 u8 val_16qam;
234 u8 val_64qam;
Christian Lamparter154e3af2008-08-23 22:15:25 +0200235 struct pda_pa_curve_data_sample_rev1 curve_data[8];
236 u8 dup_bpsk;
237 u8 dup_qpsk;
238 u8 dup_16qam;
239 u8 dup_64qam;
240 __le16 rssical_mul;
241 __le16 rssical_add;
Michael Wueff1a592007-09-25 18:11:01 -0700242} __attribute__ ((packed));
243
244struct p54_tx_control_led {
245 __le16 mode;
246 __le16 led_temporary;
247 __le16 led_permanent;
248 __le16 duration;
249} __attribute__ ((packed));
250
251struct p54_tx_vdcf_queues {
252 __le16 aifs;
253 __le16 cwmin;
254 __le16 cwmax;
255 __le16 txop;
256} __attribute__ ((packed));
257
258struct p54_tx_control_vdcf {
259 u8 padding;
260 u8 slottime;
261 u8 magic1;
262 u8 magic2;
263 struct p54_tx_vdcf_queues queue[8];
264 u8 pad2[4];
265 __le16 frameburst;
266} __attribute__ ((packed));
267
Christian Lamparter32ddf072008-08-08 21:17:37 +0200268#endif /* P54COMMON_H */