ARM64: DTS: Add rk3399-firefly uart4 device, node as /dev/ttyS1
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rtl8723bs / 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
24 #define RTL8712_EEPROM_ID                       0x8712
25 //#define       EEPROM_MAX_SIZE                 256
26
27 #define HWSET_MAX_SIZE_128              128
28 #define HWSET_MAX_SIZE_256              256
29 #define HWSET_MAX_SIZE_512              512
30
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 //
53 // Customer ID, note that: 
54 // This variable is initiailzed through EEPROM or registry, 
55 // however, its definition may be different with that in EEPROM for 
56 // EEPROM size consideration. So, we have to perform proper translation between them.
57 // Besides, CustomerID of registry has precedence of that of EEPROM.
58 // defined below. 060703, by rcnjko.
59 //
60 typedef enum _RT_CUSTOMER_ID
61 {
62         RT_CID_DEFAULT = 0,
63         RT_CID_8187_ALPHA0 = 1,
64         RT_CID_8187_SERCOMM_PS = 2,
65         RT_CID_8187_HW_LED = 3,
66         RT_CID_8187_NETGEAR = 4,
67         RT_CID_WHQL = 5,
68         RT_CID_819x_CAMEO  = 6,
69         RT_CID_819x_RUNTOP = 7,
70         RT_CID_819x_Senao = 8,
71         RT_CID_TOSHIBA = 9,     // Merge by Jacken, 2008/01/31.
72         RT_CID_819x_Netcore = 10,
73         RT_CID_Nettronix = 11,
74         RT_CID_DLINK = 12,
75         RT_CID_PRONET = 13,
76         RT_CID_COREGA = 14,
77         RT_CID_CHINA_MOBILE = 15,
78         RT_CID_819x_ALPHA = 16,
79         RT_CID_819x_Sitecom = 17,
80         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.
81         RT_CID_819x_Lenovo = 19,
82         RT_CID_819x_QMI = 20,
83         RT_CID_819x_Edimax_Belkin = 21,
84         RT_CID_819x_Sercomm_Belkin = 22,
85         RT_CID_819x_CAMEO1 = 23,
86         RT_CID_819x_MSI = 24,
87         RT_CID_819x_Acer = 25,
88         RT_CID_819x_AzWave_ASUS = 26,
89         RT_CID_819x_AzWave = 27, // For AzWave in PCIe, The ID is AzWave use and not only Asus
90         RT_CID_819x_HP = 28,
91         RT_CID_819x_WNC_COREGA = 29,
92         RT_CID_819x_Arcadyan_Belkin = 30,
93         RT_CID_819x_SAMSUNG = 31,
94         RT_CID_819x_CLEVO = 32,
95         RT_CID_819x_DELL = 33,
96         RT_CID_819x_PRONETS = 34,
97         RT_CID_819x_Edimax_ASUS = 35,
98         RT_CID_NETGEAR = 36,
99         RT_CID_PLANEX = 37,
100         RT_CID_CC_C = 38,
101         RT_CID_819x_Xavi = 39,
102         RT_CID_LENOVO_CHINA = 40,
103         RT_CID_INTEL_CHINA = 41,
104         RT_CID_TPLINK_HPWR = 42,
105         RT_CID_819x_Sercomm_Netgear = 43,
106         RT_CID_819x_ALPHA_Dlink = 44,//add by ylb 20121012 for customer led for alpha
107         RT_CID_WNC_NEC = 45,//add by page for NEC
108         RT_CID_DNI_BUFFALO = 46,//add by page for NEC
109 }RT_CUSTOMER_ID, *PRT_CUSTOMER_ID;
110
111 struct eeprom_priv 
112 {    
113         u8              bautoload_fail_flag;
114         u8              bloadfile_fail_flag;
115         u8              bloadmac_fail_flag;
116         u8              EepromOrEfuse;
117
118         u8              mac_addr[6];    //PermanentAddress
119
120         u16             channel_plan;
121         u16             CustomerID;
122
123         u8              efuse_eeprom_data[EEPROM_MAX_SIZE]; //92C:256bytes, 88E:512bytes, we use union set (512bytes)
124         u8              adjuseVoltageVal;
125
126 #ifdef CONFIG_RF_GAIN_OFFSET
127         u8              EEPROMRFGainOffset;
128         u8              EEPROMRFGainVal;
129 #endif //CONFIG_RF_GAIN_OFFSET
130
131 #ifdef CONFIG_SDIO_HCI
132         u8              sdio_setting;   
133         u32             ocr;
134         u8              cis0[eeprom_cis0_sz];
135         u8              cis1[eeprom_cis1_sz];   
136 #endif
137 };
138
139
140 extern void eeprom_write16(_adapter *padapter, u16 reg, u16 data);
141 extern u16 eeprom_read16(_adapter *padapter, u16 reg);
142 extern void read_eeprom_content(_adapter *padapter);
143 extern void eeprom_read_sz(_adapter * padapter, u16 reg,u8* data, u32 sz); 
144
145 extern void read_eeprom_content_by_attrib(_adapter *    padapter        );
146
147 #ifdef PLATFORM_LINUX
148 #ifdef CONFIG_ADAPTOR_INFO_CACHING_FILE
149 extern int isAdaptorInfoFileValid(void);
150 extern int storeAdaptorInfoFile(char *path, struct eeprom_priv * eeprom_priv);
151 extern int retriveAdaptorInfoFile(char *path, struct eeprom_priv * eeprom_priv);
152 #endif //CONFIG_ADAPTOR_INFO_CACHING_FILE
153 #endif //PLATFORM_LINUX
154
155 #endif  //__RTL871X_EEPROM_H__
156