1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3  *
4  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
5  *
6  ******************************************************************************/
7 #ifndef __RTW_EEPROM_H__
8 #define __RTW_EEPROM_H__
9 
10 #include <osdep_service.h>
11 #include <drv_types.h>
12 
13 #define	RTL8712_EEPROM_ID		0x8712
14 
15 #define	HWSET_MAX_SIZE_512		512
16 #define	EEPROM_MAX_SIZE			HWSET_MAX_SIZE_512
17 
18 #define	CLOCK_RATE			50	/* 100us */
19 
20 /*  EEPROM opcodes */
21 #define EEPROM_READ_OPCODE		06
22 #define EEPROM_WRITE_OPCODE		05
23 #define EEPROM_ERASE_OPCODE		07
24 #define EEPROM_EWEN_OPCODE		19      /*  Erase/write enable */
25 #define EEPROM_EWDS_OPCODE		16      /*  Erase/write disable */
26 
27 /* Country codes */
28 #define USA				0x555320
29 #define EUROPE				0x1 /* temp, should be provided later */
30 #define JAPAN				0x2 /* temp, should be provided later */
31 
32 #define	EEPROM_CID_DEFAULT		0x0
33 #define	EEPROM_CID_ALPHA		0x1
34 #define	EEPROM_CID_Senao		0x3
35 #define	EEPROM_CID_NetCore		0x5
36 #define	EEPROM_CID_CAMEO		0X8
37 #define	EEPROM_CID_SITECOM		0x9
38 #define	EEPROM_CID_COREGA		0xB
39 #define	EEPROM_CID_EDIMAX_BELK		0xC
40 #define	EEPROM_CID_SERCOMM_BELK		0xE
41 #define	EEPROM_CID_CAMEO1		0xF
42 #define	EEPROM_CID_WNC_COREGA		0x12
43 #define	EEPROM_CID_CLEVO		0x13
44 #define	EEPROM_CID_WHQL			0xFE
45 
46 /*  Customer ID, note that: */
47 /*  This variable is initiailzed through EEPROM or registry, */
48 /*  however, its definition may be different with that in EEPROM for */
49 /*  EEPROM size consideration. So, we have to perform proper translation
50  *  between them.
51  */
52 /*  Besides, CustomerID of registry has precedence of that of EEPROM. */
53 /*  defined below. 060703, by rcnjko. */
54 enum RT_CUSTOMER_ID {
55 	RT_CID_DEFAULT = 0,
56 	RT_CID_8187_ALPHA0 = 1,
57 	RT_CID_8187_SERCOMM_PS = 2,
58 	RT_CID_8187_HW_LED = 3,
59 	RT_CID_8187_NETGEAR = 4,
60 	RT_CID_WHQL = 5,
61 	RT_CID_819x_CAMEO  = 6,
62 	RT_CID_819x_RUNTOP = 7,
63 	RT_CID_819x_Senao = 8,
64 	RT_CID_TOSHIBA = 9,	/*  Merge by Jacken, 2008/01/31. */
65 	RT_CID_819x_Netcore = 10,
66 	RT_CID_Nettronix = 11,
67 	RT_CID_DLINK = 12,
68 	RT_CID_PRONET = 13,
69 	RT_CID_COREGA = 14,
70 	RT_CID_CHINA_MOBILE = 15,
71 	RT_CID_819x_ALPHA = 16,
72 	RT_CID_819x_Sitecom = 17,
73 	RT_CID_CCX = 18, /*  It's set under CCX logo test and isn't demanded
74 			  * for CCX functions, but for test behavior like retry
75 			  * limit and tx report. By Bruce, 2009-02-17.
76 			  */
77 	RT_CID_819x_Lenovo = 19,
78 	RT_CID_819x_QMI = 20,
79 	RT_CID_819x_Edimax_Belkin = 21,
80 	RT_CID_819x_Sercomm_Belkin = 22,
81 	RT_CID_819x_CAMEO1 = 23,
82 	RT_CID_819x_MSI = 24,
83 	RT_CID_819x_Acer = 25,
84 	RT_CID_819x_AzWave_ASUS = 26,
85 	RT_CID_819x_AzWave = 27, /*  For AzWave in PCIe,i
86 				  * The ID is AzWave use and not only Asus
87 				  */
88 	RT_CID_819x_HP = 28,
89 	RT_CID_819x_WNC_COREGA = 29,
90 	RT_CID_819x_Arcadyan_Belkin = 30,
91 	RT_CID_819x_SAMSUNG = 31,
92 	RT_CID_819x_CLEVO = 32,
93 	RT_CID_819x_DELL = 33,
94 	RT_CID_819x_PRONETS = 34,
95 	RT_CID_819x_Edimax_ASUS = 35,
96 	RT_CID_819x_CAMEO_NETGEAR = 36,
97 	RT_CID_PLANEX = 37,
98 	RT_CID_CC_C = 38,
99 	RT_CID_819x_Xavi = 39,
100 	RT_CID_819x_FUNAI_TV = 40,
101 	RT_CID_819x_ALPHA_WD = 41,
102 };
103 
104 struct eeprom_priv {
105 	u8		bautoload_fail_flag;
106 	u8		bloadfile_fail_flag;
107 	u8		bloadmac_fail_flag;
108 	u8		mac_addr[6];	/* PermanentAddress */
109 	u16		channel_plan;
110 	u8		EepromOrEfuse;
111 	u8		efuse_eeprom_data[HWSET_MAX_SIZE_512];
112 };
113 
114 #endif  /* __RTL871X_EEPROM_H__ */
115