1 /******************************************************************************
3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
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.
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
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
19 ******************************************************************************/
24 #define REALTEK_USB_VENQT_READ 0xC0
25 #define REALTEK_USB_VENQT_WRITE 0x40
26 #define REALTEK_USB_VENQT_CMD_REQ 0x05
27 #define REALTEK_USB_VENQT_CMD_IDX 0x00
28 #define REALTEK_USB_IN_INT_EP_IDX 1
34 #define ALIGNMENT_UNIT 16
35 #define MAX_VENDOR_REQ_CMD_SIZE 254 /* 8188cu SIE Support */
36 #define MAX_USB_IO_CTL_SIZE (MAX_VENDOR_REQ_CMD_SIZE + ALIGNMENT_UNIT)
39 #include <usb_ops_linux.h>
40 #endif /* PLATFORM_LINUX */
42 #ifdef CONFIG_RTL8188E
43 void rtl8188eu_set_hw_type(struct dvobj_priv *pdvobj);
44 #ifdef CONFIG_SUPPORT_USB_INT
45 void interrupt_handler_8188eu(_adapter *padapter, u16 pkt_len, u8 *pbuf);
49 #if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A)
50 void rtl8812au_set_hw_type(struct dvobj_priv *pdvobj);
51 #ifdef CONFIG_SUPPORT_USB_INT
52 void interrupt_handler_8812au(_adapter *padapter, u16 pkt_len, u8 *pbuf);
56 #ifdef CONFIG_RTL8814A
57 void rtl8814au_set_hw_type(struct dvobj_priv *pdvobj);
58 #ifdef CONFIG_SUPPORT_USB_INT
59 void interrupt_handler_8814au(_adapter *padapter, u16 pkt_len, u8 *pbuf);
61 #endif /* CONFIG_RTL8814 */
63 #ifdef CONFIG_RTL8192E
64 void rtl8192eu_set_hw_type(struct dvobj_priv *pdvobj);
65 #ifdef CONFIG_SUPPORT_USB_INT
66 void interrupt_handler_8192eu(_adapter *padapter, u16 pkt_len, u8 *pbuf);
71 #ifdef CONFIG_RTL8188F
72 void rtl8188fu_set_hw_type(struct dvobj_priv *pdvobj);
73 #ifdef CONFIG_SUPPORT_USB_INT
74 void interrupt_handler_8188fu(_adapter *padapter, u16 pkt_len, u8 *pbuf);
78 #ifdef CONFIG_RTL8723B
79 void rtl8723bu_set_hw_type(struct dvobj_priv *pdvobj);
80 #ifdef CONFIG_SUPPORT_USB_INT
81 void interrupt_handler_8723bu(_adapter *padapter, u16 pkt_len, u8 *pbuf);
85 #ifdef CONFIG_RTL8703B
86 void rtl8703bu_set_hw_type(struct dvobj_priv *pdvobj);
87 #ifdef CONFIG_SUPPORT_USB_INT
88 void interrupt_handler_8703bu(_adapter *padapter, u16 pkt_len, u8 *pbuf);
89 #endif /* CONFIG_SUPPORT_USB_INT */
90 #endif /* CONFIG_RTL8703B */
92 void usb_set_intf_ops(_adapter *padapter, struct _io_ops *pops);
94 #ifdef CONFIG_RTL8723D
95 void rtl8723du_set_hw_type(struct dvobj_priv *pdvobj);
96 void rtl8723du_set_intf_ops(struct _io_ops *pops);
97 void rtl8723du_recv_tasklet(void *priv);
98 void rtl8723du_xmit_tasklet(void *priv);
99 #ifdef CONFIG_SUPPORT_USB_INT
100 void interrupt_handler_8723du(_adapter *padapter, u16 pkt_len, u8 *pbuf);
101 #endif /* CONFIG_SUPPORT_USB_INT */
102 #endif /* CONFIG_RTL8723D */
105 RTW_USB_SPEED_UNKNOWN = 0,
106 RTW_USB_SPEED_1_1 = 1,
111 #define IS_FULL_SPEED_USB(Adapter) (adapter_to_dvobj(Adapter)->usb_speed == RTW_USB_SPEED_1_1)
112 #define IS_HIGH_SPEED_USB(Adapter) (adapter_to_dvobj(Adapter)->usb_speed == RTW_USB_SPEED_2)
113 #define IS_SUPER_SPEED_USB(Adapter) (adapter_to_dvobj(Adapter)->usb_speed == RTW_USB_SPEED_3)
115 #define USB_SUPER_SPEED_BULK_SIZE 1024 /* usb 3.0 */
116 #define USB_HIGH_SPEED_BULK_SIZE 512 /* usb 2.0 */
117 #define USB_FULL_SPEED_BULK_SIZE 64 /* usb 1.1 */
119 static inline u8 rtw_usb_bulk_size_boundary(_adapter *padapter, int buf_len)
123 if (IS_SUPER_SPEED_USB(padapter))
124 rst = (0 == (buf_len) % USB_SUPER_SPEED_BULK_SIZE) ? _TRUE : _FALSE;
125 if (IS_HIGH_SPEED_USB(padapter))
126 rst = (0 == (buf_len) % USB_HIGH_SPEED_BULK_SIZE) ? _TRUE : _FALSE;
128 rst = (0 == (buf_len) % USB_FULL_SPEED_BULK_SIZE) ? _TRUE : _FALSE;
133 #endif /* __USB_OPS_H_ */