• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/net/wireless/ath/ath9k/

Lines Matching defs:hif_dev

51 static int __hif_usb_tx(struct hif_device_usb *hif_dev);
70 ath9k_htc_txcompletion_cb(cmd->hif_dev->htc_handle,
81 static int hif_usb_send_regout(struct hif_device_usb *hif_dev,
99 cmd->hif_dev = hif_dev;
101 usb_fill_int_urb(urb, hif_dev->udev,
102 usb_sndintpipe(hif_dev->udev, USB_REG_OUT_PIPE),
106 usb_anchor_urb(urb, &hif_dev->regout_submitted);
117 static inline void ath9k_skb_queue_purge(struct hif_device_usb *hif_dev,
131 struct hif_device_usb *hif_dev;
134 if (!tx_buf || !tx_buf->hif_dev)
137 hif_dev = tx_buf->hif_dev;
149 ath9k_skb_queue_purge(hif_dev, &tx_buf->skb_queue);
155 spin_lock(&hif_dev->tx.tx_lock);
156 if (hif_dev->tx.flags & HIF_USB_TX_FLUSH) {
157 spin_unlock(&hif_dev->tx.tx_lock);
160 spin_unlock(&hif_dev->tx.tx_lock);
177 spin_lock(&hif_dev->tx.tx_lock);
178 if (hif_dev->tx.flags & HIF_USB_TX_STOP) {
179 spin_unlock(&hif_dev->tx.tx_lock);
180 ath9k_skb_queue_purge(hif_dev, &tx_buf->skb_queue);
183 spin_unlock(&hif_dev->tx.tx_lock);
187 ath9k_htc_txcompletion_cb(hif_dev->htc_handle,
198 spin_lock(&hif_dev->tx.tx_lock);
199 list_move_tail(&tx_buf->list, &hif_dev->tx.tx_buf);
200 hif_dev->tx.tx_buf_cnt++;
201 if (!(hif_dev->tx.flags & HIF_USB_TX_STOP))
202 __hif_usb_tx(hif_dev); /* Check for pending SKBs */
204 spin_unlock(&hif_dev->tx.tx_lock);
208 static int __hif_usb_tx(struct hif_device_usb *hif_dev)
216 if (hif_dev->tx.tx_skb_cnt == 0)
220 if (list_empty(&hif_dev->tx.tx_buf))
223 tx_buf = list_first_entry(&hif_dev->tx.tx_buf, struct tx_buf, list);
224 list_move_tail(&tx_buf->list, &hif_dev->tx.tx_pending);
225 hif_dev->tx.tx_buf_cnt--;
227 tx_skb_cnt = min_t(u16, hif_dev->tx.tx_skb_cnt, MAX_TX_AGGR_NUM);
230 nskb = __skb_dequeue(&hif_dev->tx.tx_skb_queue);
235 hif_dev->tx.tx_skb_cnt--;
256 usb_fill_bulk_urb(tx_buf->urb, hif_dev->udev,
257 usb_sndbulkpipe(hif_dev->udev, USB_WLAN_TX_PIPE),
264 ath9k_skb_queue_purge(hif_dev, &tx_buf->skb_queue);
266 list_move_tail(&tx_buf->list, &hif_dev->tx.tx_buf);
267 hif_dev->tx.tx_buf_cnt++;
276 static int hif_usb_send_tx(struct hif_device_usb *hif_dev, struct sk_buff *skb,
281 spin_lock_irqsave(&hif_dev->tx.tx_lock, flags);
283 if (hif_dev->tx.flags & HIF_USB_TX_STOP) {
284 spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
289 if (hif_dev->tx.tx_skb_cnt > MAX_TX_BUF_NUM) {
290 spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
294 __skb_queue_tail(&hif_dev->tx.tx_skb_queue, skb);
295 hif_dev->tx.tx_skb_cnt++;
299 __hif_usb_tx(hif_dev);
303 (hif_dev->tx.tx_buf_cnt == MAX_TX_URB_NUM) &&
304 (hif_dev->tx.tx_skb_cnt < 2)) {
305 __hif_usb_tx(hif_dev);
308 spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
315 struct hif_device_usb *hif_dev = (struct hif_device_usb *)hif_handle;
318 hif_dev->flags |= HIF_USB_START;
320 spin_lock_irqsave(&hif_dev->tx.tx_lock, flags);
321 hif_dev->tx.flags &= ~HIF_USB_TX_STOP;
322 spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
327 struct hif_device_usb *hif_dev = (struct hif_device_usb *)hif_handle;
331 spin_lock_irqsave(&hif_dev->tx.tx_lock, flags);
332 ath9k_skb_queue_purge(hif_dev, &hif_dev->tx.tx_skb_queue);
333 hif_dev->tx.tx_skb_cnt = 0;
334 hif_dev->tx.flags |= HIF_USB_TX_STOP;
335 spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
339 &hif_dev->tx.tx_pending, list) {
347 struct hif_device_usb *hif_dev = (struct hif_device_usb *)hif_handle;
352 ret = hif_usb_send_tx(hif_dev, skb, tx_ctl);
355 ret = hif_usb_send_regout(hif_dev, skb);
358 dev_err(&hif_dev->udev->dev,
379 static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
388 spin_lock(&hif_dev->rx_lock);
390 rx_remain_len = hif_dev->rx_remain_len;
391 rx_pkt_len = hif_dev->rx_transfer_len;
394 struct sk_buff *remain_skb = hif_dev->remain_skb;
400 rx_remain_len -= hif_dev->rx_pad_len;
406 hif_dev->rx_remain_len = 0;
416 spin_unlock(&hif_dev->rx_lock);
435 spin_lock(&hif_dev->rx_lock);
436 hif_dev->rx_remain_len = index - MAX_RX_BUF_SIZE;
437 hif_dev->rx_transfer_len =
439 hif_dev->rx_pad_len = pad_len;
444 dev_err(&hif_dev->udev->dev,
447 spin_unlock(&hif_dev->rx_lock);
454 hif_dev->rx_transfer_len);
457 hif_dev->remain_skb = nskb;
458 spin_unlock(&hif_dev->rx_lock);
462 dev_err(&hif_dev->udev->dev,
482 ath9k_htc_rx_msg(hif_dev->htc_handle, skb_pool[i],
491 struct hif_device_usb *hif_dev = (struct hif_device_usb *)
498 if (!hif_dev)
515 ath9k_hif_usb_rx_stream(hif_dev, skb);
522 usb_anchor_urb(urb, &hif_dev->rx_submitted);
538 struct hif_device_usb *hif_dev = (struct hif_device_usb *)
545 if (!hif_dev)
564 ath9k_htc_rx_msg(hif_dev->htc_handle, skb,
570 dev_err(&hif_dev->udev->dev,
576 usb_fill_int_urb(urb, hif_dev->udev,
577 usb_rcvintpipe(hif_dev->udev, USB_REG_IN_PIPE),
604 static void ath9k_hif_usb_dealloc_tx_urbs(struct hif_device_usb *hif_dev)
610 &hif_dev->tx.tx_buf, list) {
618 spin_lock_irqsave(&hif_dev->tx.tx_lock, flags);
619 hif_dev->tx.flags |= HIF_USB_TX_FLUSH;
620 spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
623 &hif_dev->tx.tx_pending, list) {
632 static int ath9k_hif_usb_alloc_tx_urbs(struct hif_device_usb *hif_dev)
637 INIT_LIST_HEAD(&hif_dev->tx.tx_buf);
638 INIT_LIST_HEAD(&hif_dev->tx.tx_pending);
639 spin_lock_init(&hif_dev->tx.tx_lock);
640 __skb_queue_head_init(&hif_dev->tx.tx_skb_queue);
655 tx_buf->hif_dev = hif_dev;
658 list_add_tail(&tx_buf->list, &hif_dev->tx.tx_buf);
661 hif_dev->tx.tx_buf_cnt = MAX_TX_URB_NUM;
669 ath9k_hif_usb_dealloc_tx_urbs(hif_dev);
673 static void ath9k_hif_usb_dealloc_rx_urbs(struct hif_device_usb *hif_dev)
675 usb_kill_anchored_urbs(&hif_dev->rx_submitted);
678 static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev)
684 init_usb_anchor(&hif_dev->rx_submitted);
685 spin_lock_init(&hif_dev->rx_lock);
703 usb_fill_bulk_urb(urb, hif_dev->udev,
704 usb_rcvbulkpipe(hif_dev->udev,
710 usb_anchor_urb(urb, &hif_dev->rx_submitted);
733 ath9k_hif_usb_dealloc_rx_urbs(hif_dev);
737 static void ath9k_hif_usb_dealloc_reg_in_urb(struct hif_device_usb *hif_dev)
739 if (hif_dev->reg_in_urb) {
740 usb_kill_urb(hif_dev->reg_in_urb);
741 if (hif_dev->reg_in_urb->context)
742 kfree_skb((void *)hif_dev->reg_in_urb->context);
743 usb_free_urb(hif_dev->reg_in_urb);
744 hif_dev->reg_in_urb = NULL;
748 static int ath9k_hif_usb_alloc_reg_in_urb(struct hif_device_usb *hif_dev)
752 hif_dev->reg_in_urb = usb_alloc_urb(0, GFP_KERNEL);
753 if (hif_dev->reg_in_urb == NULL)
760 usb_fill_int_urb(hif_dev->reg_in_urb, hif_dev->udev,
761 usb_rcvintpipe(hif_dev->udev, USB_REG_IN_PIPE),
765 if (usb_submit_urb(hif_dev->reg_in_urb, GFP_KERNEL) != 0)
771 ath9k_hif_usb_dealloc_reg_in_urb(hif_dev);
775 static int ath9k_hif_usb_alloc_urbs(struct hif_device_usb *hif_dev)
778 init_usb_anchor(&hif_dev->regout_submitted);
781 if (ath9k_hif_usb_alloc_tx_urbs(hif_dev) < 0)
785 if (ath9k_hif_usb_alloc_rx_urbs(hif_dev) < 0)
789 if (ath9k_hif_usb_alloc_reg_in_urb(hif_dev) < 0)
794 ath9k_hif_usb_dealloc_rx_urbs(hif_dev);
796 ath9k_hif_usb_dealloc_tx_urbs(hif_dev);
801 static void ath9k_hif_usb_dealloc_urbs(struct hif_device_usb *hif_dev)
803 usb_kill_anchored_urbs(&hif_dev->regout_submitted);
804 ath9k_hif_usb_dealloc_reg_in_urb(hif_dev);
805 ath9k_hif_usb_dealloc_tx_urbs(hif_dev);
806 ath9k_hif_usb_dealloc_rx_urbs(hif_dev);
809 static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev)
812 const void *data = hif_dev->firmware->data;
813 size_t len = hif_dev->firmware->size;
825 err = usb_control_msg(hif_dev->udev,
826 usb_sndctrlpipe(hif_dev->udev, 0),
840 switch (hif_dev->device_id) {
856 err = usb_control_msg(hif_dev->udev, usb_sndctrlpipe(hif_dev->udev, 0),
863 dev_info(&hif_dev->udev->dev, "ath9k_htc: Transferred FW: %s, size: %ld\n",
864 hif_dev->fw_name, (unsigned long) hif_dev->firmware->size);
869 static int ath9k_hif_usb_dev_init(struct hif_device_usb *hif_dev)
874 ret = request_firmware(&hif_dev->firmware, hif_dev->fw_name,
875 &hif_dev->udev->dev);
877 dev_err(&hif_dev->udev->dev,
878 "ath9k_htc: Firmware - %s not found\n", hif_dev->fw_name);
883 ret = ath9k_hif_usb_alloc_urbs(hif_dev);
885 dev_err(&hif_dev->udev->dev,
891 ret = ath9k_hif_usb_download_fw(hif_dev);
893 dev_err(&hif_dev->udev->dev,
895 hif_dev->fw_name);
902 ath9k_hif_usb_dealloc_urbs(hif_dev);
904 release_firmware(hif_dev->firmware);
906 hif_dev->firmware = NULL;
910 static void ath9k_hif_usb_dev_deinit(struct hif_device_usb *hif_dev)
912 ath9k_hif_usb_dealloc_urbs(hif_dev);
913 if (hif_dev->firmware)
914 release_firmware(hif_dev->firmware);
921 struct hif_device_usb *hif_dev;
924 hif_dev = kzalloc(sizeof(struct hif_device_usb), GFP_KERNEL);
925 if (!hif_dev) {
931 hif_dev->udev = udev;
932 hif_dev->interface = interface;
933 hif_dev->device_id = id->idProduct;
937 usb_set_intfdata(interface, hif_dev);
939 hif_dev->htc_handle = ath9k_htc_hw_alloc(hif_dev, &hif_usb,
940 &hif_dev->udev->dev);
941 if (hif_dev->htc_handle == NULL) {
948 switch(hif_dev->device_id) {
955 hif_dev->fw_name = FIRMWARE_AR7010_1_1;
957 hif_dev->fw_name = FIRMWARE_AR7010;
960 hif_dev->fw_name = FIRMWARE_AR9271;
964 ret = ath9k_hif_usb_dev_init(hif_dev);
970 ret = ath9k_htc_hw_init(hif_dev->htc_handle,
971 &hif_dev->udev->dev, hif_dev->device_id);
977 dev_info(&hif_dev->udev->dev, "ath9k_htc: USB layer initialized\n");
982 ath9k_hif_usb_dev_deinit(hif_dev);
984 ath9k_htc_hw_free(hif_dev->htc_handle);
987 kfree(hif_dev);
1014 struct hif_device_usb *hif_dev =
1017 if (hif_dev) {
1018 ath9k_htc_hw_deinit(hif_dev->htc_handle,
1020 ath9k_htc_hw_free(hif_dev->htc_handle);
1021 ath9k_hif_usb_dev_deinit(hif_dev);
1025 if (hif_dev->flags & HIF_USB_START)
1028 kfree(hif_dev);
1037 struct hif_device_usb *hif_dev =
1040 ath9k_hif_usb_dealloc_urbs(hif_dev);
1047 struct hif_device_usb *hif_dev =
1051 ret = ath9k_hif_usb_alloc_urbs(hif_dev);
1055 if (hif_dev->firmware) {
1056 ret = ath9k_hif_usb_download_fw(hif_dev);
1060 ath9k_hif_usb_dealloc_urbs(hif_dev);
1066 ret = ath9k_htc_resume(hif_dev->htc_handle);
1074 ath9k_hif_usb_dealloc_urbs(hif_dev);