add rk3288 pinctrl dts code
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rtl8192cu / include / rtl8192d_cmd.h
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 __RTL8192D_CMD_H_
21 #define __RTL8192D_CMD_H_
22
23
24 //--------------------------------------------
25 //3                             Host Message Box 
26 //--------------------------------------------
27
28 // User Define Message [31:8]
29
30 //_SETPWRMODE_PARM
31 #define SET_H2CCMD_PWRMODE_PARM_MODE(__pH2CCmd, __Value)                        SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 8, __Value)
32 #define SET_H2CCMD_PWRMODE_PARM_SMART_PS(__pH2CCmd, __Value)            SET_BITS_TO_LE_1BYTE((__pH2CCmd)+1, 0, 8, __Value)
33 #define SET_H2CCMD_PWRMODE_PARM_BCN_PASS_TIME(__pH2CCmd, __Value)       SET_BITS_TO_LE_1BYTE((__pH2CCmd)+2, 0, 8, __Value)
34
35 //JOINBSSRPT_PARM
36 #define SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(__pH2CCmd, __Value)           SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 8, __Value)
37
38 //_RSVDPAGE_LOC
39 #define SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(__pH2CCmd, __Value)           SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 8, __Value)
40 #define SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(__pH2CCmd, __Value)                      SET_BITS_TO_LE_1BYTE((__pH2CCmd)+1, 0, 8, __Value)
41 #define SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(__pH2CCmd, __Value)           SET_BITS_TO_LE_1BYTE((__pH2CCmd)+2, 0, 8, __Value)
42
43 //P2P_PS_OFFLOAD
44
45 struct P2P_PS_Offload_t {
46  unsigned char Offload_En:1;
47  unsigned char role:1; // 1: Owner, 0: Client
48  unsigned char CTWindow_En:1;
49  unsigned char NoA0_En:1;
50  unsigned char NoA1_En:1;
51  unsigned char AllStaSleep:1; // Only valid in Owner
52  unsigned char discovery:1;
53  unsigned char rsvd:1;
54 };
55
56 #define SET_H2CCMD_P2P_PS_OFFLOAD_EN(__pH2CCmd, __Value)                SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 1, __Value)
57 #define SET_H2CCMD_P2P_PS_OFFLOAD_ROLE(__pH2CCmd, __Value)              SET_BITS_TO_LE_1BYTE(__pH2CCmd, 1, 1, __Value)
58 #define SET_H2CCMD_P2P_PS_OFFLOAD_CTW(__pH2CCmd, __Value)               SET_BITS_TO_LE_1BYTE(__pH2CCmd, 2, 1, __Value)
59 #define SET_H2CCMD_P2P_PS_OFFLOAD_NOA0(__pH2CCmd, __Value)              SET_BITS_TO_LE_1BYTE(__pH2CCmd, 3, 1, __Value)
60 #define SET_H2CCMD_P2P_PS_OFFLOAD_NOA1(__pH2CCmd, __Value)              SET_BITS_TO_LE_1BYTE(__pH2CCmd, 4, 1, __Value)
61 #define SET_H2CCMD_P2P_PS_OFFLOAD_ALLSTASLEEP(__pH2CCmd, __Value)               SET_BITS_TO_LE_1BYTE(__pH2CCmd, 5, 1, __Value)
62 #define SET_H2CCMD_P2P_PS_OFFLOAD_DISCOVERY(__pH2CCmd, __Value)         SET_BITS_TO_LE_1BYTE(__pH2CCmd, 6, 1, __Value)
63
64 // Description: Determine the types of H2C commands that are the same in driver and Fw.
65 // Fisrt constructed by tynli. 2009.10.09.
66 typedef enum _RTL8192D_H2C_CMD 
67 {
68         H2C_AP_OFFLOAD = 0,             /*0*/
69         H2C_SETPWRMODE = 1,             /*1*/
70         H2C_JOINBSSRPT = 2,             /*2*/
71         H2C_RSVDPAGE = 3,
72         H2C_RSSI_REPORT = 5,
73         H2C_RA_MASK = 6,
74         H2C_P2P_PS_OFFLOAD = 8,
75         H2C_MAC_MODE_SEL = 9,
76         H2C_PWRM=15,
77 #ifdef CONFIG_WOWLAN
78         H2C_WO_WLAN_CMD = 20,   // Wake on Wlan.
79 #endif // CONFIG_WOWLAN
80         H2C_P2P_PS_CTW_CMD = 24,
81         H2C_PathDiv = 26,                  //PathDiv--NeilChen--2011.07.15
82 #ifdef CONFIG_WOWLAN
83         KEEP_ALIVE_CONTROL_CMD=31, //keep alive for wake on wlan
84         DISCONNECT_DECISION_CTRL_CMD=32,
85         REMOTE_WAKE_CTRL_CMD=34,
86 #endif // CONFIG_WOWLAN
87         H2C_92D_TSF_SYNC=36,
88         H2C_92D_RESET_TSF = 43,
89         H2C_CMD_MAX
90 }RTL8192D_H2C_CMD;
91
92 struct cmd_msg_parm {
93         u8 eid; //element id
94         u8 sz; // sz
95         u8 buf[6];
96 };
97
98
99 void    FillH2CCmd92D(_adapter* padapter, u8 ElementID, u32 CmdLen, u8* pCmdBuffer);
100
101 // host message to firmware cmd
102 void    rtl8192d_set_FwPwrMode_cmd(_adapter*padapter, u8 Mode);
103 void    rtl8192d_set_FwJoinBssReport_cmd(_adapter* padapter, u8 mstatus);
104 u8      rtl8192d_set_rssi_cmd(_adapter*padapter, u8 *param);
105 u8      rtl8192d_set_raid_cmd(_adapter*padapter, u32 mask, u8 arg);
106 void    rtl8192d_Add_RateATid(PADAPTER pAdapter, u32 bitmap, u8 arg);
107 #ifdef CONFIG_P2P
108 void    rtl8192d_set_p2p_ps_offload_cmd(_adapter* padapter, u8 p2p_ps_state);
109 #endif //CONFIG_P2P
110
111 #ifdef CONFIG_TSF_RESET_OFFLOAD
112 int reset_tsf(PADAPTER Adapter, u8 reset_port );
113 #endif  // CONFIG_TSF_RESET_OFFLOAD
114
115 #ifdef CONFIG_WOWLAN
116 typedef struct _SETWOWLAN_PARM{
117         u8      mode;
118         u8      gpio_index;
119         u8      gpio_duration;  
120         u8  second_mode;
121         u8  reserve;
122 }SETWOWLAN_PARM, *PSETWOWLAN_PARM;
123
124 #define FW_WOWLAN_FUN_EN                        BIT(0)
125 #define FW_WOWLAN_PATTERN_MATCH         BIT(1)
126 #define FW_WOWLAN_MAGIC_PKT                     BIT(2)
127 #define FW_WOWLAN_UNICAST                       BIT(3)
128 #define FW_WOWLAN_ALL_PKT_DROP          BIT(4)
129 #define FW_WOWLAN_GPIO_ACTIVE           BIT(5)
130 #define FW_WOWLAN_REKEY_WAKEUP          BIT(6)
131 #define FW_WOWLAN_DEAUTH_WAKEUP         BIT(7)
132
133 #define FW_WOWLAN_GPIO_WAKEUP_EN        BIT(0)
134 #define FW_FW_PARSE_MAGIC_PKT           BIT(1)
135
136 void rtl8192d_set_wowlan_cmd(_adapter* padapter);
137 void SetFwRelatedForWoWLAN8192DU(_adapter*      padapter,u8 bHostIsGoingtoSleep);
138 #endif // CONFIG_WOWLAN
139
140 #endif  // __RTL8192D_CMD_H_
141
142