Author: kevlo
Date: Fri Feb 28 16:11:43 2014
New Revision: 262605
URL: http://svnweb.freebsd.org/changeset/base/262605

Log:
  MFC r262465:
  
  Add a flag to run's device list which uses a standard scsi eject.
  The flag indicates that the mcu doesn't need to load firmware.
  
  Tested by:    Alex Deiter <alex dot deiter at gmail.com>, myself
  Tested on:    ASUS USB-N66

Modified:
  stable/9/sys/dev/usb/wlan/if_run.c   (contents, props changed)
  stable/9/sys/dev/usb/wlan/if_runvar.h
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/usb/wlan/if_run.c
==============================================================================
--- stable/9/sys/dev/usb/wlan/if_run.c  Fri Feb 28 16:08:31 2014        
(r262604)
+++ stable/9/sys/dev/usb/wlan/if_run.c  Fri Feb 28 16:11:43 2014        
(r262605)
@@ -99,7 +99,8 @@ SYSCTL_INT(_hw_usb_run, OID_AUTO, debug,
 static const STRUCT_USB_HOST_ID run_devs[] = {
 #define        RUN_DEV(v,p)    { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) 
}
 #define        RUN_DEV_EJECT(v,p)      \
-       { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, 0) }
+       { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, RUN_EJECT) }
+#define        RUN_EJECT       1
     RUN_DEV(ABOCOM,            RT2770),
     RUN_DEV(ABOCOM,            RT2870),
     RUN_DEV(ABOCOM,            RT3070),
@@ -314,7 +315,7 @@ static const STRUCT_USB_HOST_ID run_devs
     RUN_DEV(ZINWELL,           RT3072_2),
     RUN_DEV(ZYXEL,             RT2870_1),
     RUN_DEV(ZYXEL,             RT2870_2),
-    RUN_DEV(ZYXEL,             NWD2705),
+    RUN_DEV_EJECT(ZYXEL,       NWD2705),
     RUN_DEV_EJECT(RALINK,      RT_STOR),
 #undef RUN_DEV_EJECT
 #undef RUN_DEV
@@ -706,6 +707,8 @@ run_attach(device_t self)
        device_set_usb_desc(self);
        sc->sc_udev = uaa->device;
        sc->sc_dev = self;
+       if (USB_GET_DRIVER_INFO(uaa) != RUN_EJECT)
+               sc->sc_flags |= RUN_FLAG_FWLOAD_NEEDED;
 
        mtx_init(&sc->sc_mtx, device_get_nameunit(sc->sc_dev),
            MTX_NETWORK_LOCK, MTX_DEF);
@@ -1150,7 +1153,7 @@ run_load_microcode(struct run_softc *sc)
        }
 
        /* write microcode image */
-       if (sc->mac_ver != 0x3593) {
+       if (sc->sc_flags & RUN_FLAG_FWLOAD_NEEDED) {
                run_write_region_1(sc, RT2870_FW_BASE, base, 4096);
                run_write(sc, RT2860_H2M_MAILBOX_CID, 0xffffffff);
                run_write(sc, RT2860_H2M_MAILBOX_STATUS, 0xffffffff);

Modified: stable/9/sys/dev/usb/wlan/if_runvar.h
==============================================================================
--- stable/9/sys/dev/usb/wlan/if_runvar.h       Fri Feb 28 16:08:31 2014        
(r262604)
+++ stable/9/sys/dev/usb/wlan/if_runvar.h       Fri Feb 28 16:11:43 2014        
(r262605)
@@ -154,6 +154,11 @@ struct run_softc {
        device_t                        sc_dev;
        struct usb_device               *sc_udev;
        struct ifnet                    *sc_ifp;
+       int                             sc_need_fwload;
+
+       int                             sc_flags;
+#define        RUN_FLAG_FWLOAD_NEEDED          0x01
+
        uint16_t                        wcid_stats[RT2870_WCID_MAX + 1][3];
 #define        RUN_TXCNT       0
 #define        RUN_SUCCESS     1
_______________________________________________
svn-src-stable-9@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"

Reply via email to