1 // SPDX-License-Identifier: BSD-3-Clause-Clear
3 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
6 #include <linux/skbuff.h>
7 #include <linux/ctype.h>
12 struct sk_buff *ath12k_htc_alloc_skb(struct ath12k_base *ab, int size)
16 skb = dev_alloc_skb(size + sizeof(struct ath12k_htc_hdr));
20 skb_reserve(skb, sizeof(struct ath12k_htc_hdr));
22 /* FW/HTC requires 4-byte aligned streams */
23 if (!IS_ALIGNED((unsigned long)skb->data, 4))
24 ath12k_warn(ab, "Unaligned HTC tx skb\n");
29 static void ath12k_htc_control_tx_complete(struct ath12k_base *ab,
35 static struct sk_buff *ath12k_htc_build_tx_ctrl_skb(void)
38 struct ath12k_skb_cb *skb_cb;
40 skb = dev_alloc_skb(ATH12K_HTC_CONTROL_BUFFER_SIZE);
44 skb_reserve(skb, sizeof(struct ath12k_htc_hdr));
45 WARN_ON_ONCE(!IS_ALIGNED((unsigned long)skb->data, 4));
47 skb_cb = ATH12K_SKB_CB(skb);
48 memset(skb_cb, 0, sizeof(*skb_cb));
53 static void ath12k_htc_prepare_tx_skb(struct ath12k_htc_ep *ep,
56 struct ath12k_htc_hdr *hdr;
58 hdr = (struct ath12k_htc_hdr *)skb->data;
60 memset(hdr, 0, sizeof(*hdr));
61 hdr->htc_info = le32_encode_bits(ep->eid, HTC_HDR_ENDPOINTID) |
62 le32_encode_bits((skb->len - sizeof(*hdr)),
65 if (ep->tx_credit_flow_enabled)
66 hdr->htc_info |= le32_encode_bits(ATH12K_HTC_FLAG_NEED_CREDIT_UPDATE,
69 spin_lock_bh(&ep->htc->tx_lock);
70 hdr->ctrl_info = le32_encode_bits(ep->seq_no++, HTC_HDR_CONTROLBYTES1);
71 spin_unlock_bh(&ep->htc->tx_lock);
74 int ath12k_htc_send(struct ath12k_htc *htc,
75 enum ath12k_htc_ep_id eid,
78 struct ath12k_htc_ep *ep = &htc->endpoint[eid];
79 struct ath12k_skb_cb *skb_cb = ATH12K_SKB_CB(skb);
80 struct device *dev = htc->ab->dev;
81 struct ath12k_base *ab = htc->ab;
85 if (eid >= ATH12K_HTC_EP_COUNT) {
86 ath12k_warn(ab, "Invalid endpoint id: %d\n", eid);
90 skb_push(skb, sizeof(struct ath12k_htc_hdr));
92 if (ep->tx_credit_flow_enabled) {
93 credits = DIV_ROUND_UP(skb->len, htc->target_credit_size);
94 spin_lock_bh(&htc->tx_lock);
95 if (ep->tx_credits < credits) {
96 ath12k_dbg(ab, ATH12K_DBG_HTC,
97 "htc insufficient credits ep %d required %d available %d\n",
98 eid, credits, ep->tx_credits);
99 spin_unlock_bh(&htc->tx_lock);
103 ep->tx_credits -= credits;
104 ath12k_dbg(ab, ATH12K_DBG_HTC,
105 "htc ep %d consumed %d credits (total %d)\n",
106 eid, credits, ep->tx_credits);
107 spin_unlock_bh(&htc->tx_lock);
110 ath12k_htc_prepare_tx_skb(ep, skb);
112 skb_cb->paddr = dma_map_single(dev, skb->data, skb->len, DMA_TO_DEVICE);
113 ret = dma_mapping_error(dev, skb_cb->paddr);
119 ret = ath12k_ce_send(htc->ab, skb, ep->ul_pipe_id, ep->eid);
126 dma_unmap_single(dev, skb_cb->paddr, skb->len, DMA_TO_DEVICE);
128 if (ep->tx_credit_flow_enabled) {
129 spin_lock_bh(&htc->tx_lock);
130 ep->tx_credits += credits;
131 ath12k_dbg(ab, ATH12K_DBG_HTC,
132 "htc ep %d reverted %d credits back (total %d)\n",
133 eid, credits, ep->tx_credits);
134 spin_unlock_bh(&htc->tx_lock);
136 if (ep->ep_ops.ep_tx_credits)
137 ep->ep_ops.ep_tx_credits(htc->ab);
140 skb_pull(skb, sizeof(struct ath12k_htc_hdr));
145 ath12k_htc_process_credit_report(struct ath12k_htc *htc,
146 const struct ath12k_htc_credit_report *report,
148 enum ath12k_htc_ep_id eid)
150 struct ath12k_base *ab = htc->ab;
151 struct ath12k_htc_ep *ep;
154 if (len % sizeof(*report))
155 ath12k_warn(ab, "Uneven credit report len %d", len);
157 n_reports = len / sizeof(*report);
159 spin_lock_bh(&htc->tx_lock);
160 for (i = 0; i < n_reports; i++, report++) {
161 if (report->eid >= ATH12K_HTC_EP_COUNT)
164 ep = &htc->endpoint[report->eid];
165 ep->tx_credits += report->credits;
167 ath12k_dbg(ab, ATH12K_DBG_HTC, "htc ep %d got %d credits (total %d)\n",
168 report->eid, report->credits, ep->tx_credits);
170 if (ep->ep_ops.ep_tx_credits) {
171 spin_unlock_bh(&htc->tx_lock);
172 ep->ep_ops.ep_tx_credits(htc->ab);
173 spin_lock_bh(&htc->tx_lock);
176 spin_unlock_bh(&htc->tx_lock);
179 static int ath12k_htc_process_trailer(struct ath12k_htc *htc,
182 enum ath12k_htc_ep_id src_eid)
184 struct ath12k_base *ab = htc->ab;
186 struct ath12k_htc_record *record;
190 record = (struct ath12k_htc_record *)buffer;
192 if (length < sizeof(record->hdr)) {
197 if (record->hdr.len > length) {
198 /* no room left in buffer for record */
199 ath12k_warn(ab, "Invalid record length: %d\n",
205 switch (record->hdr.id) {
206 case ATH12K_HTC_RECORD_CREDITS:
207 len = sizeof(struct ath12k_htc_credit_report);
208 if (record->hdr.len < len) {
209 ath12k_warn(ab, "Credit report too long\n");
213 ath12k_htc_process_credit_report(htc,
214 record->credit_report,
219 ath12k_warn(ab, "Unhandled record: id:%d length:%d\n",
220 record->hdr.id, record->hdr.len);
227 /* multiple records may be present in a trailer */
228 buffer += sizeof(record->hdr) + record->hdr.len;
229 length -= sizeof(record->hdr) + record->hdr.len;
235 static void ath12k_htc_suspend_complete(struct ath12k_base *ab, bool ack)
237 ath12k_dbg(ab, ATH12K_DBG_BOOT, "boot suspend complete %d\n", ack);
240 set_bit(ATH12K_FLAG_HTC_SUSPEND_COMPLETE, &ab->dev_flags);
242 clear_bit(ATH12K_FLAG_HTC_SUSPEND_COMPLETE, &ab->dev_flags);
244 complete(&ab->htc_suspend);
247 void ath12k_htc_rx_completion_handler(struct ath12k_base *ab,
251 struct ath12k_htc *htc = &ab->htc;
252 struct ath12k_htc_hdr *hdr;
253 struct ath12k_htc_ep *ep;
258 bool trailer_present;
260 hdr = (struct ath12k_htc_hdr *)skb->data;
261 skb_pull(skb, sizeof(*hdr));
263 eid = le32_get_bits(hdr->htc_info, HTC_HDR_ENDPOINTID);
265 if (eid >= ATH12K_HTC_EP_COUNT) {
266 ath12k_warn(ab, "HTC Rx: invalid eid %d\n", eid);
270 ep = &htc->endpoint[eid];
272 payload_len = le32_get_bits(hdr->htc_info, HTC_HDR_PAYLOADLEN);
274 if (payload_len + sizeof(*hdr) > ATH12K_HTC_MAX_LEN) {
275 ath12k_warn(ab, "HTC rx frame too long, len: %zu\n",
276 payload_len + sizeof(*hdr));
280 if (skb->len < payload_len) {
281 ath12k_warn(ab, "HTC Rx: insufficient length, got %d, expected %d\n",
282 skb->len, payload_len);
286 /* get flags to check for trailer */
287 trailer_present = le32_get_bits(hdr->htc_info, HTC_HDR_FLAGS) &
288 ATH12K_HTC_FLAG_TRAILER_PRESENT;
290 if (trailer_present) {
293 trailer_len = le32_get_bits(hdr->ctrl_info,
294 HTC_HDR_CONTROLBYTES0);
295 min_len = sizeof(struct ath12k_htc_record_hdr);
297 if ((trailer_len < min_len) ||
298 (trailer_len > payload_len)) {
299 ath12k_warn(ab, "Invalid trailer length: %d\n",
305 trailer += sizeof(*hdr);
306 trailer += payload_len;
307 trailer -= trailer_len;
308 status = ath12k_htc_process_trailer(htc, trailer,
313 skb_trim(skb, skb->len - trailer_len);
316 if (trailer_len >= payload_len)
317 /* zero length packet with trailer data, just drop these */
320 if (eid == ATH12K_HTC_EP_0) {
321 struct ath12k_htc_msg *msg = (struct ath12k_htc_msg *)skb->data;
323 switch (le32_get_bits(msg->msg_svc_id, HTC_MSG_MESSAGEID)) {
324 case ATH12K_HTC_MSG_READY_ID:
325 case ATH12K_HTC_MSG_CONNECT_SERVICE_RESP_ID:
326 /* handle HTC control message */
327 if (completion_done(&htc->ctl_resp)) {
328 /* this is a fatal error, target should not be
329 * sending unsolicited messages on the ep 0
331 ath12k_warn(ab, "HTC rx ctrl still processing\n");
332 complete(&htc->ctl_resp);
336 htc->control_resp_len =
338 ATH12K_HTC_MAX_CTRL_MSG_LEN);
340 memcpy(htc->control_resp_buffer, skb->data,
341 htc->control_resp_len);
343 complete(&htc->ctl_resp);
345 case ATH12K_HTC_MSG_SEND_SUSPEND_COMPLETE:
346 ath12k_htc_suspend_complete(ab, true);
348 case ATH12K_HTC_MSG_NACK_SUSPEND:
349 ath12k_htc_suspend_complete(ab, false);
351 case ATH12K_HTC_MSG_WAKEUP_FROM_SUSPEND_ID:
354 ath12k_warn(ab, "ignoring unsolicited htc ep0 event %u\n",
355 le32_get_bits(msg->msg_svc_id, HTC_MSG_MESSAGEID));
361 ath12k_dbg(ab, ATH12K_DBG_HTC, "htc rx completion ep %d skb %pK\n",
363 ep->ep_ops.ep_rx_complete(ab, skb);
365 /* poll tx completion for interrupt disabled CE's */
366 ath12k_ce_poll_send_completed(ab, ep->ul_pipe_id);
368 /* skb is now owned by the rx completion handler */
374 static void ath12k_htc_control_rx_complete(struct ath12k_base *ab,
377 /* This is unexpected. FW is not supposed to send regular rx on this
380 ath12k_warn(ab, "unexpected htc rx\n");
384 static const char *htc_service_name(enum ath12k_htc_svc_id id)
387 case ATH12K_HTC_SVC_ID_RESERVED:
389 case ATH12K_HTC_SVC_ID_RSVD_CTRL:
391 case ATH12K_HTC_SVC_ID_WMI_CONTROL:
393 case ATH12K_HTC_SVC_ID_WMI_DATA_BE:
395 case ATH12K_HTC_SVC_ID_WMI_DATA_BK:
397 case ATH12K_HTC_SVC_ID_WMI_DATA_VI:
399 case ATH12K_HTC_SVC_ID_WMI_DATA_VO:
401 case ATH12K_HTC_SVC_ID_WMI_CONTROL_MAC1:
403 case ATH12K_HTC_SVC_ID_WMI_CONTROL_MAC2:
405 case ATH12K_HTC_SVC_ID_NMI_CONTROL:
406 return "NMI Control";
407 case ATH12K_HTC_SVC_ID_NMI_DATA:
409 case ATH12K_HTC_SVC_ID_HTT_DATA_MSG:
411 case ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS:
413 case ATH12K_HTC_SVC_ID_IPA_TX:
415 case ATH12K_HTC_SVC_ID_PKT_LOG:
417 case ATH12K_HTC_SVC_ID_WMI_CONTROL_DIAG:
424 static void ath12k_htc_reset_endpoint_states(struct ath12k_htc *htc)
426 struct ath12k_htc_ep *ep;
429 for (i = ATH12K_HTC_EP_0; i < ATH12K_HTC_EP_COUNT; i++) {
430 ep = &htc->endpoint[i];
431 ep->service_id = ATH12K_HTC_SVC_ID_UNUSED;
432 ep->max_ep_message_len = 0;
433 ep->max_tx_queue_depth = 0;
436 ep->tx_credit_flow_enabled = true;
440 static u8 ath12k_htc_get_credit_allocation(struct ath12k_htc *htc,
443 struct ath12k_htc_svc_tx_credits *serv_entry;
444 u8 i, allocation = 0;
446 serv_entry = htc->service_alloc_table;
448 for (i = 0; i < ATH12K_HTC_MAX_SERVICE_ALLOC_ENTRIES; i++) {
449 if (serv_entry[i].service_id == service_id) {
450 allocation = serv_entry[i].credit_allocation;
458 static int ath12k_htc_setup_target_buffer_assignments(struct ath12k_htc *htc)
460 struct ath12k_htc_svc_tx_credits *serv_entry;
461 static const u32 svc_id[] = {
462 ATH12K_HTC_SVC_ID_WMI_CONTROL,
463 ATH12K_HTC_SVC_ID_WMI_CONTROL_MAC1,
464 ATH12K_HTC_SVC_ID_WMI_CONTROL_MAC2,
468 credits = htc->total_transmit_credits;
469 serv_entry = htc->service_alloc_table;
471 if ((htc->wmi_ep_count == 0) ||
472 (htc->wmi_ep_count > ARRAY_SIZE(svc_id)))
475 /* Divide credits among number of endpoints for WMI */
476 credits = credits / htc->wmi_ep_count;
477 for (i = 0; i < htc->wmi_ep_count; i++) {
478 serv_entry[i].service_id = svc_id[i];
479 serv_entry[i].credit_allocation = credits;
485 int ath12k_htc_wait_target(struct ath12k_htc *htc)
488 struct ath12k_base *ab = htc->ab;
489 unsigned long time_left;
490 struct ath12k_htc_ready *ready;
495 time_left = wait_for_completion_timeout(&htc->ctl_resp,
496 ATH12K_HTC_WAIT_TIMEOUT_HZ);
498 ath12k_warn(ab, "failed to receive control response completion, polling..\n");
500 for (i = 0; i < ab->hw_params->ce_count; i++)
501 ath12k_ce_per_engine_service(htc->ab, i);
504 wait_for_completion_timeout(&htc->ctl_resp,
505 ATH12K_HTC_WAIT_TIMEOUT_HZ);
512 ath12k_warn(ab, "ctl_resp never came in (%d)\n", status);
516 if (htc->control_resp_len < sizeof(*ready)) {
517 ath12k_warn(ab, "Invalid HTC ready msg len:%d\n",
518 htc->control_resp_len);
522 ready = (struct ath12k_htc_ready *)htc->control_resp_buffer;
523 message_id = le32_get_bits(ready->id_credit_count, HTC_MSG_MESSAGEID);
524 credit_count = le32_get_bits(ready->id_credit_count,
525 HTC_READY_MSG_CREDITCOUNT);
526 credit_size = le32_get_bits(ready->size_ep, HTC_READY_MSG_CREDITSIZE);
528 if (message_id != ATH12K_HTC_MSG_READY_ID) {
529 ath12k_warn(ab, "Invalid HTC ready msg: 0x%x\n", message_id);
533 htc->total_transmit_credits = credit_count;
534 htc->target_credit_size = credit_size;
536 ath12k_dbg(ab, ATH12K_DBG_HTC,
537 "Target ready! transmit resources: %d size:%d\n",
538 htc->total_transmit_credits, htc->target_credit_size);
540 if ((htc->total_transmit_credits == 0) ||
541 (htc->target_credit_size == 0)) {
542 ath12k_warn(ab, "Invalid credit size received\n");
546 ath12k_htc_setup_target_buffer_assignments(htc);
551 int ath12k_htc_connect_service(struct ath12k_htc *htc,
552 struct ath12k_htc_svc_conn_req *conn_req,
553 struct ath12k_htc_svc_conn_resp *conn_resp)
555 struct ath12k_base *ab = htc->ab;
556 struct ath12k_htc_conn_svc *req_msg;
557 struct ath12k_htc_conn_svc_resp resp_msg_dummy;
558 struct ath12k_htc_conn_svc_resp *resp_msg = &resp_msg_dummy;
559 enum ath12k_htc_ep_id assigned_eid = ATH12K_HTC_EP_COUNT;
560 struct ath12k_htc_ep *ep;
562 unsigned int max_msg_size = 0;
564 unsigned long time_left;
565 bool disable_credit_flow_ctrl = false;
566 u16 message_id, service_id, flags = 0;
569 /* special case for HTC pseudo control service */
570 if (conn_req->service_id == ATH12K_HTC_SVC_ID_RSVD_CTRL) {
571 disable_credit_flow_ctrl = true;
572 assigned_eid = ATH12K_HTC_EP_0;
573 max_msg_size = ATH12K_HTC_MAX_CTRL_MSG_LEN;
574 memset(&resp_msg_dummy, 0, sizeof(resp_msg_dummy));
578 tx_alloc = ath12k_htc_get_credit_allocation(htc,
579 conn_req->service_id);
581 ath12k_dbg(ab, ATH12K_DBG_BOOT,
582 "boot htc service %s does not allocate target credits\n",
583 htc_service_name(conn_req->service_id));
585 skb = ath12k_htc_build_tx_ctrl_skb();
587 ath12k_warn(ab, "Failed to allocate HTC packet\n");
591 length = sizeof(*req_msg);
592 skb_put(skb, length);
593 memset(skb->data, 0, length);
595 req_msg = (struct ath12k_htc_conn_svc *)skb->data;
596 req_msg->msg_svc_id = le32_encode_bits(ATH12K_HTC_MSG_CONNECT_SERVICE_ID,
599 flags |= u32_encode_bits(tx_alloc, ATH12K_HTC_CONN_FLAGS_RECV_ALLOC);
601 /* Only enable credit flow control for WMI ctrl service */
602 if (!(conn_req->service_id == ATH12K_HTC_SVC_ID_WMI_CONTROL ||
603 conn_req->service_id == ATH12K_HTC_SVC_ID_WMI_CONTROL_MAC1 ||
604 conn_req->service_id == ATH12K_HTC_SVC_ID_WMI_CONTROL_MAC2)) {
605 flags |= ATH12K_HTC_CONN_FLAGS_DISABLE_CREDIT_FLOW_CTRL;
606 disable_credit_flow_ctrl = true;
609 req_msg->flags_len = le32_encode_bits(flags, HTC_SVC_MSG_CONNECTIONFLAGS);
610 req_msg->msg_svc_id |= le32_encode_bits(conn_req->service_id,
611 HTC_SVC_MSG_SERVICE_ID);
613 reinit_completion(&htc->ctl_resp);
615 status = ath12k_htc_send(htc, ATH12K_HTC_EP_0, skb);
621 /* wait for response */
622 time_left = wait_for_completion_timeout(&htc->ctl_resp,
623 ATH12K_HTC_CONN_SVC_TIMEOUT_HZ);
625 ath12k_err(ab, "Service connect timeout\n");
629 /* we controlled the buffer creation, it's aligned */
630 resp_msg = (struct ath12k_htc_conn_svc_resp *)htc->control_resp_buffer;
631 message_id = le32_get_bits(resp_msg->msg_svc_id, HTC_MSG_MESSAGEID);
632 service_id = le32_get_bits(resp_msg->msg_svc_id,
633 HTC_SVC_RESP_MSG_SERVICEID);
635 if ((message_id != ATH12K_HTC_MSG_CONNECT_SERVICE_RESP_ID) ||
636 (htc->control_resp_len < sizeof(*resp_msg))) {
637 ath12k_err(ab, "Invalid resp message ID 0x%x", message_id);
641 ath12k_dbg(ab, ATH12K_DBG_HTC,
642 "HTC Service %s connect response: status: %u, assigned ep: %u\n",
643 htc_service_name(service_id),
644 le32_get_bits(resp_msg->flags_len, HTC_SVC_RESP_MSG_STATUS),
645 le32_get_bits(resp_msg->flags_len, HTC_SVC_RESP_MSG_ENDPOINTID));
647 conn_resp->connect_resp_code = le32_get_bits(resp_msg->flags_len,
648 HTC_SVC_RESP_MSG_STATUS);
650 /* check response status */
651 if (conn_resp->connect_resp_code != ATH12K_HTC_CONN_SVC_STATUS_SUCCESS) {
652 ath12k_err(ab, "HTC Service %s connect request failed: 0x%x)\n",
653 htc_service_name(service_id),
654 conn_resp->connect_resp_code);
658 assigned_eid = le32_get_bits(resp_msg->flags_len,
659 HTC_SVC_RESP_MSG_ENDPOINTID);
661 max_msg_size = le32_get_bits(resp_msg->flags_len,
662 HTC_SVC_RESP_MSG_MAXMSGSIZE);
666 if (assigned_eid >= ATH12K_HTC_EP_COUNT)
669 if (max_msg_size == 0)
672 ep = &htc->endpoint[assigned_eid];
673 ep->eid = assigned_eid;
675 if (ep->service_id != ATH12K_HTC_SVC_ID_UNUSED)
678 /* return assigned endpoint to caller */
679 conn_resp->eid = assigned_eid;
680 conn_resp->max_msg_len = le32_get_bits(resp_msg->flags_len,
681 HTC_SVC_RESP_MSG_MAXMSGSIZE);
683 /* setup the endpoint */
684 ep->service_id = conn_req->service_id;
685 ep->max_tx_queue_depth = conn_req->max_send_queue_depth;
686 ep->max_ep_message_len = le32_get_bits(resp_msg->flags_len,
687 HTC_SVC_RESP_MSG_MAXMSGSIZE);
688 ep->tx_credits = tx_alloc;
690 /* copy all the callbacks */
691 ep->ep_ops = conn_req->ep_ops;
693 status = ath12k_hif_map_service_to_pipe(htc->ab,
700 ath12k_dbg(ab, ATH12K_DBG_BOOT,
701 "boot htc service '%s' ul pipe %d dl pipe %d eid %d ready\n",
702 htc_service_name(ep->service_id), ep->ul_pipe_id,
703 ep->dl_pipe_id, ep->eid);
705 if (disable_credit_flow_ctrl && ep->tx_credit_flow_enabled) {
706 ep->tx_credit_flow_enabled = false;
707 ath12k_dbg(ab, ATH12K_DBG_BOOT,
708 "boot htc service '%s' eid %d TX flow control disabled\n",
709 htc_service_name(ep->service_id), assigned_eid);
715 int ath12k_htc_start(struct ath12k_htc *htc)
719 struct ath12k_base *ab = htc->ab;
720 struct ath12k_htc_setup_complete_extended *msg;
722 skb = ath12k_htc_build_tx_ctrl_skb();
726 skb_put(skb, sizeof(*msg));
727 memset(skb->data, 0, skb->len);
729 msg = (struct ath12k_htc_setup_complete_extended *)skb->data;
730 msg->msg_id = le32_encode_bits(ATH12K_HTC_MSG_SETUP_COMPLETE_EX_ID,
733 ath12k_dbg(ab, ATH12K_DBG_HTC, "HTC is using TX credit flow control\n");
735 status = ath12k_htc_send(htc, ATH12K_HTC_EP_0, skb);
744 int ath12k_htc_init(struct ath12k_base *ab)
746 struct ath12k_htc *htc = &ab->htc;
747 struct ath12k_htc_svc_conn_req conn_req = { };
748 struct ath12k_htc_svc_conn_resp conn_resp = { };
751 spin_lock_init(&htc->tx_lock);
753 ath12k_htc_reset_endpoint_states(htc);
757 switch (ab->wmi_ab.preferred_hw_mode) {
758 case WMI_HOST_HW_MODE_SINGLE:
759 htc->wmi_ep_count = 1;
761 case WMI_HOST_HW_MODE_DBS:
762 case WMI_HOST_HW_MODE_DBS_OR_SBS:
763 htc->wmi_ep_count = 2;
765 case WMI_HOST_HW_MODE_DBS_SBS:
766 htc->wmi_ep_count = 3;
769 htc->wmi_ep_count = ab->hw_params->max_radios;
773 /* setup our pseudo HTC control endpoint connection */
774 conn_req.ep_ops.ep_tx_complete = ath12k_htc_control_tx_complete;
775 conn_req.ep_ops.ep_rx_complete = ath12k_htc_control_rx_complete;
776 conn_req.max_send_queue_depth = ATH12K_NUM_CONTROL_TX_BUFFERS;
777 conn_req.service_id = ATH12K_HTC_SVC_ID_RSVD_CTRL;
779 /* connect fake service */
780 ret = ath12k_htc_connect_service(htc, &conn_req, &conn_resp);
782 ath12k_err(ab, "could not connect to htc service (%d)\n", ret);
786 init_completion(&htc->ctl_resp);