Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Added support for the Realtek RTL8188EUS and RTL8188ETV chip...



details:   https://anonhg.NetBSD.org/src/rev/ccb4c465f05e
branches:  trunk
changeset: 330753:ccb4c465f05e
user:      nonaka <nonaka%NetBSD.org@localhost>
date:      Sun Jul 20 13:25:23 2014 +0000

description:
Added support for the Realtek RTL8188EUS and RTL8188ETV chipsets from FreeBSD.

diffstat:

 external/realtek/urtwn/Makefile             |    6 +-
 external/realtek/urtwn/dist/rtl8188eufw.bin |  Bin 
 share/man/man4/urtwn.4                      |   15 +-
 sys/dev/usb/if_urtwn.c                      |  872 ++++++++++++++++++++++-----
 sys/dev/usb/if_urtwn_data.h                 |  223 +++++++-
 sys/dev/usb/if_urtwnreg.h                   |   66 ++-
 sys/dev/usb/if_urtwnvar.h                   |   13 +-
 7 files changed, 1012 insertions(+), 183 deletions(-)

diffs (truncated from 1851 to 300 lines):

diff -r 7c4978bf87bf -r ccb4c465f05e external/realtek/urtwn/Makefile
--- a/external/realtek/urtwn/Makefile   Sun Jul 20 13:17:37 2014 +0000
+++ b/external/realtek/urtwn/Makefile   Sun Jul 20 13:25:23 2014 +0000
@@ -1,8 +1,10 @@
-# $NetBSD: Makefile,v 1.1 2012/06/14 04:14:36 riz Exp $
+# $NetBSD: Makefile,v 1.2 2014/07/20 13:25:23 nonaka Exp $
 
 NOMAN= # define
 
-FILES= dist/Realtek-Firmware-License.txt dist/rtl8192cfw.bin
+FILES= dist/Realtek-Firmware-License.txt
+FILES+=        dist/rtl8188eufw.bin
+FILES+=        dist/rtl8192cfw.bin
 FILES+=        dist/rtl8192cfwU.bin
 
 FILESDIR=      /libdata/firmware/if_urtwn
diff -r 7c4978bf87bf -r ccb4c465f05e external/realtek/urtwn/dist/rtl8188eufw.bin
Binary file external/realtek/urtwn/dist/rtl8188eufw.bin has changed
diff -r 7c4978bf87bf -r ccb4c465f05e share/man/man4/urtwn.4
--- a/share/man/man4/urtwn.4    Sun Jul 20 13:17:37 2014 +0000
+++ b/share/man/man4/urtwn.4    Sun Jul 20 13:25:23 2014 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: urtwn.4,v 1.10 2014/02/14 07:29:06 wiz Exp $
+.\" $NetBSD: urtwn.4,v 1.11 2014/07/20 13:25:23 nonaka Exp $
 .\" $OpenBSD: urtwn.4,v 1.15 2011/11/26 06:39:33 ckuethe Exp $
 .\"
 .\" Copyright (c) 2010 Damien Bergamini <damien.bergamini%free.fr@localhost>
@@ -20,18 +20,18 @@
 .Os
 .Sh NAME
 .Nm urtwn
-.Nd Realtek RTL8188CU/RTL8192CU USB IEEE 802.11b/g/n wireless network device
+.Nd Realtek RTL8188CU/RTL8188EU/RTL8192CU USB IEEE 802.11b/g/n wireless network device
 .Sh SYNOPSIS
 .Cd "urtwn* at uhub? port ?"
 .Sh DESCRIPTION
 The
 .Nm
 driver supports USB 2.0 wireless network devices based on Realtek
-RTL8188CUS, RTL8188CE-VAU, RTL8188RU, and RTL8192CU chipsets.
+RTL8188CUS, RTL8188CE-VAU, RTL8188EUS, RTL8188RU, and RTL8192CU chipsets.
 .Pp
-The RTL8188CUS is a highly integrated 802.11n adapter that combines
-a MAC, a 1T1R capable baseband and an RF in a single chip.
-It operates in the 2GHz spectrum only.
+The RTL8188CUS and RTL8188EUS is a highly integrated 802.11n adapter that
+combines a MAC, a 1T1R capable baseband and an RF in a single chip.
+They operates in the 2GHz spectrum only.
 The RTL8188RU is a high-power variant of the RTL8188CUS.
 The RTL8188CE-VAU is a PCI Express Mini Card adapter that attaches
 to the USB interface.
@@ -93,6 +93,7 @@
 which are loaded when an interface is attached:
 .Pp
 .Bl -tag -width Ds -offset indent -compact
+.It /libdata/firmware/if_urtwn/rtl8188eufw.bin
 .It /libdata/firmware/if_urtwn/rtl8192cfw.bin
 .It /libdata/firmware/if_urtwn/rtl8192cfwU.bin
 .El
@@ -121,6 +122,8 @@
 .It Sitecom N300 USB (WLA-2102 v1)
 .It Sitecom WL-365
 .It Solwise NET-WL-UMD-606N
+.It TP-LINK TL-WN723N v3
+.It TP-LINK TL-WN725N v2
 .It TRENDnet TEW-648UBM
 .El
 .Sh EXAMPLES
diff -r 7c4978bf87bf -r ccb4c465f05e sys/dev/usb/if_urtwn.c
--- a/sys/dev/usb/if_urtwn.c    Sun Jul 20 13:17:37 2014 +0000
+++ b/sys/dev/usb/if_urtwn.c    Sun Jul 20 13:25:23 2014 +0000
@@ -1,8 +1,9 @@
-/*     $NetBSD: if_urtwn.c,v 1.31 2014/07/02 20:17:30 christos Exp $   */
+/*     $NetBSD: if_urtwn.c,v 1.32 2014/07/20 13:25:23 nonaka Exp $     */
 /*     $OpenBSD: if_urtwn.c,v 1.20 2011/11/26 06:39:33 ckuethe Exp $   */
 
 /*-
  * Copyright (c) 2010 Damien Bergamini <damien.bergamini%free.fr@localhost>
+ * Copyright (c) 2014 Kevin Lo <kevlo%FreeBSD.org@localhost>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -18,11 +19,11 @@
  */
 
 /*-
- * Driver for Realtek RTL8188CE-VAU/RTL8188CUS/RTL8188RU/RTL8192CU.
+ * Driver for Realtek RTL8188CE-VAU/RTL8188CUS/RTL8188EU/RTL8188RU/RTL8192CU.
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.31 2014/07/02 20:17:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.32 2014/07/20 13:25:23 nonaka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -96,64 +97,77 @@
 #define DPRINTFN(n, s)
 #endif
 
-static const struct usb_devno urtwn_devs[] = {
-       { USB_VENDOR_ABOCOM,    USB_PRODUCT_ABOCOM_RTL8188CU_1 },
-       { USB_VENDOR_ABOCOM,    USB_PRODUCT_ABOCOM_RTL8188CU_2 },
-       { USB_VENDOR_ABOCOM,    USB_PRODUCT_ABOCOM_RTL8192CU },
-       { USB_VENDOR_ASUSTEK,   USB_PRODUCT_ASUSTEK_RTL8192CU },
-       { USB_VENDOR_AZUREWAVE, USB_PRODUCT_AZUREWAVE_RTL8188CE_1 },
-       { USB_VENDOR_AZUREWAVE, USB_PRODUCT_AZUREWAVE_RTL8188CE_2 },
-       { USB_VENDOR_AZUREWAVE, USB_PRODUCT_AZUREWAVE_RTL8188CU },
-       { USB_VENDOR_BELKIN,    USB_PRODUCT_BELKIN_RTL8188CU },
-       { USB_VENDOR_BELKIN,    USB_PRODUCT_BELKIN_RTL8192CU },
-       { USB_VENDOR_CHICONY,   USB_PRODUCT_CHICONY_RTL8188CUS_1 },
-       { USB_VENDOR_CHICONY,   USB_PRODUCT_CHICONY_RTL8188CUS_2 },
-       { USB_VENDOR_CHICONY,   USB_PRODUCT_CHICONY_RTL8188CUS_3 },
-       { USB_VENDOR_CHICONY,   USB_PRODUCT_CHICONY_RTL8188CUS_4 },
-       { USB_VENDOR_CHICONY,   USB_PRODUCT_CHICONY_RTL8188CUS_5 },
-       { USB_VENDOR_COREGA,    USB_PRODUCT_COREGA_RTL8192CU },
-       { USB_VENDOR_DLINK,     USB_PRODUCT_DLINK_RTL8188CU },
-       { USB_VENDOR_DLINK,     USB_PRODUCT_DLINK_RTL8192CU_1 },
-       { USB_VENDOR_DLINK,     USB_PRODUCT_DLINK_RTL8192CU_2 },
-       { USB_VENDOR_DLINK,     USB_PRODUCT_DLINK_RTL8192CU_3 },
-       { USB_VENDOR_EDIMAX,    USB_PRODUCT_EDIMAX_RTL8188CU },
-       { USB_VENDOR_EDIMAX,    USB_PRODUCT_EDIMAX_RTL8192CU },
-       { USB_VENDOR_FEIXUN,    USB_PRODUCT_FEIXUN_RTL8188CU },
-       { USB_VENDOR_FEIXUN,    USB_PRODUCT_FEIXUN_RTL8192CU },
-       { USB_VENDOR_GUILLEMOT, USB_PRODUCT_GUILLEMOT_HWNUP150 },
-       { USB_VENDOR_HAWKING,   USB_PRODUCT_HAWKING_RTL8192CU },
-       { USB_VENDOR_HP3,       USB_PRODUCT_HP3_RTL8188CU },
-       { USB_VENDOR_NETGEAR,   USB_PRODUCT_NETGEAR_WNA1000M },
-       { USB_VENDOR_NETGEAR,   USB_PRODUCT_NETGEAR_RTL8192CU },
-       { USB_VENDOR_NETGEAR4,  USB_PRODUCT_NETGEAR4_RTL8188CU },
-       { USB_VENDOR_NOVATECH,  USB_PRODUCT_NOVATECH_RTL8188CU },
-       { USB_VENDOR_PLANEX2,   USB_PRODUCT_PLANEX2_RTL8188CU_1 },
-       { USB_VENDOR_PLANEX2,   USB_PRODUCT_PLANEX2_RTL8188CU_2 },
-       { USB_VENDOR_PLANEX2,   USB_PRODUCT_PLANEX2_RTL8192CU },
-       { USB_VENDOR_PLANEX2,   USB_PRODUCT_PLANEX2_RTL8188CU_3 },
-       { USB_VENDOR_PLANEX2,   USB_PRODUCT_PLANEX2_RTL8188CU_4 },
-       { USB_VENDOR_PLANEX2,   USB_PRODUCT_PLANEX2_RTL8188CUS },
-       { USB_VENDOR_REALTEK,   USB_PRODUCT_REALTEK_RTL8188CE_0 },
-       { USB_VENDOR_REALTEK,   USB_PRODUCT_REALTEK_RTL8188CE_1 },
-       { USB_VENDOR_REALTEK,   USB_PRODUCT_REALTEK_RTL8188CTV },
-       { USB_VENDOR_REALTEK,   USB_PRODUCT_REALTEK_RTL8188CU_0 },
-       { USB_VENDOR_REALTEK,   USB_PRODUCT_REALTEK_RTL8188CU_1 },
-       { USB_VENDOR_REALTEK,   USB_PRODUCT_REALTEK_RTL8188CU_2 },
-       { USB_VENDOR_REALTEK,   USB_PRODUCT_REALTEK_RTL8188CU_COMBO },
-       { USB_VENDOR_REALTEK,   USB_PRODUCT_REALTEK_RTL8188CUS },
-       { USB_VENDOR_REALTEK,   USB_PRODUCT_REALTEK_RTL8188RU },
-       { USB_VENDOR_REALTEK,   USB_PRODUCT_REALTEK_RTL8188RU_2 },
-       { USB_VENDOR_REALTEK,   USB_PRODUCT_REALTEK_RTL8191CU },
-       { USB_VENDOR_REALTEK,   USB_PRODUCT_REALTEK_RTL8192CE },
-       { USB_VENDOR_REALTEK,   USB_PRODUCT_REALTEK_RTL8192CU },
-       { USB_VENDOR_SITECOMEU, USB_PRODUCT_SITECOMEU_RTL8188CU },
-       { USB_VENDOR_SITECOMEU, USB_PRODUCT_SITECOMEU_RTL8188CU_2 },
-       { USB_VENDOR_SITECOMEU, USB_PRODUCT_SITECOMEU_RTL8192CU },
-       { USB_VENDOR_SITECOMEU, USB_PRODUCT_SITECOMEU_RTL8192CUR2 },
-       { USB_VENDOR_TRENDNET,  USB_PRODUCT_TRENDNET_RTL8188CU },
-       { USB_VENDOR_TRENDNET,  USB_PRODUCT_TRENDNET_RTL8192CU },
-       { USB_VENDOR_ZYXEL,     USB_PRODUCT_ZYXEL_RTL8192CU }
+#define URTWN_DEV(v,p) { { USB_VENDOR_##v, USB_PRODUCT_##v##_##p }, 0 } 
+#define URTWN_RTL8188E_DEV(v,p) \
+       { { USB_VENDOR_##v, USB_PRODUCT_##v##_##p }, FLAG_RTL8188E } 
+static const struct urtwn_dev {
+       struct usb_devno        dev;
+       uint32_t                flags;
+#define        FLAG_RTL8188E   __BIT(0)
+} urtwn_devs[] = {
+       URTWN_DEV(ABOCOM,       RTL8188CU_1),
+       URTWN_DEV(ABOCOM,       RTL8188CU_2),
+       URTWN_DEV(ABOCOM,       RTL8192CU),
+       URTWN_DEV(ASUSTEK,      RTL8192CU),
+       URTWN_DEV(AZUREWAVE,    RTL8188CE_1),
+       URTWN_DEV(AZUREWAVE,    RTL8188CE_2),
+       URTWN_DEV(AZUREWAVE,    RTL8188CU),
+       URTWN_DEV(BELKIN,       RTL8188CU),
+       URTWN_DEV(BELKIN,       RTL8192CU),
+       URTWN_DEV(CHICONY,      RTL8188CUS_1),
+       URTWN_DEV(CHICONY,      RTL8188CUS_2),
+       URTWN_DEV(CHICONY,      RTL8188CUS_3),
+       URTWN_DEV(CHICONY,      RTL8188CUS_4),
+       URTWN_DEV(CHICONY,      RTL8188CUS_5),
+       URTWN_DEV(COREGA,       RTL8192CU),
+       URTWN_DEV(DLINK,        RTL8188CU),
+       URTWN_DEV(DLINK,        RTL8192CU_1),
+       URTWN_DEV(DLINK,        RTL8192CU_2),
+       URTWN_DEV(DLINK,        RTL8192CU_3),
+       URTWN_DEV(EDIMAX,       RTL8188CU),
+       URTWN_DEV(EDIMAX,       RTL8192CU),
+       URTWN_DEV(FEIXUN,       RTL8188CU),
+       URTWN_DEV(FEIXUN,       RTL8192CU),
+       URTWN_DEV(GUILLEMOT,    HWNUP150),
+       URTWN_DEV(HAWKING,      RTL8192CU),
+       URTWN_DEV(HP3,          RTL8188CU),
+       URTWN_DEV(NETGEAR,      WNA1000M),
+       URTWN_DEV(NETGEAR,      RTL8192CU),
+       URTWN_DEV(NETGEAR4,     RTL8188CU),
+       URTWN_DEV(NOVATECH,     RTL8188CU),
+       URTWN_DEV(PLANEX2,      RTL8188CU_1),
+       URTWN_DEV(PLANEX2,      RTL8188CU_2),
+       URTWN_DEV(PLANEX2,      RTL8192CU),
+       URTWN_DEV(PLANEX2,      RTL8188CU_3),
+       URTWN_DEV(PLANEX2,      RTL8188CU_4),
+       URTWN_DEV(PLANEX2,      RTL8188CUS),
+       URTWN_DEV(REALTEK,      RTL8188CE_0),
+       URTWN_DEV(REALTEK,      RTL8188CE_1),
+       URTWN_DEV(REALTEK,      RTL8188CTV),
+       URTWN_DEV(REALTEK,      RTL8188CU_0),
+       URTWN_DEV(REALTEK,      RTL8188CU_1),
+       URTWN_DEV(REALTEK,      RTL8188CU_2),
+       URTWN_DEV(REALTEK,      RTL8188CU_COMBO),
+       URTWN_DEV(REALTEK,      RTL8188CUS),
+       URTWN_DEV(REALTEK,      RTL8188RU),
+       URTWN_DEV(REALTEK,      RTL8188RU_2),
+       URTWN_DEV(REALTEK,      RTL8191CU),
+       URTWN_DEV(REALTEK,      RTL8192CE),
+       URTWN_DEV(REALTEK,      RTL8192CU),
+       URTWN_DEV(SITECOMEU,    RTL8188CU),
+       URTWN_DEV(SITECOMEU,    RTL8188CU_2),
+       URTWN_DEV(SITECOMEU,    RTL8192CU),
+       URTWN_DEV(SITECOMEU,    RTL8192CUR2),
+       URTWN_DEV(TRENDNET,     RTL8188CU),
+       URTWN_DEV(TRENDNET,     RTL8192CU),
+       URTWN_DEV(ZYXEL,        RTL8192CU),
+
+       /* URTWN_RTL8188E */
+       URTWN_RTL8188E_DEV(REALTEK, RTL8188ETV),
+       URTWN_RTL8188E_DEV(REALTEK, RTL8188EU),
 };
+#undef URTWN_DEV
+#undef URTWN_RTL8188E_DEV
 
 static int     urtwn_match(device_t, cfdata_t, void *);
 static void    urtwn_attach(device_t, device_t, void *);
@@ -186,16 +200,21 @@
 static uint16_t        urtwn_read_2(struct urtwn_softc *, uint16_t);
 static uint32_t        urtwn_read_4(struct urtwn_softc *, uint16_t);
 static int     urtwn_fw_cmd(struct urtwn_softc *, uint8_t, const void *, int);
-static void    urtwn_rf_write(struct urtwn_softc *, int, uint8_t, uint32_t);
+static void    urtwn_r92c_rf_write(struct urtwn_softc *, int, uint8_t,
+                   uint32_t);
+static void    urtwn_r88e_rf_write(struct urtwn_softc *, int, uint8_t,
+                   uint32_t);
 static uint32_t        urtwn_rf_read(struct urtwn_softc *, int, uint8_t);
 static int     urtwn_llt_write(struct urtwn_softc *, uint32_t, uint32_t);
 static uint8_t urtwn_efuse_read_1(struct urtwn_softc *, uint16_t);
 static void    urtwn_efuse_read(struct urtwn_softc *);
+static void    urtwn_efuse_switch_power(struct urtwn_softc *);
 static int     urtwn_read_chipid(struct urtwn_softc *);
 #ifdef URTWN_DEBUG
 static void    urtwn_dump_rom(struct urtwn_softc *, struct r92c_rom *);
 #endif
 static void    urtwn_read_rom(struct urtwn_softc *);
+static void    urtwn_r88e_read_rom(struct urtwn_softc *);
 static int     urtwn_media_change(struct ifnet *);
 static int     urtwn_ra_init(struct urtwn_softc *);
 static int     urtwn_get_nettype(struct urtwn_softc *);
@@ -212,6 +231,7 @@
 static void    urtwn_wme_update_cb(struct urtwn_softc *, void *);
 static void    urtwn_update_avgrssi(struct urtwn_softc *, int, int8_t);
 static int8_t  urtwn_get_rssi(struct urtwn_softc *, int, void *);
+static int8_t  urtwn_r88e_get_rssi(struct urtwn_softc *, int, void *);
 static void    urtwn_rx_frame(struct urtwn_softc *, uint8_t *, int);
 static void    urtwn_rxeof(usbd_xfer_handle, usbd_private_handle, usbd_status);
 static void    urtwn_txeof(usbd_xfer_handle, usbd_private_handle, usbd_status);
@@ -220,12 +240,15 @@
 static void    urtwn_start(struct ifnet *);
 static void    urtwn_watchdog(struct ifnet *);
 static int     urtwn_ioctl(struct ifnet *, u_long, void *);
-static int     urtwn_power_on(struct urtwn_softc *);
+static int     urtwn_r92c_power_on(struct urtwn_softc *);
+static int     urtwn_r88e_power_on(struct urtwn_softc *);
 static int     urtwn_llt_init(struct urtwn_softc *);
 static void    urtwn_fw_reset(struct urtwn_softc *);
+static void    urtwn_r88e_fw_reset(struct urtwn_softc *);
 static int     urtwn_fw_loadpage(struct urtwn_softc *, int, uint8_t *, int);
 static int     urtwn_load_firmware(struct urtwn_softc *);
-static int     urtwn_dma_init(struct urtwn_softc *);
+static int     urtwn_r92c_dma_init(struct urtwn_softc *);
+static int     urtwn_r88e_dma_init(struct urtwn_softc *);
 static void    urtwn_mac_init(struct urtwn_softc *);
 static void    urtwn_bb_init(struct urtwn_softc *);
 static void    urtwn_rf_init(struct urtwn_softc *);
@@ -236,6 +259,8 @@
 static void    urtwn_write_txpower(struct urtwn_softc *, int, uint16_t[]);
 static void    urtwn_get_txpower(struct urtwn_softc *, size_t, u_int, u_int,
                    uint16_t[]);
+static void    urtwn_r88e_get_txpower(struct urtwn_softc *, size_t, u_int,
+                   u_int, uint16_t[]);
 static void    urtwn_set_txpower(struct urtwn_softc *, u_int, u_int);
 static void    urtwn_set_chan(struct urtwn_softc *, struct ieee80211_channel *,
                    u_int);
@@ -252,12 +277,14 @@
 #define        urtwn_bb_write  urtwn_write_4
 #define        urtwn_bb_read   urtwn_read_4
 
+#define        urtwn_lookup(d,v,p)     ((const struct urtwn_dev *)usb_lookup(d,v,p))
+
 static int
 urtwn_match(device_t parent, cfdata_t match, void *aux)
 {
        struct usb_attach_arg *uaa = aux;
 



Home | Main Index | Thread Index | Old Index