xref: /freebsd/sys/dev/rtwn/usb/rtwn_usb_attach.h (revision 094fba962f20075e405a1fd78b9c2aaacfd07beb)
17453645fSAndriy Voskoboinyk /*	$OpenBSD: if_urtwn.c,v 1.16 2011/02/10 17:26:40 jakemsr Exp $	*/
27453645fSAndriy Voskoboinyk 
37453645fSAndriy Voskoboinyk /*-
47453645fSAndriy Voskoboinyk  * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
57453645fSAndriy Voskoboinyk  * Copyright (c) 2014 Kevin Lo <kevlo@FreeBSD.org>
67453645fSAndriy Voskoboinyk  * Copyright (c) 2015-2016 Andriy Voskoboinyk <avos@FreeBSD.org>
77453645fSAndriy Voskoboinyk  *
87453645fSAndriy Voskoboinyk  * Permission to use, copy, modify, and distribute this software for any
97453645fSAndriy Voskoboinyk  * purpose with or without fee is hereby granted, provided that the above
107453645fSAndriy Voskoboinyk  * copyright notice and this permission notice appear in all copies.
117453645fSAndriy Voskoboinyk  *
127453645fSAndriy Voskoboinyk  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
137453645fSAndriy Voskoboinyk  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
147453645fSAndriy Voskoboinyk  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
157453645fSAndriy Voskoboinyk  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
167453645fSAndriy Voskoboinyk  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
177453645fSAndriy Voskoboinyk  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
187453645fSAndriy Voskoboinyk  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
197453645fSAndriy Voskoboinyk  *
207453645fSAndriy Voskoboinyk  * $FreeBSD$
217453645fSAndriy Voskoboinyk  */
227453645fSAndriy Voskoboinyk 
237453645fSAndriy Voskoboinyk void	r92cu_attach(struct rtwn_usb_softc *);
247453645fSAndriy Voskoboinyk void	r88eu_attach(struct rtwn_usb_softc *);
257453645fSAndriy Voskoboinyk void	r12au_attach(struct rtwn_usb_softc *);
267453645fSAndriy Voskoboinyk void	r21au_attach(struct rtwn_usb_softc *);
277453645fSAndriy Voskoboinyk 
287453645fSAndriy Voskoboinyk enum {
297453645fSAndriy Voskoboinyk 	RTWN_CHIP_RTL8192CU,
307453645fSAndriy Voskoboinyk 	RTWN_CHIP_RTL8188EU,
317453645fSAndriy Voskoboinyk 	RTWN_CHIP_RTL8812AU,
327453645fSAndriy Voskoboinyk 	RTWN_CHIP_RTL8821AU,
337453645fSAndriy Voskoboinyk 	RTWN_CHIP_MAX_USB
347453645fSAndriy Voskoboinyk };
357453645fSAndriy Voskoboinyk 
367453645fSAndriy Voskoboinyk /* various supported device vendors/products */
377453645fSAndriy Voskoboinyk static const STRUCT_USB_HOST_ID rtwn_devs[] = {
387453645fSAndriy Voskoboinyk 	/* RTL8188CE-VAU/RTL8188CUS/RTL8188RU/RTL8192CU */
397453645fSAndriy Voskoboinyk #define RTWN_RTL8192CU_DEV(v,p) \
407453645fSAndriy Voskoboinyk 	{ USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, RTWN_CHIP_RTL8192CU) }
417453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(ABOCOM,		RTL8188CU_1),
427453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(ABOCOM,		RTL8188CU_2),
437453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(ABOCOM,		RTL8192CU),
447453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(ASUS,		RTL8192CU),
457453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(ASUS,		USBN10NANO),
467453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(AZUREWAVE,		RTL8188CE_1),
477453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(AZUREWAVE,		RTL8188CE_2),
487453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(AZUREWAVE,		RTL8188CU),
497453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(BELKIN,		F7D2102),
507453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(BELKIN,		RTL8188CU),
517453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(BELKIN,		RTL8192CU),
527453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(CHICONY,		RTL8188CUS_1),
537453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(CHICONY,		RTL8188CUS_2),
547453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(CHICONY,		RTL8188CUS_3),
557453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(CHICONY,		RTL8188CUS_4),
567453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(CHICONY,		RTL8188CUS_5),
577453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(COREGA,		RTL8192CU),
587453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(DLINK,		RTL8188CU),
597453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(DLINK,		RTL8192CU_1),
607453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(DLINK,		RTL8192CU_2),
617453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(DLINK,		RTL8192CU_3),
627453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(DLINK,		DWA131B),
637453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(EDIMAX,		EW7811UN),
647453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(EDIMAX,		RTL8192CU),
657453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(FEIXUN,		RTL8188CU),
667453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(FEIXUN,		RTL8192CU),
677453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(GUILLEMOT,		HWNUP150),
687453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(HAWKING,		RTL8192CU),
697453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(HP3,			RTL8188CU),
707453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(NETGEAR,		WNA1000M),
717453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(NETGEAR,		RTL8192CU),
727453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(NETGEAR4,		RTL8188CU),
737453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(NOVATECH,		RTL8188CU),
747453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(PLANEX2,		RTL8188CU_1),
757453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(PLANEX2,		RTL8188CU_2),
767453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(PLANEX2,		RTL8188CU_3),
777453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(PLANEX2,		RTL8188CU_4),
787453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(PLANEX2,		RTL8188CUS),
797453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(PLANEX2,		RTL8192CU),
807453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CE_0),
817453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CE_1),
827453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CTV),
837453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CU_0),
847453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CU_1),
857453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CU_2),
867453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CU_3),
877453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CU_COMBO),
887453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CUS),
897453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188RU_1),
907453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188RU_2),
917453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188RU_3),
927453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8191CU),
937453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8192CE),
947453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8192CU),
95*094fba96SKevin Lo 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8192CU_1),
967453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(SITECOMEU,		RTL8188CU_1),
977453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(SITECOMEU,		RTL8188CU_2),
987453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(SITECOMEU,		RTL8192CU),
997453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(TRENDNET,		RTL8188CU),
1007453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(TRENDNET,		RTL8192CU),
1017453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(ZYXEL,		RTL8192CU),
1027453645fSAndriy Voskoboinyk #undef RTWN_RTL8192CU_DEV
1037453645fSAndriy Voskoboinyk 
1047453645fSAndriy Voskoboinyk 	/* RTL8188EU */
1057453645fSAndriy Voskoboinyk #define RTWN_RTL8188EU_DEV(v,p) \
1067453645fSAndriy Voskoboinyk 	{ USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, RTWN_CHIP_RTL8188EU) }
1077453645fSAndriy Voskoboinyk 	RTWN_RTL8188EU_DEV(ABOCOM,		RTL8188EU),
1087453645fSAndriy Voskoboinyk 	RTWN_RTL8188EU_DEV(DLINK,		DWA123D1),
1097453645fSAndriy Voskoboinyk 	RTWN_RTL8188EU_DEV(DLINK,		DWA125D1),
1107453645fSAndriy Voskoboinyk 	RTWN_RTL8188EU_DEV(ELECOM,		WDC150SU2M),
1117453645fSAndriy Voskoboinyk 	RTWN_RTL8188EU_DEV(REALTEK,		RTL8188ETV),
1127453645fSAndriy Voskoboinyk 	RTWN_RTL8188EU_DEV(REALTEK,		RTL8188EU),
1137453645fSAndriy Voskoboinyk #undef RTWN_RTL8188EU_DEV
1147453645fSAndriy Voskoboinyk 
1157453645fSAndriy Voskoboinyk 	/* RTL8812AU */
1167453645fSAndriy Voskoboinyk #define RTWN_RTL8812AU_DEV(v,p) \
1177453645fSAndriy Voskoboinyk 	{ USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, RTWN_CHIP_RTL8812AU) }
1187453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(ASUS,		USBAC56),
1197453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(CISCOLINKSYS,	WUSB6300),
1207453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(DLINK,		DWA182C1),
1217453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(DLINK,		DWA180A1),
1227453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(EDIMAX,		EW7822UAC),
1237453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(IODATA,		WNAC867U),
1247453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(MELCO,		WIU3866D),
1257453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(NEC,			WL900U),
1267453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(PLANEX2,		GW900D),
1277453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(SENAO,		EUB1200AC),
1287453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(SITECOMEU,		WLA7100),
1297453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(TPLINK,		T4U),
1307453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(TRENDNET,		TEW805UB),
1317453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(ZYXEL,		NWD6605),
1327453645fSAndriy Voskoboinyk #undef RTWN_RTL8812AU_DEV
1337453645fSAndriy Voskoboinyk 
1347453645fSAndriy Voskoboinyk 	/* RTL8821AU */
1357453645fSAndriy Voskoboinyk #define RTWN_RTL8821AU_DEV(v,p) \
1367453645fSAndriy Voskoboinyk 	{ USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, RTWN_CHIP_RTL8821AU) }
1377453645fSAndriy Voskoboinyk 	RTWN_RTL8821AU_DEV(DLINK,		DWA171A1),
1387453645fSAndriy Voskoboinyk 	RTWN_RTL8821AU_DEV(DLINK,		DWA172A1),
1397453645fSAndriy Voskoboinyk 	RTWN_RTL8821AU_DEV(EDIMAX,		EW7811UTC_1),
1407453645fSAndriy Voskoboinyk 	RTWN_RTL8821AU_DEV(EDIMAX,		EW7811UTC_2),
1417453645fSAndriy Voskoboinyk 	RTWN_RTL8821AU_DEV(HAWKING,		HD65U),
1427453645fSAndriy Voskoboinyk 	RTWN_RTL8821AU_DEV(MELCO,		WIU2433DM),
1437453645fSAndriy Voskoboinyk 	RTWN_RTL8821AU_DEV(NETGEAR,		A6100)
1447453645fSAndriy Voskoboinyk #undef RTWN_RTL8821AU_DEV
1457453645fSAndriy Voskoboinyk };
1467453645fSAndriy Voskoboinyk 
1477453645fSAndriy Voskoboinyk typedef void	(*chip_usb_attach)(struct rtwn_usb_softc *);
1487453645fSAndriy Voskoboinyk 
1497453645fSAndriy Voskoboinyk static const chip_usb_attach rtwn_chip_usb_attach[RTWN_CHIP_MAX_USB] = {
1507453645fSAndriy Voskoboinyk 	[RTWN_CHIP_RTL8192CU] = r92cu_attach,
1517453645fSAndriy Voskoboinyk 	[RTWN_CHIP_RTL8188EU] = r88eu_attach,
1527453645fSAndriy Voskoboinyk 	[RTWN_CHIP_RTL8812AU] = r12au_attach,
1537453645fSAndriy Voskoboinyk 	[RTWN_CHIP_RTL8821AU] = r21au_attach
1547453645fSAndriy Voskoboinyk };
1557453645fSAndriy Voskoboinyk 
1567453645fSAndriy Voskoboinyk static __inline void
1577453645fSAndriy Voskoboinyk rtwn_usb_attach_private(struct rtwn_usb_softc *uc, int chip)
1587453645fSAndriy Voskoboinyk {
1597453645fSAndriy Voskoboinyk 	rtwn_chip_usb_attach[chip](uc);
1607453645fSAndriy Voskoboinyk }
161