• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  ******************************************************************************/
15 #ifndef __RTW_EEPROM_H__
16 #define __RTW_EEPROM_H__
17 
18 #include <osdep_service.h>
19 #include <drv_types.h>
20 
21 #define	RTL8712_EEPROM_ID			0x8712
22 /* define	EEPROM_MAX_SIZE			256 */
23 
24 #define	HWSET_MAX_SIZE_512		512
25 #define	EEPROM_MAX_SIZE			HWSET_MAX_SIZE_512
26 
27 #define	CLOCK_RATE					50			/* 100us */
28 
29 /*  EEPROM opcodes */
30 #define EEPROM_READ_OPCODE		06
31 #define EEPROM_WRITE_OPCODE		05
32 #define EEPROM_ERASE_OPCODE		07
33 #define EEPROM_EWEN_OPCODE		19      /*  Erase/write enable */
34 #define EEPROM_EWDS_OPCODE		16      /*  Erase/write disable */
35 
36 /* Country codes */
37 #define USA							0x555320
38 #define EUROPE						0x1 /* temp, should be provided later */
39 #define JAPAN						0x2 /* temp, should be provided later */
40 
41 #define	EEPROM_CID_DEFAULT			0x0
42 #define	EEPROM_CID_ALPHA				0x1
43 #define	EEPROM_CID_Senao				0x3
44 #define	EEPROM_CID_NetCore				0x5
45 #define	EEPROM_CID_CAMEO				0X8
46 #define	EEPROM_CID_SITECOM				0x9
47 #define	EEPROM_CID_COREGA				0xB
48 #define	EEPROM_CID_EDIMAX_BELKIN		0xC
49 #define	EEPROM_CID_SERCOMM_BELKIN		0xE
50 #define	EEPROM_CID_CAMEO1				0xF
51 #define	EEPROM_CID_WNC_COREGA		0x12
52 #define	EEPROM_CID_CLEVO				0x13
53 #define	EEPROM_CID_WHQL				0xFE /*  added by chiyoko for dtm, 20090108 */
54 
55 /*  */
56 /*  Customer ID, note that: */
57 /*  This variable is initiailzed through EEPROM or registry, */
58 /*  however, its definition may be different with that in EEPROM for */
59 /*  EEPROM size consideration. So, we have to perform proper translation between them. */
60 /*  Besides, CustomerID of registry has precedence of that of EEPROM. */
61 /*  defined below. 060703, by rcnjko. */
62 /*  */
63 enum rt_customer_id
64 {
65 	RT_CID_DEFAULT = 0,
66 	RT_CID_8187_ALPHA0 = 1,
67 	RT_CID_8187_SERCOMM_PS = 2,
68 	RT_CID_8187_HW_LED = 3,
69 	RT_CID_8187_NETGEAR = 4,
70 	RT_CID_WHQL = 5,
71 	RT_CID_819x_CAMEO  = 6,
72 	RT_CID_819x_RUNTOP = 7,
73 	RT_CID_819x_Senao = 8,
74 	RT_CID_TOSHIBA = 9,	/*  Merge by Jacken, 2008/01/31. */
75 	RT_CID_819x_Netcore = 10,
76 	RT_CID_Nettronix = 11,
77 	RT_CID_DLINK = 12,
78 	RT_CID_PRONET = 13,
79 	RT_CID_COREGA = 14,
80 	RT_CID_CHINA_MOBILE = 15,
81 	RT_CID_819x_ALPHA = 16,
82 	RT_CID_819x_Sitecom = 17,
83 	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. */
84 	RT_CID_819x_Lenovo = 19,
85 	RT_CID_819x_QMI = 20,
86 	RT_CID_819x_Edimax_Belkin = 21,
87 	RT_CID_819x_Sercomm_Belkin = 22,
88 	RT_CID_819x_CAMEO1 = 23,
89 	RT_CID_819x_MSI = 24,
90 	RT_CID_819x_Acer = 25,
91 	RT_CID_819x_AzWave_ASUS = 26,
92 	RT_CID_819x_AzWave = 27, /*  For AzWave in PCIe, The ID is AzWave use and not only Asus */
93 	RT_CID_819x_HP = 28,
94 	RT_CID_819x_WNC_COREGA = 29,
95 	RT_CID_819x_Arcadyan_Belkin = 30,
96 	RT_CID_819x_SAMSUNG = 31,
97 	RT_CID_819x_CLEVO = 32,
98 	RT_CID_819x_DELL = 33,
99 	RT_CID_819x_PRONETS = 34,
100 	RT_CID_819x_Edimax_ASUS = 35,
101 	RT_CID_819x_CAMEO_NETGEAR = 36,
102 	RT_CID_PLANEX = 37,
103 	RT_CID_CC_C = 38,
104 	RT_CID_819x_Xavi = 39,
105 	RT_CID_819x_FUNAI_TV = 40,
106 	RT_CID_819x_ALPHA_WD=41,
107 };
108 
109 struct eeprom_priv {
110 	u8		mac_addr[6];	/* PermanentAddress */
111 	u8		bautoload_fail_flag;
112 	u8		bloadfile_fail_flag;
113 	u8		bloadmac_fail_flag;
114 	/* u8		bempty; */
115 	/* u8		sys_config; */
116 	/* u8		config0; */
117 	u16		channel_plan;
118 	/* u8		country_string[3]; */
119 	/* u8		tx_power_b[15]; */
120 	/* u8		tx_power_g[15]; */
121 	/* u8		tx_power_a[201]; */
122 
123 	u8		EepromOrEfuse;
124 
125 	u8		efuse_eeprom_data[HWSET_MAX_SIZE_512]; /* 92C:256bytes, 88E:512bytes, we use union set (512bytes) */
126 };
127 
128 void eeprom_write16(struct rtw_adapter *padapter, u16 reg, u16 data);
129 u16 eeprom_read16(struct rtw_adapter *padapter, u16 reg);
130 void read_eeprom_content(struct rtw_adapter *padapter);
131 void eeprom_read_sz(struct rtw_adapter *padapter, u16 reg, u8 *data, u32 sz);
132 
133 void read_eeprom_content_by_attrib(struct rtw_adapter *padapter);
134 
135 #endif  /* __RTL871X_EEPROM_H__ */
136