xref: /freebsd/sys/dev/rtwn/usb/rtwn_usb_attach.h (revision 7dfaf238562cfb9b8f2fe9a025220fd7147fedfe)
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 
217453645fSAndriy Voskoboinyk void	r92cu_attach(struct rtwn_usb_softc *);
2260b9567dSKevin Lo void	r92eu_attach(struct rtwn_usb_softc *);
237453645fSAndriy Voskoboinyk void	r88eu_attach(struct rtwn_usb_softc *);
247453645fSAndriy Voskoboinyk void	r12au_attach(struct rtwn_usb_softc *);
257453645fSAndriy Voskoboinyk void	r21au_attach(struct rtwn_usb_softc *);
267453645fSAndriy Voskoboinyk 
277453645fSAndriy Voskoboinyk enum {
287453645fSAndriy Voskoboinyk 	RTWN_CHIP_RTL8192CU,
2960b9567dSKevin Lo 	RTWN_CHIP_RTL8192EU,
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),
50f4d7179aSMark Johnston 	RTWN_RTL8192CU_DEV(BELKIN,		F9L1004V1),
517453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(BELKIN,		RTL8188CU),
527453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(BELKIN,		RTL8192CU),
537453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(CHICONY,		RTL8188CUS_1),
547453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(CHICONY,		RTL8188CUS_2),
557453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(CHICONY,		RTL8188CUS_3),
567453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(CHICONY,		RTL8188CUS_4),
577453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(CHICONY,		RTL8188CUS_5),
587453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(COREGA,		RTL8192CU),
597453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(DLINK,		RTL8188CU),
607453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(DLINK,		RTL8192CU_1),
617453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(DLINK,		RTL8192CU_2),
627453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(DLINK,		RTL8192CU_3),
637453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(DLINK,		DWA131B),
647453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(EDIMAX,		EW7811UN),
657453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(EDIMAX,		RTL8192CU),
667453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(FEIXUN,		RTL8188CU),
677453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(FEIXUN,		RTL8192CU),
687453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(GUILLEMOT,		HWNUP150),
697453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(HAWKING,		RTL8192CU),
707453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(HP3,			RTL8188CU),
717453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(NETGEAR,		WNA1000M),
727453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(NETGEAR,		RTL8192CU),
737453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(NETGEAR4,		RTL8188CU),
747453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(NOVATECH,		RTL8188CU),
757453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(PLANEX2,		RTL8188CU_1),
767453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(PLANEX2,		RTL8188CU_2),
777453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(PLANEX2,		RTL8188CU_3),
787453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(PLANEX2,		RTL8188CU_4),
797453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(PLANEX2,		RTL8188CUS),
807453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(PLANEX2,		RTL8192CU),
817453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CE_0),
827453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CE_1),
837453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CTV),
847453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CU_0),
857453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CU_1),
867453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CU_2),
877453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CU_3),
887453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CU_COMBO),
897453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188CUS),
907453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188RU_1),
917453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188RU_2),
927453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8188RU_3),
937453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8191CU),
947453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8192CE),
957453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(REALTEK,		RTL8192CU),
967453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(SITECOMEU,		RTL8188CU_1),
977453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(SITECOMEU,		RTL8188CU_2),
987453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(SITECOMEU,		RTL8192CU),
99*7dfaf238SAugustin Cavalier 	RTWN_RTL8192CU_DEV(TPLINK,		RTL8192CU),
1007453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(TRENDNET,		RTL8188CU),
1017453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(TRENDNET,		RTL8192CU),
1027453645fSAndriy Voskoboinyk 	RTWN_RTL8192CU_DEV(ZYXEL,		RTL8192CU),
1037453645fSAndriy Voskoboinyk #undef RTWN_RTL8192CU_DEV
1047453645fSAndriy Voskoboinyk 
10560b9567dSKevin Lo 	/* RTL8192EU */
10660b9567dSKevin Lo #define RTWN_RTL8192EU_DEV(v,p) \
10760b9567dSKevin Lo 	{ USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, RTWN_CHIP_RTL8192EU) }
10860b9567dSKevin Lo 	RTWN_RTL8192EU_DEV(DLINK,		DWA131E1),
10960b9567dSKevin Lo 	RTWN_RTL8192EU_DEV(REALTEK,		RTL8192EU),
110920dfe02SAndriy Voskoboinyk 	RTWN_RTL8192EU_DEV(TPLINK,		WN821NV5),
11160b9567dSKevin Lo 	RTWN_RTL8192EU_DEV(TPLINK,		WN822NV4),
11260b9567dSKevin Lo 	RTWN_RTL8192EU_DEV(TPLINK,		WN823NV2),
11360b9567dSKevin Lo #undef RTWN_RTL8192EU_DEV
11460b9567dSKevin Lo 
1157453645fSAndriy Voskoboinyk 	/* RTL8188EU */
1167453645fSAndriy Voskoboinyk #define RTWN_RTL8188EU_DEV(v,p) \
1177453645fSAndriy Voskoboinyk 	{ USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, RTWN_CHIP_RTL8188EU) }
1187453645fSAndriy Voskoboinyk 	RTWN_RTL8188EU_DEV(ABOCOM,		RTL8188EU),
119cd6f0b47SAndreas Wetzel 	RTWN_RTL8188EU_DEV(ASUS,		USBN10NANOB1),
1207453645fSAndriy Voskoboinyk 	RTWN_RTL8188EU_DEV(DLINK,		DWA123D1),
1217453645fSAndriy Voskoboinyk 	RTWN_RTL8188EU_DEV(DLINK,		DWA125D1),
1222891a280SHans Petter Selasky 	RTWN_RTL8188EU_DEV(EDIMAX,		EW7811UN_V2),
1237453645fSAndriy Voskoboinyk 	RTWN_RTL8188EU_DEV(ELECOM,		WDC150SU2M),
124b5a2424bSAndriy Voskoboinyk 	RTWN_RTL8188EU_DEV(TPLINK,		WN722NV2),
12531882563SMark Johnston 	RTWN_RTL8188EU_DEV(TPLINK,		WN727NV5),
1267453645fSAndriy Voskoboinyk 	RTWN_RTL8188EU_DEV(REALTEK,		RTL8188ETV),
1277453645fSAndriy Voskoboinyk 	RTWN_RTL8188EU_DEV(REALTEK,		RTL8188EU),
1280736ad87SHans Petter Selasky 	RTWN_RTL8188EU_DEV(MERCUSYS,		MW150US),
1297453645fSAndriy Voskoboinyk #undef RTWN_RTL8188EU_DEV
1307453645fSAndriy Voskoboinyk 
1317453645fSAndriy Voskoboinyk 	/* RTL8812AU */
1327453645fSAndriy Voskoboinyk #define RTWN_RTL8812AU_DEV(v,p) \
1337453645fSAndriy Voskoboinyk 	{ USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, RTWN_CHIP_RTL8812AU) }
1347453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(ASUS,		USBAC56),
1357453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(CISCOLINKSYS,	WUSB6300),
1367453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(DLINK,		DWA182C1),
1377453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(DLINK,		DWA180A1),
1387453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(EDIMAX,		EW7822UAC),
1397453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(IODATA,		WNAC867U),
1407453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(MELCO,		WIU3866D),
1417453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(NEC,			WL900U),
1427453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(PLANEX2,		GW900D),
14375c600d2SMark Johnston 	RTWN_RTL8812AU_DEV(REALTEK,		RTL8812AU_1),
14475c600d2SMark Johnston 	RTWN_RTL8812AU_DEV(REALTEK,		RTL8812AU_2),
1457453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(SENAO,		EUB1200AC),
1467453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(SITECOMEU,		WLA7100),
14775d20a5eSHans Petter Selasky 	RTWN_RTL8812AU_DEV(TENDA2,		U12),
1487453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(TPLINK,		T4U),
1497e192934SAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(TPLINK,		T4UV2),
1503c3e1b0aSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(TPLINK,		T4UHV1),
1517e192934SAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(TPLINK,		T4UHV2),
1527453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(TRENDNET,		TEW805UB),
1537453645fSAndriy Voskoboinyk 	RTWN_RTL8812AU_DEV(ZYXEL,		NWD6605),
1547453645fSAndriy Voskoboinyk #undef RTWN_RTL8812AU_DEV
1557453645fSAndriy Voskoboinyk 
1567453645fSAndriy Voskoboinyk 	/* RTL8821AU */
1577453645fSAndriy Voskoboinyk #define RTWN_RTL8821AU_DEV(v,p) \
1587453645fSAndriy Voskoboinyk 	{ USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, RTWN_CHIP_RTL8821AU) }
1597453645fSAndriy Voskoboinyk 	RTWN_RTL8821AU_DEV(DLINK,		DWA171A1),
1607453645fSAndriy Voskoboinyk 	RTWN_RTL8821AU_DEV(DLINK,		DWA172A1),
1617453645fSAndriy Voskoboinyk 	RTWN_RTL8821AU_DEV(EDIMAX,		EW7811UTC_1),
1627453645fSAndriy Voskoboinyk 	RTWN_RTL8821AU_DEV(EDIMAX,		EW7811UTC_2),
1634b156472SGavin Atkinson 	RTWN_RTL8821AU_DEV(ELECOM,		WDB433SU2M2),
1647453645fSAndriy Voskoboinyk 	RTWN_RTL8821AU_DEV(HAWKING,		HD65U),
1657453645fSAndriy Voskoboinyk 	RTWN_RTL8821AU_DEV(MELCO,		WIU2433DM),
16618db3c61SLi-Wen Hsu 	RTWN_RTL8821AU_DEV(MELCO,		WIU2433DHP),
167a461b7e5SAndriy Voskoboinyk 	RTWN_RTL8821AU_DEV(NETGEAR,		A6100),
1686bda1ad8SAndriy Voskoboinyk 	RTWN_RTL8821AU_DEV(REALTEK,		RTL8821AU_1),
1691c9c1f59SJung-uk Kim 	RTWN_RTL8821AU_DEV(REALTEK,		RTL8821AU_2),
170d0edc32eSHans Petter Selasky 	RTWN_RTL8821AU_DEV(TPLINK,		T2UNANO),
171d0edc32eSHans Petter Selasky 	RTWN_RTL8821AU_DEV(TPLINK,		T2UPLUS),
172434c46c0SDmitry Chagin 	RTWN_RTL8821AU_DEV(TPLINK,		T2UV3),
1737453645fSAndriy Voskoboinyk #undef RTWN_RTL8821AU_DEV
1747453645fSAndriy Voskoboinyk };
1757453645fSAndriy Voskoboinyk 
1767453645fSAndriy Voskoboinyk typedef void	(*chip_usb_attach)(struct rtwn_usb_softc *);
1777453645fSAndriy Voskoboinyk 
1787453645fSAndriy Voskoboinyk static const chip_usb_attach rtwn_chip_usb_attach[RTWN_CHIP_MAX_USB] = {
1797453645fSAndriy Voskoboinyk 	[RTWN_CHIP_RTL8192CU] = r92cu_attach,
18060b9567dSKevin Lo 	[RTWN_CHIP_RTL8192EU] = r92eu_attach,
1817453645fSAndriy Voskoboinyk 	[RTWN_CHIP_RTL8188EU] = r88eu_attach,
1827453645fSAndriy Voskoboinyk 	[RTWN_CHIP_RTL8812AU] = r12au_attach,
1837453645fSAndriy Voskoboinyk 	[RTWN_CHIP_RTL8821AU] = r21au_attach
1847453645fSAndriy Voskoboinyk };
1857453645fSAndriy Voskoboinyk 
1867453645fSAndriy Voskoboinyk static __inline void
rtwn_usb_attach_private(struct rtwn_usb_softc * uc,int chip)1877453645fSAndriy Voskoboinyk rtwn_usb_attach_private(struct rtwn_usb_softc *uc, int chip)
1887453645fSAndriy Voskoboinyk {
1897453645fSAndriy Voskoboinyk 	rtwn_chip_usb_attach[chip](uc);
1907453645fSAndriy Voskoboinyk }
191