xref: /linux/drivers/staging/rtl8723bs/include/rtw_eeprom.h (revision 8be98d2f2a0a262f8bf8a0bc1fdf522b3c7aab17)
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 
11 #define	RTL8712_EEPROM_ID			0x8712
12 /* define	EEPROM_MAX_SIZE			256 */
13 
14 #define	HWSET_MAX_SIZE_128		128
15 #define	HWSET_MAX_SIZE_256		256
16 #define	HWSET_MAX_SIZE_512		512
17 
18 #define	EEPROM_MAX_SIZE			HWSET_MAX_SIZE_512
19 
20 #define	CLOCK_RATE					50			/* 100us */
21 
22 /*  EEPROM opcodes */
23 #define EEPROM_READ_OPCODE		06
24 #define EEPROM_WRITE_OPCODE		05
25 #define EEPROM_ERASE_OPCODE		07
26 #define EEPROM_EWEN_OPCODE		19      /*  Erase/write enable */
27 #define EEPROM_EWDS_OPCODE		16      /*  Erase/write disable */
28 
29 /* Country codes */
30 #define USA							0x555320
31 #define EUROPE						0x1 /* temp, should be provided later */
32 #define JAPAN						0x2 /* temp, should be provided later */
33 
34 #define eeprom_cis0_sz	17
35 #define eeprom_cis1_sz	50
36 
37 /*  */
38 /*  Customer ID, note that: */
39 /*  This variable is initiailzed through EEPROM or registry, */
40 /*  however, its definition may be different with that in EEPROM for */
41 /*  EEPROM size consideration. So, we have to perform proper translation between them. */
42 /*  Besides, CustomerID of registry has precedence of that of EEPROM. */
43 /*  defined below. 060703, by rcnjko. */
44 /*  */
45 enum {
46 	RT_CID_DEFAULT = 0,
47 	RT_CID_8187_ALPHA0 = 1,
48 	RT_CID_8187_SERCOMM_PS = 2,
49 	RT_CID_8187_HW_LED = 3,
50 	RT_CID_8187_NETGEAR = 4,
51 	RT_CID_WHQL = 5,
52 	RT_CID_819x_CAMEO  = 6,
53 	RT_CID_819x_RUNTOP = 7,
54 	RT_CID_819x_Senao = 8,
55 	RT_CID_TOSHIBA = 9,	/*  Merge by Jacken, 2008/01/31. */
56 	RT_CID_819x_Netcore = 10,
57 	RT_CID_Nettronix = 11,
58 	RT_CID_DLINK = 12,
59 	RT_CID_PRONET = 13,
60 	RT_CID_COREGA = 14,
61 	RT_CID_CHINA_MOBILE = 15,
62 	RT_CID_819x_ALPHA = 16,
63 	RT_CID_819x_Sitecom = 17,
64 	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. */
65 	RT_CID_819x_Lenovo = 19,
66 	RT_CID_819x_QMI = 20,
67 	RT_CID_819x_Edimax_Belkin = 21,
68 	RT_CID_819x_Sercomm_Belkin = 22,
69 	RT_CID_819x_CAMEO1 = 23,
70 	RT_CID_819x_MSI = 24,
71 	RT_CID_819x_Acer = 25,
72 	RT_CID_819x_AzWave_ASUS = 26,
73 	RT_CID_819x_AzWave = 27, /*  For AzWave in PCIe, The ID is AzWave use and not only Asus */
74 	RT_CID_819x_HP = 28,
75 	RT_CID_819x_WNC_COREGA = 29,
76 	RT_CID_819x_Arcadyan_Belkin = 30,
77 	RT_CID_819x_SAMSUNG = 31,
78 	RT_CID_819x_CLEVO = 32,
79 	RT_CID_819x_DELL = 33,
80 	RT_CID_819x_PRONETS = 34,
81 	RT_CID_819x_Edimax_ASUS = 35,
82 	RT_CID_NETGEAR = 36,
83 	RT_CID_PLANEX = 37,
84 	RT_CID_CC_C = 38,
85 	RT_CID_819x_Xavi = 39,
86 	RT_CID_LENOVO_CHINA = 40,
87 	RT_CID_INTEL_CHINA = 41,
88 	RT_CID_TPLINK_HPWR = 42,
89 	RT_CID_819x_Sercomm_Netgear = 43,
90 	RT_CID_819x_ALPHA_Dlink = 44,/* add by ylb 20121012 for customer led for alpha */
91 	RT_CID_WNC_NEC = 45,/* add by page for NEC */
92 	RT_CID_DNI_BUFFALO = 46,/* add by page for NEC */
93 };
94 
95 struct eeprom_priv {
96 	u8 bautoload_fail_flag;
97 	u8 bloadfile_fail_flag;
98 	u8 bloadmac_fail_flag;
99 	u8 EepromOrEfuse;
100 
101 	u8 mac_addr[6];	/* PermanentAddress */
102 
103 	u16 	channel_plan;
104 	u16 	CustomerID;
105 
106 	u8 efuse_eeprom_data[EEPROM_MAX_SIZE]; /* 92C:256bytes, 88E:512bytes, we use union set (512bytes) */
107 	u8 adjuseVoltageVal;
108 
109 	u8 EEPROMRFGainOffset;
110 	u8 EEPROMRFGainVal;
111 
112 	u8 sdio_setting;
113 	u32 	ocr;
114 	u8 cis0[eeprom_cis0_sz];
115 	u8 cis1[eeprom_cis1_sz];
116 };
117 
118 #endif  /* __RTL871X_EEPROM_H__ */
119