Lines Matching refs:htc

40 static inline void ath10k_htc_restore_tx_skb(struct ath10k_htc *htc,
45 if (htc->ar->bus_param.dev_type != ATH10K_DEV_TYPE_HL)
46 dma_unmap_single(htc->ar->dev, skb_cb->paddr, skb->len, DMA_TO_DEVICE);
53 struct ath10k *ar = ep->htc->ar;
60 ath10k_htc_restore_tx_skb(ep->htc, skb);
73 ep->ep_ops.ep_tx_complete(ep->htc->ar, skb);
91 spin_lock_bh(&ep->htc->tx_lock);
93 spin_unlock_bh(&ep->htc->tx_lock);
100 struct ath10k_htc *htc = ep->htc;
101 struct ath10k *ar = htc->ar;
109 spin_lock_bh(&htc->tx_lock);
113 "htc insufficient credits ep %d required %d available %d consume %d\n",
122 "htc ep %d consumed %d credits total %d\n",
127 spin_unlock_bh(&htc->tx_lock);
133 struct ath10k_htc *htc = ep->htc;
134 struct ath10k *ar = htc->ar;
142 spin_lock_bh(&htc->tx_lock);
145 "htc ep %d reverted %d credits back total %d\n",
147 spin_unlock_bh(&htc->tx_lock);
150 ep->ep_ops.ep_tx_credits(htc->ar);
153 int ath10k_htc_send(struct ath10k_htc *htc,
157 struct ath10k *ar = htc->ar;
158 struct ath10k_htc_ep *ep = &htc->endpoint[eid];
161 struct device *dev = htc->ar->dev;
165 if (htc->ar->state == ATH10K_STATE_WEDGED)
199 ret = ath10k_hif_tx_sg(htc->ar, ep->ul_pipe_id, &sg_item, 1);
217 struct ath10k_htc *htc = &ar->htc;
225 ep = &htc->endpoint[skb_cb->eid];
237 ath10k_htc_process_credit_report(struct ath10k_htc *htc,
242 struct ath10k *ar = htc->ar;
251 spin_lock_bh(&htc->tx_lock);
256 ep = &htc->endpoint[report->eid];
259 ath10k_dbg(ar, ATH10K_DBG_HTC, "htc ep %d got %d credits (total %d)\n",
263 spin_unlock_bh(&htc->tx_lock);
264 ep->ep_ops.ep_tx_credits(htc->ar);
265 spin_lock_bh(&htc->tx_lock);
268 spin_unlock_bh(&htc->tx_lock);
272 ath10k_htc_process_lookahead(struct ath10k_htc *htc,
279 struct ath10k *ar = htc->ar;
291 "htc rx lookahead found pre_valid 0x%x post_valid 0x%x\n",
304 ath10k_htc_process_lookahead_bundle(struct ath10k_htc *htc,
311 struct ath10k *ar = htc->ar;
314 if (!bundle_cnt || (bundle_cnt > htc->max_msgs_per_htc_bundle)) {
335 int ath10k_htc_process_trailer(struct ath10k_htc *htc,
343 struct ath10k *ar = htc->ar;
377 ath10k_htc_process_credit_report(htc,
389 status = ath10k_htc_process_lookahead(htc,
398 status = ath10k_htc_process_lookahead_bundle(htc,
420 ath10k_dbg_dump(ar, ATH10K_DBG_HTC, "htc rx bad trailer", "",
430 struct ath10k_htc *htc = &ar->htc;
446 ath10k_dbg_dump(ar, ATH10K_DBG_HTC, "htc bad header", "",
451 ep = &htc->endpoint[eid];
458 ath10k_dbg_dump(ar, ATH10K_DBG_HTC, "htc bad rx pkt len", "",
467 ath10k_dbg_dump(ar, ATH10K_DBG_HTC, "htc bad rx pkt len",
491 status = ath10k_htc_process_trailer(htc, trailer,
504 ath10k_dbg(ar, ATH10K_DBG_HTC, "htc rx completion ep %d skb %pK\n",
518 struct ath10k_htc *htc = &ar->htc;
525 if (completion_done(&htc->ctl_resp)) {
530 complete(&htc->ctl_resp);
534 htc->control_resp_len =
538 memcpy(htc->control_resp_buffer, skb->data,
539 htc->control_resp_len);
541 complete(&htc->ctl_resp);
544 htc->htc_ops.target_send_suspend_complete(ar);
547 ath10k_warn(ar, "ignoring unsolicited htc ep0 event\n");
595 static void ath10k_htc_reset_endpoint_states(struct ath10k_htc *htc)
601 ep = &htc->endpoint[i];
606 ep->htc = htc;
611 static u8 ath10k_htc_get_credit_allocation(struct ath10k_htc *htc,
620 allocation = htc->total_transmit_credits;
630 struct ath10k_htc *htc = ep->htc;
631 struct ath10k *ar = htc->ar;
646 ret = ath10k_hif_tx_sg(htc->ar, ep->ul_pipe_id, &sg_item, 1);
674 struct ath10k_htc *htc = ep->htc;
675 struct ath10k *ar = htc->ar;
678 ret = ath10k_htc_send(htc, ep->eid, skb);
689 struct ath10k_htc *htc = ep->htc;
696 if (htc->ar->state == ATH10K_STATE_WEDGED)
795 for (i = 0; i < ARRAY_SIZE(ar->htc.endpoint); i++) {
796 ep = &ar->htc.endpoint[i];
825 for (i = 0; i < ARRAY_SIZE(ar->htc.endpoint); i++) {
826 ep = &ar->htc.endpoint[i];
842 int ath10k_htc_send_hl(struct ath10k_htc *htc,
846 struct ath10k_htc_ep *ep = &htc->endpoint[eid];
847 struct ath10k *ar = htc->ar;
854 ath10k_dbg(ar, ATH10K_DBG_HTC, "htc send hl eid %d bundle %d tx count %d len %d\n",
862 return ath10k_htc_send(htc, eid, skb);
868 if (ep->htc->max_msgs_per_htc_bundle >= ATH10K_MIN_MSG_PER_HTC_TX_BUNDLE &&
884 for (i = 0; i < ARRAY_SIZE(ar->htc.endpoint); i++) {
885 ep = &ar->htc.endpoint[i];
897 int ath10k_htc_wait_target(struct ath10k_htc *htc)
899 struct ath10k *ar = htc->ar;
905 time_left = wait_for_completion_timeout(&htc->ctl_resp,
917 ath10k_hif_send_complete_check(htc->ar, i, 1);
920 wait_for_completion_timeout(&htc->ctl_resp,
932 if (htc->control_resp_len < sizeof(msg->hdr) + sizeof(msg->ready)) {
934 htc->control_resp_len);
938 msg = (struct ath10k_htc_msg *)htc->control_resp_buffer;
946 htc->total_transmit_credits = __le16_to_cpu(msg->ready.credit_count);
947 htc->target_credit_size = __le16_to_cpu(msg->ready.credit_size);
951 htc->total_transmit_credits,
952 htc->target_credit_size);
954 if ((htc->total_transmit_credits == 0) ||
955 (htc->target_credit_size == 0)) {
963 if (htc->control_resp_len >=
965 htc->alt_data_credit_size =
968 htc->max_msgs_per_htc_bundle =
973 htc->max_msgs_per_htc_bundle,
974 htc->alt_data_credit_size);
983 void ath10k_htc_change_tx_credit_flow(struct ath10k_htc *htc,
987 struct ath10k *ar = htc->ar;
988 struct ath10k_htc_ep *ep = &ar->htc.endpoint[eid];
993 int ath10k_htc_connect_service(struct ath10k_htc *htc,
997 struct ath10k *ar = htc->ar;
1021 tx_alloc = ath10k_htc_get_credit_allocation(htc,
1025 "boot htc service %s does not allocate target credits\n",
1028 skb = ath10k_htc_build_tx_ctrl_skb(htc->ar);
1054 reinit_completion(&htc->ctl_resp);
1056 status = ath10k_htc_send(htc, ATH10K_HTC_EP_0, skb);
1063 time_left = wait_for_completion_timeout(&htc->ctl_resp,
1071 msg = (struct ath10k_htc_msg *)htc->control_resp_buffer;
1077 (htc->control_resp_len < sizeof(msg->hdr) +
1109 ep = &htc->endpoint[assigned_eid];
1124 ep->tx_credit_size = htc->target_credit_size;
1127 htc->alt_data_credit_size != 0)
1128 ep->tx_credit_size = htc->alt_data_credit_size;
1133 status = ath10k_hif_map_service_to_pipe(htc->ar,
1144 "boot htc service '%s' ul pipe %d dl pipe %d eid %d ready\n",
1151 "boot htc service '%s' eid %d TX flow control disabled\n",
1196 status = ath10k_htc_connect_service(&ar->htc, &conn_req, &conn_resp);
1225 int ath10k_htc_start(struct ath10k_htc *htc)
1227 struct ath10k *ar = htc->ar;
1232 skb = ath10k_htc_build_tx_ctrl_skb(htc->ar);
1248 htc->max_msgs_per_htc_bundle;
1252 status = ath10k_htc_send(htc, ATH10K_HTC_EP_0, skb);
1273 struct ath10k_htc *htc = &ar->htc;
1277 spin_lock_init(&htc->tx_lock);
1279 ath10k_htc_reset_endpoint_states(htc);
1281 htc->ar = ar;
1292 status = ath10k_htc_connect_service(htc, &conn_req, &conn_resp);
1294 ath10k_err(ar, "could not connect to htc service (%d)\n",
1299 init_completion(&htc->ctl_resp);