Commit a4302bff authored by Siva Rebbagondla's avatar Siva Rebbagondla Committed by Kalle Valo

rsi: add bluetooth rx endpoint

USB endpoint 1 is used for WLAN which is presently in use.
USB endpoint 2 is introduced for BT Rx traffic. Enumeration
of Rx BT endpoint and submitting Rx BT URB are added.

>From /sys/kernel/debug/usb/devices,
Ad=81(I) is for WLAN EP IN and Ad=01(O) is for Wlan EP OUT.
Ad=82(I) is for BT EP IN and Ad=02(O) is for BT EP OUT.

T:  Bus=01 Lev=01 Prnt=01 Port=09 Cnt=03 Dev#=  4 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1618 ProdID=9113 Rev= 0.02
S:  Manufacturer=Redpine Signals, Inc.
S:  Product=Wireless USB Network Module
S:  SerialNumber=000000000001
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=  2mA
I:* If#= 0 Alt= 0 #EPs= 6 Cls=00(>ifc ) Sub=00 Prot=00 Driver=(none)
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
Signed-off-by: default avatarSiva Rebbagondla <siva.rebbagondla@redpinesignals.com>
Signed-off-by: default avatarPrameela Rani Garnepudi <prameela.j04cs@gmail.com>
Signed-off-by: default avatarAmitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 1100f81b
...@@ -103,41 +103,42 @@ static int rsi_find_bulk_in_and_out_endpoints(struct usb_interface *interface, ...@@ -103,41 +103,42 @@ static int rsi_find_bulk_in_and_out_endpoints(struct usb_interface *interface,
struct usb_host_interface *iface_desc; struct usb_host_interface *iface_desc;
struct usb_endpoint_descriptor *endpoint; struct usb_endpoint_descriptor *endpoint;
__le16 buffer_size; __le16 buffer_size;
int ii, bep_found = 0; int ii, bin_found = 0, bout_found = 0;
iface_desc = &(interface->altsetting[0]); iface_desc = &(interface->altsetting[0]);
for (ii = 0; ii < iface_desc->desc.bNumEndpoints; ++ii) { for (ii = 0; ii < iface_desc->desc.bNumEndpoints; ++ii) {
endpoint = &(iface_desc->endpoint[ii].desc); endpoint = &(iface_desc->endpoint[ii].desc);
if ((!(dev->bulkin_endpoint_addr)) && if (!dev->bulkin_endpoint_addr[bin_found] &&
(endpoint->bEndpointAddress & USB_DIR_IN) && (endpoint->bEndpointAddress & USB_DIR_IN) &&
((endpoint->bmAttributes & ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_BULK)) { USB_ENDPOINT_XFER_BULK)) {
buffer_size = endpoint->wMaxPacketSize; buffer_size = endpoint->wMaxPacketSize;
dev->bulkin_size = buffer_size; dev->bulkin_size[bin_found] = buffer_size;
dev->bulkin_endpoint_addr = dev->bulkin_endpoint_addr[bin_found] =
endpoint->bEndpointAddress; endpoint->bEndpointAddress;
bin_found++;
} }
if (!dev->bulkout_endpoint_addr[bep_found] && if (!dev->bulkout_endpoint_addr[bout_found] &&
!(endpoint->bEndpointAddress & USB_DIR_IN) && !(endpoint->bEndpointAddress & USB_DIR_IN) &&
((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_BULK)) { USB_ENDPOINT_XFER_BULK)) {
dev->bulkout_endpoint_addr[bep_found] = buffer_size = endpoint->wMaxPacketSize;
dev->bulkout_endpoint_addr[bout_found] =
endpoint->bEndpointAddress; endpoint->bEndpointAddress;
buffer_size = endpoint->wMaxPacketSize; buffer_size = endpoint->wMaxPacketSize;
dev->bulkout_size[bep_found] = buffer_size; dev->bulkout_size[bout_found] = buffer_size;
bep_found++; bout_found++;
} }
if (bep_found >= MAX_BULK_EP) if (bin_found >= MAX_BULK_EP || bout_found >= MAX_BULK_EP)
break; break;
} }
if (!(dev->bulkin_endpoint_addr) && if (!(dev->bulkin_endpoint_addr[0]) &&
(dev->bulkout_endpoint_addr[0])) dev->bulkout_endpoint_addr[0])
return -EINVAL; return -EINVAL;
return 0; return 0;
...@@ -273,7 +274,7 @@ static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num) ...@@ -273,7 +274,7 @@ static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num)
usb_fill_bulk_urb(urb, usb_fill_bulk_urb(urb,
dev->usbdev, dev->usbdev,
usb_rcvbulkpipe(dev->usbdev, usb_rcvbulkpipe(dev->usbdev,
dev->bulkin_endpoint_addr), dev->bulkin_endpoint_addr[ep_num - 1]),
urb->transfer_buffer, urb->transfer_buffer,
3000, 3000,
rsi_rx_done_handler, rsi_rx_done_handler,
...@@ -745,6 +746,12 @@ static int rsi_probe(struct usb_interface *pfunction, ...@@ -745,6 +746,12 @@ static int rsi_probe(struct usb_interface *pfunction,
if (status) if (status)
goto err1; goto err1;
if (adapter->priv->coex_mode > 1) {
status = rsi_rx_urb_submit(adapter, BT_EP);
if (status)
goto err1;
}
return 0; return 0;
err1: err1:
rsi_deinit_usb_interface(adapter); rsi_deinit_usb_interface(adapter);
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#define USB_VENDOR_REGISTER_WRITE 0x16 #define USB_VENDOR_REGISTER_WRITE 0x16
#define RSI_USB_TX_HEAD_ROOM 128 #define RSI_USB_TX_HEAD_ROOM 128
#define MAX_RX_URBS 1 #define MAX_RX_URBS 2
#define MAX_BULK_EP 8 #define MAX_BULK_EP 8
#define WLAN_EP 1 #define WLAN_EP 1
#define BT_EP 2 #define BT_EP 2
...@@ -54,8 +54,8 @@ struct rsi_91x_usbdev { ...@@ -54,8 +54,8 @@ struct rsi_91x_usbdev {
struct usb_interface *pfunction; struct usb_interface *pfunction;
struct rx_usb_ctrl_block rx_cb[MAX_RX_URBS]; struct rx_usb_ctrl_block rx_cb[MAX_RX_URBS];
u8 *tx_buffer; u8 *tx_buffer;
__le16 bulkin_size; __le16 bulkin_size[MAX_BULK_EP];
u8 bulkin_endpoint_addr; u8 bulkin_endpoint_addr[MAX_BULK_EP];
__le16 bulkout_size[MAX_BULK_EP]; __le16 bulkout_size[MAX_BULK_EP];
u8 bulkout_endpoint_addr[MAX_BULK_EP]; u8 bulkout_endpoint_addr[MAX_BULK_EP];
u32 tx_blk_size; u32 tx_blk_size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment