add rk3288 pinctrl dts code
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / combo_mt66xx / mt6628 / wlan / include / CFG_Wifi_File.h
1 /*
2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/CFG_Wifi_File.h#1 $
3 */
4
5 /*! \file   CFG_Wifi_File.h
6     \brief  Collection of NVRAM structure used for YuSu project
7
8     In this file we collect all compiler flags and detail the driver behavior if
9     enable/disable such switch or adjust numeric parameters.
10 */
11
12
13
14 /*
15 ** $Log: CFG_Wifi_File.h $
16  *
17  * 09 08 2011 cm.chang
18  * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code
19  * Use new fields ucChannelListMap and ucChannelListIndex in NVRAM
20  *
21  * 08 31 2011 cm.chang
22  * [WCXRP00000969] [MT6620 Wi-Fi][Driver][FW] Channel list for 5G band based on country code
23  * .
24  *
25  * 08 15 2011 cp.wu
26  * [WCXRP00000851] [MT6628 Wi-Fi][Driver] Add HIFSYS related definition to driver source tree
27  * add MT6628-specific definitions.
28  *
29  * 08 09 2011 cp.wu
30  * [WCXRP00000702] [MT5931][Driver] Modify initialization sequence for E1 ASIC[WCXRP00000913] [MT6620 Wi-Fi] create repository of source code dedicated for MT6620 E6 ASIC
31  * add CCK-DSSS TX-PWR control field in NVRAM and CMD definition for MT5931-MP
32  *
33  * 05 27 2011 cp.wu
34  * [WCXRP00000749] [MT6620 Wi-Fi][Driver] Add band edge tx power control to Wi-Fi NVRAM
35  * update NVRAM data structure definition.
36  *
37  * 03 10 2011 cp.wu
38  * [WCXRP00000532] [MT6620 Wi-Fi][Driver] Migrate NVRAM configuration procedures from MT6620 E2 to MT6620 E3
39  * deprecate configuration used by MT6620 E2
40  *
41  * 10 26 2010 cp.wu
42  * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check[WCXRP00000137] [MT6620 Wi-Fi] [FW] Support NIC capability query command
43  * 1) update NVRAM content template to ver 1.02
44  * 2) add compile option for querying NIC capability (default: off)
45  * 3) modify AIS 5GHz support to run-time option, which could be turned on by registry or NVRAM setting
46  * 4) correct auto-rate compiler error under linux (treat warning as error)
47  * 5) simplify usage of NVRAM and REG_INFO_T
48  * 6) add version checking between driver and firmware
49  *
50  * 10 25 2010 cp.wu
51  * [WCXRP00000133] [MT6620 Wi-Fi] [FW][Driver] Change TX power offset band definition
52  * follow-up for CMD_5G_PWR_OFFSET_T definition change
53  *
54  * 10 05 2010 cp.wu
55  * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check
56  * 1) add NVRAM access API
57  * 2) fake scanning result when NVRAM doesn't exist and/or version mismatch. (off by compiler option)
58  * 3) add OID implementation for NVRAM read/write service
59  *
60  * 09 23 2010 cp.wu
61  * [WCXRP00000056] [MT6620 Wi-Fi][Driver] NVRAM implementation with Version Check
62  * add skeleton for NVRAM integration
63  *
64 */
65
66 #ifndef _CFG_WIFI_FILE_H
67 #define _CFG_WIFI_FILE_H
68
69 /*******************************************************************************
70 *                         C O M P I L E R   F L A G S
71 ********************************************************************************
72 */
73
74 /*******************************************************************************
75 *                    E X T E R N A L   R E F E R E N C E S
76 ********************************************************************************
77 */
78 #include "gl_typedef.h"
79
80 /*******************************************************************************
81 *                              C O N S T A N T S
82 ********************************************************************************
83 */
84
85 /*******************************************************************************
86 *                             D A T A   T Y P E S
87 ********************************************************************************
88 */
89
90 /*******************************************************************************
91 *                            P U B L I C   D A T A
92 ********************************************************************************
93 */
94 // duplicated from nic_cmd_event.h to avoid header dependency
95 typedef struct _TX_PWR_PARAM_T {
96     INT_8       cTxPwr2G4Cck;           /* signed, in unit of 0.5dBm */
97 #if defined(MT6620)
98     INT_8       acReserved[3];
99 #elif defined(MT5931) || defined(MT6628)
100     INT_8       cTxPwr2G4Dsss;      /* signed, in unit of 0.5dBm */
101     INT_8       acReserved[2];
102 #else
103     #error "No valid definition!"
104 #endif
105
106     INT_8       cTxPwr2G4OFDM_BPSK;
107     INT_8       cTxPwr2G4OFDM_QPSK;
108     INT_8       cTxPwr2G4OFDM_16QAM;
109     INT_8       cTxPwr2G4OFDM_Reserved;
110     INT_8       cTxPwr2G4OFDM_48Mbps;
111     INT_8       cTxPwr2G4OFDM_54Mbps;
112
113     INT_8       cTxPwr2G4HT20_BPSK;
114     INT_8       cTxPwr2G4HT20_QPSK;
115     INT_8       cTxPwr2G4HT20_16QAM;
116     INT_8       cTxPwr2G4HT20_MCS5;
117     INT_8       cTxPwr2G4HT20_MCS6;
118     INT_8       cTxPwr2G4HT20_MCS7;
119
120     INT_8       cTxPwr2G4HT40_BPSK;
121     INT_8       cTxPwr2G4HT40_QPSK;
122     INT_8       cTxPwr2G4HT40_16QAM;
123     INT_8       cTxPwr2G4HT40_MCS5;
124     INT_8       cTxPwr2G4HT40_MCS6;
125     INT_8       cTxPwr2G4HT40_MCS7;
126
127     INT_8       cTxPwr5GOFDM_BPSK;
128     INT_8       cTxPwr5GOFDM_QPSK;
129     INT_8       cTxPwr5GOFDM_16QAM;
130     INT_8       cTxPwr5GOFDM_Reserved;
131     INT_8       cTxPwr5GOFDM_48Mbps;
132     INT_8       cTxPwr5GOFDM_54Mbps;
133
134     INT_8       cTxPwr5GHT20_BPSK;
135     INT_8       cTxPwr5GHT20_QPSK;
136     INT_8       cTxPwr5GHT20_16QAM;
137     INT_8       cTxPwr5GHT20_MCS5;
138     INT_8       cTxPwr5GHT20_MCS6;
139     INT_8       cTxPwr5GHT20_MCS7;
140
141     INT_8       cTxPwr5GHT40_BPSK;
142     INT_8       cTxPwr5GHT40_QPSK;
143     INT_8       cTxPwr5GHT40_16QAM;
144     INT_8       cTxPwr5GHT40_MCS5;
145     INT_8       cTxPwr5GHT40_MCS6;
146     INT_8       cTxPwr5GHT40_MCS7;
147 } TX_PWR_PARAM_T, *P_TX_PWR_PARAM_T;
148
149 typedef struct _PWR_5G_OFFSET_T {
150     INT_8       cOffsetBand0;       /* 4.915-4.980G */
151     INT_8       cOffsetBand1;       /* 5.000-5.080G */
152     INT_8       cOffsetBand2;       /* 5.160-5.180G */
153     INT_8       cOffsetBand3;       /* 5.200-5.280G */
154     INT_8       cOffsetBand4;       /* 5.300-5.340G */
155     INT_8       cOffsetBand5;       /* 5.500-5.580G */
156     INT_8       cOffsetBand6;       /* 5.600-5.680G */
157     INT_8       cOffsetBand7;       /* 5.700-5.825G */
158 } PWR_5G_OFFSET_T, *P_PWR_5G_OFFSET_T;
159
160 typedef struct _PWR_PARAM_T {
161     UINT_32     au4Data[28];
162     UINT_32     u4RefValue1;
163     UINT_32     u4RefValue2;
164 } PWR_PARAM_T, *P_PWR_PARAM_T;
165
166 typedef struct _MT6620_CFG_PARAM_STRUCT {
167     /* 256 bytes of MP data */
168     UINT_16             u2Part1OwnVersion;
169     UINT_16             u2Part1PeerVersion;
170     UINT_8              aucMacAddress[6];
171     UINT_8              aucCountryCode[2];
172     TX_PWR_PARAM_T      rTxPwr;
173     UINT_8              aucEFUSE[144];
174     UINT_8              ucTxPwrValid;
175     UINT_8              ucSupport5GBand;
176     UINT_8              fg2G4BandEdgePwrUsed;
177     INT_8               cBandEdgeMaxPwrCCK;
178     INT_8               cBandEdgeMaxPwrOFDM20;
179     INT_8               cBandEdgeMaxPwrOFDM40;
180
181     UINT_8              ucRegChannelListMap;
182     UINT_8              ucRegChannelListIndex;
183     UINT_8              aucRegSubbandInfo[36];
184
185     UINT_8              aucReserved2[256-240];
186
187     /* 256 bytes of function data */
188     UINT_16             u2Part2OwnVersion;
189     UINT_16             u2Part2PeerVersion;
190     UINT_8              uc2G4BwFixed20M;
191     UINT_8              uc5GBwFixed20M;
192     UINT_8              ucEnable5GBand;
193     UINT_8              aucPreTailReserved;
194     UINT_8              aucTailReserved[256-8];
195 } MT6620_CFG_PARAM_STRUCT, *P_MT6620_CFG_PARAM_STRUCT,
196     WIFI_CFG_PARAM_STRUCT, *P_WIFI_CFG_PARAM_STRUCT;
197
198 /*******************************************************************************
199 *                           P R I V A T E   D A T A
200 ********************************************************************************
201 */
202
203 /*******************************************************************************
204 *                                 M A C R O S
205 ********************************************************************************
206 */
207 #ifndef DATA_STRUC_INSPECTING_ASSERT
208 #define DATA_STRUC_INSPECTING_ASSERT(expr) \
209         switch (0) {case 0: case (expr): default:;}
210 #endif
211
212 #define CFG_FILE_WIFI_REC_SIZE    sizeof(WIFI_CFG_PARAM_STRUCT)
213
214
215 /*******************************************************************************
216 *                  F U N C T I O N   D E C L A R A T I O N S
217 ********************************************************************************
218 */
219
220 /*******************************************************************************
221 *                              F U N C T I O N S
222 ********************************************************************************
223 */
224 #ifndef _lint
225 /* We don't have to call following function to inspect the data structure.
226  * It will check automatically while at compile time.
227  * We'll need this to guarantee the same member order in different structures
228  * to simply handling effort in some functions.
229  */
230 __KAL_INLINE__ VOID
231 nvramOffsetCheck (
232     VOID
233     )
234 {
235     DATA_STRUC_INSPECTING_ASSERT(
236         OFFSET_OF(WIFI_CFG_PARAM_STRUCT, u2Part2OwnVersion) == 256);
237
238     DATA_STRUC_INSPECTING_ASSERT(
239         sizeof(WIFI_CFG_PARAM_STRUCT) == 512);
240
241     DATA_STRUC_INSPECTING_ASSERT(
242         (OFFSET_OF(WIFI_CFG_PARAM_STRUCT, aucEFUSE) & 0x0001) == 0);
243
244     DATA_STRUC_INSPECTING_ASSERT(
245         (OFFSET_OF(WIFI_CFG_PARAM_STRUCT, aucRegSubbandInfo) & 0x0001) == 0);
246 }
247 #endif
248
249 #endif /* _CFG_WIFI_FILE_H */
250
251