1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3  *
4  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
5  *
6  ******************************************************************************/
7 #ifndef __HAL_VERSION_DEF_H__
8 #define __HAL_VERSION_DEF_H__
9 
10 /*  hal_ic_type_e */
11 enum hal_ic_type_e { /* tag_HAL_IC_Type_Definition */
12 	CHIP_8723B	=	8,
13 };
14 
15 /* hal_chip_type_e */
16 enum hal_chip_type_e { /* tag_HAL_CHIP_Type_Definition */
17 	TEST_CHIP		=	0,
18 	NORMAL_CHIP	=	1,
19 	FPGA			=	2,
20 };
21 
22 /* hal_cut_version_e */
23 enum hal_cut_version_e { /* tag_HAL_Cut_Version_Definition */
24 	A_CUT_VERSION		=	0,
25 	B_CUT_VERSION		=	1,
26 	C_CUT_VERSION		=	2,
27 	D_CUT_VERSION		=	3,
28 	E_CUT_VERSION		=	4,
29 	F_CUT_VERSION		=	5,
30 	G_CUT_VERSION		=	6,
31 	H_CUT_VERSION		=	7,
32 	I_CUT_VERSION		=	8,
33 	J_CUT_VERSION		=	9,
34 	K_CUT_VERSION		=	10,
35 };
36 
37 /*  HAL_Manufacturer */
38 enum hal_vendor_e { /* tag_HAL_Manufacturer_Version_Definition */
39 	CHIP_VENDOR_TSMC	=	0,
40 	CHIP_VENDOR_UMC		=	1,
41 	CHIP_VENDOR_SMIC	=	2,
42 };
43 
44 struct hal_version { /* tag_HAL_VERSION */
45 	enum hal_ic_type_e		ICType;
46 	enum hal_chip_type_e		ChipType;
47 	enum hal_cut_version_e	CUTVersion;
48 	enum hal_vendor_e		VendorType;
49 	u8 			ROMVer;
50 };
51 
52 /* hal_version			VersionID; */
53 
54 /*  Get element */
55 #define GET_CVID_IC_TYPE(version)			((enum hal_ic_type_e)((version).ICType))
56 #define GET_CVID_CHIP_TYPE(version)			((enum hal_chip_type_e)((version).ChipType))
57 #define GET_CVID_MANUFACTUER(version)		((enum hal_vendor_e)((version).VendorType))
58 #define GET_CVID_CUT_VERSION(version)		((enum hal_cut_version_e)((version).CUTVersion))
59 #define GET_CVID_ROM_VERSION(version)		(((version).ROMVer) & ROM_VERSION_MASK)
60 
61 /*  */
62 /* Common Macro. -- */
63 /*  */
64 /* hal_version VersionID */
65 
66 /* hal_chip_type_e */
67 #define IS_TEST_CHIP(version)			((GET_CVID_CHIP_TYPE(version) == TEST_CHIP) ? true : false)
68 #define IS_NORMAL_CHIP(version)			((GET_CVID_CHIP_TYPE(version) == NORMAL_CHIP) ? true : false)
69 
70 /* hal_cut_version_e */
71 #define IS_A_CUT(version)				((GET_CVID_CUT_VERSION(version) == A_CUT_VERSION) ? true : false)
72 #define IS_B_CUT(version)				((GET_CVID_CUT_VERSION(version) == B_CUT_VERSION) ? true : false)
73 #define IS_C_CUT(version)				((GET_CVID_CUT_VERSION(version) == C_CUT_VERSION) ? true : false)
74 #define IS_D_CUT(version)				((GET_CVID_CUT_VERSION(version) == D_CUT_VERSION) ? true : false)
75 #define IS_E_CUT(version)				((GET_CVID_CUT_VERSION(version) == E_CUT_VERSION) ? true : false)
76 #define IS_I_CUT(version)				((GET_CVID_CUT_VERSION(version) == I_CUT_VERSION) ? true : false)
77 #define IS_J_CUT(version)				((GET_CVID_CUT_VERSION(version) == J_CUT_VERSION) ? true : false)
78 #define IS_K_CUT(version)				((GET_CVID_CUT_VERSION(version) == K_CUT_VERSION) ? true : false)
79 
80 /* hal_vendor_e */
81 #define IS_CHIP_VENDOR_TSMC(version)	((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_TSMC) ? true : false)
82 #define IS_CHIP_VENDOR_UMC(version)	((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_UMC) ? true : false)
83 #define IS_CHIP_VENDOR_SMIC(version)	((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_SMIC) ? true : false)
84 
85 #endif
86