Lines Matching +full:transfer +full:- +full:function
33 * rsi_usb_card_write() - This function writes to the USB Card.
46 struct rsi_91x_usbdev *dev = adapter->rsi_dev; in rsi_usb_card_write()
48 u8 *seg = dev->tx_buffer; in rsi_usb_card_write()
49 int transfer; in rsi_usb_card_write() local
50 int ep = dev->bulkout_endpoint_addr[endpoint - 1]; in rsi_usb_card_write()
55 transfer = len; in rsi_usb_card_write()
56 status = usb_bulk_msg(dev->usbdev, in rsi_usb_card_write()
57 usb_sndbulkpipe(dev->usbdev, ep), in rsi_usb_card_write()
60 &transfer, in rsi_usb_card_write()
66 dev->write_fail = 1; in rsi_usb_card_write()
72 * rsi_write_multiple() - This function writes multiple bytes of information
89 return -ENODEV; in rsi_write_multiple()
92 return -EINVAL; in rsi_write_multiple()
94 dev = adapter->rsi_dev; in rsi_write_multiple()
95 if (dev->write_fail) in rsi_write_multiple()
96 return -ENETDOWN; in rsi_write_multiple()
102 * rsi_find_bulk_in_and_out_endpoints() - This function initializes the bulk
107 * Return: ret_val: 0 on success, -ENOMEM on failure.
112 struct rsi_91x_usbdev *dev = adapter->rsi_dev; in rsi_find_bulk_in_and_out_endpoints()
118 iface_desc = interface->cur_altsetting; in rsi_find_bulk_in_and_out_endpoints()
120 for (ii = 0; ii < iface_desc->desc.bNumEndpoints; ++ii) { in rsi_find_bulk_in_and_out_endpoints()
121 endpoint = &(iface_desc->endpoint[ii].desc); in rsi_find_bulk_in_and_out_endpoints()
123 if (!dev->bulkin_endpoint_addr[bin_found] && in rsi_find_bulk_in_and_out_endpoints()
124 (endpoint->bEndpointAddress & USB_DIR_IN) && in rsi_find_bulk_in_and_out_endpoints()
125 ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == in rsi_find_bulk_in_and_out_endpoints()
127 buffer_size = endpoint->wMaxPacketSize; in rsi_find_bulk_in_and_out_endpoints()
128 dev->bulkin_size[bin_found] = buffer_size; in rsi_find_bulk_in_and_out_endpoints()
129 dev->bulkin_endpoint_addr[bin_found] = in rsi_find_bulk_in_and_out_endpoints()
130 endpoint->bEndpointAddress; in rsi_find_bulk_in_and_out_endpoints()
134 if (!dev->bulkout_endpoint_addr[bout_found] && in rsi_find_bulk_in_and_out_endpoints()
135 !(endpoint->bEndpointAddress & USB_DIR_IN) && in rsi_find_bulk_in_and_out_endpoints()
136 ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == in rsi_find_bulk_in_and_out_endpoints()
138 buffer_size = endpoint->wMaxPacketSize; in rsi_find_bulk_in_and_out_endpoints()
139 dev->bulkout_endpoint_addr[bout_found] = in rsi_find_bulk_in_and_out_endpoints()
140 endpoint->bEndpointAddress; in rsi_find_bulk_in_and_out_endpoints()
141 dev->bulkout_size[bout_found] = buffer_size; in rsi_find_bulk_in_and_out_endpoints()
149 if (!(dev->bulkin_endpoint_addr[0] && dev->bulkout_endpoint_addr[0])) { in rsi_find_bulk_in_and_out_endpoints()
150 dev_err(&interface->dev, "missing wlan bulk endpoints\n"); in rsi_find_bulk_in_and_out_endpoints()
151 return -EINVAL; in rsi_find_bulk_in_and_out_endpoints()
154 if (adapter->priv->coex_mode > 1) { in rsi_find_bulk_in_and_out_endpoints()
155 if (!dev->bulkin_endpoint_addr[1]) { in rsi_find_bulk_in_and_out_endpoints()
156 dev_err(&interface->dev, "missing bt bulk-in endpoint\n"); in rsi_find_bulk_in_and_out_endpoints()
157 return -EINVAL; in rsi_find_bulk_in_and_out_endpoints()
167 /* rsi_usb_reg_read() - This function reads data from given register address.
181 int status = -ENOMEM; in rsi_usb_reg_read()
184 return -EINVAL; in rsi_usb_reg_read()
211 * rsi_usb_reg_write() - This function writes the given data into the given
226 int status = -ENOMEM; in rsi_usb_reg_write()
229 return -EINVAL; in rsi_usb_reg_write()
260 * rsi_rx_done_handler() - This function is called when a packet is received
268 struct rx_usb_ctrl_block *rx_cb = urb->context; in rsi_rx_done_handler()
269 struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)rx_cb->data; in rsi_rx_done_handler()
270 int status = -EINVAL; in rsi_rx_done_handler()
272 if (!rx_cb->rx_skb) in rsi_rx_done_handler()
275 if (urb->status) { in rsi_rx_done_handler()
276 dev_kfree_skb(rx_cb->rx_skb); in rsi_rx_done_handler()
277 rx_cb->rx_skb = NULL; in rsi_rx_done_handler()
281 if (urb->actual_length <= 0 || in rsi_rx_done_handler()
282 urb->actual_length > rx_cb->rx_skb->len) { in rsi_rx_done_handler()
284 __func__, urb->actual_length); in rsi_rx_done_handler()
287 if (skb_queue_len(&dev->rx_q) >= RSI_MAX_RX_PKTS) { in rsi_rx_done_handler()
291 skb_trim(rx_cb->rx_skb, urb->actual_length); in rsi_rx_done_handler()
292 skb_queue_tail(&dev->rx_q, rx_cb->rx_skb); in rsi_rx_done_handler()
294 rsi_set_event(&dev->rx_thread.event); in rsi_rx_done_handler()
298 if (rsi_rx_urb_submit(dev->priv, rx_cb->ep_num, GFP_ATOMIC)) in rsi_rx_done_handler()
302 dev_kfree_skb(rx_cb->rx_skb); in rsi_rx_done_handler()
303 rx_cb->rx_skb = NULL; in rsi_rx_done_handler()
309 struct rsi_91x_usbdev *dev = adapter->rsi_dev; in rsi_rx_urb_kill()
310 struct rx_usb_ctrl_block *rx_cb = &dev->rx_cb[ep_num - 1]; in rsi_rx_urb_kill()
311 struct urb *urb = rx_cb->rx_urb; in rsi_rx_urb_kill()
317 * rsi_rx_urb_submit() - This function submits the given URB to the USB stack.
326 struct rsi_91x_usbdev *dev = adapter->rsi_dev; in rsi_rx_urb_submit()
327 struct rx_usb_ctrl_block *rx_cb = &dev->rx_cb[ep_num - 1]; in rsi_rx_urb_submit()
328 struct urb *urb = rx_cb->rx_urb; in rsi_rx_urb_submit()
335 return -ENOMEM; in rsi_rx_urb_submit()
337 skb_put(skb, RSI_MAX_RX_USB_PKT_SIZE - MAX_DWORD_ALIGN_BYTES); in rsi_rx_urb_submit()
338 dword_align_bytes = (unsigned long)skb->data & 0x3f; in rsi_rx_urb_submit()
341 urb->transfer_buffer = skb->data; in rsi_rx_urb_submit()
342 rx_cb->rx_skb = skb; in rsi_rx_urb_submit()
345 dev->usbdev, in rsi_rx_urb_submit()
346 usb_rcvbulkpipe(dev->usbdev, in rsi_rx_urb_submit()
347 dev->bulkin_endpoint_addr[ep_num - 1]), in rsi_rx_urb_submit()
348 urb->transfer_buffer, in rsi_rx_urb_submit()
349 skb->len, in rsi_rx_urb_submit()
365 struct rsi_91x_usbdev *dev = adapter->rsi_dev; in rsi_usb_read_register_multiple()
367 u16 transfer; in rsi_usb_read_register_multiple() local
371 return -EINVAL; in rsi_usb_read_register_multiple()
375 return -ENOMEM; in rsi_usb_read_register_multiple()
378 transfer = min_t(u16, count, RSI_USB_BUF_SIZE); in rsi_usb_read_register_multiple()
379 status = usb_control_msg(dev->usbdev, in rsi_usb_read_register_multiple()
380 usb_rcvctrlpipe(dev->usbdev, 0), in rsi_usb_read_register_multiple()
385 transfer, USB_CTRL_GET_TIMEOUT); in rsi_usb_read_register_multiple()
393 memcpy(data, buf, transfer); in rsi_usb_read_register_multiple()
394 count -= transfer; in rsi_usb_read_register_multiple()
395 data += transfer; in rsi_usb_read_register_multiple()
396 addr += transfer; in rsi_usb_read_register_multiple()
403 * rsi_usb_write_register_multiple() - This function writes multiple bytes of
415 struct rsi_91x_usbdev *dev = adapter->rsi_dev; in rsi_usb_write_register_multiple()
417 u16 transfer; in rsi_usb_write_register_multiple() local
422 return -ENOMEM; in rsi_usb_write_register_multiple()
425 transfer = min_t(u16, count, RSI_USB_BUF_SIZE); in rsi_usb_write_register_multiple()
426 memcpy(buf, data, transfer); in rsi_usb_write_register_multiple()
427 status = usb_control_msg(dev->usbdev, in rsi_usb_write_register_multiple()
428 usb_sndctrlpipe(dev->usbdev, 0), in rsi_usb_write_register_multiple()
434 transfer, in rsi_usb_write_register_multiple()
443 count -= transfer; in rsi_usb_write_register_multiple()
444 data += transfer; in rsi_usb_write_register_multiple()
445 addr += transfer; in rsi_usb_write_register_multiple()
453 *rsi_usb_host_intf_write_pkt() - This function writes the packet to the
481 ((struct rsi_91x_usbdev *)adapter->rsi_dev)->usbdev; in rsi_usb_master_reg_read()
498 ((struct rsi_91x_usbdev *)adapter->rsi_dev)->usbdev; in rsi_usb_master_reg_write()
555 * rsi_deinit_usb_interface() - This function deinitializes the usb interface.
562 struct rsi_91x_usbdev *dev = adapter->rsi_dev; in rsi_deinit_usb_interface()
564 rsi_kill_thread(&dev->rx_thread); in rsi_deinit_usb_interface()
566 usb_free_urb(dev->rx_cb[0].rx_urb); in rsi_deinit_usb_interface()
567 if (adapter->priv->coex_mode > 1) in rsi_deinit_usb_interface()
568 usb_free_urb(dev->rx_cb[1].rx_urb); in rsi_deinit_usb_interface()
570 kfree(dev->tx_buffer); in rsi_deinit_usb_interface()
575 struct rsi_91x_usbdev *dev = adapter->rsi_dev; in rsi_usb_init_rx()
579 num_rx_cb = (adapter->priv->coex_mode > 1 ? 2 : 1); in rsi_usb_init_rx()
582 rx_cb = &dev->rx_cb[idx]; in rsi_usb_init_rx()
584 rx_cb->rx_urb = usb_alloc_urb(0, GFP_KERNEL); in rsi_usb_init_rx()
585 if (!rx_cb->rx_urb) { in rsi_usb_init_rx()
589 rx_cb->ep_num = idx + 1; in rsi_usb_init_rx()
590 rx_cb->data = (void *)dev; in rsi_usb_init_rx()
592 skb_queue_head_init(&dev->rx_q); in rsi_usb_init_rx()
593 rsi_init_event(&dev->rx_thread.event); in rsi_usb_init_rx()
594 if (rsi_create_kthread(adapter->priv, &dev->rx_thread, in rsi_usb_init_rx()
595 rsi_usb_rx_thread, "RX-Thread")) { in rsi_usb_init_rx()
603 usb_free_urb(dev->rx_cb[0].rx_urb); in rsi_usb_init_rx()
604 if (adapter->priv->coex_mode > 1) in rsi_usb_init_rx()
605 usb_free_urb(dev->rx_cb[1].rx_urb); in rsi_usb_init_rx()
607 return -1; in rsi_usb_init_rx()
611 * rsi_init_usb_interface() - This function initializes the usb interface.
625 return -ENOMEM; in rsi_init_usb_interface()
627 adapter->rsi_dev = rsi_dev; in rsi_init_usb_interface()
628 rsi_dev->usbdev = interface_to_usbdev(pfunction); in rsi_init_usb_interface()
629 rsi_dev->priv = (void *)adapter; in rsi_init_usb_interface()
632 status = -EINVAL; in rsi_init_usb_interface()
636 adapter->device = &pfunction->dev; in rsi_init_usb_interface()
639 rsi_dev->tx_buffer = kmalloc(2048, GFP_KERNEL); in rsi_init_usb_interface()
640 if (!rsi_dev->tx_buffer) { in rsi_init_usb_interface()
641 status = -ENOMEM; in rsi_init_usb_interface()
647 status = -ENOMEM; in rsi_init_usb_interface()
651 rsi_dev->tx_blk_size = 252; in rsi_init_usb_interface()
652 adapter->block_size = rsi_dev->tx_blk_size; in rsi_init_usb_interface()
654 /* Initializing function callbacks */ in rsi_init_usb_interface()
655 adapter->check_hw_queue_status = rsi_usb_check_queue_status; in rsi_init_usb_interface()
656 adapter->determine_event_timeout = rsi_usb_event_timeout; in rsi_init_usb_interface()
657 adapter->rsi_host_intf = RSI_HOST_INTF_USB; in rsi_init_usb_interface()
658 adapter->host_intf_ops = &usb_host_intf_ops; in rsi_init_usb_interface()
662 adapter->num_debugfs_entries = (MAX_DEBUGFS_ENTRIES - 1); in rsi_init_usb_interface()
669 kfree(rsi_dev->tx_buffer); in rsi_init_usb_interface()
697 ((len_in_bits - 1) | RSI_GSPI_TRIG), 2); in usb_ulp_read_write()
713 /* This msleep will ensure Thread-Arch processor to go to hold in rsi_reset_card()
726 if (adapter->device_model != RSI_DEV_9116) { in rsi_reset_card()
777 * rsi_probe() - This function is called by kernel when the driver provided
793 rsi_dbg(INIT_ZONE, "%s: Init function called\n", __func__); in rsi_probe()
799 return -ENOMEM; in rsi_probe()
801 adapter->rsi_host_intf = RSI_HOST_INTF_USB; in rsi_probe()
812 if (id->idProduct == RSI_USB_PID_9113) { in rsi_probe()
814 adapter->device_model = RSI_DEV_9113; in rsi_probe()
815 } else if (id->idProduct == RSI_USB_PID_9116) { in rsi_probe()
817 adapter->device_model = RSI_DEV_9116; in rsi_probe()
820 __func__, id->idProduct); in rsi_probe()
821 status = -ENODEV; in rsi_probe()
825 dev = adapter->rsi_dev; in rsi_probe()
827 status = rsi_usb_reg_read(dev->usbdev, FW_STATUS_REG, &fw_status, 2); in rsi_probe()
848 if (adapter->priv->coex_mode > 1) { in rsi_probe()
867 * rsi_disconnect() - This function performs the reverse of the probe function,
882 if (IS_ENABLED(CONFIG_RSI_COEX) && adapter->priv->coex_mode > 1 && in rsi_disconnect()
883 adapter->priv->bt_adapter) { in rsi_disconnect()
884 rsi_bt_ops.detach(adapter->priv->bt_adapter); in rsi_disconnect()
885 adapter->priv->bt_adapter = NULL; in rsi_disconnect()
888 if (adapter->priv->coex_mode > 1) in rsi_disconnect()
903 return -ENOSYS; in rsi_suspend()
909 return -ENOSYS; in rsi_resume()
920 .name = "RSI-USB WLAN",