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 *); 2460b9567dSKevin Lo void r92eu_attach(struct rtwn_usb_softc *); 257453645fSAndriy Voskoboinyk void r88eu_attach(struct rtwn_usb_softc *); 267453645fSAndriy Voskoboinyk void r12au_attach(struct rtwn_usb_softc *); 277453645fSAndriy Voskoboinyk void r21au_attach(struct rtwn_usb_softc *); 287453645fSAndriy Voskoboinyk 297453645fSAndriy Voskoboinyk enum { 307453645fSAndriy Voskoboinyk RTWN_CHIP_RTL8192CU, 3160b9567dSKevin Lo RTWN_CHIP_RTL8192EU, 327453645fSAndriy Voskoboinyk RTWN_CHIP_RTL8188EU, 337453645fSAndriy Voskoboinyk RTWN_CHIP_RTL8812AU, 347453645fSAndriy Voskoboinyk RTWN_CHIP_RTL8821AU, 357453645fSAndriy Voskoboinyk RTWN_CHIP_MAX_USB 367453645fSAndriy Voskoboinyk }; 377453645fSAndriy Voskoboinyk 387453645fSAndriy Voskoboinyk /* various supported device vendors/products */ 397453645fSAndriy Voskoboinyk static const STRUCT_USB_HOST_ID rtwn_devs[] = { 407453645fSAndriy Voskoboinyk /* RTL8188CE-VAU/RTL8188CUS/RTL8188RU/RTL8192CU */ 417453645fSAndriy Voskoboinyk #define RTWN_RTL8192CU_DEV(v,p) \ 427453645fSAndriy Voskoboinyk { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, RTWN_CHIP_RTL8192CU) } 437453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(ABOCOM, RTL8188CU_1), 447453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(ABOCOM, RTL8188CU_2), 457453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(ABOCOM, RTL8192CU), 467453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(ASUS, RTL8192CU), 477453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(ASUS, USBN10NANO), 487453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(AZUREWAVE, RTL8188CE_1), 497453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(AZUREWAVE, RTL8188CE_2), 507453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(AZUREWAVE, RTL8188CU), 517453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(BELKIN, F7D2102), 527453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(BELKIN, RTL8188CU), 537453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(BELKIN, RTL8192CU), 547453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(CHICONY, RTL8188CUS_1), 557453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(CHICONY, RTL8188CUS_2), 567453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(CHICONY, RTL8188CUS_3), 577453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(CHICONY, RTL8188CUS_4), 587453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(CHICONY, RTL8188CUS_5), 597453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(COREGA, RTL8192CU), 607453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(DLINK, RTL8188CU), 617453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(DLINK, RTL8192CU_1), 627453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(DLINK, RTL8192CU_2), 637453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(DLINK, RTL8192CU_3), 647453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(DLINK, DWA131B), 657453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(EDIMAX, EW7811UN), 667453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(EDIMAX, RTL8192CU), 677453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(FEIXUN, RTL8188CU), 687453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(FEIXUN, RTL8192CU), 697453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(GUILLEMOT, HWNUP150), 707453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(HAWKING, RTL8192CU), 717453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(HP3, RTL8188CU), 727453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(NETGEAR, WNA1000M), 737453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(NETGEAR, RTL8192CU), 747453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(NETGEAR4, RTL8188CU), 757453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(NOVATECH, RTL8188CU), 767453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(PLANEX2, RTL8188CU_1), 777453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(PLANEX2, RTL8188CU_2), 787453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(PLANEX2, RTL8188CU_3), 797453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(PLANEX2, RTL8188CU_4), 807453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(PLANEX2, RTL8188CUS), 817453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(PLANEX2, RTL8192CU), 827453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188CE_0), 837453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188CE_1), 847453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188CTV), 857453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188CU_0), 867453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188CU_1), 877453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188CU_2), 887453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188CU_3), 897453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188CU_COMBO), 907453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188CUS), 917453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188RU_1), 927453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188RU_2), 937453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188RU_3), 947453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8191CU), 957453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8192CE), 967453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8192CU), 977453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(SITECOMEU, RTL8188CU_1), 987453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(SITECOMEU, RTL8188CU_2), 997453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(SITECOMEU, 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), 110*920dfe02SAndriy 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), 1197453645fSAndriy Voskoboinyk RTWN_RTL8188EU_DEV(DLINK, DWA123D1), 1207453645fSAndriy Voskoboinyk RTWN_RTL8188EU_DEV(DLINK, DWA125D1), 1217453645fSAndriy Voskoboinyk RTWN_RTL8188EU_DEV(ELECOM, WDC150SU2M), 122b5a2424bSAndriy Voskoboinyk RTWN_RTL8188EU_DEV(TPLINK, WN722NV2), 1237453645fSAndriy Voskoboinyk RTWN_RTL8188EU_DEV(REALTEK, RTL8188ETV), 1247453645fSAndriy Voskoboinyk RTWN_RTL8188EU_DEV(REALTEK, RTL8188EU), 1257453645fSAndriy Voskoboinyk #undef RTWN_RTL8188EU_DEV 1267453645fSAndriy Voskoboinyk 1277453645fSAndriy Voskoboinyk /* RTL8812AU */ 1287453645fSAndriy Voskoboinyk #define RTWN_RTL8812AU_DEV(v,p) \ 1297453645fSAndriy Voskoboinyk { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, RTWN_CHIP_RTL8812AU) } 1307453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(ASUS, USBAC56), 1317453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(CISCOLINKSYS, WUSB6300), 1327453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(DLINK, DWA182C1), 1337453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(DLINK, DWA180A1), 1347453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(EDIMAX, EW7822UAC), 1357453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(IODATA, WNAC867U), 1367453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(MELCO, WIU3866D), 1377453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(NEC, WL900U), 1387453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(PLANEX2, GW900D), 139b61cdf0eSGeorge V. Neville-Neil RTWN_RTL8812AU_DEV(REALTEK, RTL8812AU), 1407453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(SENAO, EUB1200AC), 1417453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(SITECOMEU, WLA7100), 1427453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(TPLINK, T4U), 1437e192934SAndriy Voskoboinyk RTWN_RTL8812AU_DEV(TPLINK, T4UV2), 1443c3e1b0aSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(TPLINK, T4UHV1), 1457e192934SAndriy Voskoboinyk RTWN_RTL8812AU_DEV(TPLINK, T4UHV2), 1467453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(TRENDNET, TEW805UB), 1477453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(ZYXEL, NWD6605), 1487453645fSAndriy Voskoboinyk #undef RTWN_RTL8812AU_DEV 1497453645fSAndriy Voskoboinyk 1507453645fSAndriy Voskoboinyk /* RTL8821AU */ 1517453645fSAndriy Voskoboinyk #define RTWN_RTL8821AU_DEV(v,p) \ 1527453645fSAndriy Voskoboinyk { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, RTWN_CHIP_RTL8821AU) } 1537453645fSAndriy Voskoboinyk RTWN_RTL8821AU_DEV(DLINK, DWA171A1), 1547453645fSAndriy Voskoboinyk RTWN_RTL8821AU_DEV(DLINK, DWA172A1), 1557453645fSAndriy Voskoboinyk RTWN_RTL8821AU_DEV(EDIMAX, EW7811UTC_1), 1567453645fSAndriy Voskoboinyk RTWN_RTL8821AU_DEV(EDIMAX, EW7811UTC_2), 1577453645fSAndriy Voskoboinyk RTWN_RTL8821AU_DEV(HAWKING, HD65U), 1587453645fSAndriy Voskoboinyk RTWN_RTL8821AU_DEV(MELCO, WIU2433DM), 1597453645fSAndriy Voskoboinyk RTWN_RTL8821AU_DEV(NETGEAR, A6100) 1607453645fSAndriy Voskoboinyk #undef RTWN_RTL8821AU_DEV 1617453645fSAndriy Voskoboinyk }; 1627453645fSAndriy Voskoboinyk 1637453645fSAndriy Voskoboinyk typedef void (*chip_usb_attach)(struct rtwn_usb_softc *); 1647453645fSAndriy Voskoboinyk 1657453645fSAndriy Voskoboinyk static const chip_usb_attach rtwn_chip_usb_attach[RTWN_CHIP_MAX_USB] = { 1667453645fSAndriy Voskoboinyk [RTWN_CHIP_RTL8192CU] = r92cu_attach, 16760b9567dSKevin Lo [RTWN_CHIP_RTL8192EU] = r92eu_attach, 1687453645fSAndriy Voskoboinyk [RTWN_CHIP_RTL8188EU] = r88eu_attach, 1697453645fSAndriy Voskoboinyk [RTWN_CHIP_RTL8812AU] = r12au_attach, 1707453645fSAndriy Voskoboinyk [RTWN_CHIP_RTL8821AU] = r21au_attach 1717453645fSAndriy Voskoboinyk }; 1727453645fSAndriy Voskoboinyk 1737453645fSAndriy Voskoboinyk static __inline void 1747453645fSAndriy Voskoboinyk rtwn_usb_attach_private(struct rtwn_usb_softc *uc, int chip) 1757453645fSAndriy Voskoboinyk { 1767453645fSAndriy Voskoboinyk rtwn_chip_usb_attach[chip](uc); 1777453645fSAndriy Voskoboinyk } 178