net: wireless: rockchip_wlan: add rtl8188eu support
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rtl8188eu / include / HalPwrSeqCmd.h
1 /******************************************************************************\r
2  *\r
3  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.\r
4  *\r
5  * This program is free software; you can redistribute it and/or modify it\r
6  * under the terms of version 2 of the GNU General Public License as\r
7  * published by the Free Software Foundation.\r
8  *\r
9  * This program is distributed in the hope that it will be useful, but WITHOUT\r
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
12  * more details.\r
13  *\r
14  * You should have received a copy of the GNU General Public License along with\r
15  * this program; if not, write to the Free Software Foundation, Inc.,\r
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA\r
17  *\r
18  *\r
19  ******************************************************************************/\r
20 #ifndef __HALPWRSEQCMD_H__\r
21 #define __HALPWRSEQCMD_H__\r
22 \r
23 #include <drv_types.h>\r
24 \r
25 /*---------------------------------------------*/\r
26 //3 The value of cmd: 4 bits\r
27 /*---------------------------------------------*/\r
28 #define PWR_CMD_READ                    0x00\r
29      // offset: the read register offset\r
30      // msk: the mask of the read value\r
31      // value: N/A, left by 0\r
32      // note: dirver shall implement this function by read & msk\r
33 \r
34 #define PWR_CMD_WRITE                   0x01\r
35      // offset: the read register offset\r
36      // msk: the mask of the write bits\r
37      // value: write value\r
38      // note: driver shall implement this cmd by read & msk after write\r
39 \r
40 #define PWR_CMD_POLLING                 0x02\r
41      // offset: the read register offset\r
42      // msk: the mask of the polled value\r
43      // value: the value to be polled, masked by the msd field.\r
44      // note: driver shall implement this cmd by\r
45      // do{\r
46      // if( (Read(offset) & msk) == (value & msk) )\r
47      // break;\r
48      // } while(not timeout);\r
49 \r
50 #define PWR_CMD_DELAY                   0x03\r
51      // offset: the value to delay\r
52      // msk: N/A\r
53      // value: the unit of delay, 0: us, 1: ms\r
54 \r
55 #define PWR_CMD_END                             0x04\r
56      // offset: N/A\r
57      // msk: N/A\r
58      // value: N/A\r
59 \r
60 /*---------------------------------------------*/\r
61 //3 The value of base: 4 bits\r
62 /*---------------------------------------------*/\r
63    // define the base address of each block\r
64 #define PWR_BASEADDR_MAC                0x00\r
65 #define PWR_BASEADDR_USB                0x01\r
66 #define PWR_BASEADDR_PCIE               0x02\r
67 #define PWR_BASEADDR_SDIO               0x03\r
68 \r
69 /*---------------------------------------------*/\r
70 //3 The value of interface_msk: 4 bits\r
71 /*---------------------------------------------*/\r
72 #define PWR_INTF_SDIO_MSK               BIT(0)\r
73 #define PWR_INTF_USB_MSK                BIT(1)\r
74 #define PWR_INTF_PCI_MSK                BIT(2)\r
75 #define PWR_INTF_ALL_MSK                (BIT(0)|BIT(1)|BIT(2)|BIT(3))\r
76 \r
77 /*---------------------------------------------*/\r
78 //3 The value of fab_msk: 4 bits\r
79 /*---------------------------------------------*/\r
80 #define PWR_FAB_TSMC_MSK                BIT(0)\r
81 #define PWR_FAB_UMC_MSK                 BIT(1)\r
82 #define PWR_FAB_ALL_MSK                 (BIT(0)|BIT(1)|BIT(2)|BIT(3))\r
83 \r
84 /*---------------------------------------------*/\r
85 //3 The value of cut_msk: 8 bits\r
86 /*---------------------------------------------*/\r
87 #define PWR_CUT_TESTCHIP_MSK    BIT(0)\r
88 #define PWR_CUT_A_MSK                   BIT(1)\r
89 #define PWR_CUT_B_MSK                   BIT(2)\r
90 #define PWR_CUT_C_MSK                   BIT(3)\r
91 #define PWR_CUT_D_MSK                   BIT(4)\r
92 #define PWR_CUT_E_MSK                   BIT(5)\r
93 #define PWR_CUT_F_MSK                   BIT(6)\r
94 #define PWR_CUT_G_MSK                   BIT(7)\r
95 #define PWR_CUT_ALL_MSK                 0xFF\r
96 \r
97 \r
98 typedef enum _PWRSEQ_CMD_DELAY_UNIT_\r
99 {\r
100         PWRSEQ_DELAY_US,\r
101         PWRSEQ_DELAY_MS,\r
102 } PWRSEQ_DELAY_UNIT;\r
103 \r
104 typedef struct _WL_PWR_CFG_\r
105 {\r
106         u16 offset;\r
107         u8 cut_msk;\r
108         u8 fab_msk:4;\r
109         u8 interface_msk:4;\r
110         u8 base:4;\r
111         u8 cmd:4;\r
112         u8 msk;\r
113         u8 value;\r
114 } WLAN_PWR_CFG, *PWLAN_PWR_CFG;\r
115 \r
116 \r
117 #define GET_PWR_CFG_OFFSET(__PWR_CMD)           __PWR_CMD.offset\r
118 #define GET_PWR_CFG_CUT_MASK(__PWR_CMD)         __PWR_CMD.cut_msk\r
119 #define GET_PWR_CFG_FAB_MASK(__PWR_CMD)         __PWR_CMD.fab_msk\r
120 #define GET_PWR_CFG_INTF_MASK(__PWR_CMD)        __PWR_CMD.interface_msk\r
121 #define GET_PWR_CFG_BASE(__PWR_CMD)                     __PWR_CMD.base\r
122 #define GET_PWR_CFG_CMD(__PWR_CMD)                      __PWR_CMD.cmd\r
123 #define GET_PWR_CFG_MASK(__PWR_CMD)                     __PWR_CMD.msk\r
124 #define GET_PWR_CFG_VALUE(__PWR_CMD)            __PWR_CMD.value\r
125 \r
126 \r
127 //================================================================================\r
128 //      Prototype of protected function.\r
129 //================================================================================\r
130 u8 HalPwrSeqCmdParsing(\r
131         PADAPTER                padapter,\r
132         u8                              CutVersion,\r
133         u8                              FabVersion,\r
134         u8                              InterfaceType,\r
135         WLAN_PWR_CFG    PwrCfgCmd[]);\r
136 \r
137 #endif\r
138 \r