Lines Matching refs:htc

33 	ath10k_hif_send_complete_check(ep->htc->ar, ep->ul_pipe_id, force);  in ath10k_htc_send_complete_check()
61 static inline void ath10k_htc_restore_tx_skb(struct ath10k_htc *htc, in ath10k_htc_restore_tx_skb() argument
66 dma_unmap_single(htc->ar->dev, skb_cb->paddr, skb->len, DMA_TO_DEVICE); in ath10k_htc_restore_tx_skb()
73 struct ath10k *ar = ep->htc->ar; in ath10k_htc_notify_tx_completion()
78 ath10k_htc_restore_tx_skb(ep->htc, skb); in ath10k_htc_notify_tx_completion()
86 ep->ep_ops.ep_tx_complete(ep->htc->ar, skb); in ath10k_htc_notify_tx_completion()
92 struct ath10k *ar = ep->htc->ar; in ath10k_htc_ep_need_credit_update()
115 spin_lock_bh(&ep->htc->tx_lock); in ath10k_htc_prepare_tx_skb()
121 spin_unlock_bh(&ep->htc->tx_lock); in ath10k_htc_prepare_tx_skb()
124 int ath10k_htc_send(struct ath10k_htc *htc, in ath10k_htc_send() argument
128 struct ath10k *ar = htc->ar; in ath10k_htc_send()
129 struct ath10k_htc_ep *ep = &htc->endpoint[eid]; in ath10k_htc_send()
132 struct device *dev = htc->ar->dev; in ath10k_htc_send()
136 if (htc->ar->state == ATH10K_STATE_WEDGED) in ath10k_htc_send()
147 credits = DIV_ROUND_UP(skb->len, htc->target_credit_size); in ath10k_htc_send()
148 spin_lock_bh(&htc->tx_lock); in ath10k_htc_send()
150 spin_unlock_bh(&htc->tx_lock); in ath10k_htc_send()
158 spin_unlock_bh(&htc->tx_lock); in ath10k_htc_send()
177 ret = ath10k_hif_tx_sg(htc->ar, ep->ul_pipe_id, &sg_item, 1); in ath10k_htc_send()
187 spin_lock_bh(&htc->tx_lock); in ath10k_htc_send()
192 spin_unlock_bh(&htc->tx_lock); in ath10k_htc_send()
195 ep->ep_ops.ep_tx_credits(htc->ar); in ath10k_htc_send()
205 struct ath10k_htc *htc = &ar->htc; in ath10k_htc_tx_completion_handler() local
213 ep = &htc->endpoint[skb_cb->eid]; in ath10k_htc_tx_completion_handler()
226 ath10k_htc_process_credit_report(struct ath10k_htc *htc, in ath10k_htc_process_credit_report() argument
231 struct ath10k *ar = htc->ar; in ath10k_htc_process_credit_report()
240 spin_lock_bh(&htc->tx_lock); in ath10k_htc_process_credit_report()
245 ep = &htc->endpoint[report->eid]; in ath10k_htc_process_credit_report()
252 spin_unlock_bh(&htc->tx_lock); in ath10k_htc_process_credit_report()
253 ep->ep_ops.ep_tx_credits(htc->ar); in ath10k_htc_process_credit_report()
254 spin_lock_bh(&htc->tx_lock); in ath10k_htc_process_credit_report()
257 spin_unlock_bh(&htc->tx_lock); in ath10k_htc_process_credit_report()
260 static int ath10k_htc_process_trailer(struct ath10k_htc *htc, in ath10k_htc_process_trailer() argument
265 struct ath10k *ar = htc->ar; in ath10k_htc_process_trailer()
299 ath10k_htc_process_credit_report(htc, in ath10k_htc_process_trailer()
329 struct ath10k_htc *htc = &ar->htc; in ath10k_htc_rx_completion_handler() local
351 ep = &htc->endpoint[eid]; in ath10k_htc_rx_completion_handler()
403 status = ath10k_htc_process_trailer(htc, trailer, in ath10k_htc_rx_completion_handler()
421 if (completion_done(&htc->ctl_resp)) { in ath10k_htc_rx_completion_handler()
428 complete(&htc->ctl_resp); in ath10k_htc_rx_completion_handler()
432 htc->control_resp_len = in ath10k_htc_rx_completion_handler()
436 memcpy(htc->control_resp_buffer, skb->data, in ath10k_htc_rx_completion_handler()
437 htc->control_resp_len); in ath10k_htc_rx_completion_handler()
439 complete(&htc->ctl_resp); in ath10k_htc_rx_completion_handler()
442 htc->htc_ops.target_send_suspend_complete(ar); in ath10k_htc_rx_completion_handler()
502 static void ath10k_htc_reset_endpoint_states(struct ath10k_htc *htc) in ath10k_htc_reset_endpoint_states() argument
508 ep = &htc->endpoint[i]; in ath10k_htc_reset_endpoint_states()
513 ep->htc = htc; in ath10k_htc_reset_endpoint_states()
518 static void ath10k_htc_setup_target_buffer_assignments(struct ath10k_htc *htc) in ath10k_htc_setup_target_buffer_assignments() argument
522 entry = &htc->service_tx_alloc[0]; in ath10k_htc_setup_target_buffer_assignments()
531 entry->credit_allocation = htc->total_transmit_credits; in ath10k_htc_setup_target_buffer_assignments()
534 static u8 ath10k_htc_get_credit_allocation(struct ath10k_htc *htc, in ath10k_htc_get_credit_allocation() argument
541 if (htc->service_tx_alloc[i].service_id == service_id) in ath10k_htc_get_credit_allocation()
543 htc->service_tx_alloc[i].credit_allocation; in ath10k_htc_get_credit_allocation()
549 int ath10k_htc_wait_target(struct ath10k_htc *htc) in ath10k_htc_wait_target() argument
551 struct ath10k *ar = htc->ar; in ath10k_htc_wait_target()
560 status = wait_for_completion_timeout(&htc->ctl_resp, in ath10k_htc_wait_target()
572 ath10k_hif_send_complete_check(htc->ar, i, 1); in ath10k_htc_wait_target()
574 status = wait_for_completion_timeout(&htc->ctl_resp, in ath10k_htc_wait_target()
586 if (htc->control_resp_len < sizeof(msg->hdr) + sizeof(msg->ready)) { in ath10k_htc_wait_target()
588 htc->control_resp_len); in ath10k_htc_wait_target()
592 msg = (struct ath10k_htc_msg *)htc->control_resp_buffer; in ath10k_htc_wait_target()
602 htc->total_transmit_credits = credit_count; in ath10k_htc_wait_target()
603 htc->target_credit_size = credit_size; in ath10k_htc_wait_target()
607 htc->total_transmit_credits, in ath10k_htc_wait_target()
608 htc->target_credit_size); in ath10k_htc_wait_target()
610 if ((htc->total_transmit_credits == 0) || in ath10k_htc_wait_target()
611 (htc->target_credit_size == 0)) { in ath10k_htc_wait_target()
616 ath10k_htc_setup_target_buffer_assignments(htc); in ath10k_htc_wait_target()
627 status = ath10k_htc_connect_service(htc, &conn_req, &conn_resp); in ath10k_htc_wait_target()
637 int ath10k_htc_connect_service(struct ath10k_htc *htc, in ath10k_htc_connect_service() argument
641 struct ath10k *ar = htc->ar; in ath10k_htc_connect_service()
664 tx_alloc = ath10k_htc_get_credit_allocation(htc, in ath10k_htc_connect_service()
671 skb = ath10k_htc_build_tx_ctrl_skb(htc->ar); in ath10k_htc_connect_service()
697 reinit_completion(&htc->ctl_resp); in ath10k_htc_connect_service()
699 status = ath10k_htc_send(htc, ATH10K_HTC_EP_0, skb); in ath10k_htc_connect_service()
706 status = wait_for_completion_timeout(&htc->ctl_resp, in ath10k_htc_connect_service()
714 msg = (struct ath10k_htc_msg *)htc->control_resp_buffer; in ath10k_htc_connect_service()
720 (htc->control_resp_len < sizeof(msg->hdr) + in ath10k_htc_connect_service()
752 ep = &htc->endpoint[assigned_eid]; in ath10k_htc_connect_service()
767 ep->tx_credit_size = htc->target_credit_size; in ath10k_htc_connect_service()
769 htc->target_credit_size; in ath10k_htc_connect_service()
771 if (ep->max_ep_message_len % htc->target_credit_size) in ath10k_htc_connect_service()
777 status = ath10k_hif_map_service_to_pipe(htc->ar, in ath10k_htc_connect_service()
822 int ath10k_htc_start(struct ath10k_htc *htc) in ath10k_htc_start() argument
824 struct ath10k *ar = htc->ar; in ath10k_htc_start()
829 skb = ath10k_htc_build_tx_ctrl_skb(htc->ar); in ath10k_htc_start()
842 status = ath10k_htc_send(htc, ATH10K_HTC_EP_0, skb); in ath10k_htc_start()
856 struct ath10k_htc *htc = &ar->htc; in ath10k_htc_init() local
858 spin_lock_init(&htc->tx_lock); in ath10k_htc_init()
860 ath10k_htc_reset_endpoint_states(htc); in ath10k_htc_init()
865 htc->ar = ar; in ath10k_htc_init()
868 ep = &htc->endpoint[ATH10K_HTC_EP_0]; in ath10k_htc_init()
873 init_completion(&htc->ctl_resp); in ath10k_htc_init()