diff mbox

[2/2] rt2800usb:fix hang during firmware load

Message ID 20140601175252.7980.64143.stgit@charlie.fem.tu-ilmenau.de
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show

Commit Message

michael-dev June 1, 2014, 5:52 p.m. UTC
The device 057c:8501 (AVM Fritz! WLAN v2 rev. B) boots into a state that does not actually require loading a firmware file.
The vendors driver finds out about this by checking a firmware state
register, so this patch adopts this here.

Finally, with this patch applied, my wifi dongle actually becomes
usefull (scan + connect to wpa network works).

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
---
 drivers/net/wireless/rt2x00/rt2800usb.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Sergei Shtylyov June 1, 2014, 7:09 p.m. UTC | #1
On 06/01/2014 09:52 PM, Michael Braun wrote:

> The device 057c:8501 (AVM Fritz! WLAN v2 rev. B) boots into a state that does not actually require loading a firmware file.

    Wrap the changelog lines on at least 80 chars please.

> The vendors driver finds out about this by checking a firmware state
> register, so this patch adopts this here.

> Finally, with this patch applied, my wifi dongle actually becomes
> usefull (scan + connect to wpa network works).

    s/usefull/useful/.

> Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
> ---
>   drivers/net/wireless/rt2x00/rt2800usb.c |   14 ++++++++++++--
>   1 file changed, 12 insertions(+), 2 deletions(-)

> diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
> index b601422..71bf101 100644
> --- a/drivers/net/wireless/rt2x00/rt2800usb.c
> +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
> @@ -240,6 +240,7 @@ static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev,
>   	int status;
>   	u32 offset;
>   	u32 length;
> +	__le32 fwMode;
>
>   	/*
>   	 * Check which section of the firmware we need.
> @@ -257,8 +258,17 @@ static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev,
>   	/*
>   	 * Write firmware to device.
>   	 */
> -	rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE,
> -				      data + offset, length);
> +	rt2x00usb_vendor_request(rt2x00dev, USB_DEVICE_MODE,
> +				 USB_VENDOR_REQUEST_IN, 0, 0x11, &fwMode,
> +				 sizeof(fwMode), REGISTER_TIMEOUT_FIRMWARE);
> +
> +	if ((fwMode & 0x00000003) == 2) {

    Same comment as for the patch #1.

> +		rt2x00_info(rt2x00dev,
> +		      "Firmware loading not required - NIC in AutoRun mode\n");

    This line should start under 'rt2xx00dev', like below.

> +	} else {
> +		rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE,
> +					      data + offset, length);
> +	}

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index b601422..71bf101 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -240,6 +240,7 @@  static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev,
 	int status;
 	u32 offset;
 	u32 length;
+	__le32 fwMode;
 
 	/*
 	 * Check which section of the firmware we need.
@@ -257,8 +258,17 @@  static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev,
 	/*
 	 * Write firmware to device.
 	 */
-	rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE,
-				      data + offset, length);
+	rt2x00usb_vendor_request(rt2x00dev, USB_DEVICE_MODE,
+				 USB_VENDOR_REQUEST_IN, 0, 0x11, &fwMode,
+				 sizeof(fwMode), REGISTER_TIMEOUT_FIRMWARE);
+
+	if ((fwMode & 0x00000003) == 2) {
+		rt2x00_info(rt2x00dev,
+		      "Firmware loading not required - NIC in AutoRun mode\n");
+	} else {
+		rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE,
+					      data + offset, length);
+	}
 
 	rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);
 	rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0);