OSDN Git Service

rtl8723au: Upgrade to driver version v4.1.6_7336.20130426
[android-x86/external-modules-rtl8723au.git] / include / rtw_eeprom.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
4  *                                        
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17  *
18  *
19  ******************************************************************************/
20 #ifndef __RTW_EEPROM_H__
21 #define __RTW_EEPROM_H__
22
23 #include <drv_conf.h>
24 #include <osdep_service.h>
25 #include <drv_types.h>
26
27 #define RTL8712_EEPROM_ID                       0x8712
28 //#define       EEPROM_MAX_SIZE                 256
29
30 #define HWSET_MAX_SIZE_512              512
31 #define EEPROM_MAX_SIZE                 HWSET_MAX_SIZE_512
32
33 #define CLOCK_RATE                                      50                      //100us         
34
35 //- EEPROM opcodes
36 #define EEPROM_READ_OPCODE              06
37 #define EEPROM_WRITE_OPCODE             05
38 #define EEPROM_ERASE_OPCODE             07
39 #define EEPROM_EWEN_OPCODE              19      // Erase/write enable
40 #define EEPROM_EWDS_OPCODE              16      // Erase/write disable
41
42 //Country codes
43 #define USA                                                     0x555320
44 #define EUROPE                                          0x1 //temp, should be provided later    
45 #define JAPAN                                           0x2 //temp, should be provided later
46
47 #ifdef CONFIG_SDIO_HCI
48 #define eeprom_cis0_sz  17
49 #define eeprom_cis1_sz  50
50 #endif
51
52 #define EEPROM_CID_DEFAULT                      0x0
53 #define EEPROM_CID_ALPHA                                0x1
54 #define EEPROM_CID_Senao                                0x3
55 #define EEPROM_CID_NetCore                              0x5
56 #define EEPROM_CID_CAMEO                                0X8
57 #define EEPROM_CID_SITECOM                              0x9
58 #define EEPROM_CID_COREGA                               0xB
59 #define EEPROM_CID_EDIMAX_BELKIN                0xC
60 #define EEPROM_CID_SERCOMM_BELKIN               0xE
61 #define EEPROM_CID_CAMEO1                               0xF
62 #define EEPROM_CID_WNC_COREGA           0x12
63 #define EEPROM_CID_CLEVO                                0x13
64 #define EEPROM_CID_WHQL                         0xFE // added by chiyoko for dtm, 20090108
65
66 //
67 // Customer ID, note that: 
68 // This variable is initiailzed through EEPROM or registry, 
69 // however, its definition may be different with that in EEPROM for 
70 // EEPROM size consideration. So, we have to perform proper translation between them.
71 // Besides, CustomerID of registry has precedence of that of EEPROM.
72 // defined below. 060703, by rcnjko.
73 //
74 typedef enum _RT_CUSTOMER_ID
75 {
76         RT_CID_DEFAULT = 0,
77         RT_CID_8187_ALPHA0 = 1,
78         RT_CID_8187_SERCOMM_PS = 2,
79         RT_CID_8187_HW_LED = 3,
80         RT_CID_8187_NETGEAR = 4,
81         RT_CID_WHQL = 5,
82         RT_CID_819x_CAMEO  = 6, 
83         RT_CID_819x_RUNTOP = 7,
84         RT_CID_819x_Senao = 8,
85         RT_CID_TOSHIBA = 9,     // Merge by Jacken, 2008/01/31.
86         RT_CID_819x_Netcore = 10,
87         RT_CID_Nettronix = 11,
88         RT_CID_DLINK = 12,
89         RT_CID_PRONET = 13,
90         RT_CID_COREGA = 14,
91         RT_CID_CHINA_MOBILE = 15,
92         RT_CID_819x_ALPHA = 16,
93         RT_CID_819x_Sitecom = 17,
94         RT_CID_CCX = 18, // It's set under CCX logo test and isn't demanded for CCX functions, but for test behavior like retry limit and tx report. By Bruce, 2009-02-17.
95         RT_CID_819x_Lenovo = 19,        
96         RT_CID_819x_QMI = 20,
97         RT_CID_819x_Edimax_Belkin = 21,         
98         RT_CID_819x_Sercomm_Belkin = 22,                        
99         RT_CID_819x_CAMEO1 = 23,
100         RT_CID_819x_MSI = 24,
101         RT_CID_819x_Acer = 25,
102         RT_CID_819x_AzWave_ASUS = 26,
103         RT_CID_819x_AzWave = 27, // For AzWave in PCIe, The ID is AzWave use and not only Asus
104         RT_CID_819x_HP = 28,
105         RT_CID_819x_WNC_COREGA = 29,
106         RT_CID_819x_Arcadyan_Belkin = 30,
107         RT_CID_819x_SAMSUNG = 31,
108         RT_CID_819x_CLEVO = 32,
109         RT_CID_819x_DELL = 33,
110         RT_CID_819x_PRONETS = 34,
111         RT_CID_819x_Edimax_ASUS = 35,
112         RT_CID_819x_CAMEO_NETGEAR = 36,
113         RT_CID_PLANEX = 37,
114         RT_CID_CC_C = 38,
115         RT_CID_819x_Xavi = 39,
116         RT_CID_819x_FUNAI_TV = 40,
117         RT_CID_819x_ALPHA_WD=41,
118 }RT_CUSTOMER_ID, *PRT_CUSTOMER_ID;
119
120 struct eeprom_priv 
121 {    
122         u8              bautoload_fail_flag;
123         u8              bloadfile_fail_flag;
124         u8              bloadmac_fail_flag;
125         //u8            bempty;
126         //u8            sys_config;
127         u8              mac_addr[6];    //PermanentAddress
128         //u8            config0;
129         u16             channel_plan;
130         //u8            country_string[3];      
131         //u8            tx_power_b[15];
132         //u8            tx_power_g[15];
133         //u8            tx_power_a[201];
134
135         u8              EepromOrEfuse;
136
137         u8              efuse_eeprom_data[HWSET_MAX_SIZE_512]; //92C:256bytes, 88E:512bytes, we use union set (512bytes)
138
139 #ifdef CONFIG_RF_GAIN_OFFSET
140         u8              EEPROMRFGainOffset;
141 #endif //CONFIG_RF_GAIN_OFFSET
142
143 #ifdef CONFIG_SDIO_HCI
144         u8              sdio_setting;   
145         u32             ocr;
146         u8              cis0[eeprom_cis0_sz];
147         u8              cis1[eeprom_cis1_sz];   
148 #endif
149 };
150
151
152 extern void eeprom_write16(_adapter *padapter, u16 reg, u16 data);
153 extern u16 eeprom_read16(_adapter *padapter, u16 reg);
154 extern void read_eeprom_content(_adapter *padapter);
155 extern void eeprom_read_sz(_adapter * padapter, u16 reg,u8* data, u32 sz); 
156
157 extern void read_eeprom_content_by_attrib(_adapter *    padapter        );
158
159 #ifdef PLATFORM_LINUX
160 #ifdef CONFIG_ADAPTOR_INFO_CACHING_FILE
161 extern int isAdaptorInfoFileValid(void);
162 extern int storeAdaptorInfoFile(char *path, struct eeprom_priv * eeprom_priv);
163 extern int retriveAdaptorInfoFile(char *path, struct eeprom_priv * eeprom_priv);
164 #endif //CONFIG_ADAPTOR_INFO_CACHING_FILE
165 #endif //PLATFORM_LINUX
166
167 #endif  //__RTL871X_EEPROM_H__
168