• 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  * 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 __HAL_VERSION_DEF_H__
21 #define __HAL_VERSION_DEF_H__
22 
23 enum HAL_IC_TYPE {
24 	CHIP_8192S	=	0,
25 	CHIP_8188C	=	1,
26 	CHIP_8192C	=	2,
27 	CHIP_8192D	=	3,
28 	CHIP_8723A	=	4,
29 	CHIP_8188E	=	5,
30 	CHIP_8881A	=	6,
31 	CHIP_8812A	=	7,
32 	CHIP_8821A	=	8,
33 	CHIP_8723B	=	9,
34 	CHIP_8192E	=	10,
35 };
36 
37 enum HAL_CHIP_TYPE {
38 	TEST_CHIP	=	0,
39 	NORMAL_CHIP	=	1,
40 	FPGA		=	2,
41 };
42 
43 enum HAL_CUT_VERSION {
44 	A_CUT_VERSION	=	0,
45 	B_CUT_VERSION	=	1,
46 	C_CUT_VERSION	=	2,
47 	D_CUT_VERSION	=	3,
48 	E_CUT_VERSION	=	4,
49 	F_CUT_VERSION	=	5,
50 	G_CUT_VERSION	=	6,
51 };
52 
53 enum HAL_VENDOR {
54 	CHIP_VENDOR_TSMC	=	0,
55 	CHIP_VENDOR_UMC		=	1,
56 };
57 
58 enum HAL_RF_TYPE {
59 	RF_TYPE_1T1R	=	0,
60 	RF_TYPE_1T2R	=	1,
61 	RF_TYPE_2T2R	=	2,
62 	RF_TYPE_2T3R	=	3,
63 	RF_TYPE_2T4R	=	4,
64 	RF_TYPE_3T3R	=	5,
65 	RF_TYPE_3T4R	=	6,
66 	RF_TYPE_4T4R	=	7,
67 };
68 
69 struct HAL_VERSION {
70 	enum HAL_IC_TYPE	ICType;
71 	enum HAL_CHIP_TYPE	ChipType;
72 	enum HAL_CUT_VERSION	CUTVersion;
73 	enum HAL_VENDOR		VendorType;
74 	enum HAL_RF_TYPE	RFType;
75 	u8			ROMVer;
76 };
77 
78 /*  Get element */
79 #define GET_CVID_IC_TYPE(version)	(((version).ICType))
80 #define GET_CVID_CHIP_TYPE(version)	(((version).ChipType))
81 #define GET_CVID_RF_TYPE(version)	(((version).RFType))
82 #define GET_CVID_MANUFACTUER(version)	(((version).VendorType))
83 #define GET_CVID_CUT_VERSION(version)	(((version).CUTVersion))
84 #define GET_CVID_ROM_VERSION(version)	(((version).ROMVer) & ROM_VERSION_MASK)
85 
86 /* Common Macro. -- */
87 /* HAL_VERSION VersionID */
88 
89 /*  HAL_IC_TYPE_E */
90 #define IS_81XXC(version)				\
91 	(((GET_CVID_IC_TYPE(version) == CHIP_8192C) ||	\
92 	 (GET_CVID_IC_TYPE(version) == CHIP_8188C)) ? true : false)
93 #define IS_8723_SERIES(version)				\
94 	((GET_CVID_IC_TYPE(version) == CHIP_8723A) ? true : false)
95 #define IS_92D(version)					\
96 	((GET_CVID_IC_TYPE(version) == CHIP_8192D) ? true : false)
97 #define IS_8188E(version)				\
98 	((GET_CVID_IC_TYPE(version) == CHIP_8188E) ? true : false)
99 
100 /* HAL_CHIP_TYPE_E */
101 #define IS_TEST_CHIP(version)				\
102 	((GET_CVID_CHIP_TYPE(version) == TEST_CHIP) ? true : false)
103 #define IS_NORMAL_CHIP(version)				\
104 	((GET_CVID_CHIP_TYPE(version) == NORMAL_CHIP) ? true : false)
105 
106 /* HAL_CUT_VERSION_E */
107 #define IS_A_CUT(version)				\
108 	((GET_CVID_CUT_VERSION(version) == A_CUT_VERSION) ? true : false)
109 #define IS_B_CUT(version)				\
110 	((GET_CVID_CUT_VERSION(version) == B_CUT_VERSION) ? true : false)
111 #define IS_C_CUT(version)				\
112 	((GET_CVID_CUT_VERSION(version) == C_CUT_VERSION) ? true : false)
113 #define IS_D_CUT(version)				\
114 	((GET_CVID_CUT_VERSION(version) == D_CUT_VERSION) ? true : false)
115 #define IS_E_CUT(version)				\
116 	((GET_CVID_CUT_VERSION(version) == E_CUT_VERSION) ? true : false)
117 
118 
119 /* HAL_VENDOR_E */
120 #define IS_CHIP_VENDOR_TSMC(version)			\
121 	((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_TSMC) ? true : false)
122 #define IS_CHIP_VENDOR_UMC(version)			\
123 	((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_UMC) ? true : false)
124 
125 /* HAL_RF_TYPE_E */
126 #define IS_1T1R(version)				\
127 	((GET_CVID_RF_TYPE(version) == RF_TYPE_1T1R) ? true : false)
128 #define IS_1T2R(version)				\
129 	((GET_CVID_RF_TYPE(version) == RF_TYPE_1T2R) ? true : false)
130 #define IS_2T2R(version)				\
131 	((GET_CVID_RF_TYPE(version) == RF_TYPE_2T2R) ? true : false)
132 
133 /* Chip version Macro. -- */
134 #define IS_81XXC_TEST_CHIP(version)			\
135 	((IS_81XXC(version) && (!IS_NORMAL_CHIP(version))) ? true : false)
136 
137 #define IS_92C_SERIAL(version)				\
138 	((IS_81XXC(version) && IS_2T2R(version)) ? true : false)
139 #define IS_81xxC_VENDOR_UMC_A_CUT(version)		\
140 	(IS_81XXC(version) ? (IS_CHIP_VENDOR_UMC(version) ?	\
141 	(IS_A_CUT(version) ? true : false) : false) : false)
142 #define IS_81xxC_VENDOR_UMC_B_CUT(version)		\
143 	(IS_81XXC(version) ? (IS_CHIP_VENDOR_UMC(version) ?	\
144 	(IS_B_CUT(version) ? true : false) : false) : false)
145 #define IS_81xxC_VENDOR_UMC_C_CUT(version)		\
146 	(IS_81XXC(version) ? (IS_CHIP_VENDOR_UMC(version) ? \
147 	 (IS_C_CUT(version) ? true : false) : false) : false)
148 
149 #define IS_NORMAL_CHIP92D(version)			\
150 	((IS_92D(version)) ?				\
151 	((GET_CVID_CHIP_TYPE(version) == NORMAL_CHIP) ? true : false) : false)
152 
153 #define IS_92D_SINGLEPHY(version)			\
154 	((IS_92D(version)) ? (IS_2T2R(version) ? true : false) : false)
155 #define IS_92D_C_CUT(version)				\
156 	((IS_92D(version)) ? (IS_C_CUT(version) ? true : false) : false)
157 #define IS_92D_D_CUT(version)				\
158 	((IS_92D(version)) ? (IS_D_CUT(version) ? true : false) : false)
159 #define IS_92D_E_CUT(version)				\
160 	((IS_92D(version)) ? (IS_E_CUT(version) ? true : false) : false)
161 
162 #define IS_8723A_A_CUT(version)				\
163 	((IS_8723_SERIES(version)) ? (IS_A_CUT(version) ? true : false) : false)
164 #define IS_8723A_B_CUT(version)				\
165 	((IS_8723_SERIES(version)) ? (IS_B_CUT(version) ? true : false) : false)
166 
167 #endif
168