WiFi: add rtl8189es/etv support, Optimization wifi configuration.
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rtl8189es / include / rtw_iol.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 __RTW_IOL_H_\r
21 #define __RTW_IOL_H_\r
22 \r
23 \r
24 struct xmit_frame       *rtw_IOL_accquire_xmit_frame(ADAPTER *adapter);\r
25 int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds, u32 cmd_len);\r
26 int rtw_IOL_append_LLT_cmd(struct xmit_frame *xmit_frame, u8 page_boundary);\r
27 int rtw_IOL_exec_cmds_sync(ADAPTER *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt);\r
28 bool rtw_IOL_applied(ADAPTER *adapter);\r
29 int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us);\r
30 int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms);\r
31 int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame);\r
32 \r
33 \r
34 #ifdef CONFIG_IOL_NEW_GENERATION\r
35 #define IOREG_CMD_END_LEN       4\r
36 \r
37 struct ioreg_cfg{\r
38         u8      length;\r
39         u8      cmd_id;\r
40         u16     address;\r
41         u32     data;\r
42         u32  mask;\r
43 };\r
44 enum ioreg_cmd{\r
45         IOREG_CMD_LLT                   = 0x01,\r
46         IOREG_CMD_REFUSE                = 0x02,\r
47         IOREG_CMD_EFUSE_PATH = 0x03,\r
48         IOREG_CMD_WB_REG                = 0x04,\r
49         IOREG_CMD_WW_REG        = 0x05,\r
50         IOREG_CMD_WD_REG        = 0x06,\r
51         IOREG_CMD_W_RF          = 0x07,\r
52         IOREG_CMD_DELAY_US      = 0x10,\r
53         IOREG_CMD_DELAY_MS      = 0x11,\r
54         IOREG_CMD_END           = 0xFF,         \r
55 };\r
56 void read_efuse_from_txpktbuf(ADAPTER *adapter, int bcnhead, u8 *content, u16 *size);\r
57 \r
58 int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, u8 mask);\r
59 int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, u16 mask);\r
60 int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, u32 mask);\r
61 int _rtw_IOL_append_WRF_cmd(struct xmit_frame *xmit_frame, u8 rf_path, u16 addr, u32 value, u32 mask);\r
62 #define rtw_IOL_append_WB_cmd(xmit_frame, addr, value,mask) _rtw_IOL_append_WB_cmd((xmit_frame), (addr), (value) ,(mask))\r
63 #define rtw_IOL_append_WW_cmd(xmit_frame, addr, value,mask) _rtw_IOL_append_WW_cmd((xmit_frame), (addr), (value),(mask))\r
64 #define rtw_IOL_append_WD_cmd(xmit_frame, addr, value,mask) _rtw_IOL_append_WD_cmd((xmit_frame), (addr), (value),(mask))\r
65 #define rtw_IOL_append_WRF_cmd(xmit_frame, rf_path, addr, value,mask) _rtw_IOL_append_WRF_cmd((xmit_frame),(rf_path), (addr), (value),(mask))\r
66 \r
67 u8 rtw_IOL_cmd_boundary_handle(struct xmit_frame *pxmit_frame);\r
68 void  rtw_IOL_cmd_buf_dump(ADAPTER *Adapter,int buf_len,u8 *pbuf);\r
69 \r
70 #ifdef CONFIG_IOL_IOREG_CFG_DBG\r
71         struct cmd_cmp{\r
72                 u16 addr;\r
73                 u32 value;\r
74         };\r
75 #endif\r
76 \r
77 #else //CONFIG_IOL_NEW_GENERATION\r
78 \r
79 typedef struct _io_offload_cmd {\r
80         u8 rsvd0;\r
81         u8 cmd;\r
82         u16 address;\r
83         u32 value;\r
84 } IO_OFFLOAD_CMD, IOL_CMD;\r
85 \r
86 #define IOL_CMD_LLT                     0x00\r
87 //#define IOL_CMD_R_EFUSE       0x01\r
88 #define IOL_CMD_WB_REG          0x02\r
89 #define IOL_CMD_WW_REG  0x03\r
90 #define IOL_CMD_WD_REG          0x04\r
91 //#define IOL_CMD_W_RF          0x05\r
92 #define IOL_CMD_DELAY_US        0x80\r
93 #define IOL_CMD_DELAY_MS        0x81\r
94 //#define IOL_CMD_DELAY_S       0x82\r
95 #define IOL_CMD_END                     0x83\r
96 \r
97 /*****************************************************\r
98 CMD                                     Address                 Value\r
99 (B1)                                    (B2/B3:H/L addr)        (B4:B7 : MSB:LSB)\r
100 ******************************************************\r
101 IOL_CMD_LLT                     -                               B7: PGBNDY\r
102 //IOL_CMD_R_EFUSE       -                               -\r
103 IOL_CMD_WB_REG          0x0~0xFFFF              B7\r
104 IOL_CMD_WW_REG  0x0~0xFFFF              B6~B7\r
105 IOL_CMD_WD_REG  0x0~0xFFFF              B4~B7\r
106 //IOL_CMD_W_RF          RF Reg                  B5~B7\r
107 IOL_CMD_DELAY_US        -                               B6~B7\r
108 IOL_CMD_DELAY_MS        -                               B6~B7\r
109 //IOL_CMD_DELAY_S       -                               B6~B7\r
110 IOL_CMD_END             -                               -\r
111 ******************************************************/\r
112 int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value);\r
113 int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value);\r
114 int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value);\r
115 \r
116 \r
117 int rtw_IOL_exec_cmd_array_sync(PADAPTER adapter, u8 *IOL_cmds, u32 cmd_num, u32 max_wating_ms);\r
118 int rtw_IOL_exec_empty_cmds_sync(ADAPTER *adapter, u32 max_wating_ms);\r
119 \r
120 #ifdef DBG_IO\r
121 int dbg_rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, const char *caller, const int line);\r
122 int dbg_rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, const char *caller, const int line);\r
123 int dbg_rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, const char *caller, const int line);\r
124 #define rtw_IOL_append_WB_cmd(xmit_frame, addr, value) dbg_rtw_IOL_append_WB_cmd((xmit_frame), (addr), (value), __FUNCTION__, __LINE__)\r
125 #define rtw_IOL_append_WW_cmd(xmit_frame, addr, value) dbg_rtw_IOL_append_WW_cmd((xmit_frame), (addr), (value), __FUNCTION__, __LINE__)\r
126 #define rtw_IOL_append_WD_cmd(xmit_frame, addr, value) dbg_rtw_IOL_append_WD_cmd((xmit_frame), (addr), (value), __FUNCTION__, __LINE__)\r
127 #else\r
128 #define rtw_IOL_append_WB_cmd(xmit_frame, addr, value) _rtw_IOL_append_WB_cmd((xmit_frame), (addr), (value))\r
129 #define rtw_IOL_append_WW_cmd(xmit_frame, addr, value) _rtw_IOL_append_WW_cmd((xmit_frame), (addr), (value))\r
130 #define rtw_IOL_append_WD_cmd(xmit_frame, addr, value) _rtw_IOL_append_WD_cmd((xmit_frame), (addr), (value))\r
131 #endif // DBG_IO\r
132 #endif // CONFIG_IOL_NEW_GENERATION\r
133 \r
134 \r
135 \r
136 #endif //__RTW_IOL_H_\r
137 \r