Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Feb 2014 16:42:55 +0800
From:      Kevin Lo <kevlo@FreeBSD.org>
To:        Alex Deiter <alex.deiter@gmail.com>
Cc:        freebsd-wireless@freebsd.org
Subject:   Re: Ralink RT3573 / ASUS USB-N66: run0: could not load 8051 microcode
Message-ID:  <530B060F.8030204@FreeBSD.org>
In-Reply-To: <53041318.6090303@FreeBSD.org>
References:  <CAAi9siYMdL12t6jHMyt9ZUaC541qneFrB5dWh2ooK2_%2Bnnw9_Q@mail.gmail.com> <63a130f264cbfb29dc3fd34ab3170447.squirrel@mx.waitman.net> <CAAi9siaqTik7t5V5SW3qVXGqiWrKLNGORGHX__SeFy=jkBzReQ@mail.gmail.com> <53041318.6090303@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------070708040301060900090202
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

On 2014/02/19 10:12, Kevin Lo wrote:
> On 2014/02/18 14:17, Alex Deiter wrote:
>> Hello,
>
> Hi Alex,
>
>>
>> Thank you for your advice!
>> I found a workaround:
>>
>> # ifconfig wlan0 create wlandev run0
>>
>> then wait 5 minutes ;-)
>>
>> and only thereafter:
>>
>> # ifconfig wlan0 up
>>
>> run0: <1.0> on usbus1
>> run0: MAC/BBP RT3593 (rev 0x0402), RF RT3053 (MIMO 3T3R), address
>> 30:85:a9:f4:52:bd
>> uhid0: <vendor 0x04d9 USB Keyboard, class 0/0, rev 1.10/1.01, addr 4> on
>> usbus1
>> wlan0: Ethernet address: 30:85:a9:f4:52:bd
>> run0: firmware RT3071 ver. 0.33 loaded
>>
>> But found another issue: ifconfig wlan0 list scan command does not 
>> show any
>> results:
>>
>> root@test:~ # ifconfig wlan0 list scan
>> root@test:~ #
>>
>> root@test:~ # wlandebug -i wlan0 scan
>> net.wlan.0.debug: 0x0 => 0x200000<scan>
>>
>> wlan0: sta_pick_bss: no scan candidate
>> wlan0: scan_task: done, restart [ticks 487917, dwell min 20 scanend
>> 2147963261]
>> wlan0: scan_task: chan 140a ->   1g [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan   1g ->   6g [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan   6g ->  11g [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan  11g ->   7g [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan   7g ->  52a [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan  52a ->  56a [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan  56a ->  60a [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan  60a ->  64a [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan  64a ->  36a [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan  36a ->  40a [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan  40a ->  44a [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan  44a ->  48a [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan  48a ->   2g [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan   2g ->   3g [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan   3g ->   4g [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan   4g ->   5g [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan   5g ->   8g [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan   8g ->   9g [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan   9g ->  10g [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan  10g -> 149a [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan 149a -> 153a [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan 153a -> 157a [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan 157a -> 161a [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan 161a -> 100a [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan 100a -> 104a [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan 104a -> 108a [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan 108a -> 112a [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan 112a -> 116a [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan 116a -> 120a [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan 120a -> 124a [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan 124a -> 128a [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan 128a -> 132a [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan 132a -> 136a [active, dwell min 20ms max 200ms]
>> wlan0: scan_task: chan 136a -> 140a [active, dwell min 20ms max 200ms]
>> wlan0: sta_pick_bss: no scan candidate
>
> I have an ZyxXEL NWD2705 working fine.  It has the exact same chipset as
> the ASUS USB-N66.  So far I haven't been able to come up with a good
> solution to your problem.  I purchased the ASUS USB-N66 and will arrive
> in the next couple of days.  Hope I could find a new interesting bug :-)

After r258363, I forgot to add a flag to run's device list which uses a
standard scsi eject.  The ASUS USB-N66 has been tested to work on my laptop.
The attached patch should fix your problem :-)  Please test it, thanks.

     Kevin

--------------070708040301060900090202
Content-Type: text/plain; charset=UTF-8;
 name="patch-if_run"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="patch-if_run"

Index: sys/dev/usb/wlan/if_run.c
===================================================================
--- sys/dev/usb/wlan/if_run.c	(revision 262433)
+++ sys/dev/usb/wlan/if_run.c	(working copy)
@@ -100,7 +100,8 @@ SYSCTL_INT(_hw_usb_run, OID_AUTO, debug, CTLFLAG_R
 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),
@@ -315,7 +316,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
@@ -707,6 +708,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);
@@ -1151,7 +1154,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);
Index: sys/dev/usb/wlan/if_runvar.h
===================================================================
--- sys/dev/usb/wlan/if_runvar.h	(revision 262433)
+++ sys/dev/usb/wlan/if_runvar.h	(working copy)
@@ -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

--------------070708040301060900090202--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?530B060F.8030204>