Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ar9003_eeprom.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2011 Atheros Communications Inc.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 #ifndef AR9003_EEPROM_H
18 #define AR9003_EEPROM_H
19 
20 #include <linux/types.h>
21 
22 #define AR9300_EEP_VER 0xD000
23 #define AR9300_EEP_VER_MINOR_MASK 0xFFF
24 #define AR9300_EEP_MINOR_VER_1 0x1
25 #define AR9300_EEP_MINOR_VER AR9300_EEP_MINOR_VER_1
26 
27 /* 16-bit offset location start of calibration struct */
28 #define AR9300_EEP_START_LOC 256
29 #define AR9300_NUM_5G_CAL_PIERS 8
30 #define AR9300_NUM_2G_CAL_PIERS 3
31 #define AR9300_NUM_5G_20_TARGET_POWERS 8
32 #define AR9300_NUM_5G_40_TARGET_POWERS 8
33 #define AR9300_NUM_2G_CCK_TARGET_POWERS 2
34 #define AR9300_NUM_2G_20_TARGET_POWERS 3
35 #define AR9300_NUM_2G_40_TARGET_POWERS 3
36 /* #define AR9300_NUM_CTLS 21 */
37 #define AR9300_NUM_CTLS_5G 9
38 #define AR9300_NUM_CTLS_2G 12
39 #define AR9300_NUM_BAND_EDGES_5G 8
40 #define AR9300_NUM_BAND_EDGES_2G 4
41 #define AR9300_EEPMISC_BIG_ENDIAN 0x01
42 #define AR9300_EEPMISC_WOW 0x02
43 #define AR9300_CUSTOMER_DATA_SIZE 20
44 
45 #define AR9300_MAX_CHAINS 3
46 #define AR9300_ANT_16S 25
47 #define AR9300_FUTURE_MODAL_SZ 6
48 
49 #define AR9300_PAPRD_RATE_MASK 0x01ffffff
50 #define AR9300_PAPRD_SCALE_1 0x0e000000
51 #define AR9300_PAPRD_SCALE_1_S 25
52 #define AR9300_PAPRD_SCALE_2 0x70000000
53 #define AR9300_PAPRD_SCALE_2_S 28
54 
55 /* Delta from which to start power to pdadc table */
56 /* This offset is used in both open loop and closed loop power control
57  * schemes. In open loop power control, it is not really needed, but for
58  * the "sake of consistency" it was kept. For certain AP designs, this
59  * value is overwritten by the value in the flag "pwrTableOffset" just
60  * before writing the pdadc vs pwr into the chip registers.
61  */
62 #define AR9300_PWR_TABLE_OFFSET 0
63 
64 /* byte addressable */
65 #define AR9300_EEPROM_SIZE (16*1024)
66 
67 #define AR9300_BASE_ADDR_4K 0xfff
68 #define AR9300_BASE_ADDR 0x3ff
69 #define AR9300_BASE_ADDR_512 0x1ff
70 
71 #define AR9300_OTP_BASE 0x14000
72 #define AR9300_OTP_STATUS 0x15f18
73 #define AR9300_OTP_STATUS_TYPE 0x7
74 #define AR9300_OTP_STATUS_VALID 0x4
75 #define AR9300_OTP_STATUS_ACCESS_BUSY 0x2
76 #define AR9300_OTP_STATUS_SM_BUSY 0x1
77 #define AR9300_OTP_READ_DATA 0x15f1c
78 
94 };
95 
101 };
102 
108 };
109 
148 };
149 
150 
151 struct eepFlags {
154 } __packed;
155 
165 };
166 
169  /* 4 bits tx and 4 bits rx */
175  /* takes lower byte in eeprom location */
177  /* offset in dB to be added to beginning
178  * of pdadc table in calibration
179  */
182  /*
183  * bit0 - enable tx temp comp
184  * bit1 - enable tx volt comp
185  * bit2 - enable fastClock - default to 1
186  * bit3 - enable doubling - default to 1
187  * bit4 - enable internal regulator - default to 1
188  */
190  /* misc flags: bit0 - turn down drivestrength */
197  /* SW controlled internal regulator fields */
199 } __packed;
200 
202  /* 4 idle, t1, t2, b (4 bits per setting) */
204  /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
206  /* 6 idle, t, r, rx1, rx12, b (2 bits each) */
208  /* 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
210  /* 3 xatten1_margin for merlin (0xa20c/b20c 16:12 */
214  /* spur channels in usual fbin coding format */
216  /* 3 Check if the register is per chain */
236 } __packed;
237 
240  /* pdadc voltage at power measurement */
242  /* pcdac used for power measurement */
244  /* range is -60 to -127 create a mapping equation 1db resolution */
246  /*range is same as noisefloor */
248  /* temp measured when noisefloor cal was performed */
250 } __packed;
251 
253  u8 tPow2x[4];
254 } __packed;
255 
257  u8 tPow2x[14];
258 } __packed;
259 
262 } __packed;
263 
266 } __packed;
267 
270  u8 future[3];
274 } __packed;
275 
283 } __packed;
284 
290 
292 
330 } __packed;
331 
334 
335 u8 *ar9003_get_spur_chan_ptr(struct ath_hw *ah, bool is_2ghz);
336 
337 unsigned int ar9003_get_paprd_scale_factor(struct ath_hw *ah,
338  struct ath9k_channel *chan);
339 
341 
342 #endif