1d8899132SKalle Valo /* SPDX-License-Identifier: BSD-3-Clause-Clear */ 2d8899132SKalle Valo /* 3d8899132SKalle Valo * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. 49f9df1a2SBaochen Qiang * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. 5d8899132SKalle Valo */ 6d8899132SKalle Valo 7d8899132SKalle Valo #ifndef ATH12K_QMI_H 8d8899132SKalle Valo #define ATH12K_QMI_H 9d8899132SKalle Valo 10d8899132SKalle Valo #include <linux/mutex.h> 11d8899132SKalle Valo #include <linux/soc/qcom/qmi.h> 12d8899132SKalle Valo 13d8899132SKalle Valo #define ATH12K_HOST_VERSION_STRING "WIN" 14d8899132SKalle Valo #define ATH12K_QMI_WLANFW_TIMEOUT_MS 10000 15d8899132SKalle Valo #define ATH12K_QMI_MAX_BDF_FILE_NAME_SIZE 64 16d8899132SKalle Valo #define ATH12K_QMI_CALDB_ADDRESS 0x4BA00000 17d8899132SKalle Valo #define ATH12K_QMI_WLANFW_MAX_BUILD_ID_LEN_V01 128 18d8899132SKalle Valo #define ATH12K_QMI_WLFW_SERVICE_ID_V01 0x45 19d8899132SKalle Valo #define ATH12K_QMI_WLFW_SERVICE_VERS_V01 0x01 20d8899132SKalle Valo #define ATH12K_QMI_WLFW_SERVICE_INS_ID_V01 0x02 21d8899132SKalle Valo #define ATH12K_QMI_WLFW_SERVICE_INS_ID_V01_WCN7850 0x1 22d8899132SKalle Valo 23d8899132SKalle Valo #define ATH12K_QMI_WLFW_SERVICE_INS_ID_V01_QCN9274 0x07 24d8899132SKalle Valo #define ATH12K_QMI_WLANFW_MAX_TIMESTAMP_LEN_V01 32 25d8899132SKalle Valo #define ATH12K_QMI_RESP_LEN_MAX 8192 26d8899132SKalle Valo #define ATH12K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01 52 27d8899132SKalle Valo #define ATH12K_QMI_CALDB_SIZE 0x480000 28d8899132SKalle Valo #define ATH12K_QMI_BDF_EXT_STR_LENGTH 0x20 29d8899132SKalle Valo #define ATH12K_QMI_FW_MEM_REQ_SEGMENT_CNT 3 30d8899132SKalle Valo #define ATH12K_QMI_WLFW_MAX_DEV_MEM_NUM_V01 4 31d8899132SKalle Valo #define ATH12K_QMI_DEVMEM_CMEM_INDEX 0 32d8899132SKalle Valo 33d8899132SKalle Valo #define QMI_WLFW_REQUEST_MEM_IND_V01 0x0035 34d8899132SKalle Valo #define QMI_WLFW_FW_MEM_READY_IND_V01 0x0037 35d8899132SKalle Valo #define QMI_WLFW_FW_READY_IND_V01 0x0038 36d8899132SKalle Valo 37d8899132SKalle Valo #define QMI_WLANFW_MAX_DATA_SIZE_V01 6144 38d8899132SKalle Valo #define ATH12K_FIRMWARE_MODE_OFF 4 39d8899132SKalle Valo #define ATH12K_QMI_TARGET_MEM_MODE_DEFAULT 0 40d8899132SKalle Valo 41d8899132SKalle Valo #define ATH12K_BOARD_ID_DEFAULT 0xFF 42d8899132SKalle Valo 43d8899132SKalle Valo struct ath12k_base; 44d8899132SKalle Valo 45d8899132SKalle Valo enum ath12k_qmi_file_type { 4627d7e348SDinesh Karthikeyan ATH12K_QMI_FILE_TYPE_BDF_GOLDEN = 0, 4727d7e348SDinesh Karthikeyan ATH12K_QMI_FILE_TYPE_CALDATA = 2, 4827d7e348SDinesh Karthikeyan ATH12K_QMI_FILE_TYPE_EEPROM = 3, 4927d7e348SDinesh Karthikeyan ATH12K_QMI_MAX_FILE_TYPE = 4, 50d8899132SKalle Valo }; 51d8899132SKalle Valo 52d8899132SKalle Valo enum ath12k_qmi_bdf_type { 53d8899132SKalle Valo ATH12K_QMI_BDF_TYPE_BIN = 0, 54d8899132SKalle Valo ATH12K_QMI_BDF_TYPE_ELF = 1, 55d8899132SKalle Valo ATH12K_QMI_BDF_TYPE_REGDB = 4, 5642982259SDinesh Karthikeyan ATH12K_QMI_BDF_TYPE_CALIBRATION = 5, 57d8899132SKalle Valo }; 58d8899132SKalle Valo 59d8899132SKalle Valo enum ath12k_qmi_event_type { 60d8899132SKalle Valo ATH12K_QMI_EVENT_SERVER_ARRIVE, 61d8899132SKalle Valo ATH12K_QMI_EVENT_SERVER_EXIT, 62d8899132SKalle Valo ATH12K_QMI_EVENT_REQUEST_MEM, 63d8899132SKalle Valo ATH12K_QMI_EVENT_FW_MEM_READY, 64d8899132SKalle Valo ATH12K_QMI_EVENT_FW_READY, 65d8899132SKalle Valo ATH12K_QMI_EVENT_REGISTER_DRIVER, 66d8899132SKalle Valo ATH12K_QMI_EVENT_UNREGISTER_DRIVER, 67d8899132SKalle Valo ATH12K_QMI_EVENT_RECOVERY, 68d8899132SKalle Valo ATH12K_QMI_EVENT_FORCE_FW_ASSERT, 69d8899132SKalle Valo ATH12K_QMI_EVENT_POWER_UP, 70d8899132SKalle Valo ATH12K_QMI_EVENT_POWER_DOWN, 71d8899132SKalle Valo ATH12K_QMI_EVENT_MAX, 72d8899132SKalle Valo }; 73d8899132SKalle Valo 74d8899132SKalle Valo struct ath12k_qmi_driver_event { 75d8899132SKalle Valo struct list_head list; 76d8899132SKalle Valo enum ath12k_qmi_event_type type; 77d8899132SKalle Valo void *data; 78d8899132SKalle Valo }; 79d8899132SKalle Valo 80d8899132SKalle Valo struct ath12k_qmi_ce_cfg { 81d8899132SKalle Valo const struct ce_pipe_config *tgt_ce; 82d8899132SKalle Valo int tgt_ce_len; 83d8899132SKalle Valo const struct service_to_pipe *svc_to_ce_map; 84d8899132SKalle Valo int svc_to_ce_map_len; 85d8899132SKalle Valo const u8 *shadow_reg; 86d8899132SKalle Valo int shadow_reg_len; 87d8899132SKalle Valo u32 *shadow_reg_v3; 88d8899132SKalle Valo int shadow_reg_v3_len; 89d8899132SKalle Valo }; 90d8899132SKalle Valo 91d8899132SKalle Valo struct ath12k_qmi_event_msg { 92d8899132SKalle Valo struct list_head list; 93d8899132SKalle Valo enum ath12k_qmi_event_type type; 94d8899132SKalle Valo }; 95d8899132SKalle Valo 96d8899132SKalle Valo struct target_mem_chunk { 97d8899132SKalle Valo u32 size; 98d8899132SKalle Valo u32 type; 99303c0178SBaochen Qiang u32 prev_size; 100303c0178SBaochen Qiang u32 prev_type; 101d8899132SKalle Valo dma_addr_t paddr; 102d8899132SKalle Valo union { 103d8899132SKalle Valo void __iomem *ioaddr; 104d8899132SKalle Valo void *addr; 105d8899132SKalle Valo } v; 106d8899132SKalle Valo }; 107d8899132SKalle Valo 108d8899132SKalle Valo struct target_info { 109d8899132SKalle Valo u32 chip_id; 110d8899132SKalle Valo u32 chip_family; 111d8899132SKalle Valo u32 board_id; 112d8899132SKalle Valo u32 soc_id; 113d8899132SKalle Valo u32 fw_version; 114d8899132SKalle Valo u32 eeprom_caldata; 115d8899132SKalle Valo char fw_build_timestamp[ATH12K_QMI_WLANFW_MAX_TIMESTAMP_LEN_V01 + 1]; 116d8899132SKalle Valo char fw_build_id[ATH12K_QMI_WLANFW_MAX_BUILD_ID_LEN_V01 + 1]; 117d8899132SKalle Valo char bdf_ext[ATH12K_QMI_BDF_EXT_STR_LENGTH]; 118d8899132SKalle Valo }; 119d8899132SKalle Valo 120d8899132SKalle Valo struct m3_mem_region { 121d8899132SKalle Valo u32 size; 122d8899132SKalle Valo dma_addr_t paddr; 123d8899132SKalle Valo void *vaddr; 124d8899132SKalle Valo }; 125d8899132SKalle Valo 126d8899132SKalle Valo struct dev_mem_info { 127d8899132SKalle Valo u64 start; 128d8899132SKalle Valo u64 size; 129d8899132SKalle Valo }; 130d8899132SKalle Valo 131d8899132SKalle Valo struct ath12k_qmi { 132d8899132SKalle Valo struct ath12k_base *ab; 133d8899132SKalle Valo struct qmi_handle handle; 134d8899132SKalle Valo struct sockaddr_qrtr sq; 135d8899132SKalle Valo struct work_struct event_work; 136d8899132SKalle Valo struct workqueue_struct *event_wq; 137d8899132SKalle Valo struct list_head event_list; 138d8899132SKalle Valo spinlock_t event_lock; /* spinlock for qmi event list */ 139d8899132SKalle Valo struct ath12k_qmi_ce_cfg ce_cfg; 140d8899132SKalle Valo struct target_mem_chunk target_mem[ATH12K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01]; 141d8899132SKalle Valo u32 mem_seg_count; 142d8899132SKalle Valo u32 target_mem_mode; 143d8899132SKalle Valo bool target_mem_delayed; 144d8899132SKalle Valo u8 cal_done; 14553a65445SKarthikeyan Periyasamy u8 num_radios; 146d8899132SKalle Valo struct target_info target; 147d8899132SKalle Valo struct m3_mem_region m3_mem; 148d8899132SKalle Valo unsigned int service_ins_id; 149d8899132SKalle Valo struct dev_mem_info dev_mem[ATH12K_QMI_WLFW_MAX_DEV_MEM_NUM_V01]; 150d8899132SKalle Valo }; 151d8899132SKalle Valo 152d8899132SKalle Valo #define QMI_WLANFW_HOST_CAP_REQ_MSG_V01_MAX_LEN 261 153d8899132SKalle Valo #define QMI_WLANFW_HOST_CAP_REQ_V01 0x0034 154d8899132SKalle Valo #define QMI_WLANFW_HOST_CAP_RESP_MSG_V01_MAX_LEN 7 155d8899132SKalle Valo #define QMI_WLFW_HOST_CAP_RESP_V01 0x0034 156d8899132SKalle Valo #define QMI_WLFW_MAX_NUM_GPIO_V01 32 157d8899132SKalle Valo #define QMI_WLANFW_MAX_PLATFORM_NAME_LEN_V01 64 158d8899132SKalle Valo #define QMI_WLANFW_MAX_HOST_DDR_RANGE_SIZE_V01 3 159d8899132SKalle Valo 160d8899132SKalle Valo struct qmi_wlanfw_host_ddr_range { 161d8899132SKalle Valo u64 start; 162d8899132SKalle Valo u64 size; 163d8899132SKalle Valo }; 164d8899132SKalle Valo 165d8899132SKalle Valo enum ath12k_qmi_target_mem { 166d8899132SKalle Valo HOST_DDR_REGION_TYPE = 0x1, 167d8899132SKalle Valo BDF_MEM_REGION_TYPE = 0x2, 168d8899132SKalle Valo M3_DUMP_REGION_TYPE = 0x3, 169d8899132SKalle Valo CALDB_MEM_REGION_TYPE = 0x4, 170d8899132SKalle Valo PAGEABLE_MEM_REGION_TYPE = 0x9, 171d8899132SKalle Valo }; 172d8899132SKalle Valo 173d8899132SKalle Valo enum qmi_wlanfw_host_build_type { 174d8899132SKalle Valo WLANFW_HOST_BUILD_TYPE_ENUM_MIN_VAL_V01 = INT_MIN, 175d8899132SKalle Valo QMI_WLANFW_HOST_BUILD_TYPE_UNSPECIFIED_V01 = 0, 176d8899132SKalle Valo QMI_WLANFW_HOST_BUILD_TYPE_PRIMARY_V01 = 1, 177d8899132SKalle Valo QMI_WLANFW_HOST_BUILD_TYPE_SECONDARY_V01 = 2, 178d8899132SKalle Valo WLANFW_HOST_BUILD_TYPE_ENUM_MAX_VAL_V01 = INT_MAX, 179d8899132SKalle Valo }; 180d8899132SKalle Valo 181d8899132SKalle Valo #define QMI_WLFW_MAX_NUM_MLO_CHIPS_V01 3 182d8899132SKalle Valo #define QMI_WLFW_MAX_NUM_MLO_LINKS_PER_CHIP_V01 2 183d8899132SKalle Valo 184d8899132SKalle Valo struct wlfw_host_mlo_chip_info_s_v01 { 185d8899132SKalle Valo u8 chip_id; 186d8899132SKalle Valo u8 num_local_links; 187d8899132SKalle Valo u8 hw_link_id[QMI_WLFW_MAX_NUM_MLO_LINKS_PER_CHIP_V01]; 188d8899132SKalle Valo u8 valid_mlo_link_id[QMI_WLFW_MAX_NUM_MLO_LINKS_PER_CHIP_V01]; 189d8899132SKalle Valo }; 190d8899132SKalle Valo 191d8899132SKalle Valo enum ath12k_qmi_cnss_feature { 192d8899132SKalle Valo CNSS_FEATURE_MIN_ENUM_VAL_V01 = INT_MIN, 193d8899132SKalle Valo CNSS_QDSS_CFG_MISS_V01 = 3, 19434c5625aSCarl Huang CNSS_PCIE_PERST_NO_PULL_V01 = 4, 195d8899132SKalle Valo CNSS_MAX_FEATURE_V01 = 64, 196d8899132SKalle Valo CNSS_FEATURE_MAX_ENUM_VAL_V01 = INT_MAX, 197d8899132SKalle Valo }; 198d8899132SKalle Valo 199d8899132SKalle Valo struct qmi_wlanfw_host_cap_req_msg_v01 { 200d8899132SKalle Valo u8 num_clients_valid; 201d8899132SKalle Valo u32 num_clients; 202d8899132SKalle Valo u8 wake_msi_valid; 203d8899132SKalle Valo u32 wake_msi; 204d8899132SKalle Valo u8 gpios_valid; 205d8899132SKalle Valo u32 gpios_len; 206d8899132SKalle Valo u32 gpios[QMI_WLFW_MAX_NUM_GPIO_V01]; 207d8899132SKalle Valo u8 nm_modem_valid; 208d8899132SKalle Valo u8 nm_modem; 209d8899132SKalle Valo u8 bdf_support_valid; 210d8899132SKalle Valo u8 bdf_support; 211d8899132SKalle Valo u8 bdf_cache_support_valid; 212d8899132SKalle Valo u8 bdf_cache_support; 213d8899132SKalle Valo u8 m3_support_valid; 214d8899132SKalle Valo u8 m3_support; 215d8899132SKalle Valo u8 m3_cache_support_valid; 216d8899132SKalle Valo u8 m3_cache_support; 217d8899132SKalle Valo u8 cal_filesys_support_valid; 218d8899132SKalle Valo u8 cal_filesys_support; 219d8899132SKalle Valo u8 cal_cache_support_valid; 220d8899132SKalle Valo u8 cal_cache_support; 221d8899132SKalle Valo u8 cal_done_valid; 222d8899132SKalle Valo u8 cal_done; 223d8899132SKalle Valo u8 mem_bucket_valid; 224d8899132SKalle Valo u32 mem_bucket; 225d8899132SKalle Valo u8 mem_cfg_mode_valid; 226d8899132SKalle Valo u8 mem_cfg_mode; 227d8899132SKalle Valo u8 cal_duration_valid; 228d8899132SKalle Valo u16 cal_duraiton; 229d8899132SKalle Valo u8 platform_name_valid; 230d8899132SKalle Valo char platform_name[QMI_WLANFW_MAX_PLATFORM_NAME_LEN_V01 + 1]; 231d8899132SKalle Valo u8 ddr_range_valid; 232d8899132SKalle Valo struct qmi_wlanfw_host_ddr_range ddr_range[QMI_WLANFW_MAX_HOST_DDR_RANGE_SIZE_V01]; 233d8899132SKalle Valo u8 host_build_type_valid; 234d8899132SKalle Valo enum qmi_wlanfw_host_build_type host_build_type; 235d8899132SKalle Valo u8 mlo_capable_valid; 236d8899132SKalle Valo u8 mlo_capable; 237d8899132SKalle Valo u8 mlo_chip_id_valid; 238d8899132SKalle Valo u16 mlo_chip_id; 239d8899132SKalle Valo u8 mlo_group_id_valid; 240d8899132SKalle Valo u8 mlo_group_id; 241d8899132SKalle Valo u8 max_mlo_peer_valid; 242d8899132SKalle Valo u16 max_mlo_peer; 243d8899132SKalle Valo u8 mlo_num_chips_valid; 244d8899132SKalle Valo u8 mlo_num_chips; 245d8899132SKalle Valo u8 mlo_chip_info_valid; 246d8899132SKalle Valo struct wlfw_host_mlo_chip_info_s_v01 mlo_chip_info[QMI_WLFW_MAX_NUM_MLO_CHIPS_V01]; 247d8899132SKalle Valo u8 feature_list_valid; 248d8899132SKalle Valo u64 feature_list; 249d8899132SKalle Valo 250d8899132SKalle Valo }; 251d8899132SKalle Valo 252d8899132SKalle Valo struct qmi_wlanfw_host_cap_resp_msg_v01 { 253d8899132SKalle Valo struct qmi_response_type_v01 resp; 254d8899132SKalle Valo }; 255d8899132SKalle Valo 25653a65445SKarthikeyan Periyasamy #define QMI_WLANFW_PHY_CAP_REQ_MSG_V01_MAX_LEN 0 25753a65445SKarthikeyan Periyasamy #define QMI_WLANFW_PHY_CAP_REQ_V01 0x0057 25853a65445SKarthikeyan Periyasamy #define QMI_WLANFW_PHY_CAP_RESP_MSG_V01_MAX_LEN 18 25953a65445SKarthikeyan Periyasamy #define QMI_WLANFW_PHY_CAP_RESP_V01 0x0057 26053a65445SKarthikeyan Periyasamy 26153a65445SKarthikeyan Periyasamy struct qmi_wlanfw_phy_cap_req_msg_v01 { 26253a65445SKarthikeyan Periyasamy }; 26353a65445SKarthikeyan Periyasamy 26453a65445SKarthikeyan Periyasamy struct qmi_wlanfw_phy_cap_resp_msg_v01 { 26553a65445SKarthikeyan Periyasamy struct qmi_response_type_v01 resp; 26653a65445SKarthikeyan Periyasamy u8 num_phy_valid; 26753a65445SKarthikeyan Periyasamy u8 num_phy; 26853a65445SKarthikeyan Periyasamy u8 board_id_valid; 26953a65445SKarthikeyan Periyasamy u32 board_id; 270*ae6ec4a3SRaj Kumar Bhagat u8 single_chip_mlo_support_valid; 271*ae6ec4a3SRaj Kumar Bhagat u8 single_chip_mlo_support; 27253a65445SKarthikeyan Periyasamy }; 27353a65445SKarthikeyan Periyasamy 274d8899132SKalle Valo #define QMI_WLANFW_IND_REGISTER_REQ_MSG_V01_MAX_LEN 54 275d8899132SKalle Valo #define QMI_WLANFW_IND_REGISTER_REQ_V01 0x0020 276d8899132SKalle Valo #define QMI_WLANFW_IND_REGISTER_RESP_MSG_V01_MAX_LEN 18 277d8899132SKalle Valo #define QMI_WLANFW_IND_REGISTER_RESP_V01 0x0020 278d8899132SKalle Valo #define QMI_WLANFW_CLIENT_ID 0x4b4e454c 279d8899132SKalle Valo 280d8899132SKalle Valo struct qmi_wlanfw_ind_register_req_msg_v01 { 281d8899132SKalle Valo u8 fw_ready_enable_valid; 282d8899132SKalle Valo u8 fw_ready_enable; 283d8899132SKalle Valo u8 initiate_cal_download_enable_valid; 284d8899132SKalle Valo u8 initiate_cal_download_enable; 285d8899132SKalle Valo u8 initiate_cal_update_enable_valid; 286d8899132SKalle Valo u8 initiate_cal_update_enable; 287d8899132SKalle Valo u8 msa_ready_enable_valid; 288d8899132SKalle Valo u8 msa_ready_enable; 289d8899132SKalle Valo u8 pin_connect_result_enable_valid; 290d8899132SKalle Valo u8 pin_connect_result_enable; 291d8899132SKalle Valo u8 client_id_valid; 292d8899132SKalle Valo u32 client_id; 293d8899132SKalle Valo u8 request_mem_enable_valid; 294d8899132SKalle Valo u8 request_mem_enable; 295d8899132SKalle Valo u8 fw_mem_ready_enable_valid; 296d8899132SKalle Valo u8 fw_mem_ready_enable; 297d8899132SKalle Valo u8 fw_init_done_enable_valid; 298d8899132SKalle Valo u8 fw_init_done_enable; 299d8899132SKalle Valo u8 rejuvenate_enable_valid; 300d8899132SKalle Valo u32 rejuvenate_enable; 301d8899132SKalle Valo u8 xo_cal_enable_valid; 302d8899132SKalle Valo u8 xo_cal_enable; 303d8899132SKalle Valo u8 cal_done_enable_valid; 304d8899132SKalle Valo u8 cal_done_enable; 305d8899132SKalle Valo }; 306d8899132SKalle Valo 307d8899132SKalle Valo struct qmi_wlanfw_ind_register_resp_msg_v01 { 308d8899132SKalle Valo struct qmi_response_type_v01 resp; 309d8899132SKalle Valo u8 fw_status_valid; 310d8899132SKalle Valo u64 fw_status; 311d8899132SKalle Valo }; 312d8899132SKalle Valo 313d8899132SKalle Valo #define QMI_WLANFW_REQUEST_MEM_IND_MSG_V01_MAX_LEN 1824 314d8899132SKalle Valo #define QMI_WLANFW_RESPOND_MEM_REQ_MSG_V01_MAX_LEN 888 315d8899132SKalle Valo #define QMI_WLANFW_RESPOND_MEM_RESP_MSG_V01_MAX_LEN 7 316d8899132SKalle Valo #define QMI_WLANFW_REQUEST_MEM_IND_V01 0x0035 317d8899132SKalle Valo #define QMI_WLANFW_RESPOND_MEM_REQ_V01 0x0036 318d8899132SKalle Valo #define QMI_WLANFW_RESPOND_MEM_RESP_V01 0x0036 319d8899132SKalle Valo #define QMI_WLANFW_MAX_NUM_MEM_CFG_V01 2 320d8899132SKalle Valo #define QMI_WLANFW_MAX_STR_LEN_V01 16 321d8899132SKalle Valo 322d8899132SKalle Valo struct qmi_wlanfw_mem_cfg_s_v01 { 323d8899132SKalle Valo u64 offset; 324d8899132SKalle Valo u32 size; 325d8899132SKalle Valo u8 secure_flag; 326d8899132SKalle Valo }; 327d8899132SKalle Valo 328d8899132SKalle Valo enum qmi_wlanfw_mem_type_enum_v01 { 329d8899132SKalle Valo WLANFW_MEM_TYPE_ENUM_MIN_VAL_V01 = INT_MIN, 330d8899132SKalle Valo QMI_WLANFW_MEM_TYPE_MSA_V01 = 0, 331d8899132SKalle Valo QMI_WLANFW_MEM_TYPE_DDR_V01 = 1, 332d8899132SKalle Valo QMI_WLANFW_MEM_BDF_V01 = 2, 333d8899132SKalle Valo QMI_WLANFW_MEM_M3_V01 = 3, 334d8899132SKalle Valo QMI_WLANFW_MEM_CAL_V01 = 4, 335d8899132SKalle Valo QMI_WLANFW_MEM_DPD_V01 = 5, 336d8899132SKalle Valo WLANFW_MEM_TYPE_ENUM_MAX_VAL_V01 = INT_MAX, 337d8899132SKalle Valo }; 338d8899132SKalle Valo 339d8899132SKalle Valo struct qmi_wlanfw_mem_seg_s_v01 { 340d8899132SKalle Valo u32 size; 341d8899132SKalle Valo enum qmi_wlanfw_mem_type_enum_v01 type; 342d8899132SKalle Valo u32 mem_cfg_len; 343d8899132SKalle Valo struct qmi_wlanfw_mem_cfg_s_v01 mem_cfg[QMI_WLANFW_MAX_NUM_MEM_CFG_V01]; 344d8899132SKalle Valo }; 345d8899132SKalle Valo 346d8899132SKalle Valo struct qmi_wlanfw_request_mem_ind_msg_v01 { 347d8899132SKalle Valo u32 mem_seg_len; 348d8899132SKalle Valo struct qmi_wlanfw_mem_seg_s_v01 mem_seg[ATH12K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01]; 349d8899132SKalle Valo }; 350d8899132SKalle Valo 351d8899132SKalle Valo struct qmi_wlanfw_mem_seg_resp_s_v01 { 352d8899132SKalle Valo u64 addr; 353d8899132SKalle Valo u32 size; 354d8899132SKalle Valo enum qmi_wlanfw_mem_type_enum_v01 type; 355d8899132SKalle Valo u8 restore; 356d8899132SKalle Valo }; 357d8899132SKalle Valo 358d8899132SKalle Valo struct qmi_wlanfw_respond_mem_req_msg_v01 { 359d8899132SKalle Valo u32 mem_seg_len; 360d8899132SKalle Valo struct qmi_wlanfw_mem_seg_resp_s_v01 mem_seg[ATH12K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01]; 361d8899132SKalle Valo }; 362d8899132SKalle Valo 363d8899132SKalle Valo struct qmi_wlanfw_respond_mem_resp_msg_v01 { 364d8899132SKalle Valo struct qmi_response_type_v01 resp; 365d8899132SKalle Valo }; 366d8899132SKalle Valo 367d8899132SKalle Valo struct qmi_wlanfw_fw_mem_ready_ind_msg_v01 { 368d8899132SKalle Valo char placeholder; 369d8899132SKalle Valo }; 370d8899132SKalle Valo 371d8899132SKalle Valo struct qmi_wlanfw_fw_ready_ind_msg_v01 { 372d8899132SKalle Valo char placeholder; 373d8899132SKalle Valo }; 374d8899132SKalle Valo 375d8899132SKalle Valo #define QMI_WLANFW_CAP_REQ_MSG_V01_MAX_LEN 0 376d8899132SKalle Valo #define QMI_WLANFW_CAP_RESP_MSG_V01_MAX_LEN 207 377d8899132SKalle Valo #define QMI_WLANFW_CAP_REQ_V01 0x0024 378d8899132SKalle Valo #define QMI_WLANFW_CAP_RESP_V01 0x0024 379d8899132SKalle Valo 380d8899132SKalle Valo enum qmi_wlanfw_pipedir_enum_v01 { 381d8899132SKalle Valo QMI_WLFW_PIPEDIR_NONE_V01 = 0, 382d8899132SKalle Valo QMI_WLFW_PIPEDIR_IN_V01 = 1, 383d8899132SKalle Valo QMI_WLFW_PIPEDIR_OUT_V01 = 2, 384d8899132SKalle Valo QMI_WLFW_PIPEDIR_INOUT_V01 = 3, 385d8899132SKalle Valo }; 386d8899132SKalle Valo 387d8899132SKalle Valo struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01 { 388d8899132SKalle Valo __le32 pipe_num; 389d8899132SKalle Valo __le32 pipe_dir; 390d8899132SKalle Valo __le32 nentries; 391d8899132SKalle Valo __le32 nbytes_max; 392d8899132SKalle Valo __le32 flags; 393d8899132SKalle Valo }; 394d8899132SKalle Valo 395d8899132SKalle Valo struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01 { 396d8899132SKalle Valo __le32 service_id; 397d8899132SKalle Valo __le32 pipe_dir; 398d8899132SKalle Valo __le32 pipe_num; 399d8899132SKalle Valo }; 400d8899132SKalle Valo 401d8899132SKalle Valo struct qmi_wlanfw_shadow_reg_cfg_s_v01 { 402d8899132SKalle Valo u16 id; 403d8899132SKalle Valo u16 offset; 404d8899132SKalle Valo }; 405d8899132SKalle Valo 406d8899132SKalle Valo struct qmi_wlanfw_shadow_reg_v3_cfg_s_v01 { 407d8899132SKalle Valo u32 addr; 408d8899132SKalle Valo }; 409d8899132SKalle Valo 410d8899132SKalle Valo struct qmi_wlanfw_memory_region_info_s_v01 { 411d8899132SKalle Valo u64 region_addr; 412d8899132SKalle Valo u32 size; 413d8899132SKalle Valo u8 secure_flag; 414d8899132SKalle Valo }; 415d8899132SKalle Valo 416d8899132SKalle Valo struct qmi_wlanfw_rf_chip_info_s_v01 { 417d8899132SKalle Valo u32 chip_id; 418d8899132SKalle Valo u32 chip_family; 419d8899132SKalle Valo }; 420d8899132SKalle Valo 421d8899132SKalle Valo struct qmi_wlanfw_rf_board_info_s_v01 { 422d8899132SKalle Valo u32 board_id; 423d8899132SKalle Valo }; 424d8899132SKalle Valo 425d8899132SKalle Valo struct qmi_wlanfw_soc_info_s_v01 { 426d8899132SKalle Valo u32 soc_id; 427d8899132SKalle Valo }; 428d8899132SKalle Valo 429d8899132SKalle Valo struct qmi_wlanfw_fw_version_info_s_v01 { 430d8899132SKalle Valo u32 fw_version; 431d8899132SKalle Valo char fw_build_timestamp[ATH12K_QMI_WLANFW_MAX_TIMESTAMP_LEN_V01 + 1]; 432d8899132SKalle Valo }; 433d8899132SKalle Valo 434d8899132SKalle Valo struct qmi_wlanfw_dev_mem_info_s_v01 { 435d8899132SKalle Valo u64 start; 436d8899132SKalle Valo u64 size; 437d8899132SKalle Valo }; 438d8899132SKalle Valo 439d8899132SKalle Valo enum qmi_wlanfw_cal_temp_id_enum_v01 { 440d8899132SKalle Valo QMI_WLANFW_CAL_TEMP_IDX_0_V01 = 0, 441d8899132SKalle Valo QMI_WLANFW_CAL_TEMP_IDX_1_V01 = 1, 442d8899132SKalle Valo QMI_WLANFW_CAL_TEMP_IDX_2_V01 = 2, 443d8899132SKalle Valo QMI_WLANFW_CAL_TEMP_IDX_3_V01 = 3, 444d8899132SKalle Valo QMI_WLANFW_CAL_TEMP_IDX_4_V01 = 4, 445d8899132SKalle Valo QMI_WLANFW_CAL_TEMP_ID_MAX_V01 = 0xFF, 446d8899132SKalle Valo }; 447d8899132SKalle Valo 448d8899132SKalle Valo enum qmi_wlanfw_rd_card_chain_cap_v01 { 449d8899132SKalle Valo WLFW_RD_CARD_CHAIN_CAP_MIN_VAL_V01 = INT_MIN, 450d8899132SKalle Valo WLFW_RD_CARD_CHAIN_CAP_UNSPECIFIED_V01 = 0, 451d8899132SKalle Valo WLFW_RD_CARD_CHAIN_CAP_1x1_V01 = 1, 452d8899132SKalle Valo WLFW_RD_CARD_CHAIN_CAP_2x2_V01 = 2, 453d8899132SKalle Valo WLFW_RD_CARD_CHAIN_CAP_MAX_VAL_V01 = INT_MAX, 454d8899132SKalle Valo }; 455d8899132SKalle Valo 456d8899132SKalle Valo struct qmi_wlanfw_cap_resp_msg_v01 { 457d8899132SKalle Valo struct qmi_response_type_v01 resp; 458d8899132SKalle Valo u8 chip_info_valid; 459d8899132SKalle Valo struct qmi_wlanfw_rf_chip_info_s_v01 chip_info; 460d8899132SKalle Valo u8 board_info_valid; 461d8899132SKalle Valo struct qmi_wlanfw_rf_board_info_s_v01 board_info; 462d8899132SKalle Valo u8 soc_info_valid; 463d8899132SKalle Valo struct qmi_wlanfw_soc_info_s_v01 soc_info; 464d8899132SKalle Valo u8 fw_version_info_valid; 465d8899132SKalle Valo struct qmi_wlanfw_fw_version_info_s_v01 fw_version_info; 466d8899132SKalle Valo u8 fw_build_id_valid; 467d8899132SKalle Valo char fw_build_id[ATH12K_QMI_WLANFW_MAX_BUILD_ID_LEN_V01 + 1]; 468d8899132SKalle Valo u8 num_macs_valid; 469d8899132SKalle Valo u8 num_macs; 470d8899132SKalle Valo u8 voltage_mv_valid; 471d8899132SKalle Valo u32 voltage_mv; 472d8899132SKalle Valo u8 time_freq_hz_valid; 473d8899132SKalle Valo u32 time_freq_hz; 474d8899132SKalle Valo u8 otp_version_valid; 475d8899132SKalle Valo u32 otp_version; 476d8899132SKalle Valo u8 eeprom_caldata_read_timeout_valid; 477d8899132SKalle Valo u32 eeprom_caldata_read_timeout; 478d8899132SKalle Valo u8 fw_caps_valid; 479d8899132SKalle Valo u64 fw_caps; 480d8899132SKalle Valo u8 rd_card_chain_cap_valid; 481d8899132SKalle Valo enum qmi_wlanfw_rd_card_chain_cap_v01 rd_card_chain_cap; 482d8899132SKalle Valo u8 dev_mem_info_valid; 483d8899132SKalle Valo struct qmi_wlanfw_dev_mem_info_s_v01 dev_mem[ATH12K_QMI_WLFW_MAX_DEV_MEM_NUM_V01]; 484d8899132SKalle Valo }; 485d8899132SKalle Valo 486d8899132SKalle Valo struct qmi_wlanfw_cap_req_msg_v01 { 487d8899132SKalle Valo char placeholder; 488d8899132SKalle Valo }; 489d8899132SKalle Valo 490d8899132SKalle Valo #define QMI_WLANFW_BDF_DOWNLOAD_REQ_MSG_V01_MAX_LEN 6182 491d8899132SKalle Valo #define QMI_WLANFW_BDF_DOWNLOAD_RESP_MSG_V01_MAX_LEN 7 492d8899132SKalle Valo #define QMI_WLANFW_BDF_DOWNLOAD_RESP_V01 0x0025 493d8899132SKalle Valo #define QMI_WLANFW_BDF_DOWNLOAD_REQ_V01 0x0025 494d8899132SKalle Valo /* TODO: Need to check with MCL and FW team that data can be pointer and 495d8899132SKalle Valo * can be last element in structure 496d8899132SKalle Valo */ 497d8899132SKalle Valo struct qmi_wlanfw_bdf_download_req_msg_v01 { 498d8899132SKalle Valo u8 valid; 499d8899132SKalle Valo u8 file_id_valid; 500d8899132SKalle Valo enum qmi_wlanfw_cal_temp_id_enum_v01 file_id; 501d8899132SKalle Valo u8 total_size_valid; 502d8899132SKalle Valo u32 total_size; 503d8899132SKalle Valo u8 seg_id_valid; 504d8899132SKalle Valo u32 seg_id; 505d8899132SKalle Valo u8 data_valid; 506d8899132SKalle Valo u32 data_len; 507d8899132SKalle Valo u8 data[QMI_WLANFW_MAX_DATA_SIZE_V01]; 508d8899132SKalle Valo u8 end_valid; 509d8899132SKalle Valo u8 end; 510d8899132SKalle Valo u8 bdf_type_valid; 511d8899132SKalle Valo u8 bdf_type; 512d8899132SKalle Valo 513d8899132SKalle Valo }; 514d8899132SKalle Valo 515d8899132SKalle Valo struct qmi_wlanfw_bdf_download_resp_msg_v01 { 516d8899132SKalle Valo struct qmi_response_type_v01 resp; 517d8899132SKalle Valo }; 518d8899132SKalle Valo 519d8899132SKalle Valo #define QMI_WLANFW_M3_INFO_REQ_MSG_V01_MAX_MSG_LEN 18 520d8899132SKalle Valo #define QMI_WLANFW_M3_INFO_RESP_MSG_V01_MAX_MSG_LEN 7 521d8899132SKalle Valo #define QMI_WLANFW_M3_INFO_RESP_V01 0x003C 522d8899132SKalle Valo #define QMI_WLANFW_M3_INFO_REQ_V01 0x003C 523d8899132SKalle Valo 524d8899132SKalle Valo struct qmi_wlanfw_m3_info_req_msg_v01 { 525d8899132SKalle Valo u64 addr; 526d8899132SKalle Valo u32 size; 527d8899132SKalle Valo }; 528d8899132SKalle Valo 529d8899132SKalle Valo struct qmi_wlanfw_m3_info_resp_msg_v01 { 530d8899132SKalle Valo struct qmi_response_type_v01 resp; 531d8899132SKalle Valo }; 532d8899132SKalle Valo 533d8899132SKalle Valo #define QMI_WLANFW_WLAN_MODE_REQ_MSG_V01_MAX_LEN 11 534d8899132SKalle Valo #define QMI_WLANFW_WLAN_MODE_RESP_MSG_V01_MAX_LEN 7 535d8899132SKalle Valo #define QMI_WLANFW_WLAN_CFG_REQ_MSG_V01_MAX_LEN 803 536d8899132SKalle Valo #define QMI_WLANFW_WLAN_CFG_RESP_MSG_V01_MAX_LEN 7 537d8899132SKalle Valo #define QMI_WLANFW_WLAN_MODE_REQ_V01 0x0022 538d8899132SKalle Valo #define QMI_WLANFW_WLAN_MODE_RESP_V01 0x0022 539d8899132SKalle Valo #define QMI_WLANFW_WLAN_CFG_REQ_V01 0x0023 540d8899132SKalle Valo #define QMI_WLANFW_WLAN_CFG_RESP_V01 0x0023 541d8899132SKalle Valo #define QMI_WLANFW_MAX_STR_LEN_V01 16 542d8899132SKalle Valo #define QMI_WLANFW_MAX_NUM_CE_V01 12 543d8899132SKalle Valo #define QMI_WLANFW_MAX_NUM_SVC_V01 24 544d8899132SKalle Valo #define QMI_WLANFW_MAX_NUM_SHADOW_REG_V01 24 545d8899132SKalle Valo #define QMI_WLANFW_MAX_NUM_SHADOW_REG_V3_V01 60 546d8899132SKalle Valo 547d8899132SKalle Valo struct qmi_wlanfw_wlan_mode_req_msg_v01 { 548d8899132SKalle Valo u32 mode; 549d8899132SKalle Valo u8 hw_debug_valid; 550d8899132SKalle Valo u8 hw_debug; 551d8899132SKalle Valo }; 552d8899132SKalle Valo 553d8899132SKalle Valo struct qmi_wlanfw_wlan_mode_resp_msg_v01 { 554d8899132SKalle Valo struct qmi_response_type_v01 resp; 555d8899132SKalle Valo }; 556d8899132SKalle Valo 557d8899132SKalle Valo struct qmi_wlanfw_wlan_cfg_req_msg_v01 { 558d8899132SKalle Valo u8 host_version_valid; 559d8899132SKalle Valo char host_version[QMI_WLANFW_MAX_STR_LEN_V01 + 1]; 560d8899132SKalle Valo u8 tgt_cfg_valid; 561d8899132SKalle Valo u32 tgt_cfg_len; 562d8899132SKalle Valo struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01 563d8899132SKalle Valo tgt_cfg[QMI_WLANFW_MAX_NUM_CE_V01]; 564d8899132SKalle Valo u8 svc_cfg_valid; 565d8899132SKalle Valo u32 svc_cfg_len; 566d8899132SKalle Valo struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01 567d8899132SKalle Valo svc_cfg[QMI_WLANFW_MAX_NUM_SVC_V01]; 568d8899132SKalle Valo u8 shadow_reg_valid; 569d8899132SKalle Valo u32 shadow_reg_len; 570d8899132SKalle Valo struct qmi_wlanfw_shadow_reg_cfg_s_v01 571d8899132SKalle Valo shadow_reg[QMI_WLANFW_MAX_NUM_SHADOW_REG_V01]; 572d8899132SKalle Valo u8 shadow_reg_v3_valid; 573d8899132SKalle Valo u32 shadow_reg_v3_len; 574d8899132SKalle Valo struct qmi_wlanfw_shadow_reg_v3_cfg_s_v01 575d8899132SKalle Valo shadow_reg_v3[QMI_WLANFW_MAX_NUM_SHADOW_REG_V3_V01]; 576d8899132SKalle Valo }; 577d8899132SKalle Valo 578d8899132SKalle Valo struct qmi_wlanfw_wlan_cfg_resp_msg_v01 { 579d8899132SKalle Valo struct qmi_response_type_v01 resp; 580d8899132SKalle Valo }; 581d8899132SKalle Valo 5829f9df1a2SBaochen Qiang #define ATH12K_QMI_WLANFW_WLAN_INI_REQ_V01 0x002F 5839f9df1a2SBaochen Qiang #define ATH12K_QMI_WLANFW_WLAN_INI_RESP_V01 0x002F 5849f9df1a2SBaochen Qiang #define QMI_WLANFW_WLAN_INI_REQ_MSG_V01_MAX_LEN 7 5859f9df1a2SBaochen Qiang #define QMI_WLANFW_WLAN_INI_RESP_MSG_V01_MAX_LEN 7 5869f9df1a2SBaochen Qiang 5879f9df1a2SBaochen Qiang struct qmi_wlanfw_wlan_ini_req_msg_v01 { 5889f9df1a2SBaochen Qiang /* Must be set to true if enable_fwlog is being passed */ 5899f9df1a2SBaochen Qiang u8 enable_fwlog_valid; 5909f9df1a2SBaochen Qiang u8 enable_fwlog; 5919f9df1a2SBaochen Qiang }; 5929f9df1a2SBaochen Qiang 5939f9df1a2SBaochen Qiang struct qmi_wlanfw_wlan_ini_resp_msg_v01 { 5949f9df1a2SBaochen Qiang struct qmi_response_type_v01 resp; 5959f9df1a2SBaochen Qiang }; 5969f9df1a2SBaochen Qiang 597d8899132SKalle Valo int ath12k_qmi_firmware_start(struct ath12k_base *ab, 598d8899132SKalle Valo u32 mode); 599d8899132SKalle Valo void ath12k_qmi_firmware_stop(struct ath12k_base *ab); 600d8899132SKalle Valo void ath12k_qmi_deinit_service(struct ath12k_base *ab); 601d8899132SKalle Valo int ath12k_qmi_init_service(struct ath12k_base *ab); 60292448f87SWen Gong void ath12k_qmi_free_resource(struct ath12k_base *ab); 603d8899132SKalle Valo 604d8899132SKalle Valo #endif 605