Merge branch 'kmemleak' of git://linux-arm.org/linux-2.6
[linux-2.6] / drivers / net / wireless / iwmc3200wifi / eeprom.h
1 /*
2  * Intel Wireless Multicomm 3200 WiFi driver
3  *
4  * Copyright (C) 2009 Intel Corporation. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  *   * Redistributions of source code must retain the above copyright
11  *     notice, this list of conditions and the following disclaimer.
12  *   * Redistributions in binary form must reproduce the above copyright
13  *     notice, this list of conditions and the following disclaimer in
14  *     the documentation and/or other materials provided with the
15  *     distribution.
16  *   * Neither the name of Intel Corporation nor the names of its
17  *     contributors may be used to endorse or promote products derived
18  *     from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  *
33  * Intel Corporation <ilw@linux.intel.com>
34  * Samuel Ortiz <samuel.ortiz@intel.com>
35  * Zhu Yi <yi.zhu@intel.com>
36  *
37  */
38
39 #ifndef __IWM_EEPROM_H__
40 #define __IWM_EEPROM_H__
41
42 enum {
43         IWM_EEPROM_SIG = 0,
44         IWM_EEPROM_FIRST = IWM_EEPROM_SIG,
45         IWM_EEPROM_VERSION,
46         IWM_EEPROM_OEM_HW_VERSION,
47         IWM_EEPROM_MAC_VERSION,
48         IWM_EEPROM_CARD_ID,
49         IWM_EEPROM_RADIO_CONF,
50         IWM_EEPROM_SKU_CAP,
51
52         IWM_EEPROM_INDIRECT_OFFSET,
53         IWM_EEPROM_CALIB_RXIQ_OFFSET = IWM_EEPROM_INDIRECT_OFFSET,
54
55         IWM_EEPROM_INDIRECT_DATA,
56         IWM_EEPROM_CALIB_RXIQ = IWM_EEPROM_INDIRECT_DATA,
57
58         IWM_EEPROM_LAST,
59 };
60
61 #define IWM_EEPROM_SIG_OFF             0x00
62 #define IWM_EEPROM_VERSION_OFF        (0x54 << 1)
63 #define IWM_EEPROM_OEM_HW_VERSION_OFF (0x56 << 1)
64 #define IWM_EEPROM_MAC_VERSION_OFF    (0x30 << 1)
65 #define IWM_EEPROM_CARD_ID_OFF        (0x5d << 1)
66 #define IWM_EEPROM_RADIO_CONF_OFF     (0x58 << 1)
67 #define IWM_EEPROM_SKU_CAP_OFF        (0x55 << 1)
68 #define IWM_EEPROM_CALIB_CONFIG_OFF   (0x7c << 1)
69
70 #define IWM_EEPROM_SIG_LEN              4
71 #define IWM_EEPROM_VERSION_LEN          2
72 #define IWM_EEPROM_OEM_HW_VERSION_LEN   2
73 #define IWM_EEPROM_MAC_VERSION_LEN      1
74 #define IWM_EEPROM_CARD_ID_LEN          2
75 #define IWM_EEPROM_RADIO_CONF_LEN       2
76 #define IWM_EEPROM_SKU_CAP_LEN          2
77 #define IWM_EEPROM_INDIRECT_LEN         2
78
79 #define IWM_MAX_EEPROM_DATA_LEN         240
80 #define IWM_EEPROM_LEN                  0x800
81
82 #define IWM_EEPROM_MIN_ALLOWED_VERSION          0x0610
83 #define IWM_EEPROM_MAX_ALLOWED_VERSION          0x0700
84 #define IWM_EEPROM_CURRENT_VERSION              0x0612
85
86 #define IWM_EEPROM_SKU_CAP_BAND_24GHZ           (1 << 4)
87 #define IWM_EEPROM_SKU_CAP_BAND_52GHZ           (1 << 5)
88 #define IWM_EEPROM_SKU_CAP_11N_ENABLE           (1 << 6)
89
90 enum {
91         IWM_EEPROM_CALIB_CAL_HDR,
92         IWM_EEPROM_CALIB_TX_POWER,
93         IWM_EEPROM_CALIB_XTAL,
94         IWM_EEPROM_CALIB_TEMPERATURE,
95         IWM_EEPROM_CALIB_RX_BB_FILTER,
96         IWM_EEPROM_CALIB_RX_IQ,
97         IWM_EEPROM_CALIB_MAX,
98 };
99
100 #define IWM_EEPROM_CALIB_RXIQ_OFF       (IWM_EEPROM_CALIB_CONFIG_OFF + \
101                                          (IWM_EEPROM_CALIB_RX_IQ << 1))
102 #define IWM_EEPROM_CALIB_RXIQ_LEN       sizeof(struct iwm_lmac_calib_rxiq)
103
104 struct iwm_eeprom_entry {
105         char *name;
106         u32 offset;
107         u32 length;
108 };
109
110 int iwm_eeprom_init(struct iwm_priv *iwm);
111 void iwm_eeprom_exit(struct iwm_priv *iwm);
112 u8 *iwm_eeprom_access(struct iwm_priv *iwm, u8 eeprom_id);
113
114 #endif