Skip to content

Commit de51b35

Browse files
michael-devlinvjw
authored andcommitted
rt2800usb:fix efuse detection
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> Acked-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 7f4dbaa commit de51b35

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

drivers/net/wireless/rt2x00/rt2800usb.c

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,27 @@ static enum hrtimer_restart rt2800usb_tx_sta_fifo_timeout(struct hrtimer *timer)
229229
/*
230230
* Firmware functions
231231
*/
232+
static int rt2800usb_autorun_detect(struct rt2x00_dev *rt2x00dev)
233+
{
234+
__le32 reg;
235+
u32 fw_mode;
236+
237+
/* cannot use rt2x00usb_register_read here as it uses different
238+
* mode (MULTI_READ vs. DEVICE_MODE) and does not pass the
239+
* magic value USB_MODE_AUTORUN (0x11) to the device, thus the
240+
* returned value would be invalid.
241+
*/
242+
rt2x00usb_vendor_request(rt2x00dev, USB_DEVICE_MODE,
243+
USB_VENDOR_REQUEST_IN, 0, USB_MODE_AUTORUN,
244+
&reg, sizeof(reg), REGISTER_TIMEOUT_FIRMWARE);
245+
fw_mode = le32_to_cpu(reg);
246+
247+
if ((fw_mode & 0x00000003) == 2)
248+
return 1;
249+
250+
return 0;
251+
}
252+
232253
static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev)
233254
{
234255
return FIRMWARE_RT2870;
@@ -735,11 +756,18 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry,
735756
/*
736757
* Device probe functions.
737758
*/
759+
static int rt2800usb_efuse_detect(struct rt2x00_dev *rt2x00dev)
760+
{
761+
if (rt2800usb_autorun_detect(rt2x00dev))
762+
return 1;
763+
return rt2800_efuse_detect(rt2x00dev);
764+
}
765+
738766
static int rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev)
739767
{
740768
int retval;
741769

742-
if (rt2800_efuse_detect(rt2x00dev))
770+
if (rt2800usb_efuse_detect(rt2x00dev))
743771
retval = rt2800_read_eeprom_efuse(rt2x00dev);
744772
else
745773
retval = rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom,

drivers/net/wireless/rt2x00/rt2x00usb.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ enum rt2x00usb_mode_offset {
9393
USB_MODE_SLEEP = 7, /* RT73USB */
9494
USB_MODE_FIRMWARE = 8, /* RT73USB */
9595
USB_MODE_WAKEUP = 9, /* RT73USB */
96+
USB_MODE_AUTORUN = 17, /* RT2800USB */
9697
};
9798

9899
/**

0 commit comments

Comments
 (0)