Lines Matching refs:htc

33 	ath10k_hif_send_complete_check(ep->htc->ar, ep->ul_pipe_id, force);
61 static inline void ath10k_htc_restore_tx_skb(struct ath10k_htc *htc,
66 dma_unmap_single(htc->ar->dev, skb_cb->paddr, skb->len, DMA_TO_DEVICE);
73 struct ath10k *ar = ep->htc->ar;
78 ath10k_htc_restore_tx_skb(ep->htc, skb);
86 ep->ep_ops.ep_tx_complete(ep->htc->ar, skb);
92 struct ath10k *ar = ep->htc->ar;
115 spin_lock_bh(&ep->htc->tx_lock);
121 spin_unlock_bh(&ep->htc->tx_lock);
124 int ath10k_htc_send(struct ath10k_htc *htc,
128 struct ath10k *ar = htc->ar;
129 struct ath10k_htc_ep *ep = &htc->endpoint[eid];
132 struct device *dev = htc->ar->dev;
136 if (htc->ar->state == ATH10K_STATE_WEDGED)
147 credits = DIV_ROUND_UP(skb->len, htc->target_credit_size);
148 spin_lock_bh(&htc->tx_lock);
150 spin_unlock_bh(&htc->tx_lock);
156 "htc ep %d consumed %d credits (total %d)\n",
158 spin_unlock_bh(&htc->tx_lock);
174 ret = ath10k_hif_tx_sg(htc->ar, ep->ul_pipe_id, &sg_item, 1);
184 spin_lock_bh(&htc->tx_lock);
187 "htc ep %d reverted %d credits back (total %d)\n",
189 spin_unlock_bh(&htc->tx_lock);
192 ep->ep_ops.ep_tx_credits(htc->ar);
203 struct ath10k_htc *htc = &ar->htc;
204 struct ath10k_htc_ep *ep = &htc->endpoint[eid];
220 ath10k_htc_process_credit_report(struct ath10k_htc *htc,
225 struct ath10k *ar = htc->ar;
234 spin_lock_bh(&htc->tx_lock);
239 ep = &htc->endpoint[report->eid];
242 ath10k_dbg(ar, ATH10K_DBG_HTC, "htc ep %d got %d credits (total %d)\n",
246 spin_unlock_bh(&htc->tx_lock);
247 ep->ep_ops.ep_tx_credits(htc->ar);
248 spin_lock_bh(&htc->tx_lock);
251 spin_unlock_bh(&htc->tx_lock);
254 static int ath10k_htc_process_trailer(struct ath10k_htc *htc,
259 struct ath10k *ar = htc->ar;
293 ath10k_htc_process_credit_report(htc,
313 ath10k_dbg_dump(ar, ATH10K_DBG_HTC, "htc rx bad trailer", "",
324 struct ath10k_htc *htc = &ar->htc;
340 ath10k_dbg_dump(ar, ATH10K_DBG_HTC, "htc bad header", "",
346 ep = &htc->endpoint[eid];
362 ath10k_dbg_dump(ar, ATH10K_DBG_HTC, "htc bad rx pkt len", "",
372 ath10k_dbg_dump(ar, ATH10K_DBG_HTC, "htc bad rx pkt len",
398 status = ath10k_htc_process_trailer(htc, trailer,
416 if (completion_done(&htc->ctl_resp)) {
423 complete(&htc->ctl_resp);
427 htc->control_resp_len =
431 memcpy(htc->control_resp_buffer, skb->data,
432 htc->control_resp_len);
434 complete(&htc->ctl_resp);
437 htc->htc_ops.target_send_suspend_complete(ar);
442 ath10k_dbg(ar, ATH10K_DBG_HTC, "htc rx completion ep %d skb %p\n",
459 ath10k_warn(ar, "unexpected htc rx\n");
497 static void ath10k_htc_reset_endpoint_states(struct ath10k_htc *htc)
503 ep = &htc->endpoint[i];
508 ep->htc = htc;
513 static void ath10k_htc_setup_target_buffer_assignments(struct ath10k_htc *htc)
517 entry = &htc->service_tx_alloc[0];
526 entry->credit_allocation = htc->total_transmit_credits;
529 static u8 ath10k_htc_get_credit_allocation(struct ath10k_htc *htc,
536 if (htc->service_tx_alloc[i].service_id == service_id)
538 htc->service_tx_alloc[i].credit_allocation;
544 int ath10k_htc_wait_target(struct ath10k_htc *htc)
546 struct ath10k *ar = htc->ar;
555 status = wait_for_completion_timeout(&htc->ctl_resp,
567 ath10k_hif_send_complete_check(htc->ar, i, 1);
569 status = wait_for_completion_timeout(&htc->ctl_resp,
581 if (htc->control_resp_len < sizeof(msg->hdr) + sizeof(msg->ready)) {
583 htc->control_resp_len);
587 msg = (struct ath10k_htc_msg *)htc->control_resp_buffer;
597 htc->total_transmit_credits = credit_count;
598 htc->target_credit_size = credit_size;
602 htc->total_transmit_credits,
603 htc->target_credit_size);
605 if ((htc->total_transmit_credits == 0) ||
606 (htc->target_credit_size == 0)) {
611 ath10k_htc_setup_target_buffer_assignments(htc);
622 status = ath10k_htc_connect_service(htc, &conn_req, &conn_resp);
624 ath10k_err(ar, "could not connect to htc service (%d)\n",
632 int ath10k_htc_connect_service(struct ath10k_htc *htc,
636 struct ath10k *ar = htc->ar;
659 tx_alloc = ath10k_htc_get_credit_allocation(htc,
663 "boot htc service %s does not allocate target credits\n",
666 skb = ath10k_htc_build_tx_ctrl_skb(htc->ar);
692 reinit_completion(&htc->ctl_resp);
694 status = ath10k_htc_send(htc, ATH10K_HTC_EP_0, skb);
701 status = wait_for_completion_timeout(&htc->ctl_resp,
711 msg = (struct ath10k_htc_msg *)htc->control_resp_buffer;
717 (htc->control_resp_len < sizeof(msg->hdr) +
749 ep = &htc->endpoint[assigned_eid];
764 ep->tx_credit_size = htc->target_credit_size;
766 htc->target_credit_size;
768 if (ep->max_ep_message_len % htc->target_credit_size)
774 status = ath10k_hif_map_service_to_pipe(htc->ar,
784 "boot htc service '%s' ul pipe %d dl pipe %d eid %d ready\n",
789 "boot htc ep %d ul polled %d dl polled %d\n",
795 "boot htc service '%s' eid %d TX flow control disabled\n",
819 int ath10k_htc_start(struct ath10k_htc *htc)
821 struct ath10k *ar = htc->ar;
826 skb = ath10k_htc_build_tx_ctrl_skb(htc->ar);
839 status = ath10k_htc_send(htc, ATH10K_HTC_EP_0, skb);
853 struct ath10k_htc *htc = &ar->htc;
855 spin_lock_init(&htc->tx_lock);
857 ath10k_htc_reset_endpoint_states(htc);
862 htc->ar = ar;
865 ep = &htc->endpoint[ATH10K_HTC_EP_0];
870 init_completion(&htc->ctl_resp);