diff options
author | George <george0505@realtek.com> | 2011-11-17 13:14:42 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-11-21 16:20:44 -0500 |
commit | 040a72785cf19fd8032f24d584ee305158c87ac7 (patch) | |
tree | 7982448c3c1c0333dad4cf149a685f5963065aa1 | |
parent | 4745fc095da0d276b9c149e87b853b78d42d4f32 (diff) |
rtlwifi: rtl8192cu: Allow retries for USB I/O
The USB driver does not retry reads - allow 10 tries.
Signed-off-by: George <george0505@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/rtlwifi/usb.c | 18 |
2 files changed, 16 insertions, 4 deletions
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h index 3d5823c12621..fcc4032585dc 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h +++ b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h | |||
@@ -32,7 +32,7 @@ | |||
32 | 32 | ||
33 | #define FW_8192C_SIZE 0x3000 | 33 | #define FW_8192C_SIZE 0x3000 |
34 | #define FW_8192C_START_ADDRESS 0x1000 | 34 | #define FW_8192C_START_ADDRESS 0x1000 |
35 | #define FW_8192C_END_ADDRESS 0x3FFF | 35 | #define FW_8192C_END_ADDRESS 0x1FFF |
36 | #define FW_8192C_PAGE_SIZE 4096 | 36 | #define FW_8192C_PAGE_SIZE 4096 |
37 | #define FW_8192C_POLLING_DELAY 5 | 37 | #define FW_8192C_POLLING_DELAY 5 |
38 | #define FW_8192C_POLLING_TIMEOUT_COUNT 100 | 38 | #define FW_8192C_POLLING_TIMEOUT_COUNT 100 |
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index b42c2e2b2055..209105c8e3dc 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "usb.h" | 33 | #include "usb.h" |
34 | #include "base.h" | 34 | #include "base.h" |
35 | #include "ps.h" | 35 | #include "ps.h" |
36 | #include "rtl8192c/fw_common.h" | ||
36 | 37 | ||
37 | #define REALTEK_USB_VENQT_READ 0xC0 | 38 | #define REALTEK_USB_VENQT_READ 0xC0 |
38 | #define REALTEK_USB_VENQT_WRITE 0x40 | 39 | #define REALTEK_USB_VENQT_WRITE 0x40 |
@@ -40,6 +41,7 @@ | |||
40 | #define REALTEK_USB_VENQT_CMD_IDX 0x00 | 41 | #define REALTEK_USB_VENQT_CMD_IDX 0x00 |
41 | 42 | ||
42 | #define REALTEK_USB_VENQT_MAX_BUF_SIZE 254 | 43 | #define REALTEK_USB_VENQT_MAX_BUF_SIZE 254 |
44 | #define MAX_USBCTRL_VENDORREQ_TIMES 10 | ||
43 | 45 | ||
44 | static void usbctrl_async_callback(struct urb *urb) | 46 | static void usbctrl_async_callback(struct urb *urb) |
45 | { | 47 | { |
@@ -99,13 +101,23 @@ static int _usbctrl_vendorreq_sync_read(struct usb_device *udev, u8 request, | |||
99 | unsigned int pipe; | 101 | unsigned int pipe; |
100 | int status; | 102 | int status; |
101 | u8 reqtype; | 103 | u8 reqtype; |
104 | int vendorreq_times = 0; | ||
102 | 105 | ||
103 | pipe = usb_rcvctrlpipe(udev, 0); /* read_in */ | 106 | pipe = usb_rcvctrlpipe(udev, 0); /* read_in */ |
104 | reqtype = REALTEK_USB_VENQT_READ; | 107 | reqtype = REALTEK_USB_VENQT_READ; |
105 | 108 | ||
106 | status = usb_control_msg(udev, pipe, request, reqtype, value, index, | 109 | while (++vendorreq_times <= MAX_USBCTRL_VENDORREQ_TIMES) { |
107 | pdata, len, 0); /* max. timeout */ | 110 | status = usb_control_msg(udev, pipe, request, reqtype, value, |
108 | 111 | index, pdata, len, 0); /*max. timeout*/ | |
112 | if (status < 0) { | ||
113 | /* firmware download is checksumed, don't retry */ | ||
114 | if ((value >= FW_8192C_START_ADDRESS && | ||
115 | value <= FW_8192C_END_ADDRESS)) | ||
116 | break; | ||
117 | } else { | ||
118 | break; | ||
119 | } | ||
120 | } | ||
109 | if (status < 0) | 121 | if (status < 0) |
110 | pr_err("reg 0x%x, usbctrl_vendorreq TimeOut! status:0x%x value=0x%x\n", | 122 | pr_err("reg 0x%x, usbctrl_vendorreq TimeOut! status:0x%x value=0x%x\n", |
111 | value, status, *(u32 *)pdata); | 123 | value, status, *(u32 *)pdata); |