diff mbox

[1/2] rt2800usb:fix efuse detection

Message ID 20140601175247.7980.2461.stgit@charlie.fem.tu-ilmenau.de (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

michael-dev June 1, 2014, 5:52 p.m. UTC
The device 057c:8501 (AVM Fritz! WLAN v2 rev. B) currently does not
load. One thing observed is that the vendors driver detects EFUSE mode
for this device, but rt2800usb does not. This is due to rt2800usb
lacking a check for the firmware mode present in the vendors driver,
that this patch adopts for rt2800usb.

With this patch applied, the 'RF chipset' detection does no longer fail.

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


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" 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:06 p.m. UTC | #1
Hello.

On 06/01/2014 09:52 PM, Michael Braun wrote:

> The device 057c:8501 (AVM Fritz! WLAN v2 rev. B) currently does not
> load. One thing observed is that the vendors driver detects EFUSE mode
> for this device, but rt2800usb does not. This is due to rt2800usb
> lacking a check for the firmware mode present in the vendors driver,
> that this patch adopts for rt2800usb.

> With this patch applied, the 'RF chipset' detection does no longer fail.

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

> diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
> index a49c3d7..b601422 100644
> --- a/drivers/net/wireless/rt2x00/rt2800usb.c
> +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
> @@ -735,11 +735,25 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry,
>   /*
>    * Device probe functions.
>    */
> +static int rt2800usb_efuse_detect(struct rt2x00_dev *rt2x00dev)
> +{
> +	__le32 fwMode;
> +
> +	rt2x00usb_vendor_request(rt2x00dev, USB_DEVICE_MODE,
> +				 USB_VENDOR_REQUEST_IN, 0, 0x11, &fwMode,
> +				 sizeof(fwMode), REGISTER_TIMEOUT_FIRMWARE);
> +
> +	if ((fwMode & 0x00000003) == 2)

    Operating directly on '__le32'? That doesn't look right.

> +		return 1;
> +
> +	return rt2800_efuse_detect(rt2x00dev);
> +}
> +

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stanislaw Gruszka June 2, 2014, 1:06 p.m. UTC | #2
On Sun, Jun 01, 2014 at 11:06:11PM +0400, Sergei Shtylyov wrote:
> >+	rt2x00usb_vendor_request(rt2x00dev, USB_DEVICE_MODE,
> >+				 USB_VENDOR_REQUEST_IN, 0, 0x11, &fwMode,
> >+				 sizeof(fwMode), REGISTER_TIMEOUT_FIRMWARE);
> >+
> >+	if ((fwMode & 0x00000003) == 2)
> 
>    Operating directly on '__le32'? That doesn't look right.

rt2x00usb_register_read() helper can be used to do conversion. I also
dislike using 0x11 number instead of register name and prefer kernel
like variable names (i.e. fw_mode instead of fwMode).

Thanks
Stanislaw
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" 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 a49c3d7..b601422 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -735,11 +735,25 @@  static void rt2800usb_fill_rxdone(struct queue_entry *entry,
 /*
  * Device probe functions.
  */
+static int rt2800usb_efuse_detect(struct rt2x00_dev *rt2x00dev)
+{
+	__le32 fwMode;
+
+	rt2x00usb_vendor_request(rt2x00dev, USB_DEVICE_MODE,
+				 USB_VENDOR_REQUEST_IN, 0, 0x11, &fwMode,
+				 sizeof(fwMode), REGISTER_TIMEOUT_FIRMWARE);
+
+	if ((fwMode & 0x00000003) == 2)
+		return 1;
+
+	return rt2800_efuse_detect(rt2x00dev);
+}
+
 static int rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev)
 {
 	int retval;
 
-	if (rt2800_efuse_detect(rt2x00dev))
+	if (rt2800usb_efuse_detect(rt2x00dev))
 		retval = rt2800_read_eeprom_efuse(rt2x00dev);
 	else
 		retval = rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom,