Lines Matching full:usb
12 #include <linux/usb.h>
23 #include "usb.h"
36 void plfxlc_send_packet_from_data_queue(struct plfxlc_usb *usb) in plfxlc_send_packet_from_data_queue() argument
38 struct plfxlc_usb_tx *tx = &usb->tx; in plfxlc_send_packet_from_data_queue()
44 last_served_sidx = usb->sidx; in plfxlc_send_packet_from_data_queue()
46 usb->sidx = (usb->sidx + 1) % MAX_STA_NUM; in plfxlc_send_packet_from_data_queue()
47 if (!(tx->station[usb->sidx].flag & STATION_CONNECTED_FLAG)) in plfxlc_send_packet_from_data_queue()
49 if (!(tx->station[usb->sidx].flag & STATION_FIFO_FULL_FLAG)) in plfxlc_send_packet_from_data_queue()
50 skb = skb_peek(&tx->station[usb->sidx].data_list); in plfxlc_send_packet_from_data_queue()
51 } while ((usb->sidx != last_served_sidx) && (!skb)); in plfxlc_send_packet_from_data_queue()
54 skb = skb_dequeue(&tx->station[usb->sidx].data_list); in plfxlc_send_packet_from_data_queue()
55 plfxlc_usb_wreq_async(usb, skb->data, skb->len, USB_REQ_DATA_TX, in plfxlc_send_packet_from_data_queue()
57 if (skb_queue_len(&tx->station[usb->sidx].data_list) <= 60) in plfxlc_send_packet_from_data_queue()
58 ieee80211_wake_queues(plfxlc_usb_to_hw(usb)); in plfxlc_send_packet_from_data_queue()
63 static void handle_rx_packet(struct plfxlc_usb *usb, const u8 *buffer, in handle_rx_packet() argument
66 plfxlc_mac_rx(plfxlc_usb_to_hw(usb), buffer, length); in handle_rx_packet()
72 struct plfxlc_usb *usb; in rx_urb_complete() local
87 usb = urb->context; in rx_urb_complete()
89 if (usb->initialized != 1) { in rx_urb_complete()
90 pr_err("usb is not initialized\n"); in rx_urb_complete()
94 tx = &usb->tx; in rx_urb_complete()
124 if (usb->initialized && usb->link_up) in rx_urb_complete()
125 handle_rx_packet(usb, buffer, length); in rx_urb_complete()
133 dev_dbg(&usb->intf->dev, in rx_urb_complete()
140 dev_dbg(&usb->intf->dev, "FIFO full packet receipt\n"); in rx_urb_complete()
145 plfxlc_send_packet_from_data_queue(usb); in rx_urb_complete()
148 usb->link_up = 1; in rx_urb_complete()
149 dev_dbg(&usb->intf->dev, "ST_CONNECT_MSG packet receipt\n"); in rx_urb_complete()
152 usb->link_up = 0; in rx_urb_complete()
153 dev_dbg(&usb->intf->dev, "ST_DISCONN_MSG packet receipt\n"); in rx_urb_complete()
156 dev_dbg(&usb->intf->dev, "Unknown packet receipt\n"); in rx_urb_complete()
166 static struct urb *alloc_rx_urb(struct plfxlc_usb *usb) in alloc_rx_urb() argument
168 struct usb_device *udev = plfxlc_usb_to_usbdev(usb); in alloc_rx_urb()
185 rx_urb_complete, usb); in alloc_rx_urb()
200 static int __lf_x_usb_enable_rx(struct plfxlc_usb *usb) in __lf_x_usb_enable_rx() argument
202 struct plfxlc_usb_rx *rx = &usb->rx; in __lf_x_usb_enable_rx()
212 urbs[i] = alloc_rx_urb(usb); in __lf_x_usb_enable_rx()
219 dev_dbg(plfxlc_usb_dev(usb), "irq_disabled %d\n", irqs_disabled()); in __lf_x_usb_enable_rx()
254 int plfxlc_usb_enable_rx(struct plfxlc_usb *usb) in plfxlc_usb_enable_rx() argument
256 struct plfxlc_usb_rx *rx = &usb->rx; in plfxlc_usb_enable_rx()
260 r = __lf_x_usb_enable_rx(usb); in plfxlc_usb_enable_rx()
262 usb->rx_usb_enabled = 1; in plfxlc_usb_enable_rx()
269 static void __lf_x_usb_disable_rx(struct plfxlc_usb *usb) in __lf_x_usb_disable_rx() argument
271 struct plfxlc_usb_rx *rx = &usb->rx; in __lf_x_usb_disable_rx()
294 void plfxlc_usb_disable_rx(struct plfxlc_usb *usb) in plfxlc_usb_disable_rx() argument
296 struct plfxlc_usb_rx *rx = &usb->rx; in plfxlc_usb_disable_rx()
299 __lf_x_usb_disable_rx(usb); in plfxlc_usb_disable_rx()
300 usb->rx_usb_enabled = 0; in plfxlc_usb_disable_rx()
304 void plfxlc_usb_disable_tx(struct plfxlc_usb *usb) in plfxlc_usb_disable_tx() argument
306 struct plfxlc_usb_tx *tx = &usb->tx; in plfxlc_usb_disable_tx()
325 void plfxlc_usb_enable_tx(struct plfxlc_usb *usb) in plfxlc_usb_enable_tx() argument
327 struct plfxlc_usb_tx *tx = &usb->tx; in plfxlc_usb_enable_tx()
333 ieee80211_wake_queues(plfxlc_usb_to_hw(usb)); in plfxlc_usb_enable_tx()
341 struct plfxlc_usb *usb; in plfxlc_tx_urb_complete() local
346 /* grab 'usb' pointer before handing off the skb (since in plfxlc_tx_urb_complete()
349 usb = &plfxlc_hw_mac(info->rate_driver_data[0])->chip.usb; in plfxlc_tx_urb_complete()
368 plfxlc_send_packet_from_data_queue(usb); in plfxlc_tx_urb_complete()
372 static inline void init_usb_rx(struct plfxlc_usb *usb) in init_usb_rx() argument
374 struct plfxlc_usb_rx *rx = &usb->rx; in init_usb_rx()
379 if (interface_to_usbdev(usb->intf)->speed == USB_SPEED_HIGH) in init_usb_rx()
385 dev_dbg(plfxlc_usb_dev(usb), "fragment_length error\n"); in init_usb_rx()
388 static inline void init_usb_tx(struct plfxlc_usb *usb) in init_usb_tx() argument
390 struct plfxlc_usb_tx *tx = &usb->tx; in init_usb_tx()
399 void plfxlc_usb_init(struct plfxlc_usb *usb, struct ieee80211_hw *hw, in plfxlc_usb_init() argument
402 memset(usb, 0, sizeof(*usb)); in plfxlc_usb_init()
403 usb->intf = usb_get_intf(intf); in plfxlc_usb_init()
404 usb_set_intfdata(usb->intf, hw); in plfxlc_usb_init()
405 init_usb_tx(usb); in plfxlc_usb_init()
406 init_usb_rx(usb); in plfxlc_usb_init()
409 void plfxlc_usb_release(struct plfxlc_usb *usb) in plfxlc_usb_release() argument
411 plfxlc_op_stop(plfxlc_usb_to_hw(usb), false); in plfxlc_usb_release()
412 plfxlc_usb_disable_tx(usb); in plfxlc_usb_release()
413 plfxlc_usb_disable_rx(usb); in plfxlc_usb_release()
414 usb_set_intfdata(usb->intf, NULL); in plfxlc_usb_release()
415 usb_put_intf(usb->intf); in plfxlc_usb_release()
432 int plfxlc_usb_init_hw(struct plfxlc_usb *usb) in plfxlc_usb_init_hw() argument
436 r = usb_reset_configuration(plfxlc_usb_to_usbdev(usb)); in plfxlc_usb_init_hw()
438 dev_err(plfxlc_usb_dev(usb), "cfg reset failed (%d)\n", r); in plfxlc_usb_init_hw()
490 int plfxlc_usb_wreq_async(struct plfxlc_usb *usb, const u8 *buffer, in plfxlc_usb_wreq_async() argument
495 struct usb_device *udev = interface_to_usbdev(usb->ez_usb); in plfxlc_usb_wreq_async()
549 struct plfxlc_usb *usb = from_timer(usb, t, tx.tx_retry_timer); in slif_data_plane_sap_timer_callb() local
551 plfxlc_send_packet_from_data_queue(usb); in slif_data_plane_sap_timer_callb()
552 timer_setup(&usb->tx.tx_retry_timer, in slif_data_plane_sap_timer_callb()
554 mod_timer(&usb->tx.tx_retry_timer, jiffies + TX_RETRY_BACKOFF_JIFF); in slif_data_plane_sap_timer_callb()
559 struct plfxlc_usb *usb = from_timer(usb, t, sta_queue_cleanup); in sta_queue_cleanup_timer_callb() local
560 struct plfxlc_usb_tx *tx = &usb->tx; in sta_queue_cleanup_timer_callb()
573 timer_setup(&usb->sta_queue_cleanup, in sta_queue_cleanup_timer_callb()
575 mod_timer(&usb->sta_queue_cleanup, jiffies + STA_QUEUE_CLEANUP_JIFF); in sta_queue_cleanup_timer_callb()
585 struct plfxlc_usb *usb; in probe() local
598 usb = &chip->usb; in probe()
599 usb->ez_usb = intf; in probe()
600 tx = &usb->tx; in probe()
640 r = plfxlc_usb_init_hw(usb); in probe()
661 r = plfxlc_usb_wreq(usb->ez_usb, in probe()
684 timer_setup(&usb->sta_queue_cleanup, in probe()
686 usb->sta_queue_cleanup.expires = jiffies + STA_QUEUE_CLEANUP_JIFF; in probe()
687 add_timer(&usb->sta_queue_cleanup); in probe()
690 usb->initialized = true; in probe()
706 struct plfxlc_usb *usb; in disconnect() local
715 usb = &mac->chip.usb; in disconnect()
717 del_timer_sync(&usb->tx.tx_retry_timer); in disconnect()
718 del_timer_sync(&usb->sta_queue_cleanup); in disconnect()
735 static void plfxlc_usb_resume(struct plfxlc_usb *usb) in plfxlc_usb_resume() argument
737 struct plfxlc_mac *mac = plfxlc_usb_to_mac(usb); in plfxlc_usb_resume()
740 r = plfxlc_op_start(plfxlc_usb_to_hw(usb)); in plfxlc_usb_resume()
742 dev_warn(plfxlc_usb_dev(usb), in plfxlc_usb_resume()
745 if (usb->was_running) in plfxlc_usb_resume()
748 usb_queue_reset_device(usb->intf); in plfxlc_usb_resume()
755 dev_dbg(plfxlc_usb_dev(usb), in plfxlc_usb_resume()
762 static void plfxlc_usb_stop(struct plfxlc_usb *usb) in plfxlc_usb_stop() argument
764 plfxlc_op_stop(plfxlc_usb_to_hw(usb), false); in plfxlc_usb_stop()
765 plfxlc_usb_disable_tx(usb); in plfxlc_usb_stop()
766 plfxlc_usb_disable_rx(usb); in plfxlc_usb_stop()
768 usb->initialized = false; in plfxlc_usb_stop()
775 struct plfxlc_usb *usb; in pre_reset() local
781 usb = &mac->chip.usb; in pre_reset()
783 usb->was_running = test_bit(PURELIFI_DEVICE_RUNNING, &mac->flags); in pre_reset()
785 plfxlc_usb_stop(usb); in pre_reset()
794 struct plfxlc_usb *usb; in post_reset() local
800 usb = &mac->chip.usb; in post_reset()
802 if (usb->was_running) in post_reset()
803 plfxlc_usb_resume(usb); in post_reset()
822 return &mac->chip.usb; in get_plfxlc_usb()
888 MODULE_DESCRIPTION("USB driver for pureLiFi devices");
892 MODULE_DEVICE_TABLE(usb, usb_ids);