Hello, inlined patch is a compilation of fixes which were pushed into
FreeBSD tree after 8188eu driver came in.

It adds four new usbdevs (r270191, r273589, r282120), fixes efuse length
and replaces magic numbers with proper defines (r281918), fixes efuse
access (r281592, r282623), and fixes man typo.

All revisions can be viewed by this url pattern:

https://svnweb.freebsd.org/base?view=revision&revision=<revision>

Efuse changes from those revisions are overlapping, patch incorporates
final version.
Index: share/man/man4/urtwn.4
===================================================================
RCS file: /cvs/src/share/man/man4/urtwn.4,v
retrieving revision 1.33
diff -u -p -r1.33 urtwn.4
--- share/man/man4/urtwn.4      4 May 2015 14:30:06 -0000       1.33
+++ share/man/man4/urtwn.4      11 May 2015 12:20:23 -0000
@@ -28,7 +28,7 @@ The
 driver supports USB 2.0 wireless network devices based on Realtek
 RTL8188CUS, RTL8188CE-VAU, RTL8188EUS, RTL8188RU and RTL8192CU chipsets.
 .Pp
-The RTL8188CUS and RTL8188EUS are a highly integrated 802.11n adapter
+The RTL8188CUS and RTL8188EUS are a highly integrated 802.11n adapters
 that combines a MAC, a 1T1R capable baseband and an RF in a single chip.
 It operates in the 2GHz spectrum only.
 The RTL8188RU is a high-power variant of the RTL8188CUS.
@@ -98,11 +98,14 @@ The following adapters should work:
 .It B-Link BL-LW05-5R
 .It Belkin F7D1102 Surf Wireless Micro
 .It D-Link DWA-121
+.It D-Link DWA-123 rev D1
+.It D-Link DWA-125 rev D1
 .It D-Link DWA-131 rev B
 .It D-Link DWA-133
 .It D-Link DWA-135
 .It Digitus DN-7042
 .It Edimax EW-7811Un
+.It Elecom WDC-150SU2M
 .It EDUP EP-N8508
 .It Full River FR-W100NUL
 .It Hercules Wireless N USB Pico HWNUp-150
Index: sys/dev/usb/if_urtwn.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_urtwn.c,v
retrieving revision 1.46
diff -u -p -r1.46 if_urtwn.c
--- sys/dev/usb/if_urtwn.c      10 May 2015 19:40:56 -0000      1.46
+++ sys/dev/usb/if_urtwn.c      11 May 2015 12:20:23 -0000
@@ -126,6 +126,7 @@ static const struct usb_devno urtwn_devs
        { 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_3 },
        { USB_VENDOR_REALTEK,   USB_PRODUCT_REALTEK_RTL8188CU_COMBO },
        { USB_VENDOR_REALTEK,   USB_PRODUCT_REALTEK_RTL8188CUS },
        { USB_VENDOR_REALTEK,   USB_PRODUCT_REALTEK_RTL8188RU },
@@ -143,6 +144,9 @@ static const struct usb_devno urtwn_devs
        { USB_VENDOR_TRENDNET,  USB_PRODUCT_TRENDNET_RTL8192CU },
        { USB_VENDOR_ZYXEL,     USB_PRODUCT_ZYXEL_RTL8192CU },
        /* URTWN_RTL8188E */
+       { USB_VENDOR_DLINK,     USB_PRODUCT_DLINK_DWA123D1 },
+       { USB_VENDOR_DLINK,     USB_PRODUCT_DLINK_DWA125D1 },
+       { USB_VENDOR_ELECOM,    USB_PRODUCT_ELECOM_WDC150SU2M },
        { USB_VENDOR_REALTEK,   USB_PRODUCT_REALTEK_RTL8188ETV },
        { USB_VENDOR_REALTEK,   USB_PRODUCT_REALTEK_RTL8188EU }
 };
@@ -305,7 +309,10 @@ urtwn_attach(struct device *parent, stru
                return;
        }
 
-       if (uaa->product == USB_PRODUCT_REALTEK_RTL8188EU ||
+       if (uaa->product == USB_PRODUCT_DLINK_DWA123D1 ||
+           uaa->product == USB_PRODUCT_DLINK_DWA125D1 ||
+           uaa->product == USB_PRODUCT_ELECOM_WDC150SU2M ||
+           uaa->product == USB_PRODUCT_REALTEK_RTL8188EU ||
            uaa->product == USB_PRODUCT_REALTEK_RTL8188ETV)
                sc->chip |= URTWN_CHIP_88E;
 
@@ -922,6 +929,8 @@ urtwn_efuse_read(struct urtwn_softc *sc)
                printf("\n");
        }
 #endif
+
+       urtwn_write_1(sc, R92C_EFUSE_ACCESS, R92C_EFUSE_ACCESS_OFF);
 }
 
 void
@@ -929,6 +938,8 @@ urtwn_efuse_switch_power(struct urtwn_so
 {
        uint32_t reg;
 
+       urtwn_write_1(sc, R92C_EFUSE_ACCESS, R92C_EFUSE_ACCESS_ON);
+
        reg = urtwn_read_2(sc, R92C_SYS_ISO_CTRL);
        if (!(reg & R92C_SYS_ISO_CTRL_PWC_EV12V)) {
                urtwn_write_2(sc, R92C_SYS_ISO_CTRL,
@@ -1014,7 +1025,7 @@ urtwn_r88e_read_rom(struct urtwn_softc *
 
        /* Read full ROM image. */
        memset(&sc->r88e_rom, 0xff, sizeof(sc->r88e_rom));
-       while (addr < 1024) {
+       while (addr < 512) {
                reg = urtwn_efuse_read_1(sc, addr);
                if (reg == 0xff)
                        break;
@@ -1040,6 +1051,8 @@ urtwn_r88e_read_rom(struct urtwn_softc *
                }
        }
 
+       urtwn_write_1(sc, R92C_EFUSE_ACCESS, R92C_EFUSE_ACCESS_OFF);
+
        addr = 0x10;
        for (i = 0; i < 6; i++)
                sc->cck_tx_pwr[i] = sc->r88e_rom[addr++];
@@ -1178,7 +1191,7 @@ urtwn_r88e_ra_init(struct urtwn_softc *s
        reg = RW(reg, R92C_RRSR_RATE_BITMAP, rates);
        urtwn_write_4(sc, R92C_RRSR, reg);
 
-       /* 
+       /*
         * Workaround for performance problems with firmware rate adaptation:
         * If the AP only supports 11b rates, disable mixed B/G mode.
         */
@@ -2354,14 +2367,12 @@ urtwn_r92c_power_on(struct urtwn_softc *
 int
 urtwn_r88e_power_on(struct urtwn_softc *sc)
 {
-       uint8_t val;
        uint32_t reg;
        int ntries;
 
        /* Wait for power ready bit. */
        for (ntries = 0; ntries < 5000; ntries++) {
-               val = urtwn_read_1(sc, 0x6) & 0x2;
-               if (val == 0x2)
+               if (urtwn_read_4(sc, R92C_APS_FSMCO) & R92C_APS_FSMCO_SUS_HOST)
                        break;
                DELAY(10);
        }
@@ -2376,17 +2387,24 @@ urtwn_r88e_power_on(struct urtwn_softc *
            urtwn_read_1(sc, R92C_SYS_FUNC_EN) & ~(R92C_SYS_FUNC_EN_BBRSTB |
            R92C_SYS_FUNC_EN_BB_GLB_RST));
 
-       urtwn_write_1(sc, 0x26, urtwn_read_1(sc, 0x26) | 0x80);
+       urtwn_write_1(sc, R92C_AFE_XTAL_CTRL + 2,
+           urtwn_read_1(sc, R92C_AFE_XTAL_CTRL + 2) | 0x80);
 
        /* Disable HWPDN. */
        urtwn_write_1(sc, 0x5, urtwn_read_1(sc, 0x5) & ~0x80);
+       urtwn_write_2(sc, R92C_APS_FSMCO,
+           urtwn_read_2(sc, R92C_APS_FSMCO) & ~R92C_APS_FSMCO_APDM_HPDN);
 
        /* Disable WL suspend. */
-       urtwn_write_1(sc, 0x5, urtwn_read_1(sc, 0x5) & ~0x18);
+       urtwn_write_2(sc, R92C_APS_FSMCO,
+           urtwn_read_2(sc, R92C_APS_FSMCO) &
+           ~(R92C_APS_FSMCO_AFSM_HSUS | R92C_APS_FSMCO_AFSM_PCIE));
 
-       urtwn_write_1(sc, 0x5, urtwn_read_1(sc, 0x5) | 0x1);
+       urtwn_write_2(sc, R92C_APS_FSMCO,
+           urtwn_read_2(sc, R92C_APS_FSMCO) | R92C_APS_FSMCO_APFM_ONMAC);
        for (ntries = 0; ntries < 5000; ntries++) {
-               if (!(urtwn_read_1(sc, 0x5) & 0x1))
+               if (!(urtwn_read_2(sc, R92C_APS_FSMCO) &
+                   R92C_APS_FSMCO_APFM_ONMAC))
                        break;
                DELAY(10);
        }
@@ -2394,7 +2412,8 @@ urtwn_r88e_power_on(struct urtwn_softc *
                return (ETIMEDOUT);
 
        /* Enable LDO normal mode. */
-       urtwn_write_1(sc, 0x23, urtwn_read_1(sc, 0x23) & ~0x10);
+       urtwn_write_1(sc, R92C_LPLDO_CTRL,
+           urtwn_read_1(sc, R92C_LPLDO_CTRL) & ~0x10);
 
        /* Enable MAC DMA/WMAC/SCHEDULE/SEC blocks. */
        urtwn_write_2(sc, R92C_CR, 0);
Index: sys/dev/usb/if_urtwnreg.h
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_urtwnreg.h,v
retrieving revision 1.6
diff -u -p -r1.6 if_urtwnreg.h
--- sys/dev/usb/if_urtwnreg.h   10 May 2015 19:40:56 -0000      1.6
+++ sys/dev/usb/if_urtwnreg.h   11 May 2015 12:20:23 -0000
@@ -171,13 +171,13 @@
 #define R92C_RD_NAV_NXT                        0x544
 #define R92C_NAV_PROT_LEN              0x546
 #define R92C_BCN_CTRL                  0x550
-#define R92C_USTIME_TSF                        0x551
 #define R92C_MBID_NUM                  0x552
 #define R92C_DUAL_TSF_RST              0x553
 #define R92C_BCN_INTERVAL              0x554
 #define R92C_DRVERLYINT                        0x558
 #define R92C_BCNDMATIM                 0x559
 #define R92C_ATIMWND                   0x55a
+#define R92C_USTIME_TSF                        0x55c
 #define R92C_BCN_MAX_ERR               0x55d
 #define R92C_RXTSF_OFFSET_CCK          0x55e
 #define R92C_RXTSF_OFFSET_OFDM         0x55f
Index: sys/dev/usb/usbdevs
===================================================================
RCS file: /cvs/src/sys/dev/usb/usbdevs,v
retrieving revision 1.649
diff -u -p -r1.649 usbdevs
--- sys/dev/usb/usbdevs 5 May 2015 10:16:00 -0000       1.649
+++ sys/dev/usb/usbdevs 11 May 2015 12:20:23 -0000
@@ -1493,6 +1493,8 @@ product DLINK DUBE100C1           0x1a02  DUB-E100
 product DLINK DSB650TX4                0x200c  10/100 Ethernet
 product DLINK DWL120E          0x3200  DWL-120 rev E
 product DLINK DWA130C          0x3301  DWA-130 rev C
+product DLINK DWA125D1         0x330f  DWA-125 rev D1
+product DLINK DWA123D1         0x3310  DWA-123 rev D1
 product DLINK RTL8192CU_1      0x3307  RTL8192CU
 product DLINK RTL8188CU                0x3308  RTL8188CU
 product DLINK RTL8192CU_2      0x3309  RTL8192CU
@@ -1639,6 +1641,7 @@ product ELECOM MOUSE29UO  0x0002  29UO
 product ELECOM LDUSBTX0                0x200c  LD-USB/TX
 product ELECOM LDUSBTX1                0x4002  LD-USB/TX
 product ELECOM LDUSBLTX                0x4005  LD-USBL/TX
+product ELECOM WDC150SU2M      0x4008  WDC-150SU2M
 product ELECOM LDUSBTX2                0x400b  LD-USB/TX
 product ELECOM LDUSB20         0x4010  LD-USB20
 product ELECOM UCSGT           0x5003  UC-SGT Serial
@@ -3511,6 +3514,7 @@ product REALTEK RTL8188RU_3       0x817f  RTL81
 product REALTEK RTL8187                0x8187  RTL8187
 product REALTEK RTL8187B_0     0x8189  RTL8187B
 product REALTEK RTL8188CUS     0x818a  RTL8188CUS
+product REALTEK RTL8188CU_3    0x8191  RTL8188CU
 product REALTEK RTL8187B_1     0x8197  RTL8187B
 product REALTEK RTL8192U       0x8192  RTL8192U
 product REALTEK RTL8187B_2     0x8198  RTL8187B

Reply via email to