.. | .. |
---|
146 | 146 | break; |
---|
147 | 147 | } |
---|
148 | 148 | |
---|
149 | | - if (!(dev->bulkin_endpoint_addr[0]) && |
---|
150 | | - dev->bulkout_endpoint_addr[0]) |
---|
| 149 | + if (!(dev->bulkin_endpoint_addr[0] && dev->bulkout_endpoint_addr[0])) { |
---|
| 150 | + dev_err(&interface->dev, "missing wlan bulk endpoints\n"); |
---|
151 | 151 | return -EINVAL; |
---|
| 152 | + } |
---|
| 153 | + |
---|
| 154 | + if (adapter->priv->coex_mode > 1) { |
---|
| 155 | + if (!dev->bulkin_endpoint_addr[1]) { |
---|
| 156 | + dev_err(&interface->dev, "missing bt bulk-in endpoint\n"); |
---|
| 157 | + return -EINVAL; |
---|
| 158 | + } |
---|
| 159 | + } |
---|
152 | 160 | |
---|
153 | 161 | return 0; |
---|
154 | 162 | } |
---|
.. | .. |
---|
211 | 219 | */ |
---|
212 | 220 | static int rsi_usb_reg_write(struct usb_device *usbdev, |
---|
213 | 221 | u32 reg, |
---|
214 | | - u16 value, |
---|
| 222 | + u32 value, |
---|
215 | 223 | u16 len) |
---|
216 | 224 | { |
---|
217 | 225 | u8 *usb_reg_buf; |
---|
.. | .. |
---|
224 | 232 | if (!usb_reg_buf) |
---|
225 | 233 | return status; |
---|
226 | 234 | |
---|
227 | | - usb_reg_buf[0] = (value & 0x00ff); |
---|
228 | | - usb_reg_buf[1] = (value & 0xff00) >> 8; |
---|
229 | | - usb_reg_buf[2] = 0x0; |
---|
230 | | - usb_reg_buf[3] = 0x0; |
---|
| 235 | + usb_reg_buf[0] = (cpu_to_le32(value) & 0x00ff); |
---|
| 236 | + usb_reg_buf[1] = (cpu_to_le32(value) & 0xff00) >> 8; |
---|
| 237 | + usb_reg_buf[2] = (cpu_to_le32(value) & 0x00ff0000) >> 16; |
---|
| 238 | + usb_reg_buf[3] = (cpu_to_le32(value) & 0xff000000) >> 24; |
---|
231 | 239 | |
---|
232 | 240 | status = usb_control_msg(usbdev, |
---|
233 | 241 | usb_sndctrlpipe(usbdev, 0), |
---|
234 | 242 | USB_VENDOR_REGISTER_WRITE, |
---|
235 | 243 | RSI_USB_REQ_OUT, |
---|
236 | | - ((reg & 0xffff0000) >> 16), |
---|
237 | | - (reg & 0xffff), |
---|
| 244 | + ((cpu_to_le32(reg) & 0xffff0000) >> 16), |
---|
| 245 | + (cpu_to_le32(reg) & 0xffff), |
---|
238 | 246 | (void *)usb_reg_buf, |
---|
239 | 247 | len, |
---|
240 | 248 | USB_CTRL_SET_TIMEOUT); |
---|
.. | .. |
---|
250 | 258 | |
---|
251 | 259 | /** |
---|
252 | 260 | * rsi_rx_done_handler() - This function is called when a packet is received |
---|
253 | | - * from USB stack. This is callback to recieve done. |
---|
| 261 | + * from USB stack. This is callback to receive done. |
---|
254 | 262 | * @urb: Received URB. |
---|
255 | 263 | * |
---|
256 | 264 | * Return: None. |
---|
.. | .. |
---|
261 | 269 | struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)rx_cb->data; |
---|
262 | 270 | int status = -EINVAL; |
---|
263 | 271 | |
---|
264 | | - if (urb->status) |
---|
265 | | - goto out; |
---|
| 272 | + if (!rx_cb->rx_skb) |
---|
| 273 | + return; |
---|
| 274 | + |
---|
| 275 | + if (urb->status) { |
---|
| 276 | + dev_kfree_skb(rx_cb->rx_skb); |
---|
| 277 | + rx_cb->rx_skb = NULL; |
---|
| 278 | + return; |
---|
| 279 | + } |
---|
266 | 280 | |
---|
267 | 281 | if (urb->actual_length <= 0 || |
---|
268 | 282 | urb->actual_length > rx_cb->rx_skb->len) { |
---|
.. | .. |
---|
284 | 298 | if (rsi_rx_urb_submit(dev->priv, rx_cb->ep_num, GFP_ATOMIC)) |
---|
285 | 299 | rsi_dbg(ERR_ZONE, "%s: Failed in urb submission", __func__); |
---|
286 | 300 | |
---|
287 | | - if (status) |
---|
| 301 | + if (status) { |
---|
288 | 302 | dev_kfree_skb(rx_cb->rx_skb); |
---|
| 303 | + rx_cb->rx_skb = NULL; |
---|
| 304 | + } |
---|
289 | 305 | } |
---|
290 | 306 | |
---|
291 | 307 | static void rsi_rx_urb_kill(struct rsi_hw *adapter, u8 ep_num) |
---|
.. | .. |
---|
705 | 721 | goto fail; |
---|
706 | 722 | } |
---|
707 | 723 | |
---|
708 | | - ret = usb_ulp_read_write(adapter, RSI_WATCH_DOG_TIMER_1, |
---|
709 | | - RSI_ULP_WRITE_2, 32); |
---|
710 | | - if (ret < 0) |
---|
711 | | - goto fail; |
---|
712 | | - ret = usb_ulp_read_write(adapter, RSI_WATCH_DOG_TIMER_2, |
---|
713 | | - RSI_ULP_WRITE_0, 32); |
---|
714 | | - if (ret < 0) |
---|
715 | | - goto fail; |
---|
716 | | - ret = usb_ulp_read_write(adapter, RSI_WATCH_DOG_DELAY_TIMER_1, |
---|
717 | | - RSI_ULP_WRITE_50, 32); |
---|
718 | | - if (ret < 0) |
---|
719 | | - goto fail; |
---|
720 | | - ret = usb_ulp_read_write(adapter, RSI_WATCH_DOG_DELAY_TIMER_2, |
---|
721 | | - RSI_ULP_WRITE_0, 32); |
---|
722 | | - if (ret < 0) |
---|
723 | | - goto fail; |
---|
724 | | - ret = usb_ulp_read_write(adapter, RSI_WATCH_DOG_TIMER_ENABLE, |
---|
725 | | - RSI_ULP_TIMER_ENABLE, 32); |
---|
726 | | - if (ret < 0) |
---|
727 | | - goto fail; |
---|
| 724 | + if (adapter->device_model != RSI_DEV_9116) { |
---|
| 725 | + ret = usb_ulp_read_write(adapter, RSI_WATCH_DOG_TIMER_1, |
---|
| 726 | + RSI_ULP_WRITE_2, 32); |
---|
| 727 | + if (ret < 0) |
---|
| 728 | + goto fail; |
---|
| 729 | + ret = usb_ulp_read_write(adapter, RSI_WATCH_DOG_TIMER_2, |
---|
| 730 | + RSI_ULP_WRITE_0, 32); |
---|
| 731 | + if (ret < 0) |
---|
| 732 | + goto fail; |
---|
| 733 | + ret = usb_ulp_read_write(adapter, RSI_WATCH_DOG_DELAY_TIMER_1, |
---|
| 734 | + RSI_ULP_WRITE_50, 32); |
---|
| 735 | + if (ret < 0) |
---|
| 736 | + goto fail; |
---|
| 737 | + ret = usb_ulp_read_write(adapter, RSI_WATCH_DOG_DELAY_TIMER_2, |
---|
| 738 | + RSI_ULP_WRITE_0, 32); |
---|
| 739 | + if (ret < 0) |
---|
| 740 | + goto fail; |
---|
| 741 | + ret = usb_ulp_read_write(adapter, RSI_WATCH_DOG_TIMER_ENABLE, |
---|
| 742 | + RSI_ULP_TIMER_ENABLE, 32); |
---|
| 743 | + if (ret < 0) |
---|
| 744 | + goto fail; |
---|
| 745 | + } else { |
---|
| 746 | + ret = rsi_usb_master_reg_write(adapter, |
---|
| 747 | + NWP_WWD_INTERRUPT_TIMER, |
---|
| 748 | + NWP_WWD_INT_TIMER_CLKS, |
---|
| 749 | + RSI_9116_REG_SIZE); |
---|
| 750 | + if (ret < 0) |
---|
| 751 | + goto fail; |
---|
| 752 | + ret = rsi_usb_master_reg_write(adapter, |
---|
| 753 | + NWP_WWD_SYSTEM_RESET_TIMER, |
---|
| 754 | + NWP_WWD_SYS_RESET_TIMER_CLKS, |
---|
| 755 | + RSI_9116_REG_SIZE); |
---|
| 756 | + if (ret < 0) |
---|
| 757 | + goto fail; |
---|
| 758 | + ret = rsi_usb_master_reg_write(adapter, |
---|
| 759 | + NWP_WWD_MODE_AND_RSTART, |
---|
| 760 | + NWP_WWD_TIMER_DISABLE, |
---|
| 761 | + RSI_9116_REG_SIZE); |
---|
| 762 | + if (ret < 0) |
---|
| 763 | + goto fail; |
---|
| 764 | + } |
---|
728 | 765 | |
---|
729 | 766 | rsi_dbg(INFO_ZONE, "Reset card done\n"); |
---|
730 | 767 | return ret; |
---|
.. | .. |
---|
769 | 806 | } |
---|
770 | 807 | |
---|
771 | 808 | rsi_dbg(ERR_ZONE, "%s: Initialized os intf ops\n", __func__); |
---|
| 809 | + |
---|
| 810 | + if (id->idProduct == RSI_USB_PID_9113) { |
---|
| 811 | + rsi_dbg(INIT_ZONE, "%s: 9113 module detected\n", __func__); |
---|
| 812 | + adapter->device_model = RSI_DEV_9113; |
---|
| 813 | + } else if (id->idProduct == RSI_USB_PID_9116) { |
---|
| 814 | + rsi_dbg(INIT_ZONE, "%s: 9116 module detected\n", __func__); |
---|
| 815 | + adapter->device_model = RSI_DEV_9116; |
---|
| 816 | + } else { |
---|
| 817 | + rsi_dbg(ERR_ZONE, "%s: Unsupported RSI device id 0x%x\n", |
---|
| 818 | + __func__, id->idProduct); |
---|
| 819 | + status = -ENODEV; |
---|
| 820 | + goto err1; |
---|
| 821 | + } |
---|
772 | 822 | |
---|
773 | 823 | dev = (struct rsi_91x_usbdev *)adapter->rsi_dev; |
---|
774 | 824 | |
---|
.. | .. |
---|
859 | 909 | #endif |
---|
860 | 910 | |
---|
861 | 911 | static const struct usb_device_id rsi_dev_table[] = { |
---|
862 | | - { USB_DEVICE(RSI_USB_VID_9113, RSI_USB_PID_9113) }, |
---|
| 912 | + { USB_DEVICE(RSI_USB_VENDOR_ID, RSI_USB_PID_9113) }, |
---|
| 913 | + { USB_DEVICE(RSI_USB_VENDOR_ID, RSI_USB_PID_9116) }, |
---|
863 | 914 | { /* Blank */}, |
---|
864 | 915 | }; |
---|
865 | 916 | |
---|