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), 52f4d7179aSMark Johnston RTWN_RTL8192CU_DEV(BELKIN, F9L1004V1), 537453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(BELKIN, RTL8188CU), 547453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(BELKIN, RTL8192CU), 557453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(CHICONY, RTL8188CUS_1), 567453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(CHICONY, RTL8188CUS_2), 577453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(CHICONY, RTL8188CUS_3), 587453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(CHICONY, RTL8188CUS_4), 597453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(CHICONY, RTL8188CUS_5), 607453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(COREGA, RTL8192CU), 617453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(DLINK, RTL8188CU), 627453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(DLINK, RTL8192CU_1), 637453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(DLINK, RTL8192CU_2), 647453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(DLINK, RTL8192CU_3), 657453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(DLINK, DWA131B), 667453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(EDIMAX, EW7811UN), 677453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(EDIMAX, RTL8192CU), 687453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(FEIXUN, RTL8188CU), 697453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(FEIXUN, RTL8192CU), 707453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(GUILLEMOT, HWNUP150), 717453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(HAWKING, RTL8192CU), 727453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(HP3, RTL8188CU), 737453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(NETGEAR, WNA1000M), 747453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(NETGEAR, RTL8192CU), 757453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(NETGEAR4, RTL8188CU), 767453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(NOVATECH, RTL8188CU), 777453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(PLANEX2, RTL8188CU_1), 787453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(PLANEX2, RTL8188CU_2), 797453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(PLANEX2, RTL8188CU_3), 807453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(PLANEX2, RTL8188CU_4), 817453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(PLANEX2, RTL8188CUS), 827453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(PLANEX2, RTL8192CU), 837453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188CE_0), 847453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188CE_1), 857453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188CTV), 867453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188CU_0), 877453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188CU_1), 887453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188CU_2), 897453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188CU_3), 907453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188CU_COMBO), 917453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188CUS), 927453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188RU_1), 937453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188RU_2), 947453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8188RU_3), 957453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8191CU), 967453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8192CE), 977453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(REALTEK, RTL8192CU), 987453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(SITECOMEU, RTL8188CU_1), 997453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(SITECOMEU, RTL8188CU_2), 1007453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(SITECOMEU, RTL8192CU), 1017453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(TRENDNET, RTL8188CU), 1027453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(TRENDNET, RTL8192CU), 1037453645fSAndriy Voskoboinyk RTWN_RTL8192CU_DEV(ZYXEL, RTL8192CU), 1047453645fSAndriy Voskoboinyk #undef RTWN_RTL8192CU_DEV 1057453645fSAndriy Voskoboinyk 10660b9567dSKevin Lo /* RTL8192EU */ 10760b9567dSKevin Lo #define RTWN_RTL8192EU_DEV(v,p) \ 10860b9567dSKevin Lo { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, RTWN_CHIP_RTL8192EU) } 10960b9567dSKevin Lo RTWN_RTL8192EU_DEV(DLINK, DWA131E1), 11060b9567dSKevin Lo RTWN_RTL8192EU_DEV(REALTEK, RTL8192EU), 111920dfe02SAndriy Voskoboinyk RTWN_RTL8192EU_DEV(TPLINK, WN821NV5), 11260b9567dSKevin Lo RTWN_RTL8192EU_DEV(TPLINK, WN822NV4), 11360b9567dSKevin Lo RTWN_RTL8192EU_DEV(TPLINK, WN823NV2), 11460b9567dSKevin Lo #undef RTWN_RTL8192EU_DEV 11560b9567dSKevin Lo 1167453645fSAndriy Voskoboinyk /* RTL8188EU */ 1177453645fSAndriy Voskoboinyk #define RTWN_RTL8188EU_DEV(v,p) \ 1187453645fSAndriy Voskoboinyk { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, RTWN_CHIP_RTL8188EU) } 1197453645fSAndriy Voskoboinyk RTWN_RTL8188EU_DEV(ABOCOM, RTL8188EU), 120cd6f0b47SAndreas Wetzel RTWN_RTL8188EU_DEV(ASUS, USBN10NANOB1), 1217453645fSAndriy Voskoboinyk RTWN_RTL8188EU_DEV(DLINK, DWA123D1), 1227453645fSAndriy Voskoboinyk RTWN_RTL8188EU_DEV(DLINK, DWA125D1), 123*2891a280SHans Petter Selasky RTWN_RTL8188EU_DEV(EDIMAX, EW7811UN_V2), 1247453645fSAndriy Voskoboinyk RTWN_RTL8188EU_DEV(ELECOM, WDC150SU2M), 125b5a2424bSAndriy Voskoboinyk RTWN_RTL8188EU_DEV(TPLINK, WN722NV2), 12631882563SMark Johnston RTWN_RTL8188EU_DEV(TPLINK, WN727NV5), 1277453645fSAndriy Voskoboinyk RTWN_RTL8188EU_DEV(REALTEK, RTL8188ETV), 1287453645fSAndriy Voskoboinyk RTWN_RTL8188EU_DEV(REALTEK, RTL8188EU), 1290736ad87SHans Petter Selasky RTWN_RTL8188EU_DEV(MERCUSYS, MW150US), 1307453645fSAndriy Voskoboinyk #undef RTWN_RTL8188EU_DEV 1317453645fSAndriy Voskoboinyk 1327453645fSAndriy Voskoboinyk /* RTL8812AU */ 1337453645fSAndriy Voskoboinyk #define RTWN_RTL8812AU_DEV(v,p) \ 1347453645fSAndriy Voskoboinyk { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, RTWN_CHIP_RTL8812AU) } 1357453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(ASUS, USBAC56), 1367453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(CISCOLINKSYS, WUSB6300), 1377453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(DLINK, DWA182C1), 1387453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(DLINK, DWA180A1), 1397453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(EDIMAX, EW7822UAC), 1407453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(IODATA, WNAC867U), 1417453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(MELCO, WIU3866D), 1427453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(NEC, WL900U), 1437453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(PLANEX2, GW900D), 14475c600d2SMark Johnston RTWN_RTL8812AU_DEV(REALTEK, RTL8812AU_1), 14575c600d2SMark Johnston RTWN_RTL8812AU_DEV(REALTEK, RTL8812AU_2), 1467453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(SENAO, EUB1200AC), 1477453645fSAndriy Voskoboinyk RTWN_RTL8812AU_DEV(SITECOMEU, WLA7100), 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 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