xref: /freebsd/sys/dev/rtwn/usb/rtwn_usb_attach.h (revision 924226fba12cc9a228c73b956e1b7fa24c60b055)
1 /*	$OpenBSD: if_urtwn.c,v 1.16 2011/02/10 17:26:40 jakemsr Exp $	*/
2 
3 /*-
4  * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
5  * Copyright (c) 2014 Kevin Lo <kevlo@FreeBSD.org>
6  * Copyright (c) 2015-2016 Andriy Voskoboinyk <avos@FreeBSD.org>
7  *
8  * Permission to use, copy, modify, and distribute this software for any
9  * purpose with or without fee is hereby granted, provided that the above
10  * copyright notice and this permission notice appear in all copies.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19  *
20  * $FreeBSD$
21  */
22 
23 void	r92cu_attach(struct rtwn_usb_softc *);
24 void	r92eu_attach(struct rtwn_usb_softc *);
25 void	r88eu_attach(struct rtwn_usb_softc *);
26 void	r12au_attach(struct rtwn_usb_softc *);
27 void	r21au_attach(struct rtwn_usb_softc *);
28 
29 enum {
30 	RTWN_CHIP_RTL8192CU,
31 	RTWN_CHIP_RTL8192EU,
32 	RTWN_CHIP_RTL8188EU,
33 	RTWN_CHIP_RTL8812AU,
34 	RTWN_CHIP_RTL8821AU,
35 	RTWN_CHIP_MAX_USB
36 };
37 
38 /* various supported device vendors/products */
39 static const STRUCT_USB_HOST_ID rtwn_devs[] = {
40 	/* RTL8188CE-VAU/RTL8188CUS/RTL8188RU/RTL8192CU */
41 #define RTWN_RTL8192CU_DEV(v,p) \
42 	{ USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, RTWN_CHIP_RTL8192CU) }
43 	RTWN_RTL8192CU_DEV(ABOCOM,		RTL8188CU_1),
44 	RTWN_RTL8192CU_DEV(ABOCOM,		RTL8188CU_2),
45 	RTWN_RTL8192CU_DEV(ABOCOM,		RTL8192CU),
46 	RTWN_RTL8192CU_DEV(ASUS,		RTL8192CU),
47 	RTWN_RTL8192CU_DEV(ASUS,		USBN10NANO),
48 	RTWN_RTL8192CU_DEV(AZUREWAVE,		RTL8188CE_1),
49 	RTWN_RTL8192CU_DEV(AZUREWAVE,		RTL8188CE_2),
50 	RTWN_RTL8192CU_DEV(AZUREWAVE,		RTL8188CU),
51 	RTWN_RTL8192CU_DEV(BELKIN,		F7D2102),
52 	RTWN_RTL8192CU_DEV(BELKIN,		F9L1004V1),
53 	RTWN_RTL8192CU_DEV(BELKIN,		RTL8188CU),
54 	RTWN_RTL8192CU_DEV(BELKIN,		RTL8192CU),
55 	RTWN_RTL8192CU_DEV(CHICONY,		RTL8188CUS_1),
56 	RTWN_RTL8192CU_DEV(CHICONY,		RTL8188CUS_2),
57 	RTWN_RTL8192CU_DEV(CHICONY,		RTL8188CUS_3),
58 	RTWN_RTL8192CU_DEV(CHICONY,		RTL8188CUS_4),
59 	RTWN_RTL8192CU_DEV(CHICONY,		RTL8188CUS_5),
60 	RTWN_RTL8192CU_DEV(COREGA,		RTL8192CU),
61 	RTWN_RTL8192CU_DEV(DLINK,		RTL8188CU),
62 	RTWN_RTL8192CU_DEV(DLINK,		RTL8192CU_1),
63 	RTWN_RTL8192CU_DEV(DLINK,		RTL8192CU_2),
64 	RTWN_RTL8192CU_DEV(DLINK,		RTL8192CU_3),
65 	RTWN_RTL8192CU_DEV(DLINK,		DWA131B),
66 	RTWN_RTL8192CU_DEV(EDIMAX,		EW7811UN),
67 	RTWN_RTL8192CU_DEV(EDIMAX,		RTL8192CU),
68 	RTWN_RTL8192CU_DEV(FEIXUN,		RTL8188CU),
69 	RTWN_RTL8192CU_DEV(FEIXUN,		RTL8192CU),
70 	RTWN_RTL8192CU_DEV(GUILLEMOT,		HWNUP150),
71 	RTWN_RTL8192CU_DEV(HAWKING,		RTL8192CU),
72 	RTWN_RTL8192CU_DEV(HP3,			RTL8188CU),
73 	RTWN_RTL8192CU_DEV(NETGEAR,		WNA1000M),
74 	RTWN_RTL8192CU_DEV(NETGEAR,		RTL8192CU),
75 	RTWN_RTL8192CU_DEV(NETGEAR4,		RTL8188CU),
76 	RTWN_RTL8192CU_DEV(NOVATECH,		RTL8188CU),
77 	RTWN_RTL8192CU_DEV(PLANEX2,		RTL8188CU_1),
78 	RTWN_RTL8192CU_DEV(PLANEX2,		RTL8188CU_2),
79 	RTWN_RTL8192CU_DEV(PLANEX2,		RTL8188CU_3),
80 	RTWN_RTL8192CU_DEV(PLANEX2,		RTL8188CU_4),
81 	RTWN_RTL8192CU_DEV(PLANEX2,		RTL8188CUS),
82 	RTWN_RTL8192CU_DEV(PLANEX2,		RTL8192CU),
83 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CE_0),
84 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CE_1),
85 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CTV),
86 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CU_0),
87 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CU_1),
88 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CU_2),
89 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CU_3),
90 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CU_COMBO),
91 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CUS),
92 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188RU_1),
93 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188RU_2),
94 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188RU_3),
95 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8191CU),
96 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8192CE),
97 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8192CU),
98 	RTWN_RTL8192CU_DEV(SITECOMEU,		RTL8188CU_1),
99 	RTWN_RTL8192CU_DEV(SITECOMEU,		RTL8188CU_2),
100 	RTWN_RTL8192CU_DEV(SITECOMEU,		RTL8192CU),
101 	RTWN_RTL8192CU_DEV(TRENDNET,		RTL8188CU),
102 	RTWN_RTL8192CU_DEV(TRENDNET,		RTL8192CU),
103 	RTWN_RTL8192CU_DEV(ZYXEL,		RTL8192CU),
104 #undef RTWN_RTL8192CU_DEV
105 
106 	/* RTL8192EU */
107 #define RTWN_RTL8192EU_DEV(v,p) \
108 	{ USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, RTWN_CHIP_RTL8192EU) }
109 	RTWN_RTL8192EU_DEV(DLINK,		DWA131E1),
110 	RTWN_RTL8192EU_DEV(REALTEK,		RTL8192EU),
111 	RTWN_RTL8192EU_DEV(TPLINK,		WN821NV5),
112 	RTWN_RTL8192EU_DEV(TPLINK,		WN822NV4),
113 	RTWN_RTL8192EU_DEV(TPLINK,		WN823NV2),
114 #undef RTWN_RTL8192EU_DEV
115 
116 	/* RTL8188EU */
117 #define RTWN_RTL8188EU_DEV(v,p) \
118 	{ USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, RTWN_CHIP_RTL8188EU) }
119 	RTWN_RTL8188EU_DEV(ABOCOM,		RTL8188EU),
120 	RTWN_RTL8188EU_DEV(ASUS,		USBN10NANOB1),
121 	RTWN_RTL8188EU_DEV(DLINK,		DWA123D1),
122 	RTWN_RTL8188EU_DEV(DLINK,		DWA125D1),
123 	RTWN_RTL8188EU_DEV(EDIMAX,		EW7811UN_V2),
124 	RTWN_RTL8188EU_DEV(ELECOM,		WDC150SU2M),
125 	RTWN_RTL8188EU_DEV(TPLINK,		WN722NV2),
126 	RTWN_RTL8188EU_DEV(TPLINK,		WN727NV5),
127 	RTWN_RTL8188EU_DEV(REALTEK,		RTL8188ETV),
128 	RTWN_RTL8188EU_DEV(REALTEK,		RTL8188EU),
129 	RTWN_RTL8188EU_DEV(MERCUSYS,		MW150US),
130 #undef RTWN_RTL8188EU_DEV
131 
132 	/* RTL8812AU */
133 #define RTWN_RTL8812AU_DEV(v,p) \
134 	{ USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, RTWN_CHIP_RTL8812AU) }
135 	RTWN_RTL8812AU_DEV(ASUS,		USBAC56),
136 	RTWN_RTL8812AU_DEV(CISCOLINKSYS,	WUSB6300),
137 	RTWN_RTL8812AU_DEV(DLINK,		DWA182C1),
138 	RTWN_RTL8812AU_DEV(DLINK,		DWA180A1),
139 	RTWN_RTL8812AU_DEV(EDIMAX,		EW7822UAC),
140 	RTWN_RTL8812AU_DEV(IODATA,		WNAC867U),
141 	RTWN_RTL8812AU_DEV(MELCO,		WIU3866D),
142 	RTWN_RTL8812AU_DEV(NEC,			WL900U),
143 	RTWN_RTL8812AU_DEV(PLANEX2,		GW900D),
144 	RTWN_RTL8812AU_DEV(REALTEK,		RTL8812AU_1),
145 	RTWN_RTL8812AU_DEV(REALTEK,		RTL8812AU_2),
146 	RTWN_RTL8812AU_DEV(SENAO,		EUB1200AC),
147 	RTWN_RTL8812AU_DEV(SITECOMEU,		WLA7100),
148 	RTWN_RTL8812AU_DEV(TENDA2,		U12),
149 	RTWN_RTL8812AU_DEV(TPLINK,		T4U),
150 	RTWN_RTL8812AU_DEV(TPLINK,		T4UV2),
151 	RTWN_RTL8812AU_DEV(TPLINK,		T4UHV1),
152 	RTWN_RTL8812AU_DEV(TPLINK,		T4UHV2),
153 	RTWN_RTL8812AU_DEV(TRENDNET,		TEW805UB),
154 	RTWN_RTL8812AU_DEV(ZYXEL,		NWD6605),
155 #undef RTWN_RTL8812AU_DEV
156 
157 	/* RTL8821AU */
158 #define RTWN_RTL8821AU_DEV(v,p) \
159 	{ USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, RTWN_CHIP_RTL8821AU) }
160 	RTWN_RTL8821AU_DEV(DLINK,		DWA171A1),
161 	RTWN_RTL8821AU_DEV(DLINK,		DWA172A1),
162 	RTWN_RTL8821AU_DEV(EDIMAX,		EW7811UTC_1),
163 	RTWN_RTL8821AU_DEV(EDIMAX,		EW7811UTC_2),
164 	RTWN_RTL8821AU_DEV(ELECOM,		WDB433SU2M2),
165 	RTWN_RTL8821AU_DEV(HAWKING,		HD65U),
166 	RTWN_RTL8821AU_DEV(MELCO,		WIU2433DM),
167 	RTWN_RTL8821AU_DEV(MELCO,		WIU2433DHP),
168 	RTWN_RTL8821AU_DEV(NETGEAR,		A6100),
169 	RTWN_RTL8821AU_DEV(REALTEK,		RTL8821AU_1),
170 	RTWN_RTL8821AU_DEV(REALTEK,		RTL8821AU_2),
171 	RTWN_RTL8821AU_DEV(TPLINK,		T2UNANO),
172 	RTWN_RTL8821AU_DEV(TPLINK,		T2UPLUS),
173 	RTWN_RTL8821AU_DEV(TPLINK,		T2UV3),
174 #undef RTWN_RTL8821AU_DEV
175 };
176 
177 typedef void	(*chip_usb_attach)(struct rtwn_usb_softc *);
178 
179 static const chip_usb_attach rtwn_chip_usb_attach[RTWN_CHIP_MAX_USB] = {
180 	[RTWN_CHIP_RTL8192CU] = r92cu_attach,
181 	[RTWN_CHIP_RTL8192EU] = r92eu_attach,
182 	[RTWN_CHIP_RTL8188EU] = r88eu_attach,
183 	[RTWN_CHIP_RTL8812AU] = r12au_attach,
184 	[RTWN_CHIP_RTL8821AU] = r21au_attach
185 };
186 
187 static __inline void
188 rtwn_usb_attach_private(struct rtwn_usb_softc *uc, int chip)
189 {
190 	rtwn_chip_usb_attach[chip](uc);
191 }
192