Lines Matching refs:htc
51 static inline void ath10k_htc_restore_tx_skb(struct ath10k_htc *htc, in ath10k_htc_restore_tx_skb() argument
56 dma_unmap_single(htc->ar->dev, skb_cb->paddr, skb->len, DMA_TO_DEVICE); in ath10k_htc_restore_tx_skb()
63 struct ath10k *ar = ep->htc->ar; in ath10k_htc_notify_tx_completion()
68 ath10k_htc_restore_tx_skb(ep->htc, skb); in ath10k_htc_notify_tx_completion()
76 ep->ep_ops.ep_tx_complete(ep->htc->ar, skb); in ath10k_htc_notify_tx_completion()
91 spin_lock_bh(&ep->htc->tx_lock); in ath10k_htc_prepare_tx_skb()
93 spin_unlock_bh(&ep->htc->tx_lock); in ath10k_htc_prepare_tx_skb()
96 int ath10k_htc_send(struct ath10k_htc *htc, in ath10k_htc_send() argument
100 struct ath10k *ar = htc->ar; in ath10k_htc_send()
101 struct ath10k_htc_ep *ep = &htc->endpoint[eid]; in ath10k_htc_send()
104 struct device *dev = htc->ar->dev; in ath10k_htc_send()
108 if (htc->ar->state == ATH10K_STATE_WEDGED) in ath10k_htc_send()
119 credits = DIV_ROUND_UP(skb->len, htc->target_credit_size); in ath10k_htc_send()
120 spin_lock_bh(&htc->tx_lock); in ath10k_htc_send()
122 spin_unlock_bh(&htc->tx_lock); in ath10k_htc_send()
130 spin_unlock_bh(&htc->tx_lock); in ath10k_htc_send()
149 ret = ath10k_hif_tx_sg(htc->ar, ep->ul_pipe_id, &sg_item, 1); in ath10k_htc_send()
159 spin_lock_bh(&htc->tx_lock); in ath10k_htc_send()
164 spin_unlock_bh(&htc->tx_lock); in ath10k_htc_send()
167 ep->ep_ops.ep_tx_credits(htc->ar); in ath10k_htc_send()
176 struct ath10k_htc *htc = &ar->htc; in ath10k_htc_tx_completion_handler() local
184 ep = &htc->endpoint[skb_cb->eid]; in ath10k_htc_tx_completion_handler()
196 ath10k_htc_process_credit_report(struct ath10k_htc *htc, in ath10k_htc_process_credit_report() argument
201 struct ath10k *ar = htc->ar; in ath10k_htc_process_credit_report()
210 spin_lock_bh(&htc->tx_lock); in ath10k_htc_process_credit_report()
215 ep = &htc->endpoint[report->eid]; in ath10k_htc_process_credit_report()
222 spin_unlock_bh(&htc->tx_lock); in ath10k_htc_process_credit_report()
223 ep->ep_ops.ep_tx_credits(htc->ar); in ath10k_htc_process_credit_report()
224 spin_lock_bh(&htc->tx_lock); in ath10k_htc_process_credit_report()
227 spin_unlock_bh(&htc->tx_lock); in ath10k_htc_process_credit_report()
230 static int ath10k_htc_process_trailer(struct ath10k_htc *htc, in ath10k_htc_process_trailer() argument
235 struct ath10k *ar = htc->ar; in ath10k_htc_process_trailer()
269 ath10k_htc_process_credit_report(htc, in ath10k_htc_process_trailer()
298 struct ath10k_htc *htc = &ar->htc; in ath10k_htc_rx_completion_handler() local
319 ep = &htc->endpoint[eid]; in ath10k_htc_rx_completion_handler()
359 status = ath10k_htc_process_trailer(htc, trailer, in ath10k_htc_rx_completion_handler()
378 if (completion_done(&htc->ctl_resp)) { in ath10k_htc_rx_completion_handler()
384 complete(&htc->ctl_resp); in ath10k_htc_rx_completion_handler()
388 htc->control_resp_len = in ath10k_htc_rx_completion_handler()
392 memcpy(htc->control_resp_buffer, skb->data, in ath10k_htc_rx_completion_handler()
393 htc->control_resp_len); in ath10k_htc_rx_completion_handler()
395 complete(&htc->ctl_resp); in ath10k_htc_rx_completion_handler()
398 htc->htc_ops.target_send_suspend_complete(ar); in ath10k_htc_rx_completion_handler()
461 static void ath10k_htc_reset_endpoint_states(struct ath10k_htc *htc) in ath10k_htc_reset_endpoint_states() argument
467 ep = &htc->endpoint[i]; in ath10k_htc_reset_endpoint_states()
472 ep->htc = htc; in ath10k_htc_reset_endpoint_states()
477 static void ath10k_htc_setup_target_buffer_assignments(struct ath10k_htc *htc) in ath10k_htc_setup_target_buffer_assignments() argument
481 entry = &htc->service_tx_alloc[0]; in ath10k_htc_setup_target_buffer_assignments()
490 entry->credit_allocation = htc->total_transmit_credits; in ath10k_htc_setup_target_buffer_assignments()
493 static u8 ath10k_htc_get_credit_allocation(struct ath10k_htc *htc, in ath10k_htc_get_credit_allocation() argument
500 if (htc->service_tx_alloc[i].service_id == service_id) in ath10k_htc_get_credit_allocation()
502 htc->service_tx_alloc[i].credit_allocation; in ath10k_htc_get_credit_allocation()
508 int ath10k_htc_wait_target(struct ath10k_htc *htc) in ath10k_htc_wait_target() argument
510 struct ath10k *ar = htc->ar; in ath10k_htc_wait_target()
520 time_left = wait_for_completion_timeout(&htc->ctl_resp, in ath10k_htc_wait_target()
532 ath10k_hif_send_complete_check(htc->ar, i, 1); in ath10k_htc_wait_target()
535 wait_for_completion_timeout(&htc->ctl_resp, in ath10k_htc_wait_target()
547 if (htc->control_resp_len < sizeof(msg->hdr) + sizeof(msg->ready)) { in ath10k_htc_wait_target()
549 htc->control_resp_len); in ath10k_htc_wait_target()
553 msg = (struct ath10k_htc_msg *)htc->control_resp_buffer; in ath10k_htc_wait_target()
563 htc->total_transmit_credits = credit_count; in ath10k_htc_wait_target()
564 htc->target_credit_size = credit_size; in ath10k_htc_wait_target()
568 htc->total_transmit_credits, in ath10k_htc_wait_target()
569 htc->target_credit_size); in ath10k_htc_wait_target()
571 if ((htc->total_transmit_credits == 0) || in ath10k_htc_wait_target()
572 (htc->target_credit_size == 0)) { in ath10k_htc_wait_target()
577 ath10k_htc_setup_target_buffer_assignments(htc); in ath10k_htc_wait_target()
588 status = ath10k_htc_connect_service(htc, &conn_req, &conn_resp); in ath10k_htc_wait_target()
598 int ath10k_htc_connect_service(struct ath10k_htc *htc, in ath10k_htc_connect_service() argument
602 struct ath10k *ar = htc->ar; in ath10k_htc_connect_service()
626 tx_alloc = ath10k_htc_get_credit_allocation(htc, in ath10k_htc_connect_service()
633 skb = ath10k_htc_build_tx_ctrl_skb(htc->ar); in ath10k_htc_connect_service()
659 reinit_completion(&htc->ctl_resp); in ath10k_htc_connect_service()
661 status = ath10k_htc_send(htc, ATH10K_HTC_EP_0, skb); in ath10k_htc_connect_service()
668 time_left = wait_for_completion_timeout(&htc->ctl_resp, in ath10k_htc_connect_service()
676 msg = (struct ath10k_htc_msg *)htc->control_resp_buffer; in ath10k_htc_connect_service()
682 (htc->control_resp_len < sizeof(msg->hdr) + in ath10k_htc_connect_service()
714 ep = &htc->endpoint[assigned_eid]; in ath10k_htc_connect_service()
729 ep->tx_credit_size = htc->target_credit_size; in ath10k_htc_connect_service()
731 htc->target_credit_size; in ath10k_htc_connect_service()
733 if (ep->max_ep_message_len % htc->target_credit_size) in ath10k_htc_connect_service()
739 status = ath10k_hif_map_service_to_pipe(htc->ar, in ath10k_htc_connect_service()
778 int ath10k_htc_start(struct ath10k_htc *htc) in ath10k_htc_start() argument
780 struct ath10k *ar = htc->ar; in ath10k_htc_start()
785 skb = ath10k_htc_build_tx_ctrl_skb(htc->ar); in ath10k_htc_start()
798 status = ath10k_htc_send(htc, ATH10K_HTC_EP_0, skb); in ath10k_htc_start()
811 struct ath10k_htc *htc = &ar->htc; in ath10k_htc_init() local
813 spin_lock_init(&htc->tx_lock); in ath10k_htc_init()
815 ath10k_htc_reset_endpoint_states(htc); in ath10k_htc_init()
817 htc->ar = ar; in ath10k_htc_init()
820 ep = &htc->endpoint[ATH10K_HTC_EP_0]; in ath10k_htc_init()
824 init_completion(&htc->ctl_resp); in ath10k_htc_init()