1 // SPDX-License-Identifier: BSD-3-Clause-Clear
3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
14 #include <linux/of_address.h>
15 #include <linux/ioport.h>
16 #include <linux/firmware.h>
17 #include <linux/of_irq.h>
19 #define SLEEP_CLOCK_SELECT_INTERNAL_BIT 0x02
20 #define HOST_CSTATE_BIT 0x04
21 #define PLATFORM_CAP_PCIE_GLOBAL_RESET 0x08
22 #define PLATFORM_CAP_PCIE_PME_D3COLD 0x10
24 #define FW_BUILD_ID_MASK "QC_IMAGE_VERSION_STRING="
26 bool ath11k_cold_boot_cal
= 1;
27 EXPORT_SYMBOL(ath11k_cold_boot_cal
);
28 module_param_named(cold_boot_cal
, ath11k_cold_boot_cal
, bool, 0644);
29 MODULE_PARM_DESC(cold_boot_cal
,
30 "Decrease the channel switch time but increase the driver load time (Default: true)");
32 static const struct qmi_elem_info qmi_wlanfw_host_cap_req_msg_v01_ei
[] = {
34 .data_type
= QMI_OPT_FLAG
,
36 .elem_size
= sizeof(u8
),
37 .array_type
= NO_ARRAY
,
39 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
43 .data_type
= QMI_UNSIGNED_4_BYTE
,
45 .elem_size
= sizeof(u32
),
46 .array_type
= NO_ARRAY
,
48 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
52 .data_type
= QMI_OPT_FLAG
,
54 .elem_size
= sizeof(u8
),
55 .array_type
= NO_ARRAY
,
57 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
61 .data_type
= QMI_UNSIGNED_4_BYTE
,
63 .elem_size
= sizeof(u32
),
64 .array_type
= NO_ARRAY
,
66 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
70 .data_type
= QMI_OPT_FLAG
,
72 .elem_size
= sizeof(u8
),
73 .array_type
= NO_ARRAY
,
75 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
79 .data_type
= QMI_DATA_LEN
,
81 .elem_size
= sizeof(u8
),
82 .array_type
= NO_ARRAY
,
84 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
88 .data_type
= QMI_UNSIGNED_4_BYTE
,
89 .elem_len
= QMI_WLFW_MAX_NUM_GPIO_V01
,
90 .elem_size
= sizeof(u32
),
91 .array_type
= VAR_LEN_ARRAY
,
93 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
97 .data_type
= QMI_OPT_FLAG
,
99 .elem_size
= sizeof(u8
),
100 .array_type
= NO_ARRAY
,
102 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
106 .data_type
= QMI_UNSIGNED_1_BYTE
,
108 .elem_size
= sizeof(u8
),
109 .array_type
= NO_ARRAY
,
111 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
115 .data_type
= QMI_OPT_FLAG
,
117 .elem_size
= sizeof(u8
),
118 .array_type
= NO_ARRAY
,
120 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
124 .data_type
= QMI_UNSIGNED_1_BYTE
,
126 .elem_size
= sizeof(u8
),
127 .array_type
= NO_ARRAY
,
129 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
133 .data_type
= QMI_OPT_FLAG
,
135 .elem_size
= sizeof(u8
),
136 .array_type
= NO_ARRAY
,
138 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
139 bdf_cache_support_valid
),
142 .data_type
= QMI_UNSIGNED_1_BYTE
,
144 .elem_size
= sizeof(u8
),
145 .array_type
= NO_ARRAY
,
147 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
151 .data_type
= QMI_OPT_FLAG
,
153 .elem_size
= sizeof(u8
),
154 .array_type
= NO_ARRAY
,
156 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
160 .data_type
= QMI_UNSIGNED_1_BYTE
,
162 .elem_size
= sizeof(u8
),
163 .array_type
= NO_ARRAY
,
165 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
169 .data_type
= QMI_OPT_FLAG
,
171 .elem_size
= sizeof(u8
),
172 .array_type
= NO_ARRAY
,
174 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
175 m3_cache_support_valid
),
178 .data_type
= QMI_UNSIGNED_1_BYTE
,
180 .elem_size
= sizeof(u8
),
181 .array_type
= NO_ARRAY
,
183 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
187 .data_type
= QMI_OPT_FLAG
,
189 .elem_size
= sizeof(u8
),
190 .array_type
= NO_ARRAY
,
192 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
193 cal_filesys_support_valid
),
196 .data_type
= QMI_UNSIGNED_1_BYTE
,
198 .elem_size
= sizeof(u8
),
199 .array_type
= NO_ARRAY
,
201 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
202 cal_filesys_support
),
205 .data_type
= QMI_OPT_FLAG
,
207 .elem_size
= sizeof(u8
),
208 .array_type
= NO_ARRAY
,
210 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
211 cal_cache_support_valid
),
214 .data_type
= QMI_UNSIGNED_1_BYTE
,
216 .elem_size
= sizeof(u8
),
217 .array_type
= NO_ARRAY
,
219 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
223 .data_type
= QMI_OPT_FLAG
,
225 .elem_size
= sizeof(u8
),
226 .array_type
= NO_ARRAY
,
228 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
232 .data_type
= QMI_UNSIGNED_1_BYTE
,
234 .elem_size
= sizeof(u8
),
235 .array_type
= NO_ARRAY
,
237 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
241 .data_type
= QMI_OPT_FLAG
,
243 .elem_size
= sizeof(u8
),
244 .array_type
= NO_ARRAY
,
246 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
250 .data_type
= QMI_UNSIGNED_4_BYTE
,
252 .elem_size
= sizeof(u32
),
253 .array_type
= NO_ARRAY
,
255 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
259 .data_type
= QMI_OPT_FLAG
,
261 .elem_size
= sizeof(u8
),
262 .array_type
= NO_ARRAY
,
264 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
268 .data_type
= QMI_UNSIGNED_1_BYTE
,
270 .elem_size
= sizeof(u8
),
271 .array_type
= NO_ARRAY
,
273 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
277 .data_type
= QMI_EOTI
,
278 .array_type
= NO_ARRAY
,
279 .tlv_type
= QMI_COMMON_TLV_TYPE
,
283 static const struct qmi_elem_info qmi_wlanfw_host_cap_resp_msg_v01_ei
[] = {
285 .data_type
= QMI_STRUCT
,
287 .elem_size
= sizeof(struct qmi_response_type_v01
),
288 .array_type
= NO_ARRAY
,
290 .offset
= offsetof(struct qmi_wlanfw_host_cap_resp_msg_v01
, resp
),
291 .ei_array
= qmi_response_type_v01_ei
,
294 .data_type
= QMI_EOTI
,
295 .array_type
= NO_ARRAY
,
296 .tlv_type
= QMI_COMMON_TLV_TYPE
,
300 static const struct qmi_elem_info qmi_wlanfw_ind_register_req_msg_v01_ei
[] = {
302 .data_type
= QMI_OPT_FLAG
,
304 .elem_size
= sizeof(u8
),
305 .array_type
= NO_ARRAY
,
307 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
308 fw_ready_enable_valid
),
311 .data_type
= QMI_UNSIGNED_1_BYTE
,
313 .elem_size
= sizeof(u8
),
314 .array_type
= NO_ARRAY
,
316 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
320 .data_type
= QMI_OPT_FLAG
,
322 .elem_size
= sizeof(u8
),
323 .array_type
= NO_ARRAY
,
325 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
326 initiate_cal_download_enable_valid
),
329 .data_type
= QMI_UNSIGNED_1_BYTE
,
331 .elem_size
= sizeof(u8
),
332 .array_type
= NO_ARRAY
,
334 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
335 initiate_cal_download_enable
),
338 .data_type
= QMI_OPT_FLAG
,
340 .elem_size
= sizeof(u8
),
341 .array_type
= NO_ARRAY
,
343 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
344 initiate_cal_update_enable_valid
),
347 .data_type
= QMI_UNSIGNED_1_BYTE
,
349 .elem_size
= sizeof(u8
),
350 .array_type
= NO_ARRAY
,
352 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
353 initiate_cal_update_enable
),
356 .data_type
= QMI_OPT_FLAG
,
358 .elem_size
= sizeof(u8
),
359 .array_type
= NO_ARRAY
,
361 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
362 msa_ready_enable_valid
),
365 .data_type
= QMI_UNSIGNED_1_BYTE
,
367 .elem_size
= sizeof(u8
),
368 .array_type
= NO_ARRAY
,
370 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
374 .data_type
= QMI_OPT_FLAG
,
376 .elem_size
= sizeof(u8
),
377 .array_type
= NO_ARRAY
,
379 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
380 pin_connect_result_enable_valid
),
383 .data_type
= QMI_UNSIGNED_1_BYTE
,
385 .elem_size
= sizeof(u8
),
386 .array_type
= NO_ARRAY
,
388 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
389 pin_connect_result_enable
),
392 .data_type
= QMI_OPT_FLAG
,
394 .elem_size
= sizeof(u8
),
395 .array_type
= NO_ARRAY
,
397 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
401 .data_type
= QMI_UNSIGNED_4_BYTE
,
403 .elem_size
= sizeof(u32
),
404 .array_type
= NO_ARRAY
,
406 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
410 .data_type
= QMI_OPT_FLAG
,
412 .elem_size
= sizeof(u8
),
413 .array_type
= NO_ARRAY
,
415 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
416 request_mem_enable_valid
),
419 .data_type
= QMI_UNSIGNED_1_BYTE
,
421 .elem_size
= sizeof(u8
),
422 .array_type
= NO_ARRAY
,
424 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
428 .data_type
= QMI_OPT_FLAG
,
430 .elem_size
= sizeof(u8
),
431 .array_type
= NO_ARRAY
,
433 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
434 fw_mem_ready_enable_valid
),
437 .data_type
= QMI_UNSIGNED_1_BYTE
,
439 .elem_size
= sizeof(u8
),
440 .array_type
= NO_ARRAY
,
442 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
443 fw_mem_ready_enable
),
446 .data_type
= QMI_OPT_FLAG
,
448 .elem_size
= sizeof(u8
),
449 .array_type
= NO_ARRAY
,
451 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
452 fw_init_done_enable_valid
),
455 .data_type
= QMI_UNSIGNED_1_BYTE
,
457 .elem_size
= sizeof(u8
),
458 .array_type
= NO_ARRAY
,
460 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
461 fw_init_done_enable
),
465 .data_type
= QMI_OPT_FLAG
,
467 .elem_size
= sizeof(u8
),
468 .array_type
= NO_ARRAY
,
470 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
471 rejuvenate_enable_valid
),
474 .data_type
= QMI_UNSIGNED_1_BYTE
,
476 .elem_size
= sizeof(u8
),
477 .array_type
= NO_ARRAY
,
479 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
483 .data_type
= QMI_OPT_FLAG
,
485 .elem_size
= sizeof(u8
),
486 .array_type
= NO_ARRAY
,
488 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
489 xo_cal_enable_valid
),
492 .data_type
= QMI_UNSIGNED_1_BYTE
,
494 .elem_size
= sizeof(u8
),
495 .array_type
= NO_ARRAY
,
497 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
501 .data_type
= QMI_OPT_FLAG
,
503 .elem_size
= sizeof(u8
),
504 .array_type
= NO_ARRAY
,
506 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
507 cal_done_enable_valid
),
510 .data_type
= QMI_UNSIGNED_1_BYTE
,
512 .elem_size
= sizeof(u8
),
513 .array_type
= NO_ARRAY
,
515 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
519 .data_type
= QMI_EOTI
,
520 .array_type
= NO_ARRAY
,
521 .tlv_type
= QMI_COMMON_TLV_TYPE
,
525 static const struct qmi_elem_info qmi_wlanfw_ind_register_resp_msg_v01_ei
[] = {
527 .data_type
= QMI_STRUCT
,
529 .elem_size
= sizeof(struct qmi_response_type_v01
),
530 .array_type
= NO_ARRAY
,
532 .offset
= offsetof(struct qmi_wlanfw_ind_register_resp_msg_v01
,
534 .ei_array
= qmi_response_type_v01_ei
,
537 .data_type
= QMI_OPT_FLAG
,
539 .elem_size
= sizeof(u8
),
540 .array_type
= NO_ARRAY
,
542 .offset
= offsetof(struct qmi_wlanfw_ind_register_resp_msg_v01
,
546 .data_type
= QMI_UNSIGNED_8_BYTE
,
548 .elem_size
= sizeof(u64
),
549 .array_type
= NO_ARRAY
,
551 .offset
= offsetof(struct qmi_wlanfw_ind_register_resp_msg_v01
,
555 .data_type
= QMI_EOTI
,
556 .array_type
= NO_ARRAY
,
557 .tlv_type
= QMI_COMMON_TLV_TYPE
,
561 static const struct qmi_elem_info qmi_wlanfw_mem_cfg_s_v01_ei
[] = {
563 .data_type
= QMI_UNSIGNED_8_BYTE
,
565 .elem_size
= sizeof(u64
),
566 .array_type
= NO_ARRAY
,
568 .offset
= offsetof(struct qmi_wlanfw_mem_cfg_s_v01
, offset
),
571 .data_type
= QMI_UNSIGNED_4_BYTE
,
573 .elem_size
= sizeof(u32
),
574 .array_type
= NO_ARRAY
,
576 .offset
= offsetof(struct qmi_wlanfw_mem_cfg_s_v01
, size
),
579 .data_type
= QMI_UNSIGNED_1_BYTE
,
581 .elem_size
= sizeof(u8
),
582 .array_type
= NO_ARRAY
,
584 .offset
= offsetof(struct qmi_wlanfw_mem_cfg_s_v01
, secure_flag
),
587 .data_type
= QMI_EOTI
,
588 .array_type
= NO_ARRAY
,
589 .tlv_type
= QMI_COMMON_TLV_TYPE
,
593 static const struct qmi_elem_info qmi_wlanfw_mem_seg_s_v01_ei
[] = {
595 .data_type
= QMI_UNSIGNED_4_BYTE
,
597 .elem_size
= sizeof(u32
),
598 .array_type
= NO_ARRAY
,
600 .offset
= offsetof(struct qmi_wlanfw_mem_seg_s_v01
,
604 .data_type
= QMI_SIGNED_4_BYTE_ENUM
,
606 .elem_size
= sizeof(enum qmi_wlanfw_mem_type_enum_v01
),
607 .array_type
= NO_ARRAY
,
609 .offset
= offsetof(struct qmi_wlanfw_mem_seg_s_v01
, type
),
612 .data_type
= QMI_DATA_LEN
,
614 .elem_size
= sizeof(u8
),
615 .array_type
= NO_ARRAY
,
617 .offset
= offsetof(struct qmi_wlanfw_mem_seg_s_v01
, mem_cfg_len
),
620 .data_type
= QMI_STRUCT
,
621 .elem_len
= QMI_WLANFW_MAX_NUM_MEM_CFG_V01
,
622 .elem_size
= sizeof(struct qmi_wlanfw_mem_cfg_s_v01
),
623 .array_type
= VAR_LEN_ARRAY
,
625 .offset
= offsetof(struct qmi_wlanfw_mem_seg_s_v01
, mem_cfg
),
626 .ei_array
= qmi_wlanfw_mem_cfg_s_v01_ei
,
629 .data_type
= QMI_EOTI
,
630 .array_type
= NO_ARRAY
,
631 .tlv_type
= QMI_COMMON_TLV_TYPE
,
635 static const struct qmi_elem_info qmi_wlanfw_request_mem_ind_msg_v01_ei
[] = {
637 .data_type
= QMI_DATA_LEN
,
639 .elem_size
= sizeof(u8
),
640 .array_type
= NO_ARRAY
,
642 .offset
= offsetof(struct qmi_wlanfw_request_mem_ind_msg_v01
,
646 .data_type
= QMI_STRUCT
,
647 .elem_len
= ATH11K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01
,
648 .elem_size
= sizeof(struct qmi_wlanfw_mem_seg_s_v01
),
649 .array_type
= VAR_LEN_ARRAY
,
651 .offset
= offsetof(struct qmi_wlanfw_request_mem_ind_msg_v01
,
653 .ei_array
= qmi_wlanfw_mem_seg_s_v01_ei
,
656 .data_type
= QMI_EOTI
,
657 .array_type
= NO_ARRAY
,
658 .tlv_type
= QMI_COMMON_TLV_TYPE
,
662 static const struct qmi_elem_info qmi_wlanfw_mem_seg_resp_s_v01_ei
[] = {
664 .data_type
= QMI_UNSIGNED_8_BYTE
,
666 .elem_size
= sizeof(u64
),
667 .array_type
= NO_ARRAY
,
669 .offset
= offsetof(struct qmi_wlanfw_mem_seg_resp_s_v01
, addr
),
672 .data_type
= QMI_UNSIGNED_4_BYTE
,
674 .elem_size
= sizeof(u32
),
675 .array_type
= NO_ARRAY
,
677 .offset
= offsetof(struct qmi_wlanfw_mem_seg_resp_s_v01
, size
),
680 .data_type
= QMI_SIGNED_4_BYTE_ENUM
,
682 .elem_size
= sizeof(enum qmi_wlanfw_mem_type_enum_v01
),
683 .array_type
= NO_ARRAY
,
685 .offset
= offsetof(struct qmi_wlanfw_mem_seg_resp_s_v01
, type
),
688 .data_type
= QMI_UNSIGNED_1_BYTE
,
690 .elem_size
= sizeof(u8
),
691 .array_type
= NO_ARRAY
,
693 .offset
= offsetof(struct qmi_wlanfw_mem_seg_resp_s_v01
, restore
),
696 .data_type
= QMI_EOTI
,
697 .array_type
= NO_ARRAY
,
698 .tlv_type
= QMI_COMMON_TLV_TYPE
,
702 static const struct qmi_elem_info qmi_wlanfw_respond_mem_req_msg_v01_ei
[] = {
704 .data_type
= QMI_DATA_LEN
,
706 .elem_size
= sizeof(u8
),
707 .array_type
= NO_ARRAY
,
709 .offset
= offsetof(struct qmi_wlanfw_respond_mem_req_msg_v01
,
713 .data_type
= QMI_STRUCT
,
714 .elem_len
= ATH11K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01
,
715 .elem_size
= sizeof(struct qmi_wlanfw_mem_seg_resp_s_v01
),
716 .array_type
= VAR_LEN_ARRAY
,
718 .offset
= offsetof(struct qmi_wlanfw_respond_mem_req_msg_v01
,
720 .ei_array
= qmi_wlanfw_mem_seg_resp_s_v01_ei
,
723 .data_type
= QMI_EOTI
,
724 .array_type
= NO_ARRAY
,
725 .tlv_type
= QMI_COMMON_TLV_TYPE
,
729 static const struct qmi_elem_info qmi_wlanfw_respond_mem_resp_msg_v01_ei
[] = {
731 .data_type
= QMI_STRUCT
,
733 .elem_size
= sizeof(struct qmi_response_type_v01
),
734 .array_type
= NO_ARRAY
,
736 .offset
= offsetof(struct qmi_wlanfw_respond_mem_resp_msg_v01
,
738 .ei_array
= qmi_response_type_v01_ei
,
741 .data_type
= QMI_EOTI
,
742 .array_type
= NO_ARRAY
,
743 .tlv_type
= QMI_COMMON_TLV_TYPE
,
747 static const struct qmi_elem_info qmi_wlanfw_cap_req_msg_v01_ei
[] = {
749 .data_type
= QMI_EOTI
,
750 .array_type
= NO_ARRAY
,
751 .tlv_type
= QMI_COMMON_TLV_TYPE
,
755 static const struct qmi_elem_info qmi_wlanfw_device_info_req_msg_v01_ei
[] = {
757 .data_type
= QMI_EOTI
,
758 .array_type
= NO_ARRAY
,
759 .tlv_type
= QMI_COMMON_TLV_TYPE
,
763 static const struct qmi_elem_info qmi_wlfw_device_info_resp_msg_v01_ei
[] = {
765 .data_type
= QMI_STRUCT
,
767 .elem_size
= sizeof(struct qmi_response_type_v01
),
768 .array_type
= NO_ARRAY
,
770 .offset
= offsetof(struct qmi_wlanfw_device_info_resp_msg_v01
,
772 .ei_array
= qmi_response_type_v01_ei
,
775 .data_type
= QMI_OPT_FLAG
,
777 .elem_size
= sizeof(u8
),
778 .array_type
= NO_ARRAY
,
780 .offset
= offsetof(struct qmi_wlanfw_device_info_resp_msg_v01
,
784 .data_type
= QMI_UNSIGNED_8_BYTE
,
786 .elem_size
= sizeof(u64
),
787 .array_type
= NO_ARRAY
,
789 .offset
= offsetof(struct qmi_wlanfw_device_info_resp_msg_v01
,
793 .data_type
= QMI_OPT_FLAG
,
795 .elem_size
= sizeof(u8
),
796 .array_type
= NO_ARRAY
,
798 .offset
= offsetof(struct qmi_wlanfw_device_info_resp_msg_v01
,
802 .data_type
= QMI_UNSIGNED_4_BYTE
,
804 .elem_size
= sizeof(u32
),
805 .array_type
= NO_ARRAY
,
807 .offset
= offsetof(struct qmi_wlanfw_device_info_resp_msg_v01
,
811 .data_type
= QMI_EOTI
,
812 .array_type
= NO_ARRAY
,
813 .tlv_type
= QMI_COMMON_TLV_TYPE
,
817 static const struct qmi_elem_info qmi_wlanfw_rf_chip_info_s_v01_ei
[] = {
819 .data_type
= QMI_UNSIGNED_4_BYTE
,
821 .elem_size
= sizeof(u32
),
822 .array_type
= NO_ARRAY
,
824 .offset
= offsetof(struct qmi_wlanfw_rf_chip_info_s_v01
,
828 .data_type
= QMI_UNSIGNED_4_BYTE
,
830 .elem_size
= sizeof(u32
),
831 .array_type
= NO_ARRAY
,
833 .offset
= offsetof(struct qmi_wlanfw_rf_chip_info_s_v01
,
837 .data_type
= QMI_EOTI
,
838 .array_type
= NO_ARRAY
,
839 .tlv_type
= QMI_COMMON_TLV_TYPE
,
843 static const struct qmi_elem_info qmi_wlanfw_rf_board_info_s_v01_ei
[] = {
845 .data_type
= QMI_UNSIGNED_4_BYTE
,
847 .elem_size
= sizeof(u32
),
848 .array_type
= NO_ARRAY
,
850 .offset
= offsetof(struct qmi_wlanfw_rf_board_info_s_v01
,
854 .data_type
= QMI_EOTI
,
855 .array_type
= NO_ARRAY
,
856 .tlv_type
= QMI_COMMON_TLV_TYPE
,
860 static const struct qmi_elem_info qmi_wlanfw_soc_info_s_v01_ei
[] = {
862 .data_type
= QMI_UNSIGNED_4_BYTE
,
864 .elem_size
= sizeof(u32
),
865 .array_type
= NO_ARRAY
,
867 .offset
= offsetof(struct qmi_wlanfw_soc_info_s_v01
, soc_id
),
870 .data_type
= QMI_EOTI
,
871 .array_type
= NO_ARRAY
,
872 .tlv_type
= QMI_COMMON_TLV_TYPE
,
876 static const struct qmi_elem_info qmi_wlanfw_fw_version_info_s_v01_ei
[] = {
878 .data_type
= QMI_UNSIGNED_4_BYTE
,
880 .elem_size
= sizeof(u32
),
881 .array_type
= NO_ARRAY
,
883 .offset
= offsetof(struct qmi_wlanfw_fw_version_info_s_v01
,
887 .data_type
= QMI_STRING
,
888 .elem_len
= ATH11K_QMI_WLANFW_MAX_TIMESTAMP_LEN_V01
+ 1,
889 .elem_size
= sizeof(char),
890 .array_type
= NO_ARRAY
,
892 .offset
= offsetof(struct qmi_wlanfw_fw_version_info_s_v01
,
896 .data_type
= QMI_EOTI
,
897 .array_type
= NO_ARRAY
,
898 .tlv_type
= QMI_COMMON_TLV_TYPE
,
902 static const struct qmi_elem_info qmi_wlanfw_cap_resp_msg_v01_ei
[] = {
904 .data_type
= QMI_STRUCT
,
906 .elem_size
= sizeof(struct qmi_response_type_v01
),
907 .array_type
= NO_ARRAY
,
909 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
, resp
),
910 .ei_array
= qmi_response_type_v01_ei
,
913 .data_type
= QMI_OPT_FLAG
,
915 .elem_size
= sizeof(u8
),
916 .array_type
= NO_ARRAY
,
918 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
922 .data_type
= QMI_STRUCT
,
924 .elem_size
= sizeof(struct qmi_wlanfw_rf_chip_info_s_v01
),
925 .array_type
= NO_ARRAY
,
927 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
929 .ei_array
= qmi_wlanfw_rf_chip_info_s_v01_ei
,
932 .data_type
= QMI_OPT_FLAG
,
934 .elem_size
= sizeof(u8
),
935 .array_type
= NO_ARRAY
,
937 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
941 .data_type
= QMI_STRUCT
,
943 .elem_size
= sizeof(struct qmi_wlanfw_rf_board_info_s_v01
),
944 .array_type
= NO_ARRAY
,
946 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
948 .ei_array
= qmi_wlanfw_rf_board_info_s_v01_ei
,
951 .data_type
= QMI_OPT_FLAG
,
953 .elem_size
= sizeof(u8
),
954 .array_type
= NO_ARRAY
,
956 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
960 .data_type
= QMI_STRUCT
,
962 .elem_size
= sizeof(struct qmi_wlanfw_soc_info_s_v01
),
963 .array_type
= NO_ARRAY
,
965 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
967 .ei_array
= qmi_wlanfw_soc_info_s_v01_ei
,
970 .data_type
= QMI_OPT_FLAG
,
972 .elem_size
= sizeof(u8
),
973 .array_type
= NO_ARRAY
,
975 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
976 fw_version_info_valid
),
979 .data_type
= QMI_STRUCT
,
981 .elem_size
= sizeof(struct qmi_wlanfw_fw_version_info_s_v01
),
982 .array_type
= NO_ARRAY
,
984 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
986 .ei_array
= qmi_wlanfw_fw_version_info_s_v01_ei
,
989 .data_type
= QMI_OPT_FLAG
,
991 .elem_size
= sizeof(u8
),
992 .array_type
= NO_ARRAY
,
994 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
998 .data_type
= QMI_STRING
,
999 .elem_len
= ATH11K_QMI_WLANFW_MAX_BUILD_ID_LEN_V01
+ 1,
1000 .elem_size
= sizeof(char),
1001 .array_type
= NO_ARRAY
,
1003 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
1007 .data_type
= QMI_OPT_FLAG
,
1009 .elem_size
= sizeof(u8
),
1010 .array_type
= NO_ARRAY
,
1012 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
1016 .data_type
= QMI_UNSIGNED_1_BYTE
,
1018 .elem_size
= sizeof(u8
),
1019 .array_type
= NO_ARRAY
,
1021 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
1025 .data_type
= QMI_OPT_FLAG
,
1027 .elem_size
= sizeof(u8
),
1028 .array_type
= NO_ARRAY
,
1030 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
1034 .data_type
= QMI_UNSIGNED_4_BYTE
,
1036 .elem_size
= sizeof(u32
),
1037 .array_type
= NO_ARRAY
,
1039 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
1043 .data_type
= QMI_OPT_FLAG
,
1045 .elem_size
= sizeof(u8
),
1046 .array_type
= NO_ARRAY
,
1048 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
1049 time_freq_hz_valid
),
1052 .data_type
= QMI_UNSIGNED_4_BYTE
,
1054 .elem_size
= sizeof(u32
),
1055 .array_type
= NO_ARRAY
,
1057 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
1061 .data_type
= QMI_OPT_FLAG
,
1063 .elem_size
= sizeof(u8
),
1064 .array_type
= NO_ARRAY
,
1066 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
1070 .data_type
= QMI_UNSIGNED_4_BYTE
,
1072 .elem_size
= sizeof(u32
),
1073 .array_type
= NO_ARRAY
,
1075 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
1079 .data_type
= QMI_OPT_FLAG
,
1081 .elem_size
= sizeof(u8
),
1082 .array_type
= NO_ARRAY
,
1084 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
1085 eeprom_read_timeout_valid
),
1088 .data_type
= QMI_UNSIGNED_4_BYTE
,
1090 .elem_size
= sizeof(u32
),
1091 .array_type
= NO_ARRAY
,
1093 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
1094 eeprom_read_timeout
),
1097 .data_type
= QMI_EOTI
,
1098 .array_type
= NO_ARRAY
,
1099 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1103 static const struct qmi_elem_info qmi_wlanfw_bdf_download_req_msg_v01_ei
[] = {
1105 .data_type
= QMI_UNSIGNED_1_BYTE
,
1107 .elem_size
= sizeof(u8
),
1108 .array_type
= NO_ARRAY
,
1110 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1114 .data_type
= QMI_OPT_FLAG
,
1116 .elem_size
= sizeof(u8
),
1117 .array_type
= NO_ARRAY
,
1119 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1123 .data_type
= QMI_SIGNED_4_BYTE_ENUM
,
1125 .elem_size
= sizeof(enum qmi_wlanfw_cal_temp_id_enum_v01
),
1126 .array_type
= NO_ARRAY
,
1128 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1132 .data_type
= QMI_OPT_FLAG
,
1134 .elem_size
= sizeof(u8
),
1135 .array_type
= NO_ARRAY
,
1137 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1141 .data_type
= QMI_UNSIGNED_4_BYTE
,
1143 .elem_size
= sizeof(u32
),
1144 .array_type
= NO_ARRAY
,
1146 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1150 .data_type
= QMI_OPT_FLAG
,
1152 .elem_size
= sizeof(u8
),
1153 .array_type
= NO_ARRAY
,
1155 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1159 .data_type
= QMI_UNSIGNED_4_BYTE
,
1161 .elem_size
= sizeof(u32
),
1162 .array_type
= NO_ARRAY
,
1164 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1168 .data_type
= QMI_OPT_FLAG
,
1170 .elem_size
= sizeof(u8
),
1171 .array_type
= NO_ARRAY
,
1173 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1177 .data_type
= QMI_DATA_LEN
,
1179 .elem_size
= sizeof(u16
),
1180 .array_type
= NO_ARRAY
,
1182 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1186 .data_type
= QMI_UNSIGNED_1_BYTE
,
1187 .elem_len
= QMI_WLANFW_MAX_DATA_SIZE_V01
,
1188 .elem_size
= sizeof(u8
),
1189 .array_type
= VAR_LEN_ARRAY
,
1191 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1195 .data_type
= QMI_OPT_FLAG
,
1197 .elem_size
= sizeof(u8
),
1198 .array_type
= NO_ARRAY
,
1200 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1204 .data_type
= QMI_UNSIGNED_1_BYTE
,
1206 .elem_size
= sizeof(u8
),
1207 .array_type
= NO_ARRAY
,
1209 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1213 .data_type
= QMI_OPT_FLAG
,
1215 .elem_size
= sizeof(u8
),
1216 .array_type
= NO_ARRAY
,
1218 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1222 .data_type
= QMI_UNSIGNED_1_BYTE
,
1224 .elem_size
= sizeof(u8
),
1225 .array_type
= NO_ARRAY
,
1227 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1232 .data_type
= QMI_EOTI
,
1233 .array_type
= NO_ARRAY
,
1234 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1238 static const struct qmi_elem_info qmi_wlanfw_bdf_download_resp_msg_v01_ei
[] = {
1240 .data_type
= QMI_STRUCT
,
1242 .elem_size
= sizeof(struct qmi_response_type_v01
),
1243 .array_type
= NO_ARRAY
,
1245 .offset
= offsetof(struct qmi_wlanfw_bdf_download_resp_msg_v01
,
1247 .ei_array
= qmi_response_type_v01_ei
,
1250 .data_type
= QMI_EOTI
,
1251 .array_type
= NO_ARRAY
,
1252 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1256 static const struct qmi_elem_info qmi_wlanfw_m3_info_req_msg_v01_ei
[] = {
1258 .data_type
= QMI_UNSIGNED_8_BYTE
,
1260 .elem_size
= sizeof(u64
),
1261 .array_type
= NO_ARRAY
,
1263 .offset
= offsetof(struct qmi_wlanfw_m3_info_req_msg_v01
, addr
),
1266 .data_type
= QMI_UNSIGNED_4_BYTE
,
1268 .elem_size
= sizeof(u32
),
1269 .array_type
= NO_ARRAY
,
1271 .offset
= offsetof(struct qmi_wlanfw_m3_info_req_msg_v01
, size
),
1274 .data_type
= QMI_EOTI
,
1275 .array_type
= NO_ARRAY
,
1276 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1280 static const struct qmi_elem_info qmi_wlanfw_m3_info_resp_msg_v01_ei
[] = {
1282 .data_type
= QMI_STRUCT
,
1284 .elem_size
= sizeof(struct qmi_response_type_v01
),
1285 .array_type
= NO_ARRAY
,
1287 .offset
= offsetof(struct qmi_wlanfw_m3_info_resp_msg_v01
, resp
),
1288 .ei_array
= qmi_response_type_v01_ei
,
1291 .data_type
= QMI_EOTI
,
1292 .array_type
= NO_ARRAY
,
1293 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1297 static const struct qmi_elem_info qmi_wlanfw_ce_tgt_pipe_cfg_s_v01_ei
[] = {
1299 .data_type
= QMI_UNSIGNED_4_BYTE
,
1301 .elem_size
= sizeof(u32
),
1302 .array_type
= NO_ARRAY
,
1304 .offset
= offsetof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01
,
1308 .data_type
= QMI_SIGNED_4_BYTE_ENUM
,
1310 .elem_size
= sizeof(enum qmi_wlanfw_pipedir_enum_v01
),
1311 .array_type
= NO_ARRAY
,
1313 .offset
= offsetof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01
,
1317 .data_type
= QMI_UNSIGNED_4_BYTE
,
1319 .elem_size
= sizeof(u32
),
1320 .array_type
= NO_ARRAY
,
1322 .offset
= offsetof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01
,
1326 .data_type
= QMI_UNSIGNED_4_BYTE
,
1328 .elem_size
= sizeof(u32
),
1329 .array_type
= NO_ARRAY
,
1331 .offset
= offsetof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01
,
1335 .data_type
= QMI_UNSIGNED_4_BYTE
,
1337 .elem_size
= sizeof(u32
),
1338 .array_type
= NO_ARRAY
,
1340 .offset
= offsetof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01
,
1344 .data_type
= QMI_EOTI
,
1345 .array_type
= NO_ARRAY
,
1346 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1350 static const struct qmi_elem_info qmi_wlanfw_ce_svc_pipe_cfg_s_v01_ei
[] = {
1352 .data_type
= QMI_UNSIGNED_4_BYTE
,
1354 .elem_size
= sizeof(u32
),
1355 .array_type
= NO_ARRAY
,
1357 .offset
= offsetof(struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01
,
1361 .data_type
= QMI_SIGNED_4_BYTE_ENUM
,
1363 .elem_size
= sizeof(enum qmi_wlanfw_pipedir_enum_v01
),
1364 .array_type
= NO_ARRAY
,
1366 .offset
= offsetof(struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01
,
1370 .data_type
= QMI_UNSIGNED_4_BYTE
,
1372 .elem_size
= sizeof(u32
),
1373 .array_type
= NO_ARRAY
,
1375 .offset
= offsetof(struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01
,
1379 .data_type
= QMI_EOTI
,
1380 .array_type
= NO_ARRAY
,
1381 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1385 static const struct qmi_elem_info qmi_wlanfw_shadow_reg_cfg_s_v01_ei
[] = {
1387 .data_type
= QMI_UNSIGNED_2_BYTE
,
1389 .elem_size
= sizeof(u16
),
1390 .array_type
= NO_ARRAY
,
1392 .offset
= offsetof(struct qmi_wlanfw_shadow_reg_cfg_s_v01
, id
),
1395 .data_type
= QMI_UNSIGNED_2_BYTE
,
1397 .elem_size
= sizeof(u16
),
1398 .array_type
= NO_ARRAY
,
1400 .offset
= offsetof(struct qmi_wlanfw_shadow_reg_cfg_s_v01
,
1404 .data_type
= QMI_EOTI
,
1405 .array_type
= QMI_COMMON_TLV_TYPE
,
1409 static const struct qmi_elem_info qmi_wlanfw_shadow_reg_v2_cfg_s_v01_ei
[] = {
1411 .data_type
= QMI_UNSIGNED_4_BYTE
,
1413 .elem_size
= sizeof(u32
),
1414 .array_type
= NO_ARRAY
,
1416 .offset
= offsetof(struct qmi_wlanfw_shadow_reg_v2_cfg_s_v01
,
1420 .data_type
= QMI_EOTI
,
1421 .array_type
= NO_ARRAY
,
1422 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1426 static const struct qmi_elem_info qmi_wlanfw_wlan_mode_req_msg_v01_ei
[] = {
1428 .data_type
= QMI_UNSIGNED_4_BYTE
,
1430 .elem_size
= sizeof(u32
),
1431 .array_type
= NO_ARRAY
,
1433 .offset
= offsetof(struct qmi_wlanfw_wlan_mode_req_msg_v01
,
1437 .data_type
= QMI_OPT_FLAG
,
1439 .elem_size
= sizeof(u8
),
1440 .array_type
= NO_ARRAY
,
1442 .offset
= offsetof(struct qmi_wlanfw_wlan_mode_req_msg_v01
,
1446 .data_type
= QMI_UNSIGNED_1_BYTE
,
1448 .elem_size
= sizeof(u8
),
1449 .array_type
= NO_ARRAY
,
1451 .offset
= offsetof(struct qmi_wlanfw_wlan_mode_req_msg_v01
,
1455 .data_type
= QMI_EOTI
,
1456 .array_type
= NO_ARRAY
,
1457 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1461 static const struct qmi_elem_info qmi_wlanfw_wlan_mode_resp_msg_v01_ei
[] = {
1463 .data_type
= QMI_STRUCT
,
1465 .elem_size
= sizeof(struct qmi_response_type_v01
),
1466 .array_type
= NO_ARRAY
,
1468 .offset
= offsetof(struct qmi_wlanfw_wlan_mode_resp_msg_v01
,
1470 .ei_array
= qmi_response_type_v01_ei
,
1473 .data_type
= QMI_EOTI
,
1474 .array_type
= NO_ARRAY
,
1475 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1479 static const struct qmi_elem_info qmi_wlanfw_wlan_cfg_req_msg_v01_ei
[] = {
1481 .data_type
= QMI_OPT_FLAG
,
1483 .elem_size
= sizeof(u8
),
1484 .array_type
= NO_ARRAY
,
1486 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1487 host_version_valid
),
1490 .data_type
= QMI_STRING
,
1491 .elem_len
= QMI_WLANFW_MAX_STR_LEN_V01
+ 1,
1492 .elem_size
= sizeof(char),
1493 .array_type
= NO_ARRAY
,
1495 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1499 .data_type
= QMI_OPT_FLAG
,
1501 .elem_size
= sizeof(u8
),
1502 .array_type
= NO_ARRAY
,
1504 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1508 .data_type
= QMI_DATA_LEN
,
1510 .elem_size
= sizeof(u8
),
1511 .array_type
= NO_ARRAY
,
1513 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1517 .data_type
= QMI_STRUCT
,
1518 .elem_len
= QMI_WLANFW_MAX_NUM_CE_V01
,
1519 .elem_size
= sizeof(
1520 struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01
),
1521 .array_type
= VAR_LEN_ARRAY
,
1523 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1525 .ei_array
= qmi_wlanfw_ce_tgt_pipe_cfg_s_v01_ei
,
1528 .data_type
= QMI_OPT_FLAG
,
1530 .elem_size
= sizeof(u8
),
1531 .array_type
= NO_ARRAY
,
1533 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1537 .data_type
= QMI_DATA_LEN
,
1539 .elem_size
= sizeof(u8
),
1540 .array_type
= NO_ARRAY
,
1542 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1546 .data_type
= QMI_STRUCT
,
1547 .elem_len
= QMI_WLANFW_MAX_NUM_SVC_V01
,
1548 .elem_size
= sizeof(struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01
),
1549 .array_type
= VAR_LEN_ARRAY
,
1551 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1553 .ei_array
= qmi_wlanfw_ce_svc_pipe_cfg_s_v01_ei
,
1556 .data_type
= QMI_OPT_FLAG
,
1558 .elem_size
= sizeof(u8
),
1559 .array_type
= NO_ARRAY
,
1561 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1565 .data_type
= QMI_DATA_LEN
,
1567 .elem_size
= sizeof(u8
),
1568 .array_type
= NO_ARRAY
,
1570 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1574 .data_type
= QMI_STRUCT
,
1575 .elem_len
= QMI_WLANFW_MAX_NUM_SHADOW_REG_V01
,
1576 .elem_size
= sizeof(struct qmi_wlanfw_shadow_reg_cfg_s_v01
),
1577 .array_type
= VAR_LEN_ARRAY
,
1579 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1581 .ei_array
= qmi_wlanfw_shadow_reg_cfg_s_v01_ei
,
1584 .data_type
= QMI_OPT_FLAG
,
1586 .elem_size
= sizeof(u8
),
1587 .array_type
= NO_ARRAY
,
1589 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1590 shadow_reg_v2_valid
),
1593 .data_type
= QMI_DATA_LEN
,
1595 .elem_size
= sizeof(u8
),
1596 .array_type
= NO_ARRAY
,
1598 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1602 .data_type
= QMI_STRUCT
,
1603 .elem_len
= QMI_WLANFW_MAX_NUM_SHADOW_REG_V2_V01
,
1604 .elem_size
= sizeof(struct qmi_wlanfw_shadow_reg_v2_cfg_s_v01
),
1605 .array_type
= VAR_LEN_ARRAY
,
1607 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1609 .ei_array
= qmi_wlanfw_shadow_reg_v2_cfg_s_v01_ei
,
1612 .data_type
= QMI_EOTI
,
1613 .array_type
= NO_ARRAY
,
1614 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1618 static const struct qmi_elem_info qmi_wlanfw_wlan_cfg_resp_msg_v01_ei
[] = {
1620 .data_type
= QMI_STRUCT
,
1622 .elem_size
= sizeof(struct qmi_response_type_v01
),
1623 .array_type
= NO_ARRAY
,
1625 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_resp_msg_v01
, resp
),
1626 .ei_array
= qmi_response_type_v01_ei
,
1629 .data_type
= QMI_EOTI
,
1630 .array_type
= NO_ARRAY
,
1631 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1635 static const struct qmi_elem_info qmi_wlanfw_mem_ready_ind_msg_v01_ei
[] = {
1637 .data_type
= QMI_EOTI
,
1638 .array_type
= NO_ARRAY
,
1642 static const struct qmi_elem_info qmi_wlanfw_fw_ready_ind_msg_v01_ei
[] = {
1644 .data_type
= QMI_EOTI
,
1645 .array_type
= NO_ARRAY
,
1649 static const struct qmi_elem_info qmi_wlanfw_cold_boot_cal_done_ind_msg_v01_ei
[] = {
1651 .data_type
= QMI_EOTI
,
1652 .array_type
= NO_ARRAY
,
1656 static const struct qmi_elem_info qmi_wlanfw_wlan_ini_req_msg_v01_ei
[] = {
1658 .data_type
= QMI_OPT_FLAG
,
1660 .elem_size
= sizeof(u8
),
1661 .array_type
= NO_ARRAY
,
1663 .offset
= offsetof(struct qmi_wlanfw_wlan_ini_req_msg_v01
,
1667 .data_type
= QMI_UNSIGNED_1_BYTE
,
1669 .elem_size
= sizeof(u8
),
1670 .array_type
= NO_ARRAY
,
1672 .offset
= offsetof(struct qmi_wlanfw_wlan_ini_req_msg_v01
,
1676 .data_type
= QMI_EOTI
,
1677 .array_type
= NO_ARRAY
,
1678 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1682 static const struct qmi_elem_info qmi_wlanfw_wlan_ini_resp_msg_v01_ei
[] = {
1684 .data_type
= QMI_STRUCT
,
1686 .elem_size
= sizeof(struct qmi_response_type_v01
),
1687 .array_type
= NO_ARRAY
,
1689 .offset
= offsetof(struct qmi_wlanfw_wlan_ini_resp_msg_v01
,
1691 .ei_array
= qmi_response_type_v01_ei
,
1694 .data_type
= QMI_EOTI
,
1695 .array_type
= NO_ARRAY
,
1696 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1700 static const struct qmi_elem_info qmi_wlfw_fw_init_done_ind_msg_v01_ei
[] = {
1702 .data_type
= QMI_EOTI
,
1703 .array_type
= NO_ARRAY
,
1707 static int ath11k_qmi_host_cap_send(struct ath11k_base
*ab
)
1709 struct qmi_wlanfw_host_cap_req_msg_v01 req
;
1710 struct qmi_wlanfw_host_cap_resp_msg_v01 resp
;
1714 memset(&req
, 0, sizeof(req
));
1715 memset(&resp
, 0, sizeof(resp
));
1717 req
.num_clients_valid
= 1;
1718 req
.num_clients
= 1;
1719 req
.mem_cfg_mode
= ab
->qmi
.target_mem_mode
;
1720 req
.mem_cfg_mode_valid
= 1;
1721 req
.bdf_support_valid
= 1;
1722 req
.bdf_support
= 1;
1724 if (ab
->hw_params
.m3_fw_support
) {
1725 req
.m3_support_valid
= 1;
1727 req
.m3_cache_support_valid
= 1;
1728 req
.m3_cache_support
= 1;
1730 req
.m3_support_valid
= 0;
1732 req
.m3_cache_support_valid
= 0;
1733 req
.m3_cache_support
= 0;
1736 req
.cal_done_valid
= 1;
1737 req
.cal_done
= ab
->qmi
.cal_done
;
1739 if (ab
->hw_params
.internal_sleep_clock
) {
1740 req
.nm_modem_valid
= 1;
1742 /* Notify firmware that this is non-qualcomm platform. */
1743 req
.nm_modem
|= HOST_CSTATE_BIT
;
1745 /* Notify firmware about the sleep clock selection,
1746 * nm_modem_bit[1] is used for this purpose. Host driver on
1747 * non-qualcomm platforms should select internal sleep
1750 req
.nm_modem
|= SLEEP_CLOCK_SELECT_INTERNAL_BIT
;
1753 if (ab
->hw_params
.global_reset
)
1754 req
.nm_modem
|= PLATFORM_CAP_PCIE_GLOBAL_RESET
;
1756 req
.nm_modem
|= PLATFORM_CAP_PCIE_PME_D3COLD
;
1758 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "host cap request\n");
1760 ret
= qmi_txn_init(&ab
->qmi
.handle
, &txn
,
1761 qmi_wlanfw_host_cap_resp_msg_v01_ei
, &resp
);
1765 ret
= qmi_send_request(&ab
->qmi
.handle
, NULL
, &txn
,
1766 QMI_WLANFW_HOST_CAP_REQ_V01
,
1767 QMI_WLANFW_HOST_CAP_REQ_MSG_V01_MAX_LEN
,
1768 qmi_wlanfw_host_cap_req_msg_v01_ei
, &req
);
1770 qmi_txn_cancel(&txn
);
1771 ath11k_warn(ab
, "failed to send host capability request: %d\n", ret
);
1775 ret
= qmi_txn_wait(&txn
, msecs_to_jiffies(ATH11K_QMI_WLANFW_TIMEOUT_MS
));
1779 if (resp
.resp
.result
!= QMI_RESULT_SUCCESS_V01
) {
1780 ath11k_warn(ab
, "host capability request failed: %d %d\n",
1781 resp
.resp
.result
, resp
.resp
.error
);
1790 static int ath11k_qmi_fw_ind_register_send(struct ath11k_base
*ab
)
1792 struct qmi_wlanfw_ind_register_req_msg_v01
*req
;
1793 struct qmi_wlanfw_ind_register_resp_msg_v01
*resp
;
1794 struct qmi_handle
*handle
= &ab
->qmi
.handle
;
1798 req
= kzalloc(sizeof(*req
), GFP_KERNEL
);
1802 resp
= kzalloc(sizeof(*resp
), GFP_KERNEL
);
1808 req
->client_id_valid
= 1;
1809 req
->client_id
= QMI_WLANFW_CLIENT_ID
;
1810 req
->fw_ready_enable_valid
= 1;
1811 req
->fw_ready_enable
= 1;
1812 req
->cal_done_enable_valid
= 1;
1813 req
->cal_done_enable
= 1;
1814 req
->fw_init_done_enable_valid
= 1;
1815 req
->fw_init_done_enable
= 1;
1817 req
->pin_connect_result_enable_valid
= 0;
1818 req
->pin_connect_result_enable
= 0;
1820 /* WCN6750 doesn't request for DDR memory via QMI,
1821 * instead it uses a fixed 12MB reserved memory
1824 if (!ab
->hw_params
.fixed_fw_mem
) {
1825 req
->request_mem_enable_valid
= 1;
1826 req
->request_mem_enable
= 1;
1827 req
->fw_mem_ready_enable_valid
= 1;
1828 req
->fw_mem_ready_enable
= 1;
1831 ret
= qmi_txn_init(handle
, &txn
,
1832 qmi_wlanfw_ind_register_resp_msg_v01_ei
, resp
);
1836 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "indication register request\n");
1838 ret
= qmi_send_request(&ab
->qmi
.handle
, NULL
, &txn
,
1839 QMI_WLANFW_IND_REGISTER_REQ_V01
,
1840 QMI_WLANFW_IND_REGISTER_REQ_MSG_V01_MAX_LEN
,
1841 qmi_wlanfw_ind_register_req_msg_v01_ei
, req
);
1843 qmi_txn_cancel(&txn
);
1844 ath11k_warn(ab
, "failed to send indication register request: %d\n",
1849 ret
= qmi_txn_wait(&txn
, msecs_to_jiffies(ATH11K_QMI_WLANFW_TIMEOUT_MS
));
1851 ath11k_warn(ab
, "failed to register fw indication: %d\n", ret
);
1855 if (resp
->resp
.result
!= QMI_RESULT_SUCCESS_V01
) {
1856 ath11k_warn(ab
, "firmware indication register request failed: %d %d\n",
1857 resp
->resp
.result
, resp
->resp
.error
);
1869 static int ath11k_qmi_respond_fw_mem_request(struct ath11k_base
*ab
)
1871 struct qmi_wlanfw_respond_mem_req_msg_v01
*req
;
1872 struct qmi_wlanfw_respond_mem_resp_msg_v01 resp
;
1877 req
= kzalloc(sizeof(*req
), GFP_KERNEL
);
1881 memset(&resp
, 0, sizeof(resp
));
1883 /* For QCA6390 by default FW requests a block of ~4M contiguous
1884 * DMA memory, it's hard to allocate from OS. So host returns
1885 * failure to FW and FW will then request multiple blocks of small
1886 * chunk size memory.
1888 if (!(ab
->hw_params
.fixed_mem_region
||
1889 test_bit(ATH11K_FLAG_FIXED_MEM_RGN
, &ab
->dev_flags
)) &&
1890 ab
->qmi
.target_mem_delayed
) {
1892 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "delays mem_request %d\n",
1893 ab
->qmi
.mem_seg_count
);
1894 memset(req
, 0, sizeof(*req
));
1897 req
->mem_seg_len
= ab
->qmi
.mem_seg_count
;
1899 for (i
= 0; i
< req
->mem_seg_len
; i
++) {
1900 req
->mem_seg
[i
].addr
= ab
->qmi
.target_mem
[i
].paddr
;
1901 req
->mem_seg
[i
].size
= ab
->qmi
.target_mem
[i
].size
;
1902 req
->mem_seg
[i
].type
= ab
->qmi
.target_mem
[i
].type
;
1903 ath11k_dbg(ab
, ATH11K_DBG_QMI
,
1904 "req mem_seg[%d] %pad %u %u\n", i
,
1905 &ab
->qmi
.target_mem
[i
].paddr
,
1906 ab
->qmi
.target_mem
[i
].size
,
1907 ab
->qmi
.target_mem
[i
].type
);
1911 ret
= qmi_txn_init(&ab
->qmi
.handle
, &txn
,
1912 qmi_wlanfw_respond_mem_resp_msg_v01_ei
, &resp
);
1916 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "respond memory request delayed %i\n",
1919 ret
= qmi_send_request(&ab
->qmi
.handle
, NULL
, &txn
,
1920 QMI_WLANFW_RESPOND_MEM_REQ_V01
,
1921 QMI_WLANFW_RESPOND_MEM_REQ_MSG_V01_MAX_LEN
,
1922 qmi_wlanfw_respond_mem_req_msg_v01_ei
, req
);
1924 qmi_txn_cancel(&txn
);
1925 ath11k_warn(ab
, "failed to respond qmi memory request: %d\n",
1930 ret
= qmi_txn_wait(&txn
, msecs_to_jiffies(ATH11K_QMI_WLANFW_TIMEOUT_MS
));
1932 ath11k_warn(ab
, "failed to wait qmi memory request: %d\n", ret
);
1936 if (resp
.resp
.result
!= QMI_RESULT_SUCCESS_V01
) {
1937 /* the error response is expected when
1938 * target_mem_delayed is true.
1940 if (delayed
&& resp
.resp
.error
== 0)
1943 ath11k_warn(ab
, "qmi respond memory request failed: %d %d\n",
1944 resp
.resp
.result
, resp
.resp
.error
);
1953 static void ath11k_qmi_free_target_mem_chunk(struct ath11k_base
*ab
)
1957 for (i
= 0; i
< ab
->qmi
.mem_seg_count
; i
++) {
1958 if ((ab
->hw_params
.fixed_mem_region
||
1959 test_bit(ATH11K_FLAG_FIXED_MEM_RGN
, &ab
->dev_flags
)) &&
1960 ab
->qmi
.target_mem
[i
].iaddr
)
1961 iounmap(ab
->qmi
.target_mem
[i
].iaddr
);
1963 if (!ab
->qmi
.target_mem
[i
].vaddr
)
1966 dma_free_coherent(ab
->dev
,
1967 ab
->qmi
.target_mem
[i
].prev_size
,
1968 ab
->qmi
.target_mem
[i
].vaddr
,
1969 ab
->qmi
.target_mem
[i
].paddr
);
1970 ab
->qmi
.target_mem
[i
].vaddr
= NULL
;
1974 static int ath11k_qmi_alloc_target_mem_chunk(struct ath11k_base
*ab
)
1977 struct target_mem_chunk
*chunk
;
1979 ab
->qmi
.target_mem_delayed
= false;
1981 for (i
= 0; i
< ab
->qmi
.mem_seg_count
; i
++) {
1982 chunk
= &ab
->qmi
.target_mem
[i
];
1984 /* Firmware reloads in coldboot/firmware recovery.
1985 * in such case, no need to allocate memory for FW again.
1988 if (chunk
->prev_type
== chunk
->type
&&
1989 chunk
->prev_size
== chunk
->size
)
1992 /* cannot reuse the existing chunk */
1993 dma_free_coherent(ab
->dev
, chunk
->prev_size
,
1994 chunk
->vaddr
, chunk
->paddr
);
1995 chunk
->vaddr
= NULL
;
1998 chunk
->vaddr
= dma_alloc_coherent(ab
->dev
,
2001 GFP_KERNEL
| __GFP_NOWARN
);
2002 if (!chunk
->vaddr
) {
2003 if (ab
->qmi
.mem_seg_count
<= ATH11K_QMI_FW_MEM_REQ_SEGMENT_CNT
) {
2004 ath11k_dbg(ab
, ATH11K_DBG_QMI
,
2005 "dma allocation failed (%d B type %u), will try later with small size\n",
2008 ath11k_qmi_free_target_mem_chunk(ab
);
2009 ab
->qmi
.target_mem_delayed
= true;
2013 ath11k_err(ab
, "failed to allocate dma memory for qmi (%d B type %u)\n",
2018 chunk
->prev_type
= chunk
->type
;
2019 chunk
->prev_size
= chunk
->size
;
2025 static int ath11k_qmi_assign_target_mem_chunk(struct ath11k_base
*ab
)
2027 struct device
*dev
= ab
->dev
;
2028 struct device_node
*hremote_node
= NULL
;
2029 struct resource res
;
2033 for (i
= 0, idx
= 0; i
< ab
->qmi
.mem_seg_count
; i
++) {
2034 switch (ab
->qmi
.target_mem
[i
].type
) {
2035 case HOST_DDR_REGION_TYPE
:
2036 hremote_node
= of_parse_phandle(dev
->of_node
, "memory-region", 0);
2037 if (!hremote_node
) {
2038 ath11k_dbg(ab
, ATH11K_DBG_QMI
,
2039 "fail to get hremote_node\n");
2043 ret
= of_address_to_resource(hremote_node
, 0, &res
);
2044 of_node_put(hremote_node
);
2046 ath11k_dbg(ab
, ATH11K_DBG_QMI
,
2047 "fail to get reg from hremote\n");
2051 if (res
.end
- res
.start
+ 1 < ab
->qmi
.target_mem
[i
].size
) {
2052 ath11k_dbg(ab
, ATH11K_DBG_QMI
,
2053 "fail to assign memory of sz\n");
2057 ab
->qmi
.target_mem
[idx
].paddr
= res
.start
;
2058 ab
->qmi
.target_mem
[idx
].iaddr
=
2059 ioremap(ab
->qmi
.target_mem
[idx
].paddr
,
2060 ab
->qmi
.target_mem
[i
].size
);
2061 if (!ab
->qmi
.target_mem
[idx
].iaddr
)
2064 ab
->qmi
.target_mem
[idx
].size
= ab
->qmi
.target_mem
[i
].size
;
2065 host_ddr_sz
= ab
->qmi
.target_mem
[i
].size
;
2066 ab
->qmi
.target_mem
[idx
].type
= ab
->qmi
.target_mem
[i
].type
;
2069 case BDF_MEM_REGION_TYPE
:
2070 ab
->qmi
.target_mem
[idx
].paddr
= ab
->hw_params
.bdf_addr
;
2071 ab
->qmi
.target_mem
[idx
].vaddr
= NULL
;
2072 ab
->qmi
.target_mem
[idx
].size
= ab
->qmi
.target_mem
[i
].size
;
2073 ab
->qmi
.target_mem
[idx
].type
= ab
->qmi
.target_mem
[i
].type
;
2076 case CALDB_MEM_REGION_TYPE
:
2077 if (ab
->qmi
.target_mem
[i
].size
> ATH11K_QMI_CALDB_SIZE
) {
2078 ath11k_warn(ab
, "qmi mem size is low to load caldata\n");
2082 if (ath11k_core_coldboot_cal_support(ab
)) {
2084 ab
->qmi
.target_mem
[idx
].paddr
=
2085 res
.start
+ host_ddr_sz
;
2086 ab
->qmi
.target_mem
[idx
].iaddr
=
2087 ioremap(ab
->qmi
.target_mem
[idx
].paddr
,
2088 ab
->qmi
.target_mem
[i
].size
);
2089 if (!ab
->qmi
.target_mem
[idx
].iaddr
)
2092 ab
->qmi
.target_mem
[idx
].paddr
=
2093 ATH11K_QMI_CALDB_ADDRESS
;
2096 ab
->qmi
.target_mem
[idx
].paddr
= 0;
2097 ab
->qmi
.target_mem
[idx
].vaddr
= NULL
;
2099 ab
->qmi
.target_mem
[idx
].size
= ab
->qmi
.target_mem
[i
].size
;
2100 ab
->qmi
.target_mem
[idx
].type
= ab
->qmi
.target_mem
[i
].type
;
2104 ath11k_warn(ab
, "qmi ignore invalid mem req type %d\n",
2105 ab
->qmi
.target_mem
[i
].type
);
2109 ab
->qmi
.mem_seg_count
= idx
;
2114 static int ath11k_qmi_request_device_info(struct ath11k_base
*ab
)
2116 struct qmi_wlanfw_device_info_req_msg_v01 req
= {};
2117 struct qmi_wlanfw_device_info_resp_msg_v01 resp
= {};
2119 void __iomem
*bar_addr_va
;
2122 /* device info message req is only sent for hybrid bus devices */
2123 if (!ab
->hw_params
.hybrid_bus_type
)
2126 ret
= qmi_txn_init(&ab
->qmi
.handle
, &txn
,
2127 qmi_wlfw_device_info_resp_msg_v01_ei
, &resp
);
2131 ret
= qmi_send_request(&ab
->qmi
.handle
, NULL
, &txn
,
2132 QMI_WLANFW_DEVICE_INFO_REQ_V01
,
2133 QMI_WLANFW_DEVICE_INFO_REQ_MSG_V01_MAX_LEN
,
2134 qmi_wlanfw_device_info_req_msg_v01_ei
, &req
);
2136 qmi_txn_cancel(&txn
);
2137 ath11k_warn(ab
, "failed to send qmi target device info request: %d\n",
2142 ret
= qmi_txn_wait(&txn
, msecs_to_jiffies(ATH11K_QMI_WLANFW_TIMEOUT_MS
));
2144 ath11k_warn(ab
, "failed to wait qmi target device info request: %d\n",
2149 if (resp
.resp
.result
!= QMI_RESULT_SUCCESS_V01
) {
2150 ath11k_warn(ab
, "qmi device info request failed: %d %d\n",
2151 resp
.resp
.result
, resp
.resp
.error
);
2156 if (!resp
.bar_addr_valid
|| !resp
.bar_size_valid
) {
2157 ath11k_warn(ab
, "qmi device info response invalid: %d %d\n",
2158 resp
.resp
.result
, resp
.resp
.error
);
2163 if (!resp
.bar_addr
||
2164 resp
.bar_size
!= ATH11K_QMI_DEVICE_BAR_SIZE
) {
2165 ath11k_warn(ab
, "qmi device info invalid address and size: %llu %u\n",
2166 resp
.bar_addr
, resp
.bar_size
);
2171 bar_addr_va
= devm_ioremap(ab
->dev
, resp
.bar_addr
, resp
.bar_size
);
2174 ath11k_warn(ab
, "qmi device info ioremap failed\n");
2180 ab
->mem
= bar_addr_va
;
2181 ab
->mem_len
= resp
.bar_size
;
2183 if (!ab
->hw_params
.ce_remap
)
2184 ab
->mem_ce
= ab
->mem
;
2191 static int ath11k_qmi_request_target_cap(struct ath11k_base
*ab
)
2193 struct qmi_wlanfw_cap_req_msg_v01 req
;
2194 struct qmi_wlanfw_cap_resp_msg_v01 resp
;
2199 int fw_build_id_mask_len
;
2201 memset(&req
, 0, sizeof(req
));
2202 memset(&resp
, 0, sizeof(resp
));
2204 ret
= qmi_txn_init(&ab
->qmi
.handle
, &txn
, qmi_wlanfw_cap_resp_msg_v01_ei
,
2209 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "target cap request\n");
2211 ret
= qmi_send_request(&ab
->qmi
.handle
, NULL
, &txn
,
2212 QMI_WLANFW_CAP_REQ_V01
,
2213 QMI_WLANFW_CAP_REQ_MSG_V01_MAX_LEN
,
2214 qmi_wlanfw_cap_req_msg_v01_ei
, &req
);
2216 qmi_txn_cancel(&txn
);
2217 ath11k_warn(ab
, "failed to send qmi cap request: %d\n",
2222 ret
= qmi_txn_wait(&txn
, msecs_to_jiffies(ATH11K_QMI_WLANFW_TIMEOUT_MS
));
2224 ath11k_warn(ab
, "failed to wait qmi cap request: %d\n", ret
);
2228 if (resp
.resp
.result
!= QMI_RESULT_SUCCESS_V01
) {
2229 ath11k_warn(ab
, "qmi cap request failed: %d %d\n",
2230 resp
.resp
.result
, resp
.resp
.error
);
2235 if (resp
.chip_info_valid
) {
2236 ab
->qmi
.target
.chip_id
= resp
.chip_info
.chip_id
;
2237 ab
->qmi
.target
.chip_family
= resp
.chip_info
.chip_family
;
2240 if (resp
.board_info_valid
)
2241 ab
->qmi
.target
.board_id
= resp
.board_info
.board_id
;
2243 ab
->qmi
.target
.board_id
= 0xFF;
2245 if (resp
.soc_info_valid
)
2246 ab
->qmi
.target
.soc_id
= resp
.soc_info
.soc_id
;
2248 if (resp
.fw_version_info_valid
) {
2249 ab
->qmi
.target
.fw_version
= resp
.fw_version_info
.fw_version
;
2250 strscpy(ab
->qmi
.target
.fw_build_timestamp
,
2251 resp
.fw_version_info
.fw_build_timestamp
,
2252 sizeof(ab
->qmi
.target
.fw_build_timestamp
));
2255 if (resp
.fw_build_id_valid
)
2256 strscpy(ab
->qmi
.target
.fw_build_id
, resp
.fw_build_id
,
2257 sizeof(ab
->qmi
.target
.fw_build_id
));
2259 if (resp
.eeprom_read_timeout_valid
) {
2260 ab
->qmi
.target
.eeprom_caldata
=
2261 resp
.eeprom_read_timeout
;
2262 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "cal data supported from eeprom\n");
2265 fw_build_id
= ab
->qmi
.target
.fw_build_id
;
2266 fw_build_id_mask_len
= strlen(FW_BUILD_ID_MASK
);
2267 if (!strncmp(fw_build_id
, FW_BUILD_ID_MASK
, fw_build_id_mask_len
))
2268 fw_build_id
= fw_build_id
+ fw_build_id_mask_len
;
2270 ath11k_info(ab
, "chip_id 0x%x chip_family 0x%x board_id 0x%x soc_id 0x%x\n",
2271 ab
->qmi
.target
.chip_id
, ab
->qmi
.target
.chip_family
,
2272 ab
->qmi
.target
.board_id
, ab
->qmi
.target
.soc_id
);
2274 ath11k_info(ab
, "fw_version 0x%x fw_build_timestamp %s fw_build_id %s",
2275 ab
->qmi
.target
.fw_version
,
2276 ab
->qmi
.target
.fw_build_timestamp
,
2279 r
= ath11k_core_check_smbios(ab
);
2281 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "SMBIOS bdf variant name not set.\n");
2283 r
= ath11k_core_check_dt(ab
);
2285 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "DT bdf variant name not set.\n");
2291 static int ath11k_qmi_load_file_target_mem(struct ath11k_base
*ab
,
2292 const u8
*data
, u32 len
, u8 type
)
2294 struct qmi_wlanfw_bdf_download_req_msg_v01
*req
;
2295 struct qmi_wlanfw_bdf_download_resp_msg_v01 resp
;
2297 const u8
*temp
= data
;
2298 void __iomem
*bdf_addr
= NULL
;
2300 u32 remaining
= len
;
2302 req
= kzalloc(sizeof(*req
), GFP_KERNEL
);
2306 memset(&resp
, 0, sizeof(resp
));
2308 if (ab
->hw_params
.fixed_bdf_addr
) {
2309 bdf_addr
= ioremap(ab
->hw_params
.bdf_addr
, ab
->hw_params
.fw
.board_size
);
2311 ath11k_warn(ab
, "qmi ioremap error for bdf_addr\n");
2319 req
->file_id_valid
= 1;
2320 req
->file_id
= ab
->qmi
.target
.board_id
;
2321 req
->total_size_valid
= 1;
2322 req
->total_size
= remaining
;
2323 req
->seg_id_valid
= 1;
2324 req
->data_valid
= 1;
2325 req
->bdf_type
= type
;
2326 req
->bdf_type_valid
= 1;
2330 if (remaining
> QMI_WLANFW_MAX_DATA_SIZE_V01
) {
2331 req
->data_len
= QMI_WLANFW_MAX_DATA_SIZE_V01
;
2333 req
->data_len
= remaining
;
2337 if (ab
->hw_params
.fixed_bdf_addr
||
2338 type
== ATH11K_QMI_FILE_TYPE_EEPROM
) {
2339 req
->data_valid
= 0;
2341 req
->data_len
= ATH11K_QMI_MAX_BDF_FILE_NAME_SIZE
;
2343 memcpy(req
->data
, temp
, req
->data_len
);
2346 if (ab
->hw_params
.fixed_bdf_addr
) {
2347 if (type
== ATH11K_QMI_FILE_TYPE_CALDATA
)
2348 bdf_addr
+= ab
->hw_params
.fw
.cal_offset
;
2350 memcpy_toio(bdf_addr
, temp
, len
);
2353 ret
= qmi_txn_init(&ab
->qmi
.handle
, &txn
,
2354 qmi_wlanfw_bdf_download_resp_msg_v01_ei
,
2359 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "bdf download req fixed addr type %d\n",
2362 ret
= qmi_send_request(&ab
->qmi
.handle
, NULL
, &txn
,
2363 QMI_WLANFW_BDF_DOWNLOAD_REQ_V01
,
2364 QMI_WLANFW_BDF_DOWNLOAD_REQ_MSG_V01_MAX_LEN
,
2365 qmi_wlanfw_bdf_download_req_msg_v01_ei
, req
);
2367 qmi_txn_cancel(&txn
);
2371 ret
= qmi_txn_wait(&txn
, msecs_to_jiffies(ATH11K_QMI_WLANFW_TIMEOUT_MS
));
2373 ath11k_warn(ab
, "failed to wait board file download request: %d\n",
2378 if (resp
.resp
.result
!= QMI_RESULT_SUCCESS_V01
) {
2379 ath11k_warn(ab
, "board file download request failed: %d %d\n",
2380 resp
.resp
.result
, resp
.resp
.error
);
2385 if (ab
->hw_params
.fixed_bdf_addr
||
2386 type
== ATH11K_QMI_FILE_TYPE_EEPROM
) {
2389 remaining
-= req
->data_len
;
2390 temp
+= req
->data_len
;
2392 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "bdf download request remaining %i\n",
2398 if (ab
->hw_params
.fixed_bdf_addr
)
2407 static int ath11k_qmi_load_bdf_qmi(struct ath11k_base
*ab
,
2410 struct device
*dev
= ab
->dev
;
2411 char filename
[ATH11K_QMI_MAX_BDF_FILE_NAME_SIZE
];
2412 const struct firmware
*fw_entry
;
2413 struct ath11k_board_data bd
;
2414 u32 fw_size
, file_type
;
2415 int ret
= 0, bdf_type
;
2418 memset(&bd
, 0, sizeof(bd
));
2421 ret
= ath11k_core_fetch_regdb(ab
, &bd
);
2423 ret
= ath11k_core_fetch_bdf(ab
, &bd
);
2425 ath11k_warn(ab
, "qmi failed to fetch board file: %d\n", ret
);
2432 bdf_type
= ATH11K_QMI_BDF_TYPE_REGDB
;
2433 else if (bd
.len
>= SELFMAG
&& memcmp(bd
.data
, ELFMAG
, SELFMAG
) == 0)
2434 bdf_type
= ATH11K_QMI_BDF_TYPE_ELF
;
2436 bdf_type
= ATH11K_QMI_BDF_TYPE_BIN
;
2438 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "bdf_type %d\n", bdf_type
);
2440 fw_size
= min_t(u32
, ab
->hw_params
.fw
.board_size
, bd
.len
);
2442 ret
= ath11k_qmi_load_file_target_mem(ab
, bd
.data
, fw_size
, bdf_type
);
2444 ath11k_warn(ab
, "qmi failed to load bdf file\n");
2448 /* QCA6390/WCN6855 does not support cal data, skip it */
2449 if (bdf_type
== ATH11K_QMI_BDF_TYPE_ELF
|| bdf_type
== ATH11K_QMI_BDF_TYPE_REGDB
)
2452 if (ab
->qmi
.target
.eeprom_caldata
) {
2453 file_type
= ATH11K_QMI_FILE_TYPE_EEPROM
;
2455 fw_size
= ATH11K_QMI_MAX_BDF_FILE_NAME_SIZE
;
2457 file_type
= ATH11K_QMI_FILE_TYPE_CALDATA
;
2459 /* cal-<bus>-<id>.bin */
2460 snprintf(filename
, sizeof(filename
), "cal-%s-%s.bin",
2461 ath11k_bus_str(ab
->hif
.bus
), dev_name(dev
));
2462 fw_entry
= ath11k_core_firmware_request(ab
, filename
);
2463 if (!IS_ERR(fw_entry
))
2466 fw_entry
= ath11k_core_firmware_request(ab
, ATH11K_DEFAULT_CAL_FILE
);
2467 if (IS_ERR(fw_entry
)) {
2468 /* Caldata may not be present during first time calibration in
2469 * factory hence allow to boot without loading caldata in ftm mode
2471 if (ath11k_ftm_mode
) {
2473 "Booting without cal data file in factory test mode\n");
2476 ret
= PTR_ERR(fw_entry
);
2478 "qmi failed to load CAL data file:%s\n",
2483 fw_size
= min_t(u32
, ab
->hw_params
.fw
.board_size
, fw_entry
->size
);
2484 tmp
= fw_entry
->data
;
2487 ret
= ath11k_qmi_load_file_target_mem(ab
, tmp
, fw_size
, file_type
);
2489 ath11k_warn(ab
, "qmi failed to load caldata\n");
2493 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "caldata type: %u\n", file_type
);
2496 if (!ab
->qmi
.target
.eeprom_caldata
)
2497 release_firmware(fw_entry
);
2499 ath11k_core_free_bdf(ab
, &bd
);
2500 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "BDF download sequence completed\n");
2505 static int ath11k_qmi_m3_load(struct ath11k_base
*ab
)
2507 struct m3_mem_region
*m3_mem
= &ab
->qmi
.m3_mem
;
2508 const struct firmware
*fw
= NULL
;
2509 const void *m3_data
;
2515 /* m3 firmware buffer is already available in the DMA buffer */
2518 if (ab
->fw
.m3_data
&& ab
->fw
.m3_len
> 0) {
2519 /* firmware-N.bin had a m3 firmware file so use that */
2520 m3_data
= ab
->fw
.m3_data
;
2521 m3_len
= ab
->fw
.m3_len
;
2523 /* No m3 file in firmware-N.bin so try to request old
2526 fw
= ath11k_core_firmware_request(ab
, ATH11K_M3_FILE
);
2529 ath11k_core_create_firmware_path(ab
, ATH11K_M3_FILE
,
2530 path
, sizeof(path
));
2531 ath11k_err(ab
, "failed to load %s: %d\n", path
, ret
);
2539 m3_mem
->vaddr
= dma_alloc_coherent(ab
->dev
,
2540 m3_len
, &m3_mem
->paddr
,
2542 if (!m3_mem
->vaddr
) {
2543 ath11k_err(ab
, "failed to allocate memory for M3 with size %zu\n",
2549 memcpy(m3_mem
->vaddr
, m3_data
, m3_len
);
2550 m3_mem
->size
= m3_len
;
2555 release_firmware(fw
);
2560 static void ath11k_qmi_m3_free(struct ath11k_base
*ab
)
2562 struct m3_mem_region
*m3_mem
= &ab
->qmi
.m3_mem
;
2564 if (!ab
->hw_params
.m3_fw_support
|| !m3_mem
->vaddr
)
2567 dma_free_coherent(ab
->dev
, m3_mem
->size
,
2568 m3_mem
->vaddr
, m3_mem
->paddr
);
2569 m3_mem
->vaddr
= NULL
;
2573 static int ath11k_qmi_wlanfw_m3_info_send(struct ath11k_base
*ab
)
2575 struct m3_mem_region
*m3_mem
= &ab
->qmi
.m3_mem
;
2576 struct qmi_wlanfw_m3_info_req_msg_v01 req
;
2577 struct qmi_wlanfw_m3_info_resp_msg_v01 resp
;
2581 memset(&req
, 0, sizeof(req
));
2582 memset(&resp
, 0, sizeof(resp
));
2584 if (ab
->hw_params
.m3_fw_support
) {
2585 ret
= ath11k_qmi_m3_load(ab
);
2587 ath11k_err(ab
, "failed to load m3 firmware: %d", ret
);
2591 req
.addr
= m3_mem
->paddr
;
2592 req
.size
= m3_mem
->size
;
2598 ret
= qmi_txn_init(&ab
->qmi
.handle
, &txn
,
2599 qmi_wlanfw_m3_info_resp_msg_v01_ei
, &resp
);
2603 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "m3 info req\n");
2605 ret
= qmi_send_request(&ab
->qmi
.handle
, NULL
, &txn
,
2606 QMI_WLANFW_M3_INFO_REQ_V01
,
2607 QMI_WLANFW_M3_INFO_REQ_MSG_V01_MAX_MSG_LEN
,
2608 qmi_wlanfw_m3_info_req_msg_v01_ei
, &req
);
2610 qmi_txn_cancel(&txn
);
2611 ath11k_warn(ab
, "failed to send m3 information request: %d\n",
2616 ret
= qmi_txn_wait(&txn
, msecs_to_jiffies(ATH11K_QMI_WLANFW_TIMEOUT_MS
));
2618 ath11k_warn(ab
, "failed to wait m3 information request: %d\n", ret
);
2622 if (resp
.resp
.result
!= QMI_RESULT_SUCCESS_V01
) {
2623 ath11k_warn(ab
, "m3 info request failed: %d %d\n",
2624 resp
.resp
.result
, resp
.resp
.error
);
2632 static int ath11k_qmi_wlanfw_mode_send(struct ath11k_base
*ab
,
2635 struct qmi_wlanfw_wlan_mode_req_msg_v01 req
;
2636 struct qmi_wlanfw_wlan_mode_resp_msg_v01 resp
;
2640 memset(&req
, 0, sizeof(req
));
2641 memset(&resp
, 0, sizeof(resp
));
2644 req
.hw_debug_valid
= 1;
2647 ret
= qmi_txn_init(&ab
->qmi
.handle
, &txn
,
2648 qmi_wlanfw_wlan_mode_resp_msg_v01_ei
, &resp
);
2652 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "wlan mode req mode %d\n", mode
);
2654 ret
= qmi_send_request(&ab
->qmi
.handle
, NULL
, &txn
,
2655 QMI_WLANFW_WLAN_MODE_REQ_V01
,
2656 QMI_WLANFW_WLAN_MODE_REQ_MSG_V01_MAX_LEN
,
2657 qmi_wlanfw_wlan_mode_req_msg_v01_ei
, &req
);
2659 qmi_txn_cancel(&txn
);
2660 ath11k_warn(ab
, "failed to send wlan mode request (mode %d): %d\n",
2665 ret
= qmi_txn_wait(&txn
, msecs_to_jiffies(ATH11K_QMI_WLANFW_TIMEOUT_MS
));
2667 if (mode
== ATH11K_FIRMWARE_MODE_OFF
&& ret
== -ENETRESET
) {
2668 ath11k_warn(ab
, "WLFW service is dis-connected\n");
2671 ath11k_warn(ab
, "failed to wait wlan mode request (mode %d): %d\n",
2676 if (resp
.resp
.result
!= QMI_RESULT_SUCCESS_V01
) {
2677 ath11k_warn(ab
, "wlan mode request failed (mode: %d): %d %d\n",
2678 mode
, resp
.resp
.result
, resp
.resp
.error
);
2687 static int ath11k_qmi_wlanfw_wlan_cfg_send(struct ath11k_base
*ab
)
2689 struct qmi_wlanfw_wlan_cfg_req_msg_v01
*req
;
2690 struct qmi_wlanfw_wlan_cfg_resp_msg_v01 resp
;
2691 struct ce_pipe_config
*ce_cfg
;
2692 struct service_to_pipe
*svc_cfg
;
2694 int ret
= 0, pipe_num
;
2696 ce_cfg
= (struct ce_pipe_config
*)ab
->qmi
.ce_cfg
.tgt_ce
;
2697 svc_cfg
= (struct service_to_pipe
*)ab
->qmi
.ce_cfg
.svc_to_ce_map
;
2699 req
= kzalloc(sizeof(*req
), GFP_KERNEL
);
2703 memset(&resp
, 0, sizeof(resp
));
2705 req
->host_version_valid
= 1;
2706 strscpy(req
->host_version
, ATH11K_HOST_VERSION_STRING
,
2707 sizeof(req
->host_version
));
2709 req
->tgt_cfg_valid
= 1;
2710 /* This is number of CE configs */
2711 req
->tgt_cfg_len
= ab
->qmi
.ce_cfg
.tgt_ce_len
;
2712 for (pipe_num
= 0; pipe_num
< req
->tgt_cfg_len
; pipe_num
++) {
2713 req
->tgt_cfg
[pipe_num
].pipe_num
= ce_cfg
[pipe_num
].pipenum
;
2714 req
->tgt_cfg
[pipe_num
].pipe_dir
= ce_cfg
[pipe_num
].pipedir
;
2715 req
->tgt_cfg
[pipe_num
].nentries
= ce_cfg
[pipe_num
].nentries
;
2716 req
->tgt_cfg
[pipe_num
].nbytes_max
= ce_cfg
[pipe_num
].nbytes_max
;
2717 req
->tgt_cfg
[pipe_num
].flags
= ce_cfg
[pipe_num
].flags
;
2720 req
->svc_cfg_valid
= 1;
2721 /* This is number of Service/CE configs */
2722 req
->svc_cfg_len
= ab
->qmi
.ce_cfg
.svc_to_ce_map_len
;
2723 for (pipe_num
= 0; pipe_num
< req
->svc_cfg_len
; pipe_num
++) {
2724 req
->svc_cfg
[pipe_num
].service_id
= svc_cfg
[pipe_num
].service_id
;
2725 req
->svc_cfg
[pipe_num
].pipe_dir
= svc_cfg
[pipe_num
].pipedir
;
2726 req
->svc_cfg
[pipe_num
].pipe_num
= svc_cfg
[pipe_num
].pipenum
;
2728 req
->shadow_reg_valid
= 0;
2730 /* set shadow v2 configuration */
2731 if (ab
->hw_params
.supports_shadow_regs
) {
2732 req
->shadow_reg_v2_valid
= 1;
2733 req
->shadow_reg_v2_len
= min_t(u32
,
2734 ab
->qmi
.ce_cfg
.shadow_reg_v2_len
,
2735 QMI_WLANFW_MAX_NUM_SHADOW_REG_V2_V01
);
2736 memcpy(&req
->shadow_reg_v2
, ab
->qmi
.ce_cfg
.shadow_reg_v2
,
2737 sizeof(u32
) * req
->shadow_reg_v2_len
);
2739 req
->shadow_reg_v2_valid
= 0;
2742 ret
= qmi_txn_init(&ab
->qmi
.handle
, &txn
,
2743 qmi_wlanfw_wlan_cfg_resp_msg_v01_ei
, &resp
);
2747 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "wlan cfg req\n");
2749 ret
= qmi_send_request(&ab
->qmi
.handle
, NULL
, &txn
,
2750 QMI_WLANFW_WLAN_CFG_REQ_V01
,
2751 QMI_WLANFW_WLAN_CFG_REQ_MSG_V01_MAX_LEN
,
2752 qmi_wlanfw_wlan_cfg_req_msg_v01_ei
, req
);
2754 qmi_txn_cancel(&txn
);
2755 ath11k_warn(ab
, "failed to send wlan config request: %d\n",
2760 ret
= qmi_txn_wait(&txn
, msecs_to_jiffies(ATH11K_QMI_WLANFW_TIMEOUT_MS
));
2762 ath11k_warn(ab
, "failed to wait wlan config request: %d\n", ret
);
2766 if (resp
.resp
.result
!= QMI_RESULT_SUCCESS_V01
) {
2767 ath11k_warn(ab
, "wlan config request failed: %d %d\n",
2768 resp
.resp
.result
, resp
.resp
.error
);
2778 static int ath11k_qmi_wlanfw_wlan_ini_send(struct ath11k_base
*ab
, bool enable
)
2782 struct qmi_wlanfw_wlan_ini_req_msg_v01 req
= {};
2783 struct qmi_wlanfw_wlan_ini_resp_msg_v01 resp
= {};
2785 req
.enablefwlog_valid
= true;
2786 req
.enablefwlog
= enable
? 1 : 0;
2788 ret
= qmi_txn_init(&ab
->qmi
.handle
, &txn
,
2789 qmi_wlanfw_wlan_ini_resp_msg_v01_ei
, &resp
);
2793 ret
= qmi_send_request(&ab
->qmi
.handle
, NULL
, &txn
,
2794 QMI_WLANFW_WLAN_INI_REQ_V01
,
2795 QMI_WLANFW_WLAN_INI_REQ_MSG_V01_MAX_LEN
,
2796 qmi_wlanfw_wlan_ini_req_msg_v01_ei
, &req
);
2798 ath11k_warn(ab
, "qmi failed to send wlan ini request, err = %d\n",
2800 qmi_txn_cancel(&txn
);
2804 ret
= qmi_txn_wait(&txn
, msecs_to_jiffies(ATH11K_QMI_WLANFW_TIMEOUT_MS
));
2806 ath11k_warn(ab
, "qmi failed wlan ini request, err = %d\n", ret
);
2810 if (resp
.resp
.result
!= QMI_RESULT_SUCCESS_V01
) {
2811 ath11k_warn(ab
, "qmi wlan ini request failed, result: %d, err: %d\n",
2812 resp
.resp
.result
, resp
.resp
.error
);
2820 void ath11k_qmi_firmware_stop(struct ath11k_base
*ab
)
2824 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "firmware stop\n");
2826 ret
= ath11k_qmi_wlanfw_mode_send(ab
, ATH11K_FIRMWARE_MODE_OFF
);
2828 ath11k_warn(ab
, "qmi failed to send wlan mode off: %d\n", ret
);
2833 int ath11k_qmi_firmware_start(struct ath11k_base
*ab
,
2838 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "firmware start\n");
2840 if (ab
->hw_params
.fw_wmi_diag_event
) {
2841 ret
= ath11k_qmi_wlanfw_wlan_ini_send(ab
, true);
2843 ath11k_warn(ab
, "qmi failed to send wlan fw ini:%d\n", ret
);
2848 ret
= ath11k_qmi_wlanfw_wlan_cfg_send(ab
);
2850 ath11k_warn(ab
, "qmi failed to send wlan cfg: %d\n", ret
);
2854 ret
= ath11k_qmi_wlanfw_mode_send(ab
, mode
);
2856 ath11k_warn(ab
, "qmi failed to send wlan fw mode: %d\n", ret
);
2863 int ath11k_qmi_fwreset_from_cold_boot(struct ath11k_base
*ab
)
2867 if (!ath11k_core_coldboot_cal_support(ab
) ||
2868 ab
->hw_params
.cbcal_restart_fw
== 0)
2871 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "wait for cold boot done\n");
2873 time_left
= wait_event_timeout(ab
->qmi
.cold_boot_waitq
,
2874 (ab
->qmi
.cal_done
== 1),
2875 ATH11K_COLD_BOOT_FW_RESET_DELAY
);
2877 if (time_left
<= 0) {
2878 ath11k_warn(ab
, "Coldboot Calibration timed out\n");
2882 /* reset the firmware */
2883 ath11k_hif_power_down(ab
);
2884 ath11k_hif_power_up(ab
);
2885 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "exit wait for cold boot done\n");
2888 EXPORT_SYMBOL(ath11k_qmi_fwreset_from_cold_boot
);
2890 static int ath11k_qmi_process_coldboot_calibration(struct ath11k_base
*ab
)
2895 ret
= ath11k_qmi_wlanfw_mode_send(ab
, ATH11K_FIRMWARE_MODE_COLD_BOOT
);
2897 ath11k_warn(ab
, "qmi failed to send wlan fw mode: %d\n", ret
);
2901 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "Coldboot calibration wait started\n");
2903 time_left
= wait_event_timeout(ab
->qmi
.cold_boot_waitq
,
2904 (ab
->qmi
.cal_done
== 1),
2905 ATH11K_COLD_BOOT_FW_RESET_DELAY
);
2906 if (time_left
<= 0) {
2907 ath11k_warn(ab
, "coldboot calibration timed out\n");
2911 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "Coldboot calibration done\n");
2917 ath11k_qmi_driver_event_post(struct ath11k_qmi
*qmi
,
2918 enum ath11k_qmi_event_type type
,
2921 struct ath11k_qmi_driver_event
*event
;
2923 event
= kzalloc(sizeof(*event
), GFP_ATOMIC
);
2930 spin_lock(&qmi
->event_lock
);
2931 list_add_tail(&event
->list
, &qmi
->event_list
);
2932 spin_unlock(&qmi
->event_lock
);
2934 queue_work(qmi
->event_wq
, &qmi
->event_work
);
2939 static int ath11k_qmi_event_mem_request(struct ath11k_qmi
*qmi
)
2941 struct ath11k_base
*ab
= qmi
->ab
;
2944 ret
= ath11k_qmi_respond_fw_mem_request(ab
);
2946 ath11k_warn(ab
, "qmi failed to respond fw mem req: %d\n", ret
);
2953 static int ath11k_qmi_event_load_bdf(struct ath11k_qmi
*qmi
)
2955 struct ath11k_base
*ab
= qmi
->ab
;
2958 ret
= ath11k_qmi_request_target_cap(ab
);
2960 ath11k_warn(ab
, "failed to request qmi target capabilities: %d\n",
2965 ret
= ath11k_qmi_request_device_info(ab
);
2967 ath11k_warn(ab
, "failed to request qmi device info: %d\n", ret
);
2971 if (ab
->hw_params
.supports_regdb
)
2972 ath11k_qmi_load_bdf_qmi(ab
, true);
2974 ret
= ath11k_qmi_load_bdf_qmi(ab
, false);
2976 ath11k_warn(ab
, "failed to load board data file: %d\n", ret
);
2983 static int ath11k_qmi_event_server_arrive(struct ath11k_qmi
*qmi
)
2985 struct ath11k_base
*ab
= qmi
->ab
;
2988 ret
= ath11k_qmi_fw_ind_register_send(ab
);
2990 ath11k_warn(ab
, "failed to send qmi firmware indication: %d\n",
2995 ret
= ath11k_qmi_host_cap_send(ab
);
2997 ath11k_warn(ab
, "failed to send qmi host cap: %d\n", ret
);
3001 if (!ab
->hw_params
.fixed_fw_mem
)
3004 ret
= ath11k_qmi_event_load_bdf(qmi
);
3006 ath11k_warn(ab
, "qmi failed to download BDF:%d\n", ret
);
3013 static void ath11k_qmi_msg_mem_request_cb(struct qmi_handle
*qmi_hdl
,
3014 struct sockaddr_qrtr
*sq
,
3015 struct qmi_txn
*txn
,
3018 struct ath11k_qmi
*qmi
= container_of(qmi_hdl
, struct ath11k_qmi
, handle
);
3019 struct ath11k_base
*ab
= qmi
->ab
;
3020 const struct qmi_wlanfw_request_mem_ind_msg_v01
*msg
= data
;
3023 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "firmware request memory request\n");
3025 if (msg
->mem_seg_len
== 0 ||
3026 msg
->mem_seg_len
> ATH11K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01
)
3027 ath11k_warn(ab
, "invalid memory segment length: %u\n",
3030 ab
->qmi
.mem_seg_count
= msg
->mem_seg_len
;
3032 for (i
= 0; i
< qmi
->mem_seg_count
; i
++) {
3033 ab
->qmi
.target_mem
[i
].type
= msg
->mem_seg
[i
].type
;
3034 ab
->qmi
.target_mem
[i
].size
= msg
->mem_seg
[i
].size
;
3035 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "mem seg type %d size %d\n",
3036 msg
->mem_seg
[i
].type
, msg
->mem_seg
[i
].size
);
3039 if (ab
->hw_params
.fixed_mem_region
||
3040 test_bit(ATH11K_FLAG_FIXED_MEM_RGN
, &ab
->dev_flags
)) {
3041 ret
= ath11k_qmi_assign_target_mem_chunk(ab
);
3043 ath11k_warn(ab
, "failed to assign qmi target memory: %d\n",
3048 ret
= ath11k_qmi_alloc_target_mem_chunk(ab
);
3050 ath11k_warn(ab
, "failed to allocate qmi target memory: %d\n",
3056 ath11k_qmi_driver_event_post(qmi
, ATH11K_QMI_EVENT_REQUEST_MEM
, NULL
);
3059 static void ath11k_qmi_msg_mem_ready_cb(struct qmi_handle
*qmi_hdl
,
3060 struct sockaddr_qrtr
*sq
,
3061 struct qmi_txn
*txn
,
3062 const void *decoded
)
3064 struct ath11k_qmi
*qmi
= container_of(qmi_hdl
, struct ath11k_qmi
, handle
);
3065 struct ath11k_base
*ab
= qmi
->ab
;
3067 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "firmware memory ready indication\n");
3068 ath11k_qmi_driver_event_post(qmi
, ATH11K_QMI_EVENT_FW_MEM_READY
, NULL
);
3071 static void ath11k_qmi_msg_fw_ready_cb(struct qmi_handle
*qmi_hdl
,
3072 struct sockaddr_qrtr
*sq
,
3073 struct qmi_txn
*txn
,
3074 const void *decoded
)
3076 struct ath11k_qmi
*qmi
= container_of(qmi_hdl
, struct ath11k_qmi
, handle
);
3077 struct ath11k_base
*ab
= qmi
->ab
;
3079 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "firmware ready\n");
3081 if (!ab
->qmi
.cal_done
) {
3082 ab
->qmi
.cal_done
= 1;
3083 wake_up(&ab
->qmi
.cold_boot_waitq
);
3086 ath11k_qmi_driver_event_post(qmi
, ATH11K_QMI_EVENT_FW_READY
, NULL
);
3089 static void ath11k_qmi_msg_cold_boot_cal_done_cb(struct qmi_handle
*qmi_hdl
,
3090 struct sockaddr_qrtr
*sq
,
3091 struct qmi_txn
*txn
,
3092 const void *decoded
)
3094 struct ath11k_qmi
*qmi
= container_of(qmi_hdl
,
3095 struct ath11k_qmi
, handle
);
3096 struct ath11k_base
*ab
= qmi
->ab
;
3098 ab
->qmi
.cal_done
= 1;
3099 wake_up(&ab
->qmi
.cold_boot_waitq
);
3100 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "cold boot calibration done\n");
3103 static void ath11k_qmi_msg_fw_init_done_cb(struct qmi_handle
*qmi_hdl
,
3104 struct sockaddr_qrtr
*sq
,
3105 struct qmi_txn
*txn
,
3106 const void *decoded
)
3108 struct ath11k_qmi
*qmi
= container_of(qmi_hdl
,
3109 struct ath11k_qmi
, handle
);
3110 struct ath11k_base
*ab
= qmi
->ab
;
3112 ath11k_qmi_driver_event_post(qmi
, ATH11K_QMI_EVENT_FW_INIT_DONE
, NULL
);
3113 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "firmware init done\n");
3116 static const struct qmi_msg_handler ath11k_qmi_msg_handlers
[] = {
3118 .type
= QMI_INDICATION
,
3119 .msg_id
= QMI_WLFW_REQUEST_MEM_IND_V01
,
3120 .ei
= qmi_wlanfw_request_mem_ind_msg_v01_ei
,
3121 .decoded_size
= sizeof(struct qmi_wlanfw_request_mem_ind_msg_v01
),
3122 .fn
= ath11k_qmi_msg_mem_request_cb
,
3125 .type
= QMI_INDICATION
,
3126 .msg_id
= QMI_WLFW_FW_MEM_READY_IND_V01
,
3127 .ei
= qmi_wlanfw_mem_ready_ind_msg_v01_ei
,
3128 .decoded_size
= sizeof(struct qmi_wlanfw_fw_mem_ready_ind_msg_v01
),
3129 .fn
= ath11k_qmi_msg_mem_ready_cb
,
3132 .type
= QMI_INDICATION
,
3133 .msg_id
= QMI_WLFW_FW_READY_IND_V01
,
3134 .ei
= qmi_wlanfw_fw_ready_ind_msg_v01_ei
,
3135 .decoded_size
= sizeof(struct qmi_wlanfw_fw_ready_ind_msg_v01
),
3136 .fn
= ath11k_qmi_msg_fw_ready_cb
,
3139 .type
= QMI_INDICATION
,
3140 .msg_id
= QMI_WLFW_COLD_BOOT_CAL_DONE_IND_V01
,
3141 .ei
= qmi_wlanfw_cold_boot_cal_done_ind_msg_v01_ei
,
3143 sizeof(struct qmi_wlanfw_fw_cold_cal_done_ind_msg_v01
),
3144 .fn
= ath11k_qmi_msg_cold_boot_cal_done_cb
,
3147 .type
= QMI_INDICATION
,
3148 .msg_id
= QMI_WLFW_FW_INIT_DONE_IND_V01
,
3149 .ei
= qmi_wlfw_fw_init_done_ind_msg_v01_ei
,
3151 sizeof(struct qmi_wlfw_fw_init_done_ind_msg_v01
),
3152 .fn
= ath11k_qmi_msg_fw_init_done_cb
,
3159 static int ath11k_qmi_ops_new_server(struct qmi_handle
*qmi_hdl
,
3160 struct qmi_service
*service
)
3162 struct ath11k_qmi
*qmi
= container_of(qmi_hdl
, struct ath11k_qmi
, handle
);
3163 struct ath11k_base
*ab
= qmi
->ab
;
3164 struct sockaddr_qrtr
*sq
= &qmi
->sq
;
3167 sq
->sq_family
= AF_QIPCRTR
;
3168 sq
->sq_node
= service
->node
;
3169 sq
->sq_port
= service
->port
;
3171 ret
= kernel_connect(qmi_hdl
->sock
, (struct sockaddr
*)sq
,
3174 ath11k_warn(ab
, "failed to connect to qmi remote service: %d\n", ret
);
3178 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "wifi fw qmi service connected\n");
3179 ath11k_qmi_driver_event_post(qmi
, ATH11K_QMI_EVENT_SERVER_ARRIVE
, NULL
);
3184 static void ath11k_qmi_ops_del_server(struct qmi_handle
*qmi_hdl
,
3185 struct qmi_service
*service
)
3187 struct ath11k_qmi
*qmi
= container_of(qmi_hdl
, struct ath11k_qmi
, handle
);
3188 struct ath11k_base
*ab
= qmi
->ab
;
3190 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "wifi fw del server\n");
3191 ath11k_qmi_driver_event_post(qmi
, ATH11K_QMI_EVENT_SERVER_EXIT
, NULL
);
3194 static const struct qmi_ops ath11k_qmi_ops
= {
3195 .new_server
= ath11k_qmi_ops_new_server
,
3196 .del_server
= ath11k_qmi_ops_del_server
,
3199 static void ath11k_qmi_driver_event_work(struct work_struct
*work
)
3201 struct ath11k_qmi
*qmi
= container_of(work
, struct ath11k_qmi
,
3203 struct ath11k_qmi_driver_event
*event
;
3204 struct ath11k_base
*ab
= qmi
->ab
;
3207 spin_lock(&qmi
->event_lock
);
3208 while (!list_empty(&qmi
->event_list
)) {
3209 event
= list_first_entry(&qmi
->event_list
,
3210 struct ath11k_qmi_driver_event
, list
);
3211 list_del(&event
->list
);
3212 spin_unlock(&qmi
->event_lock
);
3214 if (test_bit(ATH11K_FLAG_UNREGISTERING
, &ab
->dev_flags
)) {
3219 switch (event
->type
) {
3220 case ATH11K_QMI_EVENT_SERVER_ARRIVE
:
3221 ret
= ath11k_qmi_event_server_arrive(qmi
);
3223 set_bit(ATH11K_FLAG_QMI_FAIL
, &ab
->dev_flags
);
3225 case ATH11K_QMI_EVENT_SERVER_EXIT
:
3226 set_bit(ATH11K_FLAG_CRASH_FLUSH
, &ab
->dev_flags
);
3227 set_bit(ATH11K_FLAG_RECOVERY
, &ab
->dev_flags
);
3230 ath11k_core_pre_reconfigure_recovery(ab
);
3232 case ATH11K_QMI_EVENT_REQUEST_MEM
:
3233 ret
= ath11k_qmi_event_mem_request(qmi
);
3235 set_bit(ATH11K_FLAG_QMI_FAIL
, &ab
->dev_flags
);
3237 case ATH11K_QMI_EVENT_FW_MEM_READY
:
3238 ret
= ath11k_qmi_event_load_bdf(qmi
);
3240 set_bit(ATH11K_FLAG_QMI_FAIL
, &ab
->dev_flags
);
3244 ret
= ath11k_qmi_wlanfw_m3_info_send(ab
);
3247 "failed to send qmi m3 info req: %d\n", ret
);
3248 set_bit(ATH11K_FLAG_QMI_FAIL
, &ab
->dev_flags
);
3252 case ATH11K_QMI_EVENT_FW_INIT_DONE
:
3253 clear_bit(ATH11K_FLAG_QMI_FAIL
, &ab
->dev_flags
);
3254 if (test_bit(ATH11K_FLAG_REGISTERED
, &ab
->dev_flags
)) {
3256 ath11k_hal_dump_srng_stats(ab
);
3257 queue_work(ab
->workqueue
, &ab
->restart_work
);
3261 if (ab
->qmi
.cal_done
== 0 &&
3262 ath11k_core_coldboot_cal_support(ab
)) {
3263 ath11k_qmi_process_coldboot_calibration(ab
);
3265 clear_bit(ATH11K_FLAG_CRASH_FLUSH
,
3267 clear_bit(ATH11K_FLAG_RECOVERY
, &ab
->dev_flags
);
3268 ret
= ath11k_core_qmi_firmware_ready(ab
);
3270 set_bit(ATH11K_FLAG_QMI_FAIL
, &ab
->dev_flags
);
3273 set_bit(ATH11K_FLAG_REGISTERED
, &ab
->dev_flags
);
3277 case ATH11K_QMI_EVENT_FW_READY
:
3278 /* For targets requiring a FW restart upon cold
3279 * boot completion, there is no need to process
3280 * FW ready; such targets will receive FW init
3281 * done message after FW restart.
3283 if (ab
->hw_params
.cbcal_restart_fw
)
3286 clear_bit(ATH11K_FLAG_CRASH_FLUSH
,
3288 clear_bit(ATH11K_FLAG_RECOVERY
, &ab
->dev_flags
);
3289 ath11k_core_qmi_firmware_ready(ab
);
3290 set_bit(ATH11K_FLAG_REGISTERED
, &ab
->dev_flags
);
3293 case ATH11K_QMI_EVENT_COLD_BOOT_CAL_DONE
:
3296 ath11k_warn(ab
, "invalid qmi event type: %d", event
->type
);
3300 spin_lock(&qmi
->event_lock
);
3302 spin_unlock(&qmi
->event_lock
);
3305 int ath11k_qmi_init_service(struct ath11k_base
*ab
)
3309 memset(&ab
->qmi
.target
, 0, sizeof(struct target_info
));
3310 memset(&ab
->qmi
.target_mem
, 0, sizeof(struct target_mem_chunk
));
3313 ab
->qmi
.target_mem_mode
= ab
->hw_params
.fw_mem_mode
;
3314 ret
= qmi_handle_init(&ab
->qmi
.handle
, ATH11K_QMI_RESP_LEN_MAX
,
3315 &ath11k_qmi_ops
, ath11k_qmi_msg_handlers
);
3317 ath11k_warn(ab
, "failed to initialize qmi handle: %d\n", ret
);
3321 ab
->qmi
.event_wq
= alloc_ordered_workqueue("ath11k_qmi_driver_event", 0);
3322 if (!ab
->qmi
.event_wq
) {
3323 ath11k_err(ab
, "failed to allocate workqueue\n");
3327 INIT_LIST_HEAD(&ab
->qmi
.event_list
);
3328 spin_lock_init(&ab
->qmi
.event_lock
);
3329 INIT_WORK(&ab
->qmi
.event_work
, ath11k_qmi_driver_event_work
);
3331 ret
= qmi_add_lookup(&ab
->qmi
.handle
, ATH11K_QMI_WLFW_SERVICE_ID_V01
,
3332 ATH11K_QMI_WLFW_SERVICE_VERS_V01
,
3333 ab
->qmi
.service_ins_id
);
3335 ath11k_warn(ab
, "failed to add qmi lookup: %d\n", ret
);
3336 destroy_workqueue(ab
->qmi
.event_wq
);
3343 void ath11k_qmi_deinit_service(struct ath11k_base
*ab
)
3345 qmi_handle_release(&ab
->qmi
.handle
);
3346 cancel_work_sync(&ab
->qmi
.event_work
);
3347 destroy_workqueue(ab
->qmi
.event_wq
);
3348 ath11k_qmi_m3_free(ab
);
3349 ath11k_qmi_free_target_mem_chunk(ab
);
3351 EXPORT_SYMBOL(ath11k_qmi_deinit_service
);
3353 void ath11k_qmi_free_resource(struct ath11k_base
*ab
)
3355 ath11k_qmi_free_target_mem_chunk(ab
);
3356 ath11k_qmi_m3_free(ab
);