1d8899132SKalle Valo // SPDX-License-Identifier: BSD-3-Clause-Clear 2d8899132SKalle Valo /* 3d8899132SKalle Valo * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. 459cf57abSJeff Johnson * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. 5d8899132SKalle Valo */ 6d8899132SKalle Valo 7d8899132SKalle Valo #include <linux/elf.h> 8d8899132SKalle Valo 9d8899132SKalle Valo #include "qmi.h" 10d8899132SKalle Valo #include "core.h" 11d8899132SKalle Valo #include "debug.h" 12d8899132SKalle Valo #include <linux/of.h> 13d8899132SKalle Valo #include <linux/firmware.h> 14d8899132SKalle Valo 15d8899132SKalle Valo #define SLEEP_CLOCK_SELECT_INTERNAL_BIT 0x02 16d8899132SKalle Valo #define HOST_CSTATE_BIT 0x04 17d8899132SKalle Valo #define PLATFORM_CAP_PCIE_GLOBAL_RESET 0x08 18d8899132SKalle Valo #define ATH12K_QMI_MAX_CHUNK_SIZE 2097152 19d8899132SKalle Valo 20e7ab40b7SJeff Johnson static const struct qmi_elem_info wlfw_host_mlo_chip_info_s_v01_ei[] = { 21d8899132SKalle Valo { 22d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 23d8899132SKalle Valo .elem_len = 1, 24d8899132SKalle Valo .elem_size = sizeof(u8), 25d8899132SKalle Valo .array_type = NO_ARRAY, 26d8899132SKalle Valo .tlv_type = 0, 27d8899132SKalle Valo .offset = offsetof(struct wlfw_host_mlo_chip_info_s_v01, 28d8899132SKalle Valo chip_id), 29d8899132SKalle Valo }, 30d8899132SKalle Valo { 31d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 32d8899132SKalle Valo .elem_len = 1, 33d8899132SKalle Valo .elem_size = sizeof(u8), 34d8899132SKalle Valo .array_type = NO_ARRAY, 35d8899132SKalle Valo .tlv_type = 0, 36d8899132SKalle Valo .offset = offsetof(struct wlfw_host_mlo_chip_info_s_v01, 37d8899132SKalle Valo num_local_links), 38d8899132SKalle Valo }, 39d8899132SKalle Valo { 40d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 41d8899132SKalle Valo .elem_len = QMI_WLFW_MAX_NUM_MLO_LINKS_PER_CHIP_V01, 42d8899132SKalle Valo .elem_size = sizeof(u8), 43d8899132SKalle Valo .array_type = STATIC_ARRAY, 44d8899132SKalle Valo .tlv_type = 0, 45d8899132SKalle Valo .offset = offsetof(struct wlfw_host_mlo_chip_info_s_v01, 46d8899132SKalle Valo hw_link_id), 47d8899132SKalle Valo }, 48d8899132SKalle Valo { 49d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 50d8899132SKalle Valo .elem_len = QMI_WLFW_MAX_NUM_MLO_LINKS_PER_CHIP_V01, 51d8899132SKalle Valo .elem_size = sizeof(u8), 52d8899132SKalle Valo .array_type = STATIC_ARRAY, 53d8899132SKalle Valo .tlv_type = 0, 54d8899132SKalle Valo .offset = offsetof(struct wlfw_host_mlo_chip_info_s_v01, 55d8899132SKalle Valo valid_mlo_link_id), 56d8899132SKalle Valo }, 57d8899132SKalle Valo { 58d8899132SKalle Valo .data_type = QMI_EOTI, 59d8899132SKalle Valo .array_type = NO_ARRAY, 60d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 61d8899132SKalle Valo }, 62d8899132SKalle Valo }; 63d8899132SKalle Valo 64e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_host_cap_req_msg_v01_ei[] = { 65d8899132SKalle Valo { 66d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 67d8899132SKalle Valo .elem_len = 1, 68d8899132SKalle Valo .elem_size = sizeof(u8), 69d8899132SKalle Valo .array_type = NO_ARRAY, 70d8899132SKalle Valo .tlv_type = 0x10, 71d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 72d8899132SKalle Valo num_clients_valid), 73d8899132SKalle Valo }, 74d8899132SKalle Valo { 75d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 76d8899132SKalle Valo .elem_len = 1, 77d8899132SKalle Valo .elem_size = sizeof(u32), 78d8899132SKalle Valo .array_type = NO_ARRAY, 79d8899132SKalle Valo .tlv_type = 0x10, 80d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 81d8899132SKalle Valo num_clients), 82d8899132SKalle Valo }, 83d8899132SKalle Valo { 84d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 85d8899132SKalle Valo .elem_len = 1, 86d8899132SKalle Valo .elem_size = sizeof(u8), 87d8899132SKalle Valo .array_type = NO_ARRAY, 88d8899132SKalle Valo .tlv_type = 0x11, 89d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 90d8899132SKalle Valo wake_msi_valid), 91d8899132SKalle Valo }, 92d8899132SKalle Valo { 93d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 94d8899132SKalle Valo .elem_len = 1, 95d8899132SKalle Valo .elem_size = sizeof(u32), 96d8899132SKalle Valo .array_type = NO_ARRAY, 97d8899132SKalle Valo .tlv_type = 0x11, 98d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 99d8899132SKalle Valo wake_msi), 100d8899132SKalle Valo }, 101d8899132SKalle Valo { 102d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 103d8899132SKalle Valo .elem_len = 1, 104d8899132SKalle Valo .elem_size = sizeof(u8), 105d8899132SKalle Valo .array_type = NO_ARRAY, 106d8899132SKalle Valo .tlv_type = 0x12, 107d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 108d8899132SKalle Valo gpios_valid), 109d8899132SKalle Valo }, 110d8899132SKalle Valo { 111d8899132SKalle Valo .data_type = QMI_DATA_LEN, 112d8899132SKalle Valo .elem_len = 1, 113d8899132SKalle Valo .elem_size = sizeof(u8), 114d8899132SKalle Valo .array_type = NO_ARRAY, 115d8899132SKalle Valo .tlv_type = 0x12, 116d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 117d8899132SKalle Valo gpios_len), 118d8899132SKalle Valo }, 119d8899132SKalle Valo { 120d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 121d8899132SKalle Valo .elem_len = QMI_WLFW_MAX_NUM_GPIO_V01, 122d8899132SKalle Valo .elem_size = sizeof(u32), 123d8899132SKalle Valo .array_type = VAR_LEN_ARRAY, 124d8899132SKalle Valo .tlv_type = 0x12, 125d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 126d8899132SKalle Valo gpios), 127d8899132SKalle Valo }, 128d8899132SKalle Valo { 129d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 130d8899132SKalle Valo .elem_len = 1, 131d8899132SKalle Valo .elem_size = sizeof(u8), 132d8899132SKalle Valo .array_type = NO_ARRAY, 133d8899132SKalle Valo .tlv_type = 0x13, 134d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 135d8899132SKalle Valo nm_modem_valid), 136d8899132SKalle Valo }, 137d8899132SKalle Valo { 138d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 139d8899132SKalle Valo .elem_len = 1, 140d8899132SKalle Valo .elem_size = sizeof(u8), 141d8899132SKalle Valo .array_type = NO_ARRAY, 142d8899132SKalle Valo .tlv_type = 0x13, 143d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 144d8899132SKalle Valo nm_modem), 145d8899132SKalle Valo }, 146d8899132SKalle Valo { 147d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 148d8899132SKalle Valo .elem_len = 1, 149d8899132SKalle Valo .elem_size = sizeof(u8), 150d8899132SKalle Valo .array_type = NO_ARRAY, 151d8899132SKalle Valo .tlv_type = 0x14, 152d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 153d8899132SKalle Valo bdf_support_valid), 154d8899132SKalle Valo }, 155d8899132SKalle Valo { 156d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 157d8899132SKalle Valo .elem_len = 1, 158d8899132SKalle Valo .elem_size = sizeof(u8), 159d8899132SKalle Valo .array_type = NO_ARRAY, 160d8899132SKalle Valo .tlv_type = 0x14, 161d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 162d8899132SKalle Valo bdf_support), 163d8899132SKalle Valo }, 164d8899132SKalle Valo { 165d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 166d8899132SKalle Valo .elem_len = 1, 167d8899132SKalle Valo .elem_size = sizeof(u8), 168d8899132SKalle Valo .array_type = NO_ARRAY, 169d8899132SKalle Valo .tlv_type = 0x15, 170d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 171d8899132SKalle Valo bdf_cache_support_valid), 172d8899132SKalle Valo }, 173d8899132SKalle Valo { 174d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 175d8899132SKalle Valo .elem_len = 1, 176d8899132SKalle Valo .elem_size = sizeof(u8), 177d8899132SKalle Valo .array_type = NO_ARRAY, 178d8899132SKalle Valo .tlv_type = 0x15, 179d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 180d8899132SKalle Valo bdf_cache_support), 181d8899132SKalle Valo }, 182d8899132SKalle Valo { 183d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 184d8899132SKalle Valo .elem_len = 1, 185d8899132SKalle Valo .elem_size = sizeof(u8), 186d8899132SKalle Valo .array_type = NO_ARRAY, 187d8899132SKalle Valo .tlv_type = 0x16, 188d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 189d8899132SKalle Valo m3_support_valid), 190d8899132SKalle Valo }, 191d8899132SKalle Valo { 192d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 193d8899132SKalle Valo .elem_len = 1, 194d8899132SKalle Valo .elem_size = sizeof(u8), 195d8899132SKalle Valo .array_type = NO_ARRAY, 196d8899132SKalle Valo .tlv_type = 0x16, 197d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 198d8899132SKalle Valo m3_support), 199d8899132SKalle Valo }, 200d8899132SKalle Valo { 201d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 202d8899132SKalle Valo .elem_len = 1, 203d8899132SKalle Valo .elem_size = sizeof(u8), 204d8899132SKalle Valo .array_type = NO_ARRAY, 205d8899132SKalle Valo .tlv_type = 0x17, 206d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 207d8899132SKalle Valo m3_cache_support_valid), 208d8899132SKalle Valo }, 209d8899132SKalle Valo { 210d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 211d8899132SKalle Valo .elem_len = 1, 212d8899132SKalle Valo .elem_size = sizeof(u8), 213d8899132SKalle Valo .array_type = NO_ARRAY, 214d8899132SKalle Valo .tlv_type = 0x17, 215d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 216d8899132SKalle Valo m3_cache_support), 217d8899132SKalle Valo }, 218d8899132SKalle Valo { 219d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 220d8899132SKalle Valo .elem_len = 1, 221d8899132SKalle Valo .elem_size = sizeof(u8), 222d8899132SKalle Valo .array_type = NO_ARRAY, 223d8899132SKalle Valo .tlv_type = 0x18, 224d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 225d8899132SKalle Valo cal_filesys_support_valid), 226d8899132SKalle Valo }, 227d8899132SKalle Valo { 228d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 229d8899132SKalle Valo .elem_len = 1, 230d8899132SKalle Valo .elem_size = sizeof(u8), 231d8899132SKalle Valo .array_type = NO_ARRAY, 232d8899132SKalle Valo .tlv_type = 0x18, 233d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 234d8899132SKalle Valo cal_filesys_support), 235d8899132SKalle Valo }, 236d8899132SKalle Valo { 237d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 238d8899132SKalle Valo .elem_len = 1, 239d8899132SKalle Valo .elem_size = sizeof(u8), 240d8899132SKalle Valo .array_type = NO_ARRAY, 241d8899132SKalle Valo .tlv_type = 0x19, 242d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 243d8899132SKalle Valo cal_cache_support_valid), 244d8899132SKalle Valo }, 245d8899132SKalle Valo { 246d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 247d8899132SKalle Valo .elem_len = 1, 248d8899132SKalle Valo .elem_size = sizeof(u8), 249d8899132SKalle Valo .array_type = NO_ARRAY, 250d8899132SKalle Valo .tlv_type = 0x19, 251d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 252d8899132SKalle Valo cal_cache_support), 253d8899132SKalle Valo }, 254d8899132SKalle Valo { 255d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 256d8899132SKalle Valo .elem_len = 1, 257d8899132SKalle Valo .elem_size = sizeof(u8), 258d8899132SKalle Valo .array_type = NO_ARRAY, 259d8899132SKalle Valo .tlv_type = 0x1A, 260d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 261d8899132SKalle Valo cal_done_valid), 262d8899132SKalle Valo }, 263d8899132SKalle Valo { 264d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 265d8899132SKalle Valo .elem_len = 1, 266d8899132SKalle Valo .elem_size = sizeof(u8), 267d8899132SKalle Valo .array_type = NO_ARRAY, 268d8899132SKalle Valo .tlv_type = 0x1A, 269d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 270d8899132SKalle Valo cal_done), 271d8899132SKalle Valo }, 272d8899132SKalle Valo { 273d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 274d8899132SKalle Valo .elem_len = 1, 275d8899132SKalle Valo .elem_size = sizeof(u8), 276d8899132SKalle Valo .array_type = NO_ARRAY, 277d8899132SKalle Valo .tlv_type = 0x1B, 278d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 279d8899132SKalle Valo mem_bucket_valid), 280d8899132SKalle Valo }, 281d8899132SKalle Valo { 282d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 283d8899132SKalle Valo .elem_len = 1, 284d8899132SKalle Valo .elem_size = sizeof(u32), 285d8899132SKalle Valo .array_type = NO_ARRAY, 286d8899132SKalle Valo .tlv_type = 0x1B, 287d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 288d8899132SKalle Valo mem_bucket), 289d8899132SKalle Valo }, 290d8899132SKalle Valo { 291d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 292d8899132SKalle Valo .elem_len = 1, 293d8899132SKalle Valo .elem_size = sizeof(u8), 294d8899132SKalle Valo .array_type = NO_ARRAY, 295d8899132SKalle Valo .tlv_type = 0x1C, 296d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 297d8899132SKalle Valo mem_cfg_mode_valid), 298d8899132SKalle Valo }, 299d8899132SKalle Valo { 300d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 301d8899132SKalle Valo .elem_len = 1, 302d8899132SKalle Valo .elem_size = sizeof(u8), 303d8899132SKalle Valo .array_type = NO_ARRAY, 304d8899132SKalle Valo .tlv_type = 0x1C, 305d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 306d8899132SKalle Valo mem_cfg_mode), 307d8899132SKalle Valo }, 308d8899132SKalle Valo { 309d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 310d8899132SKalle Valo .elem_len = 1, 311d8899132SKalle Valo .elem_size = sizeof(u8), 312d8899132SKalle Valo .array_type = NO_ARRAY, 313d8899132SKalle Valo .tlv_type = 0x1D, 314d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 315d8899132SKalle Valo cal_duration_valid), 316d8899132SKalle Valo }, 317d8899132SKalle Valo { 318d8899132SKalle Valo .data_type = QMI_UNSIGNED_2_BYTE, 319d8899132SKalle Valo .elem_len = 1, 320d8899132SKalle Valo .elem_size = sizeof(u16), 321d8899132SKalle Valo .array_type = NO_ARRAY, 322d8899132SKalle Valo .tlv_type = 0x1D, 323d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 324d8899132SKalle Valo cal_duraiton), 325d8899132SKalle Valo }, 326d8899132SKalle Valo { 327d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 328d8899132SKalle Valo .elem_len = 1, 329d8899132SKalle Valo .elem_size = sizeof(u8), 330d8899132SKalle Valo .array_type = NO_ARRAY, 331d8899132SKalle Valo .tlv_type = 0x1E, 332d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 333d8899132SKalle Valo platform_name_valid), 334d8899132SKalle Valo }, 335d8899132SKalle Valo { 336d8899132SKalle Valo .data_type = QMI_STRING, 337d8899132SKalle Valo .elem_len = QMI_WLANFW_MAX_PLATFORM_NAME_LEN_V01 + 1, 338d8899132SKalle Valo .elem_size = sizeof(char), 339d8899132SKalle Valo .array_type = NO_ARRAY, 340d8899132SKalle Valo .tlv_type = 0x1E, 341d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 342d8899132SKalle Valo platform_name), 343d8899132SKalle Valo }, 344d8899132SKalle Valo { 345d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 346d8899132SKalle Valo .elem_len = 1, 347d8899132SKalle Valo .elem_size = sizeof(u8), 348d8899132SKalle Valo .array_type = NO_ARRAY, 349d8899132SKalle Valo .tlv_type = 0x1F, 350d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 351d8899132SKalle Valo ddr_range_valid), 352d8899132SKalle Valo }, 353d8899132SKalle Valo { 354d8899132SKalle Valo .data_type = QMI_STRUCT, 355d8899132SKalle Valo .elem_len = QMI_WLANFW_MAX_HOST_DDR_RANGE_SIZE_V01, 356d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_host_ddr_range), 357d8899132SKalle Valo .array_type = STATIC_ARRAY, 358d8899132SKalle Valo .tlv_type = 0x1F, 359d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 360d8899132SKalle Valo ddr_range), 361d8899132SKalle Valo }, 362d8899132SKalle Valo { 363d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 364d8899132SKalle Valo .elem_len = 1, 365d8899132SKalle Valo .elem_size = sizeof(u8), 366d8899132SKalle Valo .array_type = NO_ARRAY, 367d8899132SKalle Valo .tlv_type = 0x20, 368d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 369d8899132SKalle Valo host_build_type_valid), 370d8899132SKalle Valo }, 371d8899132SKalle Valo { 372d8899132SKalle Valo .data_type = QMI_SIGNED_4_BYTE_ENUM, 373d8899132SKalle Valo .elem_len = 1, 374d8899132SKalle Valo .elem_size = sizeof(enum qmi_wlanfw_host_build_type), 375d8899132SKalle Valo .array_type = NO_ARRAY, 376d8899132SKalle Valo .tlv_type = 0x20, 377d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 378d8899132SKalle Valo host_build_type), 379d8899132SKalle Valo }, 380d8899132SKalle Valo { 381d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 382d8899132SKalle Valo .elem_len = 1, 383d8899132SKalle Valo .elem_size = sizeof(u8), 384d8899132SKalle Valo .array_type = NO_ARRAY, 385d8899132SKalle Valo .tlv_type = 0x21, 386d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 387d8899132SKalle Valo mlo_capable_valid), 388d8899132SKalle Valo }, 389d8899132SKalle Valo { 39015c8441dSWen Gong .data_type = QMI_UNSIGNED_1_BYTE, 391d8899132SKalle Valo .elem_len = 1, 392d8899132SKalle Valo .elem_size = sizeof(u8), 393d8899132SKalle Valo .array_type = NO_ARRAY, 394d8899132SKalle Valo .tlv_type = 0x21, 395d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 396d8899132SKalle Valo mlo_capable), 397d8899132SKalle Valo }, 398d8899132SKalle Valo { 399d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 400d8899132SKalle Valo .elem_len = 1, 401d8899132SKalle Valo .elem_size = sizeof(u8), 402d8899132SKalle Valo .array_type = NO_ARRAY, 403d8899132SKalle Valo .tlv_type = 0x22, 404d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 405d8899132SKalle Valo mlo_chip_id_valid), 406d8899132SKalle Valo }, 407d8899132SKalle Valo { 408d8899132SKalle Valo .data_type = QMI_UNSIGNED_2_BYTE, 409d8899132SKalle Valo .elem_len = 1, 410d8899132SKalle Valo .elem_size = sizeof(u16), 411d8899132SKalle Valo .array_type = NO_ARRAY, 412d8899132SKalle Valo .tlv_type = 0x22, 413d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 414d8899132SKalle Valo mlo_chip_id), 415d8899132SKalle Valo }, 416d8899132SKalle Valo { 417d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 418d8899132SKalle Valo .elem_len = 1, 419d8899132SKalle Valo .elem_size = sizeof(u8), 420d8899132SKalle Valo .array_type = NO_ARRAY, 421d8899132SKalle Valo .tlv_type = 0x23, 422d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 423d8899132SKalle Valo mlo_group_id_valid), 424d8899132SKalle Valo }, 425d8899132SKalle Valo { 426d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 427d8899132SKalle Valo .elem_len = 1, 428d8899132SKalle Valo .elem_size = sizeof(u8), 429d8899132SKalle Valo .array_type = NO_ARRAY, 430d8899132SKalle Valo .tlv_type = 0x23, 431d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 432d8899132SKalle Valo mlo_group_id), 433d8899132SKalle Valo }, 434d8899132SKalle Valo { 435d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 436d8899132SKalle Valo .elem_len = 1, 437d8899132SKalle Valo .elem_size = sizeof(u8), 438d8899132SKalle Valo .array_type = NO_ARRAY, 439d8899132SKalle Valo .tlv_type = 0x24, 440d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 441d8899132SKalle Valo max_mlo_peer_valid), 442d8899132SKalle Valo }, 443d8899132SKalle Valo { 444d8899132SKalle Valo .data_type = QMI_UNSIGNED_2_BYTE, 445d8899132SKalle Valo .elem_len = 1, 446d8899132SKalle Valo .elem_size = sizeof(u16), 447d8899132SKalle Valo .array_type = NO_ARRAY, 448d8899132SKalle Valo .tlv_type = 0x24, 449d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 450d8899132SKalle Valo max_mlo_peer), 451d8899132SKalle Valo }, 452d8899132SKalle Valo { 453d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 454d8899132SKalle Valo .elem_len = 1, 455d8899132SKalle Valo .elem_size = sizeof(u8), 456d8899132SKalle Valo .array_type = NO_ARRAY, 457d8899132SKalle Valo .tlv_type = 0x25, 458d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 459d8899132SKalle Valo mlo_num_chips_valid), 460d8899132SKalle Valo }, 461d8899132SKalle Valo { 462d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 463d8899132SKalle Valo .elem_len = 1, 464d8899132SKalle Valo .elem_size = sizeof(u8), 465d8899132SKalle Valo .array_type = NO_ARRAY, 466d8899132SKalle Valo .tlv_type = 0x25, 467d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 468d8899132SKalle Valo mlo_num_chips), 469d8899132SKalle Valo }, 470d8899132SKalle Valo { 471d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 472d8899132SKalle Valo .elem_len = 1, 473d8899132SKalle Valo .elem_size = sizeof(u8), 474d8899132SKalle Valo .array_type = NO_ARRAY, 475d8899132SKalle Valo .tlv_type = 0x26, 476d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 477d8899132SKalle Valo mlo_chip_info_valid), 478d8899132SKalle Valo }, 479d8899132SKalle Valo { 480d8899132SKalle Valo .data_type = QMI_STRUCT, 481d8899132SKalle Valo .elem_len = QMI_WLFW_MAX_NUM_MLO_CHIPS_V01, 482d8899132SKalle Valo .elem_size = sizeof(struct wlfw_host_mlo_chip_info_s_v01), 483d8899132SKalle Valo .array_type = STATIC_ARRAY, 484d8899132SKalle Valo .tlv_type = 0x26, 485d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 486d8899132SKalle Valo mlo_chip_info), 487d8899132SKalle Valo .ei_array = wlfw_host_mlo_chip_info_s_v01_ei, 488d8899132SKalle Valo }, 489d8899132SKalle Valo { 490d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 491d8899132SKalle Valo .elem_len = 1, 492d8899132SKalle Valo .elem_size = sizeof(u8), 493d8899132SKalle Valo .array_type = NO_ARRAY, 494d8899132SKalle Valo .tlv_type = 0x27, 495d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 496d8899132SKalle Valo feature_list_valid), 497d8899132SKalle Valo }, 498d8899132SKalle Valo { 499d8899132SKalle Valo .data_type = QMI_UNSIGNED_8_BYTE, 500d8899132SKalle Valo .elem_len = 1, 501d8899132SKalle Valo .elem_size = sizeof(u64), 502d8899132SKalle Valo .array_type = NO_ARRAY, 503d8899132SKalle Valo .tlv_type = 0x27, 504d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_req_msg_v01, 505d8899132SKalle Valo feature_list), 506d8899132SKalle Valo }, 507d8899132SKalle Valo { 508d8899132SKalle Valo .data_type = QMI_EOTI, 509d8899132SKalle Valo .array_type = NO_ARRAY, 510d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 511d8899132SKalle Valo }, 512d8899132SKalle Valo }; 513d8899132SKalle Valo 514e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_host_cap_resp_msg_v01_ei[] = { 515d8899132SKalle Valo { 516d8899132SKalle Valo .data_type = QMI_STRUCT, 517d8899132SKalle Valo .elem_len = 1, 518d8899132SKalle Valo .elem_size = sizeof(struct qmi_response_type_v01), 519d8899132SKalle Valo .array_type = NO_ARRAY, 520d8899132SKalle Valo .tlv_type = 0x02, 521d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_host_cap_resp_msg_v01, resp), 522d8899132SKalle Valo .ei_array = qmi_response_type_v01_ei, 523d8899132SKalle Valo }, 524d8899132SKalle Valo { 525d8899132SKalle Valo .data_type = QMI_EOTI, 526d8899132SKalle Valo .array_type = NO_ARRAY, 527d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 528d8899132SKalle Valo }, 529d8899132SKalle Valo }; 530d8899132SKalle Valo 531e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_ind_register_req_msg_v01_ei[] = { 532d8899132SKalle Valo { 533d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 534d8899132SKalle Valo .elem_len = 1, 535d8899132SKalle Valo .elem_size = sizeof(u8), 536d8899132SKalle Valo .array_type = NO_ARRAY, 537d8899132SKalle Valo .tlv_type = 0x10, 538d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 539d8899132SKalle Valo fw_ready_enable_valid), 540d8899132SKalle Valo }, 541d8899132SKalle Valo { 542d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 543d8899132SKalle Valo .elem_len = 1, 544d8899132SKalle Valo .elem_size = sizeof(u8), 545d8899132SKalle Valo .array_type = NO_ARRAY, 546d8899132SKalle Valo .tlv_type = 0x10, 547d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 548d8899132SKalle Valo fw_ready_enable), 549d8899132SKalle Valo }, 550d8899132SKalle Valo { 551d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 552d8899132SKalle Valo .elem_len = 1, 553d8899132SKalle Valo .elem_size = sizeof(u8), 554d8899132SKalle Valo .array_type = NO_ARRAY, 555d8899132SKalle Valo .tlv_type = 0x11, 556d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 557d8899132SKalle Valo initiate_cal_download_enable_valid), 558d8899132SKalle Valo }, 559d8899132SKalle Valo { 560d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 561d8899132SKalle Valo .elem_len = 1, 562d8899132SKalle Valo .elem_size = sizeof(u8), 563d8899132SKalle Valo .array_type = NO_ARRAY, 564d8899132SKalle Valo .tlv_type = 0x11, 565d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 566d8899132SKalle Valo initiate_cal_download_enable), 567d8899132SKalle Valo }, 568d8899132SKalle Valo { 569d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 570d8899132SKalle Valo .elem_len = 1, 571d8899132SKalle Valo .elem_size = sizeof(u8), 572d8899132SKalle Valo .array_type = NO_ARRAY, 573d8899132SKalle Valo .tlv_type = 0x12, 574d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 575d8899132SKalle Valo initiate_cal_update_enable_valid), 576d8899132SKalle Valo }, 577d8899132SKalle Valo { 578d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 579d8899132SKalle Valo .elem_len = 1, 580d8899132SKalle Valo .elem_size = sizeof(u8), 581d8899132SKalle Valo .array_type = NO_ARRAY, 582d8899132SKalle Valo .tlv_type = 0x12, 583d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 584d8899132SKalle Valo initiate_cal_update_enable), 585d8899132SKalle Valo }, 586d8899132SKalle Valo { 587d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 588d8899132SKalle Valo .elem_len = 1, 589d8899132SKalle Valo .elem_size = sizeof(u8), 590d8899132SKalle Valo .array_type = NO_ARRAY, 591d8899132SKalle Valo .tlv_type = 0x13, 592d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 593d8899132SKalle Valo msa_ready_enable_valid), 594d8899132SKalle Valo }, 595d8899132SKalle Valo { 596d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 597d8899132SKalle Valo .elem_len = 1, 598d8899132SKalle Valo .elem_size = sizeof(u8), 599d8899132SKalle Valo .array_type = NO_ARRAY, 600d8899132SKalle Valo .tlv_type = 0x13, 601d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 602d8899132SKalle Valo msa_ready_enable), 603d8899132SKalle Valo }, 604d8899132SKalle Valo { 605d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 606d8899132SKalle Valo .elem_len = 1, 607d8899132SKalle Valo .elem_size = sizeof(u8), 608d8899132SKalle Valo .array_type = NO_ARRAY, 609d8899132SKalle Valo .tlv_type = 0x14, 610d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 611d8899132SKalle Valo pin_connect_result_enable_valid), 612d8899132SKalle Valo }, 613d8899132SKalle Valo { 614d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 615d8899132SKalle Valo .elem_len = 1, 616d8899132SKalle Valo .elem_size = sizeof(u8), 617d8899132SKalle Valo .array_type = NO_ARRAY, 618d8899132SKalle Valo .tlv_type = 0x14, 619d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 620d8899132SKalle Valo pin_connect_result_enable), 621d8899132SKalle Valo }, 622d8899132SKalle Valo { 623d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 624d8899132SKalle Valo .elem_len = 1, 625d8899132SKalle Valo .elem_size = sizeof(u8), 626d8899132SKalle Valo .array_type = NO_ARRAY, 627d8899132SKalle Valo .tlv_type = 0x15, 628d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 629d8899132SKalle Valo client_id_valid), 630d8899132SKalle Valo }, 631d8899132SKalle Valo { 632d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 633d8899132SKalle Valo .elem_len = 1, 634d8899132SKalle Valo .elem_size = sizeof(u32), 635d8899132SKalle Valo .array_type = NO_ARRAY, 636d8899132SKalle Valo .tlv_type = 0x15, 637d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 638d8899132SKalle Valo client_id), 639d8899132SKalle Valo }, 640d8899132SKalle Valo { 641d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 642d8899132SKalle Valo .elem_len = 1, 643d8899132SKalle Valo .elem_size = sizeof(u8), 644d8899132SKalle Valo .array_type = NO_ARRAY, 645d8899132SKalle Valo .tlv_type = 0x16, 646d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 647d8899132SKalle Valo request_mem_enable_valid), 648d8899132SKalle Valo }, 649d8899132SKalle Valo { 650d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 651d8899132SKalle Valo .elem_len = 1, 652d8899132SKalle Valo .elem_size = sizeof(u8), 653d8899132SKalle Valo .array_type = NO_ARRAY, 654d8899132SKalle Valo .tlv_type = 0x16, 655d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 656d8899132SKalle Valo request_mem_enable), 657d8899132SKalle Valo }, 658d8899132SKalle Valo { 659d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 660d8899132SKalle Valo .elem_len = 1, 661d8899132SKalle Valo .elem_size = sizeof(u8), 662d8899132SKalle Valo .array_type = NO_ARRAY, 663d8899132SKalle Valo .tlv_type = 0x17, 664d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 665d8899132SKalle Valo fw_mem_ready_enable_valid), 666d8899132SKalle Valo }, 667d8899132SKalle Valo { 668d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 669d8899132SKalle Valo .elem_len = 1, 670d8899132SKalle Valo .elem_size = sizeof(u8), 671d8899132SKalle Valo .array_type = NO_ARRAY, 672d8899132SKalle Valo .tlv_type = 0x17, 673d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 674d8899132SKalle Valo fw_mem_ready_enable), 675d8899132SKalle Valo }, 676d8899132SKalle Valo { 677d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 678d8899132SKalle Valo .elem_len = 1, 679d8899132SKalle Valo .elem_size = sizeof(u8), 680d8899132SKalle Valo .array_type = NO_ARRAY, 681d8899132SKalle Valo .tlv_type = 0x18, 682d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 683d8899132SKalle Valo fw_init_done_enable_valid), 684d8899132SKalle Valo }, 685d8899132SKalle Valo { 686d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 687d8899132SKalle Valo .elem_len = 1, 688d8899132SKalle Valo .elem_size = sizeof(u8), 689d8899132SKalle Valo .array_type = NO_ARRAY, 690d8899132SKalle Valo .tlv_type = 0x18, 691d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 692d8899132SKalle Valo fw_init_done_enable), 693d8899132SKalle Valo }, 694d8899132SKalle Valo 695d8899132SKalle Valo { 696d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 697d8899132SKalle Valo .elem_len = 1, 698d8899132SKalle Valo .elem_size = sizeof(u8), 699d8899132SKalle Valo .array_type = NO_ARRAY, 700d8899132SKalle Valo .tlv_type = 0x19, 701d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 702d8899132SKalle Valo rejuvenate_enable_valid), 703d8899132SKalle Valo }, 704d8899132SKalle Valo { 705d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 706d8899132SKalle Valo .elem_len = 1, 707d8899132SKalle Valo .elem_size = sizeof(u8), 708d8899132SKalle Valo .array_type = NO_ARRAY, 709d8899132SKalle Valo .tlv_type = 0x19, 710d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 711d8899132SKalle Valo rejuvenate_enable), 712d8899132SKalle Valo }, 713d8899132SKalle Valo { 714d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 715d8899132SKalle Valo .elem_len = 1, 716d8899132SKalle Valo .elem_size = sizeof(u8), 717d8899132SKalle Valo .array_type = NO_ARRAY, 718d8899132SKalle Valo .tlv_type = 0x1A, 719d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 720d8899132SKalle Valo xo_cal_enable_valid), 721d8899132SKalle Valo }, 722d8899132SKalle Valo { 723d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 724d8899132SKalle Valo .elem_len = 1, 725d8899132SKalle Valo .elem_size = sizeof(u8), 726d8899132SKalle Valo .array_type = NO_ARRAY, 727d8899132SKalle Valo .tlv_type = 0x1A, 728d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 729d8899132SKalle Valo xo_cal_enable), 730d8899132SKalle Valo }, 731d8899132SKalle Valo { 732d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 733d8899132SKalle Valo .elem_len = 1, 734d8899132SKalle Valo .elem_size = sizeof(u8), 735d8899132SKalle Valo .array_type = NO_ARRAY, 736d8899132SKalle Valo .tlv_type = 0x1B, 737d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 738d8899132SKalle Valo cal_done_enable_valid), 739d8899132SKalle Valo }, 740d8899132SKalle Valo { 741d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 742d8899132SKalle Valo .elem_len = 1, 743d8899132SKalle Valo .elem_size = sizeof(u8), 744d8899132SKalle Valo .array_type = NO_ARRAY, 745d8899132SKalle Valo .tlv_type = 0x1B, 746d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_req_msg_v01, 747d8899132SKalle Valo cal_done_enable), 748d8899132SKalle Valo }, 749d8899132SKalle Valo { 750d8899132SKalle Valo .data_type = QMI_EOTI, 751d8899132SKalle Valo .array_type = NO_ARRAY, 752d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 753d8899132SKalle Valo }, 754d8899132SKalle Valo }; 755d8899132SKalle Valo 756e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_ind_register_resp_msg_v01_ei[] = { 757d8899132SKalle Valo { 758d8899132SKalle Valo .data_type = QMI_STRUCT, 759d8899132SKalle Valo .elem_len = 1, 760d8899132SKalle Valo .elem_size = sizeof(struct qmi_response_type_v01), 761d8899132SKalle Valo .array_type = NO_ARRAY, 762d8899132SKalle Valo .tlv_type = 0x02, 763d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_resp_msg_v01, 764d8899132SKalle Valo resp), 765d8899132SKalle Valo .ei_array = qmi_response_type_v01_ei, 766d8899132SKalle Valo }, 767d8899132SKalle Valo { 768d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 769d8899132SKalle Valo .elem_len = 1, 770d8899132SKalle Valo .elem_size = sizeof(u8), 771d8899132SKalle Valo .array_type = NO_ARRAY, 772d8899132SKalle Valo .tlv_type = 0x10, 773d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_resp_msg_v01, 774d8899132SKalle Valo fw_status_valid), 775d8899132SKalle Valo }, 776d8899132SKalle Valo { 777d8899132SKalle Valo .data_type = QMI_UNSIGNED_8_BYTE, 778d8899132SKalle Valo .elem_len = 1, 779d8899132SKalle Valo .elem_size = sizeof(u64), 780d8899132SKalle Valo .array_type = NO_ARRAY, 781d8899132SKalle Valo .tlv_type = 0x10, 782d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ind_register_resp_msg_v01, 783d8899132SKalle Valo fw_status), 784d8899132SKalle Valo }, 785d8899132SKalle Valo { 786d8899132SKalle Valo .data_type = QMI_EOTI, 787d8899132SKalle Valo .array_type = NO_ARRAY, 788d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 789d8899132SKalle Valo }, 790d8899132SKalle Valo }; 791d8899132SKalle Valo 792e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_mem_cfg_s_v01_ei[] = { 793d8899132SKalle Valo { 794d8899132SKalle Valo .data_type = QMI_UNSIGNED_8_BYTE, 795d8899132SKalle Valo .elem_len = 1, 796d8899132SKalle Valo .elem_size = sizeof(u64), 797d8899132SKalle Valo .array_type = NO_ARRAY, 798d8899132SKalle Valo .tlv_type = 0, 799d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_mem_cfg_s_v01, offset), 800d8899132SKalle Valo }, 801d8899132SKalle Valo { 802d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 803d8899132SKalle Valo .elem_len = 1, 804d8899132SKalle Valo .elem_size = sizeof(u32), 805d8899132SKalle Valo .array_type = NO_ARRAY, 806d8899132SKalle Valo .tlv_type = 0, 807d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_mem_cfg_s_v01, size), 808d8899132SKalle Valo }, 809d8899132SKalle Valo { 810d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 811d8899132SKalle Valo .elem_len = 1, 812d8899132SKalle Valo .elem_size = sizeof(u8), 813d8899132SKalle Valo .array_type = NO_ARRAY, 814d8899132SKalle Valo .tlv_type = 0, 815d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_mem_cfg_s_v01, secure_flag), 816d8899132SKalle Valo }, 817d8899132SKalle Valo { 818d8899132SKalle Valo .data_type = QMI_EOTI, 819d8899132SKalle Valo .array_type = NO_ARRAY, 820d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 821d8899132SKalle Valo }, 822d8899132SKalle Valo }; 823d8899132SKalle Valo 824e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_mem_seg_s_v01_ei[] = { 825d8899132SKalle Valo { 826d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 827d8899132SKalle Valo .elem_len = 1, 828d8899132SKalle Valo .elem_size = sizeof(u32), 829d8899132SKalle Valo .array_type = NO_ARRAY, 830d8899132SKalle Valo .tlv_type = 0, 831d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_mem_seg_s_v01, 832d8899132SKalle Valo size), 833d8899132SKalle Valo }, 834d8899132SKalle Valo { 835d8899132SKalle Valo .data_type = QMI_SIGNED_4_BYTE_ENUM, 836d8899132SKalle Valo .elem_len = 1, 837d8899132SKalle Valo .elem_size = sizeof(enum qmi_wlanfw_mem_type_enum_v01), 838d8899132SKalle Valo .array_type = NO_ARRAY, 839d8899132SKalle Valo .tlv_type = 0, 840d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_mem_seg_s_v01, type), 841d8899132SKalle Valo }, 842d8899132SKalle Valo { 843d8899132SKalle Valo .data_type = QMI_DATA_LEN, 844d8899132SKalle Valo .elem_len = 1, 845d8899132SKalle Valo .elem_size = sizeof(u8), 846d8899132SKalle Valo .array_type = NO_ARRAY, 847d8899132SKalle Valo .tlv_type = 0, 848d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_mem_seg_s_v01, mem_cfg_len), 849d8899132SKalle Valo }, 850d8899132SKalle Valo { 851d8899132SKalle Valo .data_type = QMI_STRUCT, 852d8899132SKalle Valo .elem_len = QMI_WLANFW_MAX_NUM_MEM_CFG_V01, 853d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_mem_cfg_s_v01), 854d8899132SKalle Valo .array_type = VAR_LEN_ARRAY, 855d8899132SKalle Valo .tlv_type = 0, 856d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_mem_seg_s_v01, mem_cfg), 857d8899132SKalle Valo .ei_array = qmi_wlanfw_mem_cfg_s_v01_ei, 858d8899132SKalle Valo }, 859d8899132SKalle Valo { 860d8899132SKalle Valo .data_type = QMI_EOTI, 861d8899132SKalle Valo .array_type = NO_ARRAY, 862d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 863d8899132SKalle Valo }, 864d8899132SKalle Valo }; 865d8899132SKalle Valo 866e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_request_mem_ind_msg_v01_ei[] = { 867d8899132SKalle Valo { 868d8899132SKalle Valo .data_type = QMI_DATA_LEN, 869d8899132SKalle Valo .elem_len = 1, 870d8899132SKalle Valo .elem_size = sizeof(u8), 871d8899132SKalle Valo .array_type = NO_ARRAY, 872d8899132SKalle Valo .tlv_type = 0x01, 873d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_request_mem_ind_msg_v01, 874d8899132SKalle Valo mem_seg_len), 875d8899132SKalle Valo }, 876d8899132SKalle Valo { 877d8899132SKalle Valo .data_type = QMI_STRUCT, 878d8899132SKalle Valo .elem_len = ATH12K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01, 879d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_mem_seg_s_v01), 880d8899132SKalle Valo .array_type = VAR_LEN_ARRAY, 881d8899132SKalle Valo .tlv_type = 0x01, 882d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_request_mem_ind_msg_v01, 883d8899132SKalle Valo mem_seg), 884d8899132SKalle Valo .ei_array = qmi_wlanfw_mem_seg_s_v01_ei, 885d8899132SKalle Valo }, 886d8899132SKalle Valo { 887d8899132SKalle Valo .data_type = QMI_EOTI, 888d8899132SKalle Valo .array_type = NO_ARRAY, 889d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 890d8899132SKalle Valo }, 891d8899132SKalle Valo }; 892d8899132SKalle Valo 893e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_mem_seg_resp_s_v01_ei[] = { 894d8899132SKalle Valo { 895d8899132SKalle Valo .data_type = QMI_UNSIGNED_8_BYTE, 896d8899132SKalle Valo .elem_len = 1, 897d8899132SKalle Valo .elem_size = sizeof(u64), 898d8899132SKalle Valo .array_type = NO_ARRAY, 899d8899132SKalle Valo .tlv_type = 0, 900d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_mem_seg_resp_s_v01, addr), 901d8899132SKalle Valo }, 902d8899132SKalle Valo { 903d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 904d8899132SKalle Valo .elem_len = 1, 905d8899132SKalle Valo .elem_size = sizeof(u32), 906d8899132SKalle Valo .array_type = NO_ARRAY, 907d8899132SKalle Valo .tlv_type = 0, 908d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_mem_seg_resp_s_v01, size), 909d8899132SKalle Valo }, 910d8899132SKalle Valo { 911d8899132SKalle Valo .data_type = QMI_SIGNED_4_BYTE_ENUM, 912d8899132SKalle Valo .elem_len = 1, 913d8899132SKalle Valo .elem_size = sizeof(enum qmi_wlanfw_mem_type_enum_v01), 914d8899132SKalle Valo .array_type = NO_ARRAY, 915d8899132SKalle Valo .tlv_type = 0, 916d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_mem_seg_resp_s_v01, type), 917d8899132SKalle Valo }, 918d8899132SKalle Valo { 919d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 920d8899132SKalle Valo .elem_len = 1, 921d8899132SKalle Valo .elem_size = sizeof(u8), 922d8899132SKalle Valo .array_type = NO_ARRAY, 923d8899132SKalle Valo .tlv_type = 0, 924d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_mem_seg_resp_s_v01, restore), 925d8899132SKalle Valo }, 926d8899132SKalle Valo { 927d8899132SKalle Valo .data_type = QMI_EOTI, 928d8899132SKalle Valo .array_type = NO_ARRAY, 929d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 930d8899132SKalle Valo }, 931d8899132SKalle Valo }; 932d8899132SKalle Valo 933e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_respond_mem_req_msg_v01_ei[] = { 934d8899132SKalle Valo { 935d8899132SKalle Valo .data_type = QMI_DATA_LEN, 936d8899132SKalle Valo .elem_len = 1, 937d8899132SKalle Valo .elem_size = sizeof(u8), 938d8899132SKalle Valo .array_type = NO_ARRAY, 939d8899132SKalle Valo .tlv_type = 0x01, 940d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_respond_mem_req_msg_v01, 941d8899132SKalle Valo mem_seg_len), 942d8899132SKalle Valo }, 943d8899132SKalle Valo { 944d8899132SKalle Valo .data_type = QMI_STRUCT, 945d8899132SKalle Valo .elem_len = ATH12K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01, 946d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_mem_seg_resp_s_v01), 947d8899132SKalle Valo .array_type = VAR_LEN_ARRAY, 948d8899132SKalle Valo .tlv_type = 0x01, 949d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_respond_mem_req_msg_v01, 950d8899132SKalle Valo mem_seg), 951d8899132SKalle Valo .ei_array = qmi_wlanfw_mem_seg_resp_s_v01_ei, 952d8899132SKalle Valo }, 953d8899132SKalle Valo { 954d8899132SKalle Valo .data_type = QMI_EOTI, 955d8899132SKalle Valo .array_type = NO_ARRAY, 956d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 957d8899132SKalle Valo }, 958d8899132SKalle Valo }; 959d8899132SKalle Valo 960e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_respond_mem_resp_msg_v01_ei[] = { 961d8899132SKalle Valo { 962d8899132SKalle Valo .data_type = QMI_STRUCT, 963d8899132SKalle Valo .elem_len = 1, 964d8899132SKalle Valo .elem_size = sizeof(struct qmi_response_type_v01), 965d8899132SKalle Valo .array_type = NO_ARRAY, 966d8899132SKalle Valo .tlv_type = 0x02, 967d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_respond_mem_resp_msg_v01, 968d8899132SKalle Valo resp), 969d8899132SKalle Valo .ei_array = qmi_response_type_v01_ei, 970d8899132SKalle Valo }, 971d8899132SKalle Valo { 972d8899132SKalle Valo .data_type = QMI_EOTI, 973d8899132SKalle Valo .array_type = NO_ARRAY, 974d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 975d8899132SKalle Valo }, 976d8899132SKalle Valo }; 977d8899132SKalle Valo 978e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_cap_req_msg_v01_ei[] = { 979d8899132SKalle Valo { 980d8899132SKalle Valo .data_type = QMI_EOTI, 981d8899132SKalle Valo .array_type = NO_ARRAY, 982d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 983d8899132SKalle Valo }, 984d8899132SKalle Valo }; 985d8899132SKalle Valo 986e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_rf_chip_info_s_v01_ei[] = { 987d8899132SKalle Valo { 988d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 989d8899132SKalle Valo .elem_len = 1, 990d8899132SKalle Valo .elem_size = sizeof(u32), 991d8899132SKalle Valo .array_type = NO_ARRAY, 992d8899132SKalle Valo .tlv_type = 0, 993d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_rf_chip_info_s_v01, 994d8899132SKalle Valo chip_id), 995d8899132SKalle Valo }, 996d8899132SKalle Valo { 997d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 998d8899132SKalle Valo .elem_len = 1, 999d8899132SKalle Valo .elem_size = sizeof(u32), 1000d8899132SKalle Valo .array_type = NO_ARRAY, 1001d8899132SKalle Valo .tlv_type = 0, 1002d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_rf_chip_info_s_v01, 1003d8899132SKalle Valo chip_family), 1004d8899132SKalle Valo }, 1005d8899132SKalle Valo { 1006d8899132SKalle Valo .data_type = QMI_EOTI, 1007d8899132SKalle Valo .array_type = NO_ARRAY, 1008d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1009d8899132SKalle Valo }, 1010d8899132SKalle Valo }; 1011d8899132SKalle Valo 1012e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_rf_board_info_s_v01_ei[] = { 1013d8899132SKalle Valo { 1014d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1015d8899132SKalle Valo .elem_len = 1, 1016d8899132SKalle Valo .elem_size = sizeof(u32), 1017d8899132SKalle Valo .array_type = NO_ARRAY, 1018d8899132SKalle Valo .tlv_type = 0, 1019d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_rf_board_info_s_v01, 1020d8899132SKalle Valo board_id), 1021d8899132SKalle Valo }, 1022d8899132SKalle Valo { 1023d8899132SKalle Valo .data_type = QMI_EOTI, 1024d8899132SKalle Valo .array_type = NO_ARRAY, 1025d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1026d8899132SKalle Valo }, 1027d8899132SKalle Valo }; 1028d8899132SKalle Valo 1029e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_soc_info_s_v01_ei[] = { 1030d8899132SKalle Valo { 1031d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1032d8899132SKalle Valo .elem_len = 1, 1033d8899132SKalle Valo .elem_size = sizeof(u32), 1034d8899132SKalle Valo .array_type = NO_ARRAY, 1035d8899132SKalle Valo .tlv_type = 0, 1036d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_soc_info_s_v01, soc_id), 1037d8899132SKalle Valo }, 1038d8899132SKalle Valo { 1039d8899132SKalle Valo .data_type = QMI_EOTI, 1040d8899132SKalle Valo .array_type = NO_ARRAY, 1041d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1042d8899132SKalle Valo }, 1043d8899132SKalle Valo }; 1044d8899132SKalle Valo 1045e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_dev_mem_info_s_v01_ei[] = { 1046d8899132SKalle Valo { 1047d8899132SKalle Valo .data_type = QMI_UNSIGNED_8_BYTE, 1048d8899132SKalle Valo .elem_len = 1, 1049d8899132SKalle Valo .elem_size = sizeof(u64), 1050d8899132SKalle Valo .array_type = NO_ARRAY, 1051d8899132SKalle Valo .tlv_type = 0, 1052d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_dev_mem_info_s_v01, 1053d8899132SKalle Valo start), 1054d8899132SKalle Valo }, 1055d8899132SKalle Valo { 1056d8899132SKalle Valo .data_type = QMI_UNSIGNED_8_BYTE, 1057d8899132SKalle Valo .elem_len = 1, 1058d8899132SKalle Valo .elem_size = sizeof(u64), 1059d8899132SKalle Valo .array_type = NO_ARRAY, 1060d8899132SKalle Valo .tlv_type = 0, 1061d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_dev_mem_info_s_v01, 1062d8899132SKalle Valo size), 1063d8899132SKalle Valo }, 1064d8899132SKalle Valo { 1065d8899132SKalle Valo .data_type = QMI_EOTI, 1066d8899132SKalle Valo .array_type = NO_ARRAY, 1067d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1068d8899132SKalle Valo }, 1069d8899132SKalle Valo }; 1070d8899132SKalle Valo 1071e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_fw_version_info_s_v01_ei[] = { 1072d8899132SKalle Valo { 1073d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1074d8899132SKalle Valo .elem_len = 1, 1075d8899132SKalle Valo .elem_size = sizeof(u32), 1076d8899132SKalle Valo .array_type = NO_ARRAY, 1077d8899132SKalle Valo .tlv_type = 0, 1078d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_fw_version_info_s_v01, 1079d8899132SKalle Valo fw_version), 1080d8899132SKalle Valo }, 1081d8899132SKalle Valo { 1082d8899132SKalle Valo .data_type = QMI_STRING, 1083d8899132SKalle Valo .elem_len = ATH12K_QMI_WLANFW_MAX_TIMESTAMP_LEN_V01 + 1, 1084d8899132SKalle Valo .elem_size = sizeof(char), 1085d8899132SKalle Valo .array_type = NO_ARRAY, 1086d8899132SKalle Valo .tlv_type = 0, 1087d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_fw_version_info_s_v01, 1088d8899132SKalle Valo fw_build_timestamp), 1089d8899132SKalle Valo }, 1090d8899132SKalle Valo { 1091d8899132SKalle Valo .data_type = QMI_EOTI, 1092d8899132SKalle Valo .array_type = NO_ARRAY, 1093d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1094d8899132SKalle Valo }, 1095d8899132SKalle Valo }; 1096d8899132SKalle Valo 1097e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_cap_resp_msg_v01_ei[] = { 1098d8899132SKalle Valo { 1099d8899132SKalle Valo .data_type = QMI_STRUCT, 1100d8899132SKalle Valo .elem_len = 1, 1101d8899132SKalle Valo .elem_size = sizeof(struct qmi_response_type_v01), 1102d8899132SKalle Valo .array_type = NO_ARRAY, 1103d8899132SKalle Valo .tlv_type = 0x02, 1104d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, resp), 1105d8899132SKalle Valo .ei_array = qmi_response_type_v01_ei, 1106d8899132SKalle Valo }, 1107d8899132SKalle Valo { 1108d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1109d8899132SKalle Valo .elem_len = 1, 1110d8899132SKalle Valo .elem_size = sizeof(u8), 1111d8899132SKalle Valo .array_type = NO_ARRAY, 1112d8899132SKalle Valo .tlv_type = 0x10, 1113d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1114d8899132SKalle Valo chip_info_valid), 1115d8899132SKalle Valo }, 1116d8899132SKalle Valo { 1117d8899132SKalle Valo .data_type = QMI_STRUCT, 1118d8899132SKalle Valo .elem_len = 1, 1119d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_rf_chip_info_s_v01), 1120d8899132SKalle Valo .array_type = NO_ARRAY, 1121d8899132SKalle Valo .tlv_type = 0x10, 1122d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1123d8899132SKalle Valo chip_info), 1124d8899132SKalle Valo .ei_array = qmi_wlanfw_rf_chip_info_s_v01_ei, 1125d8899132SKalle Valo }, 1126d8899132SKalle Valo { 1127d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1128d8899132SKalle Valo .elem_len = 1, 1129d8899132SKalle Valo .elem_size = sizeof(u8), 1130d8899132SKalle Valo .array_type = NO_ARRAY, 1131d8899132SKalle Valo .tlv_type = 0x11, 1132d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1133d8899132SKalle Valo board_info_valid), 1134d8899132SKalle Valo }, 1135d8899132SKalle Valo { 1136d8899132SKalle Valo .data_type = QMI_STRUCT, 1137d8899132SKalle Valo .elem_len = 1, 1138d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_rf_board_info_s_v01), 1139d8899132SKalle Valo .array_type = NO_ARRAY, 1140d8899132SKalle Valo .tlv_type = 0x11, 1141d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1142d8899132SKalle Valo board_info), 1143d8899132SKalle Valo .ei_array = qmi_wlanfw_rf_board_info_s_v01_ei, 1144d8899132SKalle Valo }, 1145d8899132SKalle Valo { 1146d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1147d8899132SKalle Valo .elem_len = 1, 1148d8899132SKalle Valo .elem_size = sizeof(u8), 1149d8899132SKalle Valo .array_type = NO_ARRAY, 1150d8899132SKalle Valo .tlv_type = 0x12, 1151d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1152d8899132SKalle Valo soc_info_valid), 1153d8899132SKalle Valo }, 1154d8899132SKalle Valo { 1155d8899132SKalle Valo .data_type = QMI_STRUCT, 1156d8899132SKalle Valo .elem_len = 1, 1157d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_soc_info_s_v01), 1158d8899132SKalle Valo .array_type = NO_ARRAY, 1159d8899132SKalle Valo .tlv_type = 0x12, 1160d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1161d8899132SKalle Valo soc_info), 1162d8899132SKalle Valo .ei_array = qmi_wlanfw_soc_info_s_v01_ei, 1163d8899132SKalle Valo }, 1164d8899132SKalle Valo { 1165d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1166d8899132SKalle Valo .elem_len = 1, 1167d8899132SKalle Valo .elem_size = sizeof(u8), 1168d8899132SKalle Valo .array_type = NO_ARRAY, 1169d8899132SKalle Valo .tlv_type = 0x13, 1170d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1171d8899132SKalle Valo fw_version_info_valid), 1172d8899132SKalle Valo }, 1173d8899132SKalle Valo { 1174d8899132SKalle Valo .data_type = QMI_STRUCT, 1175d8899132SKalle Valo .elem_len = 1, 1176d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_fw_version_info_s_v01), 1177d8899132SKalle Valo .array_type = NO_ARRAY, 1178d8899132SKalle Valo .tlv_type = 0x13, 1179d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1180d8899132SKalle Valo fw_version_info), 1181d8899132SKalle Valo .ei_array = qmi_wlanfw_fw_version_info_s_v01_ei, 1182d8899132SKalle Valo }, 1183d8899132SKalle Valo { 1184d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1185d8899132SKalle Valo .elem_len = 1, 1186d8899132SKalle Valo .elem_size = sizeof(u8), 1187d8899132SKalle Valo .array_type = NO_ARRAY, 1188d8899132SKalle Valo .tlv_type = 0x14, 1189d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1190d8899132SKalle Valo fw_build_id_valid), 1191d8899132SKalle Valo }, 1192d8899132SKalle Valo { 1193d8899132SKalle Valo .data_type = QMI_STRING, 1194d8899132SKalle Valo .elem_len = ATH12K_QMI_WLANFW_MAX_BUILD_ID_LEN_V01 + 1, 1195d8899132SKalle Valo .elem_size = sizeof(char), 1196d8899132SKalle Valo .array_type = NO_ARRAY, 1197d8899132SKalle Valo .tlv_type = 0x14, 1198d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1199d8899132SKalle Valo fw_build_id), 1200d8899132SKalle Valo }, 1201d8899132SKalle Valo { 1202d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1203d8899132SKalle Valo .elem_len = 1, 1204d8899132SKalle Valo .elem_size = sizeof(u8), 1205d8899132SKalle Valo .array_type = NO_ARRAY, 1206d8899132SKalle Valo .tlv_type = 0x15, 1207d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1208d8899132SKalle Valo num_macs_valid), 1209d8899132SKalle Valo }, 1210d8899132SKalle Valo { 1211d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 1212d8899132SKalle Valo .elem_len = 1, 1213d8899132SKalle Valo .elem_size = sizeof(u8), 1214d8899132SKalle Valo .array_type = NO_ARRAY, 1215d8899132SKalle Valo .tlv_type = 0x15, 1216d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1217d8899132SKalle Valo num_macs), 1218d8899132SKalle Valo }, 1219d8899132SKalle Valo { 1220d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1221d8899132SKalle Valo .elem_len = 1, 1222d8899132SKalle Valo .elem_size = sizeof(u8), 1223d8899132SKalle Valo .array_type = NO_ARRAY, 1224d8899132SKalle Valo .tlv_type = 0x16, 1225d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1226d8899132SKalle Valo voltage_mv_valid), 1227d8899132SKalle Valo }, 1228d8899132SKalle Valo { 1229d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1230d8899132SKalle Valo .elem_len = 1, 1231d8899132SKalle Valo .elem_size = sizeof(u32), 1232d8899132SKalle Valo .array_type = NO_ARRAY, 1233d8899132SKalle Valo .tlv_type = 0x16, 1234d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1235d8899132SKalle Valo voltage_mv), 1236d8899132SKalle Valo }, 1237d8899132SKalle Valo { 1238d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1239d8899132SKalle Valo .elem_len = 1, 1240d8899132SKalle Valo .elem_size = sizeof(u8), 1241d8899132SKalle Valo .array_type = NO_ARRAY, 1242d8899132SKalle Valo .tlv_type = 0x17, 1243d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1244d8899132SKalle Valo time_freq_hz_valid), 1245d8899132SKalle Valo }, 1246d8899132SKalle Valo { 1247d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1248d8899132SKalle Valo .elem_len = 1, 1249d8899132SKalle Valo .elem_size = sizeof(u32), 1250d8899132SKalle Valo .array_type = NO_ARRAY, 1251d8899132SKalle Valo .tlv_type = 0x17, 1252d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1253d8899132SKalle Valo time_freq_hz), 1254d8899132SKalle Valo }, 1255d8899132SKalle Valo { 1256d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1257d8899132SKalle Valo .elem_len = 1, 1258d8899132SKalle Valo .elem_size = sizeof(u8), 1259d8899132SKalle Valo .array_type = NO_ARRAY, 1260d8899132SKalle Valo .tlv_type = 0x18, 1261d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1262d8899132SKalle Valo otp_version_valid), 1263d8899132SKalle Valo }, 1264d8899132SKalle Valo { 1265d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1266d8899132SKalle Valo .elem_len = 1, 1267d8899132SKalle Valo .elem_size = sizeof(u32), 1268d8899132SKalle Valo .array_type = NO_ARRAY, 1269d8899132SKalle Valo .tlv_type = 0x18, 1270d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1271d8899132SKalle Valo otp_version), 1272d8899132SKalle Valo }, 1273d8899132SKalle Valo { 1274d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1275d8899132SKalle Valo .elem_len = 1, 1276d8899132SKalle Valo .elem_size = sizeof(u8), 1277d8899132SKalle Valo .array_type = NO_ARRAY, 1278d8899132SKalle Valo .tlv_type = 0x19, 1279d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1280d8899132SKalle Valo eeprom_caldata_read_timeout_valid), 1281d8899132SKalle Valo }, 1282d8899132SKalle Valo { 1283d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1284d8899132SKalle Valo .elem_len = 1, 1285d8899132SKalle Valo .elem_size = sizeof(u32), 1286d8899132SKalle Valo .array_type = NO_ARRAY, 1287d8899132SKalle Valo .tlv_type = 0x19, 1288d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1289d8899132SKalle Valo eeprom_caldata_read_timeout), 1290d8899132SKalle Valo }, 1291d8899132SKalle Valo { 1292d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1293d8899132SKalle Valo .elem_len = 1, 1294d8899132SKalle Valo .elem_size = sizeof(u8), 1295d8899132SKalle Valo .array_type = NO_ARRAY, 1296d8899132SKalle Valo .tlv_type = 0x1A, 1297d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1298d8899132SKalle Valo fw_caps_valid), 1299d8899132SKalle Valo }, 1300d8899132SKalle Valo { 1301d8899132SKalle Valo .data_type = QMI_UNSIGNED_8_BYTE, 1302d8899132SKalle Valo .elem_len = 1, 1303d8899132SKalle Valo .elem_size = sizeof(u64), 1304d8899132SKalle Valo .array_type = NO_ARRAY, 1305d8899132SKalle Valo .tlv_type = 0x1A, 1306d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, fw_caps), 1307d8899132SKalle Valo }, 1308d8899132SKalle Valo { 1309d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1310d8899132SKalle Valo .elem_len = 1, 1311d8899132SKalle Valo .elem_size = sizeof(u8), 1312d8899132SKalle Valo .array_type = NO_ARRAY, 1313d8899132SKalle Valo .tlv_type = 0x1B, 1314d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1315d8899132SKalle Valo rd_card_chain_cap_valid), 1316d8899132SKalle Valo }, 1317d8899132SKalle Valo { 1318d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1319d8899132SKalle Valo .elem_len = 1, 1320d8899132SKalle Valo .elem_size = sizeof(u32), 1321d8899132SKalle Valo .array_type = NO_ARRAY, 1322d8899132SKalle Valo .tlv_type = 0x1B, 1323d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1324d8899132SKalle Valo rd_card_chain_cap), 1325d8899132SKalle Valo }, 1326d8899132SKalle Valo { 1327d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1328d8899132SKalle Valo .elem_len = 1, 1329d8899132SKalle Valo .elem_size = sizeof(u8), 1330d8899132SKalle Valo .array_type = NO_ARRAY, 1331d8899132SKalle Valo .tlv_type = 0x1C, 1332d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, 1333d8899132SKalle Valo dev_mem_info_valid), 1334d8899132SKalle Valo }, 1335d8899132SKalle Valo { 1336d8899132SKalle Valo .data_type = QMI_STRUCT, 1337d8899132SKalle Valo .elem_len = ATH12K_QMI_WLFW_MAX_DEV_MEM_NUM_V01, 1338d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_dev_mem_info_s_v01), 1339d8899132SKalle Valo .array_type = STATIC_ARRAY, 1340d8899132SKalle Valo .tlv_type = 0x1C, 1341d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_cap_resp_msg_v01, dev_mem), 1342d8899132SKalle Valo .ei_array = qmi_wlanfw_dev_mem_info_s_v01_ei, 1343d8899132SKalle Valo }, 1344d8899132SKalle Valo { 1345d8899132SKalle Valo .data_type = QMI_EOTI, 1346d8899132SKalle Valo .array_type = NO_ARRAY, 1347d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1348d8899132SKalle Valo }, 1349d8899132SKalle Valo }; 1350d8899132SKalle Valo 1351e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_bdf_download_req_msg_v01_ei[] = { 1352d8899132SKalle Valo { 1353d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 1354d8899132SKalle Valo .elem_len = 1, 1355d8899132SKalle Valo .elem_size = sizeof(u8), 1356d8899132SKalle Valo .array_type = NO_ARRAY, 1357d8899132SKalle Valo .tlv_type = 0x01, 1358d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1359d8899132SKalle Valo valid), 1360d8899132SKalle Valo }, 1361d8899132SKalle Valo { 1362d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1363d8899132SKalle Valo .elem_len = 1, 1364d8899132SKalle Valo .elem_size = sizeof(u8), 1365d8899132SKalle Valo .array_type = NO_ARRAY, 1366d8899132SKalle Valo .tlv_type = 0x10, 1367d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1368d8899132SKalle Valo file_id_valid), 1369d8899132SKalle Valo }, 1370d8899132SKalle Valo { 1371d8899132SKalle Valo .data_type = QMI_SIGNED_4_BYTE_ENUM, 1372d8899132SKalle Valo .elem_len = 1, 1373d8899132SKalle Valo .elem_size = sizeof(enum qmi_wlanfw_cal_temp_id_enum_v01), 1374d8899132SKalle Valo .array_type = NO_ARRAY, 1375d8899132SKalle Valo .tlv_type = 0x10, 1376d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1377d8899132SKalle Valo file_id), 1378d8899132SKalle Valo }, 1379d8899132SKalle Valo { 1380d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1381d8899132SKalle Valo .elem_len = 1, 1382d8899132SKalle Valo .elem_size = sizeof(u8), 1383d8899132SKalle Valo .array_type = NO_ARRAY, 1384d8899132SKalle Valo .tlv_type = 0x11, 1385d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1386d8899132SKalle Valo total_size_valid), 1387d8899132SKalle Valo }, 1388d8899132SKalle Valo { 1389d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1390d8899132SKalle Valo .elem_len = 1, 1391d8899132SKalle Valo .elem_size = sizeof(u32), 1392d8899132SKalle Valo .array_type = NO_ARRAY, 1393d8899132SKalle Valo .tlv_type = 0x11, 1394d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1395d8899132SKalle Valo total_size), 1396d8899132SKalle Valo }, 1397d8899132SKalle Valo { 1398d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1399d8899132SKalle Valo .elem_len = 1, 1400d8899132SKalle Valo .elem_size = sizeof(u8), 1401d8899132SKalle Valo .array_type = NO_ARRAY, 1402d8899132SKalle Valo .tlv_type = 0x12, 1403d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1404d8899132SKalle Valo seg_id_valid), 1405d8899132SKalle Valo }, 1406d8899132SKalle Valo { 1407d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1408d8899132SKalle Valo .elem_len = 1, 1409d8899132SKalle Valo .elem_size = sizeof(u32), 1410d8899132SKalle Valo .array_type = NO_ARRAY, 1411d8899132SKalle Valo .tlv_type = 0x12, 1412d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1413d8899132SKalle Valo seg_id), 1414d8899132SKalle Valo }, 1415d8899132SKalle Valo { 1416d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1417d8899132SKalle Valo .elem_len = 1, 1418d8899132SKalle Valo .elem_size = sizeof(u8), 1419d8899132SKalle Valo .array_type = NO_ARRAY, 1420d8899132SKalle Valo .tlv_type = 0x13, 1421d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1422d8899132SKalle Valo data_valid), 1423d8899132SKalle Valo }, 1424d8899132SKalle Valo { 1425d8899132SKalle Valo .data_type = QMI_DATA_LEN, 1426d8899132SKalle Valo .elem_len = 1, 1427d8899132SKalle Valo .elem_size = sizeof(u16), 1428d8899132SKalle Valo .array_type = NO_ARRAY, 1429d8899132SKalle Valo .tlv_type = 0x13, 1430d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1431d8899132SKalle Valo data_len), 1432d8899132SKalle Valo }, 1433d8899132SKalle Valo { 1434d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 1435d8899132SKalle Valo .elem_len = QMI_WLANFW_MAX_DATA_SIZE_V01, 1436d8899132SKalle Valo .elem_size = sizeof(u8), 1437d8899132SKalle Valo .array_type = VAR_LEN_ARRAY, 1438d8899132SKalle Valo .tlv_type = 0x13, 1439d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1440d8899132SKalle Valo data), 1441d8899132SKalle Valo }, 1442d8899132SKalle Valo { 1443d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1444d8899132SKalle Valo .elem_len = 1, 1445d8899132SKalle Valo .elem_size = sizeof(u8), 1446d8899132SKalle Valo .array_type = NO_ARRAY, 1447d8899132SKalle Valo .tlv_type = 0x14, 1448d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1449d8899132SKalle Valo end_valid), 1450d8899132SKalle Valo }, 1451d8899132SKalle Valo { 1452d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 1453d8899132SKalle Valo .elem_len = 1, 1454d8899132SKalle Valo .elem_size = sizeof(u8), 1455d8899132SKalle Valo .array_type = NO_ARRAY, 1456d8899132SKalle Valo .tlv_type = 0x14, 1457d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1458d8899132SKalle Valo end), 1459d8899132SKalle Valo }, 1460d8899132SKalle Valo { 1461d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1462d8899132SKalle Valo .elem_len = 1, 1463d8899132SKalle Valo .elem_size = sizeof(u8), 1464d8899132SKalle Valo .array_type = NO_ARRAY, 1465d8899132SKalle Valo .tlv_type = 0x15, 1466d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1467d8899132SKalle Valo bdf_type_valid), 1468d8899132SKalle Valo }, 1469d8899132SKalle Valo { 1470d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 1471d8899132SKalle Valo .elem_len = 1, 1472d8899132SKalle Valo .elem_size = sizeof(u8), 1473d8899132SKalle Valo .array_type = NO_ARRAY, 1474d8899132SKalle Valo .tlv_type = 0x15, 1475d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01, 1476d8899132SKalle Valo bdf_type), 1477d8899132SKalle Valo }, 1478d8899132SKalle Valo 1479d8899132SKalle Valo { 1480d8899132SKalle Valo .data_type = QMI_EOTI, 1481d8899132SKalle Valo .array_type = NO_ARRAY, 1482d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1483d8899132SKalle Valo }, 1484d8899132SKalle Valo }; 1485d8899132SKalle Valo 1486e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_bdf_download_resp_msg_v01_ei[] = { 1487d8899132SKalle Valo { 1488d8899132SKalle Valo .data_type = QMI_STRUCT, 1489d8899132SKalle Valo .elem_len = 1, 1490d8899132SKalle Valo .elem_size = sizeof(struct qmi_response_type_v01), 1491d8899132SKalle Valo .array_type = NO_ARRAY, 1492d8899132SKalle Valo .tlv_type = 0x02, 1493d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_bdf_download_resp_msg_v01, 1494d8899132SKalle Valo resp), 1495d8899132SKalle Valo .ei_array = qmi_response_type_v01_ei, 1496d8899132SKalle Valo }, 1497d8899132SKalle Valo { 1498d8899132SKalle Valo .data_type = QMI_EOTI, 1499d8899132SKalle Valo .array_type = NO_ARRAY, 1500d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1501d8899132SKalle Valo }, 1502d8899132SKalle Valo }; 1503d8899132SKalle Valo 1504e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_m3_info_req_msg_v01_ei[] = { 1505d8899132SKalle Valo { 1506d8899132SKalle Valo .data_type = QMI_UNSIGNED_8_BYTE, 1507d8899132SKalle Valo .elem_len = 1, 1508d8899132SKalle Valo .elem_size = sizeof(u64), 1509d8899132SKalle Valo .array_type = NO_ARRAY, 1510d8899132SKalle Valo .tlv_type = 0x01, 1511d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_m3_info_req_msg_v01, addr), 1512d8899132SKalle Valo }, 1513d8899132SKalle Valo { 1514d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1515d8899132SKalle Valo .elem_len = 1, 1516d8899132SKalle Valo .elem_size = sizeof(u32), 1517d8899132SKalle Valo .array_type = NO_ARRAY, 1518d8899132SKalle Valo .tlv_type = 0x02, 1519d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_m3_info_req_msg_v01, size), 1520d8899132SKalle Valo }, 1521d8899132SKalle Valo { 1522d8899132SKalle Valo .data_type = QMI_EOTI, 1523d8899132SKalle Valo .array_type = NO_ARRAY, 1524d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1525d8899132SKalle Valo }, 1526d8899132SKalle Valo }; 1527d8899132SKalle Valo 1528e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_m3_info_resp_msg_v01_ei[] = { 1529d8899132SKalle Valo { 1530d8899132SKalle Valo .data_type = QMI_STRUCT, 1531d8899132SKalle Valo .elem_len = 1, 1532d8899132SKalle Valo .elem_size = sizeof(struct qmi_response_type_v01), 1533d8899132SKalle Valo .array_type = NO_ARRAY, 1534d8899132SKalle Valo .tlv_type = 0x02, 1535d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_m3_info_resp_msg_v01, resp), 1536d8899132SKalle Valo .ei_array = qmi_response_type_v01_ei, 1537d8899132SKalle Valo }, 1538d8899132SKalle Valo { 1539d8899132SKalle Valo .data_type = QMI_EOTI, 1540d8899132SKalle Valo .array_type = NO_ARRAY, 1541d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1542d8899132SKalle Valo }, 1543d8899132SKalle Valo }; 1544d8899132SKalle Valo 1545e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_ce_tgt_pipe_cfg_s_v01_ei[] = { 1546d8899132SKalle Valo { 1547d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1548d8899132SKalle Valo .elem_len = 1, 1549d8899132SKalle Valo .elem_size = sizeof(u32), 1550d8899132SKalle Valo .array_type = NO_ARRAY, 1551d8899132SKalle Valo .tlv_type = 0, 1552d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01, 1553d8899132SKalle Valo pipe_num), 1554d8899132SKalle Valo }, 1555d8899132SKalle Valo { 1556d8899132SKalle Valo .data_type = QMI_SIGNED_4_BYTE_ENUM, 1557d8899132SKalle Valo .elem_len = 1, 1558d8899132SKalle Valo .elem_size = sizeof(enum qmi_wlanfw_pipedir_enum_v01), 1559d8899132SKalle Valo .array_type = NO_ARRAY, 1560d8899132SKalle Valo .tlv_type = 0, 1561d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01, 1562d8899132SKalle Valo pipe_dir), 1563d8899132SKalle Valo }, 1564d8899132SKalle Valo { 1565d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1566d8899132SKalle Valo .elem_len = 1, 1567d8899132SKalle Valo .elem_size = sizeof(u32), 1568d8899132SKalle Valo .array_type = NO_ARRAY, 1569d8899132SKalle Valo .tlv_type = 0, 1570d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01, 1571d8899132SKalle Valo nentries), 1572d8899132SKalle Valo }, 1573d8899132SKalle Valo { 1574d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1575d8899132SKalle Valo .elem_len = 1, 1576d8899132SKalle Valo .elem_size = sizeof(u32), 1577d8899132SKalle Valo .array_type = NO_ARRAY, 1578d8899132SKalle Valo .tlv_type = 0, 1579d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01, 1580d8899132SKalle Valo nbytes_max), 1581d8899132SKalle Valo }, 1582d8899132SKalle Valo { 1583d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1584d8899132SKalle Valo .elem_len = 1, 1585d8899132SKalle Valo .elem_size = sizeof(u32), 1586d8899132SKalle Valo .array_type = NO_ARRAY, 1587d8899132SKalle Valo .tlv_type = 0, 1588d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01, 1589d8899132SKalle Valo flags), 1590d8899132SKalle Valo }, 1591d8899132SKalle Valo { 1592d8899132SKalle Valo .data_type = QMI_EOTI, 1593d8899132SKalle Valo .array_type = NO_ARRAY, 1594d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1595d8899132SKalle Valo }, 1596d8899132SKalle Valo }; 1597d8899132SKalle Valo 1598e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_ce_svc_pipe_cfg_s_v01_ei[] = { 1599d8899132SKalle Valo { 1600d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1601d8899132SKalle Valo .elem_len = 1, 1602d8899132SKalle Valo .elem_size = sizeof(u32), 1603d8899132SKalle Valo .array_type = NO_ARRAY, 1604d8899132SKalle Valo .tlv_type = 0, 1605d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01, 1606d8899132SKalle Valo service_id), 1607d8899132SKalle Valo }, 1608d8899132SKalle Valo { 1609d8899132SKalle Valo .data_type = QMI_SIGNED_4_BYTE_ENUM, 1610d8899132SKalle Valo .elem_len = 1, 1611d8899132SKalle Valo .elem_size = sizeof(enum qmi_wlanfw_pipedir_enum_v01), 1612d8899132SKalle Valo .array_type = NO_ARRAY, 1613d8899132SKalle Valo .tlv_type = 0, 1614d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01, 1615d8899132SKalle Valo pipe_dir), 1616d8899132SKalle Valo }, 1617d8899132SKalle Valo { 1618d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1619d8899132SKalle Valo .elem_len = 1, 1620d8899132SKalle Valo .elem_size = sizeof(u32), 1621d8899132SKalle Valo .array_type = NO_ARRAY, 1622d8899132SKalle Valo .tlv_type = 0, 1623d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01, 1624d8899132SKalle Valo pipe_num), 1625d8899132SKalle Valo }, 1626d8899132SKalle Valo { 1627d8899132SKalle Valo .data_type = QMI_EOTI, 1628d8899132SKalle Valo .array_type = NO_ARRAY, 1629d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1630d8899132SKalle Valo }, 1631d8899132SKalle Valo }; 1632d8899132SKalle Valo 1633e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_shadow_reg_cfg_s_v01_ei[] = { 1634d8899132SKalle Valo { 1635d8899132SKalle Valo .data_type = QMI_UNSIGNED_2_BYTE, 1636d8899132SKalle Valo .elem_len = 1, 1637d8899132SKalle Valo .elem_size = sizeof(u16), 1638d8899132SKalle Valo .array_type = NO_ARRAY, 1639d8899132SKalle Valo .tlv_type = 0, 1640d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_shadow_reg_cfg_s_v01, id), 1641d8899132SKalle Valo }, 1642d8899132SKalle Valo { 1643d8899132SKalle Valo .data_type = QMI_UNSIGNED_2_BYTE, 1644d8899132SKalle Valo .elem_len = 1, 1645d8899132SKalle Valo .elem_size = sizeof(u16), 1646d8899132SKalle Valo .array_type = NO_ARRAY, 1647d8899132SKalle Valo .tlv_type = 0, 1648d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_shadow_reg_cfg_s_v01, 1649d8899132SKalle Valo offset), 1650d8899132SKalle Valo }, 1651d8899132SKalle Valo { 1652d8899132SKalle Valo .data_type = QMI_EOTI, 1653d8899132SKalle Valo .array_type = QMI_COMMON_TLV_TYPE, 1654d8899132SKalle Valo }, 1655d8899132SKalle Valo }; 1656d8899132SKalle Valo 1657e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_shadow_reg_v3_cfg_s_v01_ei[] = { 1658d8899132SKalle Valo { 1659d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1660d8899132SKalle Valo .elem_len = 1, 1661d8899132SKalle Valo .elem_size = sizeof(u32), 1662d8899132SKalle Valo .array_type = NO_ARRAY, 1663d8899132SKalle Valo .tlv_type = 0, 1664d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_shadow_reg_v3_cfg_s_v01, 1665d8899132SKalle Valo addr), 1666d8899132SKalle Valo }, 1667d8899132SKalle Valo { 1668d8899132SKalle Valo .data_type = QMI_EOTI, 1669d8899132SKalle Valo .array_type = NO_ARRAY, 1670d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1671d8899132SKalle Valo }, 1672d8899132SKalle Valo }; 1673d8899132SKalle Valo 1674e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_wlan_mode_req_msg_v01_ei[] = { 1675d8899132SKalle Valo { 1676d8899132SKalle Valo .data_type = QMI_UNSIGNED_4_BYTE, 1677d8899132SKalle Valo .elem_len = 1, 1678d8899132SKalle Valo .elem_size = sizeof(u32), 1679d8899132SKalle Valo .array_type = NO_ARRAY, 1680d8899132SKalle Valo .tlv_type = 0x01, 1681d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_mode_req_msg_v01, 1682d8899132SKalle Valo mode), 1683d8899132SKalle Valo }, 1684d8899132SKalle Valo { 1685d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1686d8899132SKalle Valo .elem_len = 1, 1687d8899132SKalle Valo .elem_size = sizeof(u8), 1688d8899132SKalle Valo .array_type = NO_ARRAY, 1689d8899132SKalle Valo .tlv_type = 0x10, 1690d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_mode_req_msg_v01, 1691d8899132SKalle Valo hw_debug_valid), 1692d8899132SKalle Valo }, 1693d8899132SKalle Valo { 1694d8899132SKalle Valo .data_type = QMI_UNSIGNED_1_BYTE, 1695d8899132SKalle Valo .elem_len = 1, 1696d8899132SKalle Valo .elem_size = sizeof(u8), 1697d8899132SKalle Valo .array_type = NO_ARRAY, 1698d8899132SKalle Valo .tlv_type = 0x10, 1699d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_mode_req_msg_v01, 1700d8899132SKalle Valo hw_debug), 1701d8899132SKalle Valo }, 1702d8899132SKalle Valo { 1703d8899132SKalle Valo .data_type = QMI_EOTI, 1704d8899132SKalle Valo .array_type = NO_ARRAY, 1705d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1706d8899132SKalle Valo }, 1707d8899132SKalle Valo }; 1708d8899132SKalle Valo 1709e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_wlan_mode_resp_msg_v01_ei[] = { 1710d8899132SKalle Valo { 1711d8899132SKalle Valo .data_type = QMI_STRUCT, 1712d8899132SKalle Valo .elem_len = 1, 1713d8899132SKalle Valo .elem_size = sizeof(struct qmi_response_type_v01), 1714d8899132SKalle Valo .array_type = NO_ARRAY, 1715d8899132SKalle Valo .tlv_type = 0x02, 1716d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_mode_resp_msg_v01, 1717d8899132SKalle Valo resp), 1718d8899132SKalle Valo .ei_array = qmi_response_type_v01_ei, 1719d8899132SKalle Valo }, 1720d8899132SKalle Valo { 1721d8899132SKalle Valo .data_type = QMI_EOTI, 1722d8899132SKalle Valo .array_type = NO_ARRAY, 1723d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1724d8899132SKalle Valo }, 1725d8899132SKalle Valo }; 1726d8899132SKalle Valo 1727e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_wlan_cfg_req_msg_v01_ei[] = { 1728d8899132SKalle Valo { 1729d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1730d8899132SKalle Valo .elem_len = 1, 1731d8899132SKalle Valo .elem_size = sizeof(u8), 1732d8899132SKalle Valo .array_type = NO_ARRAY, 1733d8899132SKalle Valo .tlv_type = 0x10, 1734d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1735d8899132SKalle Valo host_version_valid), 1736d8899132SKalle Valo }, 1737d8899132SKalle Valo { 1738d8899132SKalle Valo .data_type = QMI_STRING, 1739d8899132SKalle Valo .elem_len = QMI_WLANFW_MAX_STR_LEN_V01 + 1, 1740d8899132SKalle Valo .elem_size = sizeof(char), 1741d8899132SKalle Valo .array_type = NO_ARRAY, 1742d8899132SKalle Valo .tlv_type = 0x10, 1743d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1744d8899132SKalle Valo host_version), 1745d8899132SKalle Valo }, 1746d8899132SKalle Valo { 1747d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1748d8899132SKalle Valo .elem_len = 1, 1749d8899132SKalle Valo .elem_size = sizeof(u8), 1750d8899132SKalle Valo .array_type = NO_ARRAY, 1751d8899132SKalle Valo .tlv_type = 0x11, 1752d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1753d8899132SKalle Valo tgt_cfg_valid), 1754d8899132SKalle Valo }, 1755d8899132SKalle Valo { 1756d8899132SKalle Valo .data_type = QMI_DATA_LEN, 1757d8899132SKalle Valo .elem_len = 1, 1758d8899132SKalle Valo .elem_size = sizeof(u8), 1759d8899132SKalle Valo .array_type = NO_ARRAY, 1760d8899132SKalle Valo .tlv_type = 0x11, 1761d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1762d8899132SKalle Valo tgt_cfg_len), 1763d8899132SKalle Valo }, 1764d8899132SKalle Valo { 1765d8899132SKalle Valo .data_type = QMI_STRUCT, 1766d8899132SKalle Valo .elem_len = QMI_WLANFW_MAX_NUM_CE_V01, 1767d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01), 1768d8899132SKalle Valo .array_type = VAR_LEN_ARRAY, 1769d8899132SKalle Valo .tlv_type = 0x11, 1770d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1771d8899132SKalle Valo tgt_cfg), 1772d8899132SKalle Valo .ei_array = qmi_wlanfw_ce_tgt_pipe_cfg_s_v01_ei, 1773d8899132SKalle Valo }, 1774d8899132SKalle Valo { 1775d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1776d8899132SKalle Valo .elem_len = 1, 1777d8899132SKalle Valo .elem_size = sizeof(u8), 1778d8899132SKalle Valo .array_type = NO_ARRAY, 1779d8899132SKalle Valo .tlv_type = 0x12, 1780d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1781d8899132SKalle Valo svc_cfg_valid), 1782d8899132SKalle Valo }, 1783d8899132SKalle Valo { 1784d8899132SKalle Valo .data_type = QMI_DATA_LEN, 1785d8899132SKalle Valo .elem_len = 1, 1786d8899132SKalle Valo .elem_size = sizeof(u8), 1787d8899132SKalle Valo .array_type = NO_ARRAY, 1788d8899132SKalle Valo .tlv_type = 0x12, 1789d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1790d8899132SKalle Valo svc_cfg_len), 1791d8899132SKalle Valo }, 1792d8899132SKalle Valo { 1793d8899132SKalle Valo .data_type = QMI_STRUCT, 1794d8899132SKalle Valo .elem_len = QMI_WLANFW_MAX_NUM_SVC_V01, 1795d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01), 1796d8899132SKalle Valo .array_type = VAR_LEN_ARRAY, 1797d8899132SKalle Valo .tlv_type = 0x12, 1798d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1799d8899132SKalle Valo svc_cfg), 1800d8899132SKalle Valo .ei_array = qmi_wlanfw_ce_svc_pipe_cfg_s_v01_ei, 1801d8899132SKalle Valo }, 1802d8899132SKalle Valo { 1803d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1804d8899132SKalle Valo .elem_len = 1, 1805d8899132SKalle Valo .elem_size = sizeof(u8), 1806d8899132SKalle Valo .array_type = NO_ARRAY, 1807d8899132SKalle Valo .tlv_type = 0x13, 1808d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1809d8899132SKalle Valo shadow_reg_valid), 1810d8899132SKalle Valo }, 1811d8899132SKalle Valo { 1812d8899132SKalle Valo .data_type = QMI_DATA_LEN, 1813d8899132SKalle Valo .elem_len = 1, 1814d8899132SKalle Valo .elem_size = sizeof(u8), 1815d8899132SKalle Valo .array_type = NO_ARRAY, 1816d8899132SKalle Valo .tlv_type = 0x13, 1817d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1818d8899132SKalle Valo shadow_reg_len), 1819d8899132SKalle Valo }, 1820d8899132SKalle Valo { 1821d8899132SKalle Valo .data_type = QMI_STRUCT, 1822d8899132SKalle Valo .elem_len = QMI_WLANFW_MAX_NUM_SHADOW_REG_V01, 1823d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_shadow_reg_cfg_s_v01), 1824d8899132SKalle Valo .array_type = VAR_LEN_ARRAY, 1825d8899132SKalle Valo .tlv_type = 0x13, 1826d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1827d8899132SKalle Valo shadow_reg), 1828d8899132SKalle Valo .ei_array = qmi_wlanfw_shadow_reg_cfg_s_v01_ei, 1829d8899132SKalle Valo }, 1830d8899132SKalle Valo { 1831d8899132SKalle Valo .data_type = QMI_OPT_FLAG, 1832d8899132SKalle Valo .elem_len = 1, 1833d8899132SKalle Valo .elem_size = sizeof(u8), 1834d8899132SKalle Valo .array_type = NO_ARRAY, 1835d8899132SKalle Valo .tlv_type = 0x17, 1836d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1837d8899132SKalle Valo shadow_reg_v3_valid), 1838d8899132SKalle Valo }, 1839d8899132SKalle Valo { 1840d8899132SKalle Valo .data_type = QMI_DATA_LEN, 1841d8899132SKalle Valo .elem_len = 1, 1842d8899132SKalle Valo .elem_size = sizeof(u8), 1843d8899132SKalle Valo .array_type = NO_ARRAY, 1844d8899132SKalle Valo .tlv_type = 0x17, 1845d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1846d8899132SKalle Valo shadow_reg_v3_len), 1847d8899132SKalle Valo }, 1848d8899132SKalle Valo { 1849d8899132SKalle Valo .data_type = QMI_STRUCT, 1850d8899132SKalle Valo .elem_len = QMI_WLANFW_MAX_NUM_SHADOW_REG_V3_V01, 1851d8899132SKalle Valo .elem_size = sizeof(struct qmi_wlanfw_shadow_reg_v3_cfg_s_v01), 1852d8899132SKalle Valo .array_type = VAR_LEN_ARRAY, 1853d8899132SKalle Valo .tlv_type = 0x17, 1854d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01, 1855d8899132SKalle Valo shadow_reg_v3), 1856d8899132SKalle Valo .ei_array = qmi_wlanfw_shadow_reg_v3_cfg_s_v01_ei, 1857d8899132SKalle Valo }, 1858d8899132SKalle Valo { 1859d8899132SKalle Valo .data_type = QMI_EOTI, 1860d8899132SKalle Valo .array_type = NO_ARRAY, 1861d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1862d8899132SKalle Valo }, 1863d8899132SKalle Valo }; 1864d8899132SKalle Valo 1865e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_wlan_cfg_resp_msg_v01_ei[] = { 1866d8899132SKalle Valo { 1867d8899132SKalle Valo .data_type = QMI_STRUCT, 1868d8899132SKalle Valo .elem_len = 1, 1869d8899132SKalle Valo .elem_size = sizeof(struct qmi_response_type_v01), 1870d8899132SKalle Valo .array_type = NO_ARRAY, 1871d8899132SKalle Valo .tlv_type = 0x02, 1872d8899132SKalle Valo .offset = offsetof(struct qmi_wlanfw_wlan_cfg_resp_msg_v01, resp), 1873d8899132SKalle Valo .ei_array = qmi_response_type_v01_ei, 1874d8899132SKalle Valo }, 1875d8899132SKalle Valo { 1876d8899132SKalle Valo .data_type = QMI_EOTI, 1877d8899132SKalle Valo .array_type = NO_ARRAY, 1878d8899132SKalle Valo .tlv_type = QMI_COMMON_TLV_TYPE, 1879d8899132SKalle Valo }, 1880d8899132SKalle Valo }; 1881d8899132SKalle Valo 1882e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_mem_ready_ind_msg_v01_ei[] = { 1883d8899132SKalle Valo { 1884d8899132SKalle Valo .data_type = QMI_EOTI, 1885d8899132SKalle Valo .array_type = NO_ARRAY, 1886d8899132SKalle Valo }, 1887d8899132SKalle Valo }; 1888d8899132SKalle Valo 1889e7ab40b7SJeff Johnson static const struct qmi_elem_info qmi_wlanfw_fw_ready_ind_msg_v01_ei[] = { 1890d8899132SKalle Valo { 1891d8899132SKalle Valo .data_type = QMI_EOTI, 1892d8899132SKalle Valo .array_type = NO_ARRAY, 1893d8899132SKalle Valo }, 1894d8899132SKalle Valo }; 1895d8899132SKalle Valo 1896d8899132SKalle Valo static void ath12k_host_cap_parse_mlo(struct qmi_wlanfw_host_cap_req_msg_v01 *req) 1897d8899132SKalle Valo { 1898d8899132SKalle Valo req->mlo_capable_valid = 1; 1899d8899132SKalle Valo req->mlo_capable = 1; 1900d8899132SKalle Valo req->mlo_chip_id_valid = 1; 1901d8899132SKalle Valo req->mlo_chip_id = 0; 1902d8899132SKalle Valo req->mlo_group_id_valid = 1; 1903d8899132SKalle Valo req->mlo_group_id = 0; 1904d8899132SKalle Valo req->max_mlo_peer_valid = 1; 1905d8899132SKalle Valo /* Max peer number generally won't change for the same device 1906d8899132SKalle Valo * but needs to be synced with host driver. 1907d8899132SKalle Valo */ 1908d8899132SKalle Valo req->max_mlo_peer = 32; 1909d8899132SKalle Valo req->mlo_num_chips_valid = 1; 1910d8899132SKalle Valo req->mlo_num_chips = 1; 1911d8899132SKalle Valo req->mlo_chip_info_valid = 1; 1912d8899132SKalle Valo req->mlo_chip_info[0].chip_id = 0; 1913d8899132SKalle Valo req->mlo_chip_info[0].num_local_links = 2; 1914d8899132SKalle Valo req->mlo_chip_info[0].hw_link_id[0] = 0; 1915d8899132SKalle Valo req->mlo_chip_info[0].hw_link_id[1] = 1; 1916d8899132SKalle Valo req->mlo_chip_info[0].valid_mlo_link_id[0] = 1; 1917d8899132SKalle Valo req->mlo_chip_info[0].valid_mlo_link_id[1] = 1; 1918d8899132SKalle Valo } 1919d8899132SKalle Valo 1920d8899132SKalle Valo static int ath12k_qmi_host_cap_send(struct ath12k_base *ab) 1921d8899132SKalle Valo { 1922d8899132SKalle Valo struct qmi_wlanfw_host_cap_req_msg_v01 req; 1923d8899132SKalle Valo struct qmi_wlanfw_host_cap_resp_msg_v01 resp; 192459cf57abSJeff Johnson struct qmi_txn txn; 1925d8899132SKalle Valo int ret = 0; 1926d8899132SKalle Valo 1927d8899132SKalle Valo memset(&req, 0, sizeof(req)); 1928d8899132SKalle Valo memset(&resp, 0, sizeof(resp)); 1929d8899132SKalle Valo 1930d8899132SKalle Valo req.num_clients_valid = 1; 1931d8899132SKalle Valo req.num_clients = 1; 1932d8899132SKalle Valo req.mem_cfg_mode = ab->qmi.target_mem_mode; 1933d8899132SKalle Valo req.mem_cfg_mode_valid = 1; 1934d8899132SKalle Valo req.bdf_support_valid = 1; 1935d8899132SKalle Valo req.bdf_support = 1; 1936d8899132SKalle Valo 1937d8899132SKalle Valo req.m3_support_valid = 1; 1938d8899132SKalle Valo req.m3_support = 1; 1939d8899132SKalle Valo req.m3_cache_support_valid = 1; 1940d8899132SKalle Valo req.m3_cache_support = 1; 1941d8899132SKalle Valo 1942d8899132SKalle Valo req.cal_done_valid = 1; 1943d8899132SKalle Valo req.cal_done = ab->qmi.cal_done; 1944d8899132SKalle Valo 19459981a3acSCarl Huang if (ab->hw_params->qmi_cnss_feature_bitmap) { 1946d8899132SKalle Valo req.feature_list_valid = 1; 19479981a3acSCarl Huang req.feature_list = ab->hw_params->qmi_cnss_feature_bitmap; 19489981a3acSCarl Huang } 1949d8899132SKalle Valo 1950d8899132SKalle Valo /* BRINGUP: here we are piggybacking a lot of stuff using 1951d8899132SKalle Valo * internal_sleep_clock, should it be split? 1952d8899132SKalle Valo */ 1953d8899132SKalle Valo if (ab->hw_params->internal_sleep_clock) { 1954d8899132SKalle Valo req.nm_modem_valid = 1; 1955d8899132SKalle Valo 1956d8899132SKalle Valo /* Notify firmware that this is non-qualcomm platform. */ 1957d8899132SKalle Valo req.nm_modem |= HOST_CSTATE_BIT; 1958d8899132SKalle Valo 1959d8899132SKalle Valo /* Notify firmware about the sleep clock selection, 1960d8899132SKalle Valo * nm_modem_bit[1] is used for this purpose. Host driver on 1961d8899132SKalle Valo * non-qualcomm platforms should select internal sleep 1962d8899132SKalle Valo * clock. 1963d8899132SKalle Valo */ 1964d8899132SKalle Valo req.nm_modem |= SLEEP_CLOCK_SELECT_INTERNAL_BIT; 1965d8899132SKalle Valo req.nm_modem |= PLATFORM_CAP_PCIE_GLOBAL_RESET; 1966d8899132SKalle Valo 1967d8899132SKalle Valo ath12k_host_cap_parse_mlo(&req); 1968d8899132SKalle Valo } 1969d8899132SKalle Valo 1970d8899132SKalle Valo ret = qmi_txn_init(&ab->qmi.handle, &txn, 1971d8899132SKalle Valo qmi_wlanfw_host_cap_resp_msg_v01_ei, &resp); 1972d8899132SKalle Valo if (ret < 0) 1973d8899132SKalle Valo goto out; 1974d8899132SKalle Valo 1975d8899132SKalle Valo ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, 1976d8899132SKalle Valo QMI_WLANFW_HOST_CAP_REQ_V01, 1977d8899132SKalle Valo QMI_WLANFW_HOST_CAP_REQ_MSG_V01_MAX_LEN, 1978d8899132SKalle Valo qmi_wlanfw_host_cap_req_msg_v01_ei, &req); 1979d8899132SKalle Valo if (ret < 0) { 1980*2e82b5f0SJeff Johnson qmi_txn_cancel(&txn); 1981d8899132SKalle Valo ath12k_warn(ab, "Failed to send host capability request,err = %d\n", ret); 1982d8899132SKalle Valo goto out; 1983d8899132SKalle Valo } 1984d8899132SKalle Valo 1985d8899132SKalle Valo ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS)); 1986d8899132SKalle Valo if (ret < 0) 1987d8899132SKalle Valo goto out; 1988d8899132SKalle Valo 1989d8899132SKalle Valo if (resp.resp.result != QMI_RESULT_SUCCESS_V01) { 1990d8899132SKalle Valo ath12k_warn(ab, "Host capability request failed, result: %d, err: %d\n", 1991d8899132SKalle Valo resp.resp.result, resp.resp.error); 1992d8899132SKalle Valo ret = -EINVAL; 1993d8899132SKalle Valo goto out; 1994d8899132SKalle Valo } 1995d8899132SKalle Valo 1996d8899132SKalle Valo out: 1997d8899132SKalle Valo return ret; 1998d8899132SKalle Valo } 1999d8899132SKalle Valo 2000d8899132SKalle Valo static int ath12k_qmi_fw_ind_register_send(struct ath12k_base *ab) 2001d8899132SKalle Valo { 2002d8899132SKalle Valo struct qmi_wlanfw_ind_register_req_msg_v01 *req; 2003d8899132SKalle Valo struct qmi_wlanfw_ind_register_resp_msg_v01 *resp; 2004d8899132SKalle Valo struct qmi_handle *handle = &ab->qmi.handle; 2005d8899132SKalle Valo struct qmi_txn txn; 2006d8899132SKalle Valo int ret; 2007d8899132SKalle Valo 2008d8899132SKalle Valo req = kzalloc(sizeof(*req), GFP_KERNEL); 2009d8899132SKalle Valo if (!req) 2010d8899132SKalle Valo return -ENOMEM; 2011d8899132SKalle Valo 2012d8899132SKalle Valo resp = kzalloc(sizeof(*resp), GFP_KERNEL); 2013d8899132SKalle Valo if (!resp) { 2014d8899132SKalle Valo ret = -ENOMEM; 2015d8899132SKalle Valo goto resp_out; 2016d8899132SKalle Valo } 2017d8899132SKalle Valo 2018d8899132SKalle Valo req->client_id_valid = 1; 2019d8899132SKalle Valo req->client_id = QMI_WLANFW_CLIENT_ID; 2020d8899132SKalle Valo req->fw_ready_enable_valid = 1; 2021d8899132SKalle Valo req->fw_ready_enable = 1; 2022d8899132SKalle Valo req->request_mem_enable_valid = 1; 2023d8899132SKalle Valo req->request_mem_enable = 1; 2024d8899132SKalle Valo req->fw_mem_ready_enable_valid = 1; 2025d8899132SKalle Valo req->fw_mem_ready_enable = 1; 2026d8899132SKalle Valo req->cal_done_enable_valid = 1; 2027d8899132SKalle Valo req->cal_done_enable = 1; 2028d8899132SKalle Valo req->fw_init_done_enable_valid = 1; 2029d8899132SKalle Valo req->fw_init_done_enable = 1; 2030d8899132SKalle Valo 2031d8899132SKalle Valo req->pin_connect_result_enable_valid = 0; 2032d8899132SKalle Valo req->pin_connect_result_enable = 0; 2033d8899132SKalle Valo 2034d8899132SKalle Valo ret = qmi_txn_init(handle, &txn, 2035d8899132SKalle Valo qmi_wlanfw_ind_register_resp_msg_v01_ei, resp); 2036d8899132SKalle Valo if (ret < 0) 2037d8899132SKalle Valo goto out; 2038d8899132SKalle Valo 2039d8899132SKalle Valo ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, 2040d8899132SKalle Valo QMI_WLANFW_IND_REGISTER_REQ_V01, 2041d8899132SKalle Valo QMI_WLANFW_IND_REGISTER_REQ_MSG_V01_MAX_LEN, 2042d8899132SKalle Valo qmi_wlanfw_ind_register_req_msg_v01_ei, req); 2043d8899132SKalle Valo if (ret < 0) { 2044*2e82b5f0SJeff Johnson qmi_txn_cancel(&txn); 2045d8899132SKalle Valo ath12k_warn(ab, "Failed to send indication register request, err = %d\n", 2046d8899132SKalle Valo ret); 2047d8899132SKalle Valo goto out; 2048d8899132SKalle Valo } 2049d8899132SKalle Valo 2050d8899132SKalle Valo ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS)); 2051d8899132SKalle Valo if (ret < 0) { 2052d8899132SKalle Valo ath12k_warn(ab, "failed to register fw indication %d\n", ret); 2053d8899132SKalle Valo goto out; 2054d8899132SKalle Valo } 2055d8899132SKalle Valo 2056d8899132SKalle Valo if (resp->resp.result != QMI_RESULT_SUCCESS_V01) { 2057d8899132SKalle Valo ath12k_warn(ab, "FW Ind register request failed, result: %d, err: %d\n", 2058d8899132SKalle Valo resp->resp.result, resp->resp.error); 2059d8899132SKalle Valo ret = -EINVAL; 2060d8899132SKalle Valo goto out; 2061d8899132SKalle Valo } 2062d8899132SKalle Valo 2063d8899132SKalle Valo out: 2064d8899132SKalle Valo kfree(resp); 2065d8899132SKalle Valo resp_out: 2066d8899132SKalle Valo kfree(req); 2067d8899132SKalle Valo return ret; 2068d8899132SKalle Valo } 2069d8899132SKalle Valo 2070d8899132SKalle Valo static int ath12k_qmi_respond_fw_mem_request(struct ath12k_base *ab) 2071d8899132SKalle Valo { 2072d8899132SKalle Valo struct qmi_wlanfw_respond_mem_req_msg_v01 *req; 2073d8899132SKalle Valo struct qmi_wlanfw_respond_mem_resp_msg_v01 resp; 207459cf57abSJeff Johnson struct qmi_txn txn; 2075d8899132SKalle Valo int ret = 0, i; 2076d8899132SKalle Valo bool delayed; 2077d8899132SKalle Valo 2078d8899132SKalle Valo req = kzalloc(sizeof(*req), GFP_KERNEL); 2079d8899132SKalle Valo if (!req) 2080d8899132SKalle Valo return -ENOMEM; 2081d8899132SKalle Valo 2082d8899132SKalle Valo memset(&resp, 0, sizeof(resp)); 2083d8899132SKalle Valo 2084d8899132SKalle Valo /* Some targets by default request a block of big contiguous 2085d8899132SKalle Valo * DMA memory, it's hard to allocate from kernel. So host returns 2086d8899132SKalle Valo * failure to firmware and firmware then request multiple blocks of 2087d8899132SKalle Valo * small chunk size memory. 2088d8899132SKalle Valo */ 2089d8899132SKalle Valo if (ab->qmi.target_mem_delayed) { 2090d8899132SKalle Valo delayed = true; 2091d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi delays mem_request %d\n", 2092d8899132SKalle Valo ab->qmi.mem_seg_count); 2093d8899132SKalle Valo memset(req, 0, sizeof(*req)); 2094d8899132SKalle Valo } else { 2095d8899132SKalle Valo delayed = false; 2096d8899132SKalle Valo req->mem_seg_len = ab->qmi.mem_seg_count; 2097d8899132SKalle Valo for (i = 0; i < req->mem_seg_len ; i++) { 2098d8899132SKalle Valo req->mem_seg[i].addr = ab->qmi.target_mem[i].paddr; 2099d8899132SKalle Valo req->mem_seg[i].size = ab->qmi.target_mem[i].size; 2100d8899132SKalle Valo req->mem_seg[i].type = ab->qmi.target_mem[i].type; 2101d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, 2102d8899132SKalle Valo "qmi req mem_seg[%d] %pad %u %u\n", i, 2103d8899132SKalle Valo &ab->qmi.target_mem[i].paddr, 2104d8899132SKalle Valo ab->qmi.target_mem[i].size, 2105d8899132SKalle Valo ab->qmi.target_mem[i].type); 2106d8899132SKalle Valo } 2107d8899132SKalle Valo } 2108d8899132SKalle Valo 2109d8899132SKalle Valo ret = qmi_txn_init(&ab->qmi.handle, &txn, 2110d8899132SKalle Valo qmi_wlanfw_respond_mem_resp_msg_v01_ei, &resp); 2111d8899132SKalle Valo if (ret < 0) 2112d8899132SKalle Valo goto out; 2113d8899132SKalle Valo 2114d8899132SKalle Valo ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, 2115d8899132SKalle Valo QMI_WLANFW_RESPOND_MEM_REQ_V01, 2116d8899132SKalle Valo QMI_WLANFW_RESPOND_MEM_REQ_MSG_V01_MAX_LEN, 2117d8899132SKalle Valo qmi_wlanfw_respond_mem_req_msg_v01_ei, req); 2118d8899132SKalle Valo if (ret < 0) { 2119*2e82b5f0SJeff Johnson qmi_txn_cancel(&txn); 2120d8899132SKalle Valo ath12k_warn(ab, "qmi failed to respond memory request, err = %d\n", 2121d8899132SKalle Valo ret); 2122d8899132SKalle Valo goto out; 2123d8899132SKalle Valo } 2124d8899132SKalle Valo 2125d8899132SKalle Valo ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS)); 2126d8899132SKalle Valo if (ret < 0) { 2127d8899132SKalle Valo ath12k_warn(ab, "qmi failed memory request, err = %d\n", ret); 2128d8899132SKalle Valo goto out; 2129d8899132SKalle Valo } 2130d8899132SKalle Valo 2131d8899132SKalle Valo if (resp.resp.result != QMI_RESULT_SUCCESS_V01) { 2132d8899132SKalle Valo /* the error response is expected when 2133d8899132SKalle Valo * target_mem_delayed is true. 2134d8899132SKalle Valo */ 2135d8899132SKalle Valo if (delayed && resp.resp.error == 0) 2136d8899132SKalle Valo goto out; 2137d8899132SKalle Valo 2138d8899132SKalle Valo ath12k_warn(ab, "Respond mem req failed, result: %d, err: %d\n", 2139d8899132SKalle Valo resp.resp.result, resp.resp.error); 2140d8899132SKalle Valo ret = -EINVAL; 2141d8899132SKalle Valo goto out; 2142d8899132SKalle Valo } 2143d8899132SKalle Valo out: 2144d8899132SKalle Valo kfree(req); 2145d8899132SKalle Valo return ret; 2146d8899132SKalle Valo } 2147d8899132SKalle Valo 2148d8899132SKalle Valo static void ath12k_qmi_free_target_mem_chunk(struct ath12k_base *ab) 2149d8899132SKalle Valo { 2150d8899132SKalle Valo int i; 2151d8899132SKalle Valo 2152d8899132SKalle Valo for (i = 0; i < ab->qmi.mem_seg_count; i++) { 2153d8899132SKalle Valo if (!ab->qmi.target_mem[i].v.addr) 2154d8899132SKalle Valo continue; 2155d8899132SKalle Valo dma_free_coherent(ab->dev, 2156d8899132SKalle Valo ab->qmi.target_mem[i].size, 2157d8899132SKalle Valo ab->qmi.target_mem[i].v.addr, 2158d8899132SKalle Valo ab->qmi.target_mem[i].paddr); 2159d8899132SKalle Valo ab->qmi.target_mem[i].v.addr = NULL; 2160d8899132SKalle Valo } 2161d8899132SKalle Valo } 2162d8899132SKalle Valo 2163d8899132SKalle Valo static int ath12k_qmi_alloc_target_mem_chunk(struct ath12k_base *ab) 2164d8899132SKalle Valo { 2165d8899132SKalle Valo int i; 2166d8899132SKalle Valo struct target_mem_chunk *chunk; 2167d8899132SKalle Valo 2168d8899132SKalle Valo ab->qmi.target_mem_delayed = false; 2169d8899132SKalle Valo 2170d8899132SKalle Valo for (i = 0; i < ab->qmi.mem_seg_count; i++) { 2171d8899132SKalle Valo chunk = &ab->qmi.target_mem[i]; 2172d8899132SKalle Valo 2173d8899132SKalle Valo /* Allocate memory for the region and the functionality supported 2174d8899132SKalle Valo * on the host. For the non-supported memory region, host does not 2175d8899132SKalle Valo * allocate memory, assigns NULL and FW will handle this without crashing. 2176d8899132SKalle Valo */ 2177d8899132SKalle Valo switch (chunk->type) { 2178d8899132SKalle Valo case HOST_DDR_REGION_TYPE: 2179d8899132SKalle Valo case M3_DUMP_REGION_TYPE: 2180d8899132SKalle Valo case PAGEABLE_MEM_REGION_TYPE: 2181d8899132SKalle Valo case CALDB_MEM_REGION_TYPE: 2182d8899132SKalle Valo chunk->v.addr = dma_alloc_coherent(ab->dev, 2183d8899132SKalle Valo chunk->size, 2184d8899132SKalle Valo &chunk->paddr, 2185d8899132SKalle Valo GFP_KERNEL | __GFP_NOWARN); 2186d8899132SKalle Valo if (!chunk->v.addr) { 2187d8899132SKalle Valo if (chunk->size > ATH12K_QMI_MAX_CHUNK_SIZE) { 2188d8899132SKalle Valo ab->qmi.target_mem_delayed = true; 2189d8899132SKalle Valo ath12k_warn(ab, 2190d8899132SKalle Valo "qmi dma allocation failed (%d B type %u), will try later with small size\n", 2191d8899132SKalle Valo chunk->size, 2192d8899132SKalle Valo chunk->type); 2193d8899132SKalle Valo ath12k_qmi_free_target_mem_chunk(ab); 2194d8899132SKalle Valo return 0; 2195d8899132SKalle Valo } 2196d8899132SKalle Valo ath12k_warn(ab, "memory allocation failure for %u size: %d\n", 2197d8899132SKalle Valo chunk->type, chunk->size); 2198d8899132SKalle Valo return -ENOMEM; 2199d8899132SKalle Valo } 2200d8899132SKalle Valo break; 2201d8899132SKalle Valo default: 2202d8899132SKalle Valo ath12k_warn(ab, "memory type %u not supported\n", 2203d8899132SKalle Valo chunk->type); 2204d8899132SKalle Valo chunk->paddr = 0; 2205d8899132SKalle Valo chunk->v.addr = NULL; 2206d8899132SKalle Valo break; 2207d8899132SKalle Valo } 2208d8899132SKalle Valo } 2209d8899132SKalle Valo return 0; 2210d8899132SKalle Valo } 2211d8899132SKalle Valo 2212d8899132SKalle Valo static int ath12k_qmi_request_target_cap(struct ath12k_base *ab) 2213d8899132SKalle Valo { 2214d8899132SKalle Valo struct qmi_wlanfw_cap_req_msg_v01 req; 2215d8899132SKalle Valo struct qmi_wlanfw_cap_resp_msg_v01 resp; 221659cf57abSJeff Johnson struct qmi_txn txn; 2217d8899132SKalle Valo unsigned int board_id = ATH12K_BOARD_ID_DEFAULT; 2218d8899132SKalle Valo int ret = 0; 22197d9832e3SWen Gong int r; 2220d8899132SKalle Valo int i; 2221d8899132SKalle Valo 2222d8899132SKalle Valo memset(&req, 0, sizeof(req)); 2223d8899132SKalle Valo memset(&resp, 0, sizeof(resp)); 2224d8899132SKalle Valo 2225d8899132SKalle Valo ret = qmi_txn_init(&ab->qmi.handle, &txn, 2226d8899132SKalle Valo qmi_wlanfw_cap_resp_msg_v01_ei, &resp); 2227d8899132SKalle Valo if (ret < 0) 2228d8899132SKalle Valo goto out; 2229d8899132SKalle Valo 2230d8899132SKalle Valo ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, 2231d8899132SKalle Valo QMI_WLANFW_CAP_REQ_V01, 2232d8899132SKalle Valo QMI_WLANFW_CAP_REQ_MSG_V01_MAX_LEN, 2233d8899132SKalle Valo qmi_wlanfw_cap_req_msg_v01_ei, &req); 2234d8899132SKalle Valo if (ret < 0) { 2235*2e82b5f0SJeff Johnson qmi_txn_cancel(&txn); 2236d8899132SKalle Valo ath12k_warn(ab, "qmi failed to send target cap request, err = %d\n", 2237d8899132SKalle Valo ret); 2238d8899132SKalle Valo goto out; 2239d8899132SKalle Valo } 2240d8899132SKalle Valo 2241d8899132SKalle Valo ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS)); 2242d8899132SKalle Valo if (ret < 0) { 2243d8899132SKalle Valo ath12k_warn(ab, "qmi failed target cap request %d\n", ret); 2244d8899132SKalle Valo goto out; 2245d8899132SKalle Valo } 2246d8899132SKalle Valo 2247d8899132SKalle Valo if (resp.resp.result != QMI_RESULT_SUCCESS_V01) { 2248d8899132SKalle Valo ath12k_warn(ab, "qmi targetcap req failed, result: %d, err: %d\n", 2249d8899132SKalle Valo resp.resp.result, resp.resp.error); 2250d8899132SKalle Valo ret = -EINVAL; 2251d8899132SKalle Valo goto out; 2252d8899132SKalle Valo } 2253d8899132SKalle Valo 2254d8899132SKalle Valo if (resp.chip_info_valid) { 2255d8899132SKalle Valo ab->qmi.target.chip_id = resp.chip_info.chip_id; 2256d8899132SKalle Valo ab->qmi.target.chip_family = resp.chip_info.chip_family; 2257d8899132SKalle Valo } 2258d8899132SKalle Valo 2259d8899132SKalle Valo if (resp.board_info_valid) 2260d8899132SKalle Valo ab->qmi.target.board_id = resp.board_info.board_id; 2261d8899132SKalle Valo else 2262d8899132SKalle Valo ab->qmi.target.board_id = board_id; 2263d8899132SKalle Valo 2264d8899132SKalle Valo if (resp.soc_info_valid) 2265d8899132SKalle Valo ab->qmi.target.soc_id = resp.soc_info.soc_id; 2266d8899132SKalle Valo 2267d8899132SKalle Valo if (resp.fw_version_info_valid) { 2268d8899132SKalle Valo ab->qmi.target.fw_version = resp.fw_version_info.fw_version; 2269d8899132SKalle Valo strscpy(ab->qmi.target.fw_build_timestamp, 2270d8899132SKalle Valo resp.fw_version_info.fw_build_timestamp, 2271d8899132SKalle Valo sizeof(ab->qmi.target.fw_build_timestamp)); 2272d8899132SKalle Valo } 2273d8899132SKalle Valo 2274d8899132SKalle Valo if (resp.fw_build_id_valid) 2275d8899132SKalle Valo strscpy(ab->qmi.target.fw_build_id, resp.fw_build_id, 2276d8899132SKalle Valo sizeof(ab->qmi.target.fw_build_id)); 2277d8899132SKalle Valo 2278d8899132SKalle Valo if (resp.dev_mem_info_valid) { 2279d8899132SKalle Valo for (i = 0; i < ATH12K_QMI_WLFW_MAX_DEV_MEM_NUM_V01; i++) { 2280d8899132SKalle Valo ab->qmi.dev_mem[i].start = 2281d8899132SKalle Valo resp.dev_mem[i].start; 2282d8899132SKalle Valo ab->qmi.dev_mem[i].size = 2283d8899132SKalle Valo resp.dev_mem[i].size; 2284d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, 2285d8899132SKalle Valo "devmem [%d] start ox%llx size %llu\n", i, 2286d8899132SKalle Valo ab->qmi.dev_mem[i].start, 2287d8899132SKalle Valo ab->qmi.dev_mem[i].size); 2288d8899132SKalle Valo } 2289d8899132SKalle Valo } 2290d8899132SKalle Valo 2291d8899132SKalle Valo if (resp.eeprom_caldata_read_timeout_valid) { 2292d8899132SKalle Valo ab->qmi.target.eeprom_caldata = resp.eeprom_caldata_read_timeout; 2293d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi cal data supported from eeprom\n"); 2294d8899132SKalle Valo } 2295d8899132SKalle Valo 2296d8899132SKalle Valo ath12k_info(ab, "chip_id 0x%x chip_family 0x%x board_id 0x%x soc_id 0x%x\n", 2297d8899132SKalle Valo ab->qmi.target.chip_id, ab->qmi.target.chip_family, 2298d8899132SKalle Valo ab->qmi.target.board_id, ab->qmi.target.soc_id); 2299d8899132SKalle Valo 2300d8899132SKalle Valo ath12k_info(ab, "fw_version 0x%x fw_build_timestamp %s fw_build_id %s", 2301d8899132SKalle Valo ab->qmi.target.fw_version, 2302d8899132SKalle Valo ab->qmi.target.fw_build_timestamp, 2303d8899132SKalle Valo ab->qmi.target.fw_build_id); 2304d8899132SKalle Valo 23057d9832e3SWen Gong r = ath12k_core_check_smbios(ab); 23067d9832e3SWen Gong if (r) 23077d9832e3SWen Gong ath12k_dbg(ab, ATH12K_DBG_QMI, "SMBIOS bdf variant name not set.\n"); 23087d9832e3SWen Gong 2309d8899132SKalle Valo out: 2310d8899132SKalle Valo return ret; 2311d8899132SKalle Valo } 2312d8899132SKalle Valo 2313d8899132SKalle Valo static int ath12k_qmi_load_file_target_mem(struct ath12k_base *ab, 2314d8899132SKalle Valo const u8 *data, u32 len, u8 type) 2315d8899132SKalle Valo { 2316d8899132SKalle Valo struct qmi_wlanfw_bdf_download_req_msg_v01 *req; 2317d8899132SKalle Valo struct qmi_wlanfw_bdf_download_resp_msg_v01 resp; 231859cf57abSJeff Johnson struct qmi_txn txn; 2319d8899132SKalle Valo const u8 *temp = data; 2320d8899132SKalle Valo int ret; 2321d8899132SKalle Valo u32 remaining = len; 2322d8899132SKalle Valo 2323d8899132SKalle Valo req = kzalloc(sizeof(*req), GFP_KERNEL); 2324d8899132SKalle Valo if (!req) 2325d8899132SKalle Valo return -ENOMEM; 2326d8899132SKalle Valo memset(&resp, 0, sizeof(resp)); 2327d8899132SKalle Valo 2328d8899132SKalle Valo while (remaining) { 2329d8899132SKalle Valo req->valid = 1; 2330d8899132SKalle Valo req->file_id_valid = 1; 2331d8899132SKalle Valo req->file_id = ab->qmi.target.board_id; 2332d8899132SKalle Valo req->total_size_valid = 1; 2333d8899132SKalle Valo req->total_size = remaining; 2334d8899132SKalle Valo req->seg_id_valid = 1; 2335d8899132SKalle Valo req->data_valid = 1; 2336d8899132SKalle Valo req->bdf_type = type; 2337d8899132SKalle Valo req->bdf_type_valid = 1; 2338d8899132SKalle Valo req->end_valid = 1; 2339d8899132SKalle Valo req->end = 0; 2340d8899132SKalle Valo 2341d8899132SKalle Valo if (remaining > QMI_WLANFW_MAX_DATA_SIZE_V01) { 2342d8899132SKalle Valo req->data_len = QMI_WLANFW_MAX_DATA_SIZE_V01; 2343d8899132SKalle Valo } else { 2344d8899132SKalle Valo req->data_len = remaining; 2345d8899132SKalle Valo req->end = 1; 2346d8899132SKalle Valo } 2347d8899132SKalle Valo 2348d8899132SKalle Valo if (type == ATH12K_QMI_FILE_TYPE_EEPROM) { 2349d8899132SKalle Valo req->data_valid = 0; 2350d8899132SKalle Valo req->end = 1; 2351d8899132SKalle Valo req->data_len = ATH12K_QMI_MAX_BDF_FILE_NAME_SIZE; 2352d8899132SKalle Valo } else { 2353d8899132SKalle Valo memcpy(req->data, temp, req->data_len); 2354d8899132SKalle Valo } 2355d8899132SKalle Valo 2356d8899132SKalle Valo ret = qmi_txn_init(&ab->qmi.handle, &txn, 2357d8899132SKalle Valo qmi_wlanfw_bdf_download_resp_msg_v01_ei, 2358d8899132SKalle Valo &resp); 2359d8899132SKalle Valo if (ret < 0) 2360d8899132SKalle Valo goto out; 2361d8899132SKalle Valo 2362d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi bdf download req fixed addr type %d\n", 2363d8899132SKalle Valo type); 2364d8899132SKalle Valo 2365d8899132SKalle Valo ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, 2366d8899132SKalle Valo QMI_WLANFW_BDF_DOWNLOAD_REQ_V01, 2367d8899132SKalle Valo QMI_WLANFW_BDF_DOWNLOAD_REQ_MSG_V01_MAX_LEN, 2368d8899132SKalle Valo qmi_wlanfw_bdf_download_req_msg_v01_ei, req); 2369d8899132SKalle Valo if (ret < 0) { 2370d8899132SKalle Valo qmi_txn_cancel(&txn); 2371d8899132SKalle Valo goto out; 2372d8899132SKalle Valo } 2373d8899132SKalle Valo 2374d8899132SKalle Valo ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS)); 2375d8899132SKalle Valo if (ret < 0) 2376d8899132SKalle Valo goto out; 2377d8899132SKalle Valo 2378d8899132SKalle Valo if (resp.resp.result != QMI_RESULT_SUCCESS_V01) { 2379d8899132SKalle Valo ath12k_warn(ab, "qmi BDF download failed, result: %d, err: %d\n", 2380d8899132SKalle Valo resp.resp.result, resp.resp.error); 2381d8899132SKalle Valo ret = -EINVAL; 2382d8899132SKalle Valo goto out; 2383d8899132SKalle Valo } 2384d8899132SKalle Valo 2385801fc159SDinesh Karthikeyan if (type == ATH12K_QMI_FILE_TYPE_EEPROM) { 2386801fc159SDinesh Karthikeyan remaining = 0; 2387801fc159SDinesh Karthikeyan } else { 2388d8899132SKalle Valo remaining -= req->data_len; 2389d8899132SKalle Valo temp += req->data_len; 2390d8899132SKalle Valo req->seg_id++; 2391d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, 2392d8899132SKalle Valo "qmi bdf download request remaining %i\n", 2393d8899132SKalle Valo remaining); 2394d8899132SKalle Valo } 2395801fc159SDinesh Karthikeyan } 2396d8899132SKalle Valo 2397d8899132SKalle Valo out: 2398d8899132SKalle Valo kfree(req); 2399d8899132SKalle Valo return ret; 2400d8899132SKalle Valo } 2401d8899132SKalle Valo 2402d8899132SKalle Valo static int ath12k_qmi_load_bdf_qmi(struct ath12k_base *ab, 2403d8899132SKalle Valo enum ath12k_qmi_bdf_type type) 2404d8899132SKalle Valo { 2405d8899132SKalle Valo struct device *dev = ab->dev; 2406d8899132SKalle Valo char filename[ATH12K_QMI_MAX_BDF_FILE_NAME_SIZE]; 2407d8899132SKalle Valo const struct firmware *fw_entry; 2408d8899132SKalle Valo struct ath12k_board_data bd; 2409d8899132SKalle Valo u32 fw_size, file_type; 2410d8899132SKalle Valo int ret = 0; 2411d8899132SKalle Valo const u8 *tmp; 2412d8899132SKalle Valo 2413d8899132SKalle Valo memset(&bd, 0, sizeof(bd)); 2414d8899132SKalle Valo 2415d8899132SKalle Valo switch (type) { 2416d8899132SKalle Valo case ATH12K_QMI_BDF_TYPE_ELF: 2417d8899132SKalle Valo ret = ath12k_core_fetch_bdf(ab, &bd); 2418d8899132SKalle Valo if (ret) { 2419d8899132SKalle Valo ath12k_warn(ab, "qmi failed to load bdf:\n"); 2420d8899132SKalle Valo goto out; 2421d8899132SKalle Valo } 2422d8899132SKalle Valo 2423d8899132SKalle Valo if (bd.len >= SELFMAG && memcmp(bd.data, ELFMAG, SELFMAG) == 0) 2424d8899132SKalle Valo type = ATH12K_QMI_BDF_TYPE_ELF; 2425d8899132SKalle Valo else 2426d8899132SKalle Valo type = ATH12K_QMI_BDF_TYPE_BIN; 2427d8899132SKalle Valo 2428d8899132SKalle Valo break; 2429d8899132SKalle Valo case ATH12K_QMI_BDF_TYPE_REGDB: 243051120745SWen Gong ret = ath12k_core_fetch_regdb(ab, &bd); 2431d8899132SKalle Valo if (ret) { 2432d8899132SKalle Valo ath12k_warn(ab, "qmi failed to load regdb bin:\n"); 2433d8899132SKalle Valo goto out; 2434d8899132SKalle Valo } 2435d8899132SKalle Valo break; 243642982259SDinesh Karthikeyan case ATH12K_QMI_BDF_TYPE_CALIBRATION: 2437d8899132SKalle Valo 2438d8899132SKalle Valo if (ab->qmi.target.eeprom_caldata) { 2439801fc159SDinesh Karthikeyan file_type = ATH12K_QMI_FILE_TYPE_EEPROM; 2440d8899132SKalle Valo tmp = filename; 2441d8899132SKalle Valo fw_size = ATH12K_QMI_MAX_BDF_FILE_NAME_SIZE; 2442d8899132SKalle Valo } else { 2443d8899132SKalle Valo file_type = ATH12K_QMI_FILE_TYPE_CALDATA; 2444d8899132SKalle Valo 2445d8899132SKalle Valo /* cal-<bus>-<id>.bin */ 2446d8899132SKalle Valo snprintf(filename, sizeof(filename), "cal-%s-%s.bin", 2447d8899132SKalle Valo ath12k_bus_str(ab->hif.bus), dev_name(dev)); 2448d8899132SKalle Valo fw_entry = ath12k_core_firmware_request(ab, filename); 2449d8899132SKalle Valo if (!IS_ERR(fw_entry)) 2450d8899132SKalle Valo goto success; 2451d8899132SKalle Valo 245242982259SDinesh Karthikeyan fw_entry = ath12k_core_firmware_request(ab, 245342982259SDinesh Karthikeyan ATH12K_DEFAULT_CAL_FILE); 2454d8899132SKalle Valo if (IS_ERR(fw_entry)) { 2455d8899132SKalle Valo ret = PTR_ERR(fw_entry); 2456d8899132SKalle Valo ath12k_warn(ab, 2457d8899132SKalle Valo "qmi failed to load CAL data file:%s\n", 2458d8899132SKalle Valo filename); 2459d8899132SKalle Valo goto out; 2460d8899132SKalle Valo } 2461d8899132SKalle Valo 2462d8899132SKalle Valo success: 246342982259SDinesh Karthikeyan fw_size = min_t(u32, ab->hw_params->fw.board_size, 246442982259SDinesh Karthikeyan fw_entry->size); 2465d8899132SKalle Valo tmp = fw_entry->data; 2466d8899132SKalle Valo } 2467d8899132SKalle Valo ret = ath12k_qmi_load_file_target_mem(ab, tmp, fw_size, file_type); 2468d8899132SKalle Valo if (ret < 0) { 2469d8899132SKalle Valo ath12k_warn(ab, "qmi failed to load caldata\n"); 2470d8899132SKalle Valo goto out_qmi_cal; 2471d8899132SKalle Valo } 2472d8899132SKalle Valo 2473d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi caldata downloaded: type: %u\n", 2474d8899132SKalle Valo file_type); 2475d8899132SKalle Valo 2476d8899132SKalle Valo out_qmi_cal: 2477d8899132SKalle Valo if (!ab->qmi.target.eeprom_caldata) 2478d8899132SKalle Valo release_firmware(fw_entry); 247942982259SDinesh Karthikeyan return ret; 248042982259SDinesh Karthikeyan default: 248142982259SDinesh Karthikeyan ath12k_warn(ab, "unknown file type for load %d", type); 248242982259SDinesh Karthikeyan goto out; 248342982259SDinesh Karthikeyan } 248442982259SDinesh Karthikeyan 248542982259SDinesh Karthikeyan ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi bdf_type %d\n", type); 248642982259SDinesh Karthikeyan 248742982259SDinesh Karthikeyan fw_size = min_t(u32, ab->hw_params->fw.board_size, bd.len); 248842982259SDinesh Karthikeyan 248942982259SDinesh Karthikeyan ret = ath12k_qmi_load_file_target_mem(ab, bd.data, fw_size, type); 249042982259SDinesh Karthikeyan if (ret < 0) 249142982259SDinesh Karthikeyan ath12k_warn(ab, "qmi failed to load bdf file\n"); 249242982259SDinesh Karthikeyan 2493d8899132SKalle Valo out: 2494d8899132SKalle Valo ath12k_core_free_bdf(ab, &bd); 2495d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi BDF download sequence completed\n"); 2496d8899132SKalle Valo 2497d8899132SKalle Valo return ret; 2498d8899132SKalle Valo } 2499d8899132SKalle Valo 2500d8899132SKalle Valo static int ath12k_qmi_m3_load(struct ath12k_base *ab) 2501d8899132SKalle Valo { 2502d8899132SKalle Valo struct m3_mem_region *m3_mem = &ab->qmi.m3_mem; 2503d8899132SKalle Valo const struct firmware *fw; 2504d8899132SKalle Valo char path[100]; 2505d8899132SKalle Valo int ret; 2506d8899132SKalle Valo 2507d8899132SKalle Valo if (m3_mem->vaddr || m3_mem->size) 2508d8899132SKalle Valo return 0; 2509d8899132SKalle Valo 2510d8899132SKalle Valo fw = ath12k_core_firmware_request(ab, ATH12K_M3_FILE); 2511d8899132SKalle Valo if (IS_ERR(fw)) { 2512d8899132SKalle Valo ret = PTR_ERR(fw); 2513d8899132SKalle Valo ath12k_core_create_firmware_path(ab, ATH12K_M3_FILE, 2514d8899132SKalle Valo path, sizeof(path)); 2515d8899132SKalle Valo ath12k_err(ab, "failed to load %s: %d\n", path, ret); 2516d8899132SKalle Valo return ret; 2517d8899132SKalle Valo } 2518d8899132SKalle Valo 2519d8899132SKalle Valo m3_mem->vaddr = dma_alloc_coherent(ab->dev, 2520d8899132SKalle Valo fw->size, &m3_mem->paddr, 2521d8899132SKalle Valo GFP_KERNEL); 2522d8899132SKalle Valo if (!m3_mem->vaddr) { 2523d8899132SKalle Valo ath12k_err(ab, "failed to allocate memory for M3 with size %zu\n", 2524d8899132SKalle Valo fw->size); 2525d8899132SKalle Valo release_firmware(fw); 2526d8899132SKalle Valo return -ENOMEM; 2527d8899132SKalle Valo } 2528d8899132SKalle Valo 2529d8899132SKalle Valo memcpy(m3_mem->vaddr, fw->data, fw->size); 2530d8899132SKalle Valo m3_mem->size = fw->size; 2531d8899132SKalle Valo release_firmware(fw); 2532d8899132SKalle Valo 2533d8899132SKalle Valo return 0; 2534d8899132SKalle Valo } 2535d8899132SKalle Valo 2536d8899132SKalle Valo static void ath12k_qmi_m3_free(struct ath12k_base *ab) 2537d8899132SKalle Valo { 2538d8899132SKalle Valo struct m3_mem_region *m3_mem = &ab->qmi.m3_mem; 2539d8899132SKalle Valo 2540d8899132SKalle Valo if (!m3_mem->vaddr) 2541d8899132SKalle Valo return; 2542d8899132SKalle Valo 2543d8899132SKalle Valo dma_free_coherent(ab->dev, m3_mem->size, 2544d8899132SKalle Valo m3_mem->vaddr, m3_mem->paddr); 2545d8899132SKalle Valo m3_mem->vaddr = NULL; 2546c42c2b82SWen Gong m3_mem->size = 0; 2547d8899132SKalle Valo } 2548d8899132SKalle Valo 2549d8899132SKalle Valo static int ath12k_qmi_wlanfw_m3_info_send(struct ath12k_base *ab) 2550d8899132SKalle Valo { 2551d8899132SKalle Valo struct m3_mem_region *m3_mem = &ab->qmi.m3_mem; 2552d8899132SKalle Valo struct qmi_wlanfw_m3_info_req_msg_v01 req; 2553d8899132SKalle Valo struct qmi_wlanfw_m3_info_resp_msg_v01 resp; 255459cf57abSJeff Johnson struct qmi_txn txn; 2555d8899132SKalle Valo int ret = 0; 2556d8899132SKalle Valo 2557d8899132SKalle Valo memset(&req, 0, sizeof(req)); 2558d8899132SKalle Valo memset(&resp, 0, sizeof(resp)); 2559d8899132SKalle Valo 2560d8899132SKalle Valo ret = ath12k_qmi_m3_load(ab); 2561d8899132SKalle Valo if (ret) { 2562d8899132SKalle Valo ath12k_err(ab, "failed to load m3 firmware: %d", ret); 2563d8899132SKalle Valo return ret; 2564d8899132SKalle Valo } 2565d8899132SKalle Valo 2566d8899132SKalle Valo req.addr = m3_mem->paddr; 2567d8899132SKalle Valo req.size = m3_mem->size; 2568d8899132SKalle Valo 2569d8899132SKalle Valo ret = qmi_txn_init(&ab->qmi.handle, &txn, 2570d8899132SKalle Valo qmi_wlanfw_m3_info_resp_msg_v01_ei, &resp); 2571d8899132SKalle Valo if (ret < 0) 2572d8899132SKalle Valo goto out; 2573d8899132SKalle Valo 2574d8899132SKalle Valo ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, 2575d8899132SKalle Valo QMI_WLANFW_M3_INFO_REQ_V01, 2576d8899132SKalle Valo QMI_WLANFW_M3_INFO_REQ_MSG_V01_MAX_MSG_LEN, 2577d8899132SKalle Valo qmi_wlanfw_m3_info_req_msg_v01_ei, &req); 2578d8899132SKalle Valo if (ret < 0) { 2579*2e82b5f0SJeff Johnson qmi_txn_cancel(&txn); 2580d8899132SKalle Valo ath12k_warn(ab, "qmi failed to send M3 information request, err = %d\n", 2581d8899132SKalle Valo ret); 2582d8899132SKalle Valo goto out; 2583d8899132SKalle Valo } 2584d8899132SKalle Valo 2585d8899132SKalle Valo ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS)); 2586d8899132SKalle Valo if (ret < 0) { 2587d8899132SKalle Valo ath12k_warn(ab, "qmi failed M3 information request %d\n", ret); 2588d8899132SKalle Valo goto out; 2589d8899132SKalle Valo } 2590d8899132SKalle Valo 2591d8899132SKalle Valo if (resp.resp.result != QMI_RESULT_SUCCESS_V01) { 2592d8899132SKalle Valo ath12k_warn(ab, "qmi M3 info request failed, result: %d, err: %d\n", 2593d8899132SKalle Valo resp.resp.result, resp.resp.error); 2594d8899132SKalle Valo ret = -EINVAL; 2595d8899132SKalle Valo goto out; 2596d8899132SKalle Valo } 2597d8899132SKalle Valo out: 2598d8899132SKalle Valo return ret; 2599d8899132SKalle Valo } 2600d8899132SKalle Valo 2601d8899132SKalle Valo static int ath12k_qmi_wlanfw_mode_send(struct ath12k_base *ab, 2602d8899132SKalle Valo u32 mode) 2603d8899132SKalle Valo { 2604d8899132SKalle Valo struct qmi_wlanfw_wlan_mode_req_msg_v01 req; 2605d8899132SKalle Valo struct qmi_wlanfw_wlan_mode_resp_msg_v01 resp; 260659cf57abSJeff Johnson struct qmi_txn txn; 2607d8899132SKalle Valo int ret = 0; 2608d8899132SKalle Valo 2609d8899132SKalle Valo memset(&req, 0, sizeof(req)); 2610d8899132SKalle Valo memset(&resp, 0, sizeof(resp)); 2611d8899132SKalle Valo 2612d8899132SKalle Valo req.mode = mode; 2613d8899132SKalle Valo req.hw_debug_valid = 1; 2614d8899132SKalle Valo req.hw_debug = 0; 2615d8899132SKalle Valo 2616d8899132SKalle Valo ret = qmi_txn_init(&ab->qmi.handle, &txn, 2617d8899132SKalle Valo qmi_wlanfw_wlan_mode_resp_msg_v01_ei, &resp); 2618d8899132SKalle Valo if (ret < 0) 2619d8899132SKalle Valo goto out; 2620d8899132SKalle Valo 2621d8899132SKalle Valo ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, 2622d8899132SKalle Valo QMI_WLANFW_WLAN_MODE_REQ_V01, 2623d8899132SKalle Valo QMI_WLANFW_WLAN_MODE_REQ_MSG_V01_MAX_LEN, 2624d8899132SKalle Valo qmi_wlanfw_wlan_mode_req_msg_v01_ei, &req); 2625d8899132SKalle Valo if (ret < 0) { 2626*2e82b5f0SJeff Johnson qmi_txn_cancel(&txn); 2627d8899132SKalle Valo ath12k_warn(ab, "qmi failed to send mode request, mode: %d, err = %d\n", 2628d8899132SKalle Valo mode, ret); 2629d8899132SKalle Valo goto out; 2630d8899132SKalle Valo } 2631d8899132SKalle Valo 2632d8899132SKalle Valo ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS)); 2633d8899132SKalle Valo if (ret < 0) { 2634d8899132SKalle Valo if (mode == ATH12K_FIRMWARE_MODE_OFF && ret == -ENETRESET) { 2635d8899132SKalle Valo ath12k_warn(ab, "WLFW service is dis-connected\n"); 2636d8899132SKalle Valo return 0; 2637d8899132SKalle Valo } 2638d8899132SKalle Valo ath12k_warn(ab, "qmi failed set mode request, mode: %d, err = %d\n", 2639d8899132SKalle Valo mode, ret); 2640d8899132SKalle Valo goto out; 2641d8899132SKalle Valo } 2642d8899132SKalle Valo 2643d8899132SKalle Valo if (resp.resp.result != QMI_RESULT_SUCCESS_V01) { 2644d8899132SKalle Valo ath12k_warn(ab, "Mode request failed, mode: %d, result: %d err: %d\n", 2645d8899132SKalle Valo mode, resp.resp.result, resp.resp.error); 2646d8899132SKalle Valo ret = -EINVAL; 2647d8899132SKalle Valo goto out; 2648d8899132SKalle Valo } 2649d8899132SKalle Valo 2650d8899132SKalle Valo out: 2651d8899132SKalle Valo return ret; 2652d8899132SKalle Valo } 2653d8899132SKalle Valo 2654d8899132SKalle Valo static int ath12k_qmi_wlanfw_wlan_cfg_send(struct ath12k_base *ab) 2655d8899132SKalle Valo { 2656d8899132SKalle Valo struct qmi_wlanfw_wlan_cfg_req_msg_v01 *req; 2657d8899132SKalle Valo struct qmi_wlanfw_wlan_cfg_resp_msg_v01 resp; 2658d8899132SKalle Valo struct ce_pipe_config *ce_cfg; 2659d8899132SKalle Valo struct service_to_pipe *svc_cfg; 266059cf57abSJeff Johnson struct qmi_txn txn; 2661d8899132SKalle Valo int ret = 0, pipe_num; 2662d8899132SKalle Valo 2663d8899132SKalle Valo ce_cfg = (struct ce_pipe_config *)ab->qmi.ce_cfg.tgt_ce; 2664d8899132SKalle Valo svc_cfg = (struct service_to_pipe *)ab->qmi.ce_cfg.svc_to_ce_map; 2665d8899132SKalle Valo 2666d8899132SKalle Valo req = kzalloc(sizeof(*req), GFP_KERNEL); 2667d8899132SKalle Valo if (!req) 2668d8899132SKalle Valo return -ENOMEM; 2669d8899132SKalle Valo 2670d8899132SKalle Valo memset(&resp, 0, sizeof(resp)); 2671d8899132SKalle Valo 2672d8899132SKalle Valo req->host_version_valid = 1; 2673d8899132SKalle Valo strscpy(req->host_version, ATH12K_HOST_VERSION_STRING, 2674d8899132SKalle Valo sizeof(req->host_version)); 2675d8899132SKalle Valo 2676d8899132SKalle Valo req->tgt_cfg_valid = 1; 2677d8899132SKalle Valo /* This is number of CE configs */ 2678d8899132SKalle Valo req->tgt_cfg_len = ab->qmi.ce_cfg.tgt_ce_len; 2679d8899132SKalle Valo for (pipe_num = 0; pipe_num < req->tgt_cfg_len ; pipe_num++) { 2680d8899132SKalle Valo req->tgt_cfg[pipe_num].pipe_num = ce_cfg[pipe_num].pipenum; 2681d8899132SKalle Valo req->tgt_cfg[pipe_num].pipe_dir = ce_cfg[pipe_num].pipedir; 2682d8899132SKalle Valo req->tgt_cfg[pipe_num].nentries = ce_cfg[pipe_num].nentries; 2683d8899132SKalle Valo req->tgt_cfg[pipe_num].nbytes_max = ce_cfg[pipe_num].nbytes_max; 2684d8899132SKalle Valo req->tgt_cfg[pipe_num].flags = ce_cfg[pipe_num].flags; 2685d8899132SKalle Valo } 2686d8899132SKalle Valo 2687d8899132SKalle Valo req->svc_cfg_valid = 1; 2688d8899132SKalle Valo /* This is number of Service/CE configs */ 2689d8899132SKalle Valo req->svc_cfg_len = ab->qmi.ce_cfg.svc_to_ce_map_len; 2690d8899132SKalle Valo for (pipe_num = 0; pipe_num < req->svc_cfg_len; pipe_num++) { 2691d8899132SKalle Valo req->svc_cfg[pipe_num].service_id = svc_cfg[pipe_num].service_id; 2692d8899132SKalle Valo req->svc_cfg[pipe_num].pipe_dir = svc_cfg[pipe_num].pipedir; 2693d8899132SKalle Valo req->svc_cfg[pipe_num].pipe_num = svc_cfg[pipe_num].pipenum; 2694d8899132SKalle Valo } 2695d8899132SKalle Valo 2696d8899132SKalle Valo /* set shadow v3 configuration */ 2697d8899132SKalle Valo if (ab->hw_params->supports_shadow_regs) { 2698d8899132SKalle Valo req->shadow_reg_v3_valid = 1; 2699d8899132SKalle Valo req->shadow_reg_v3_len = min_t(u32, 2700d8899132SKalle Valo ab->qmi.ce_cfg.shadow_reg_v3_len, 2701d8899132SKalle Valo QMI_WLANFW_MAX_NUM_SHADOW_REG_V3_V01); 2702d8899132SKalle Valo memcpy(&req->shadow_reg_v3, ab->qmi.ce_cfg.shadow_reg_v3, 2703d8899132SKalle Valo sizeof(u32) * req->shadow_reg_v3_len); 2704d8899132SKalle Valo } else { 2705d8899132SKalle Valo req->shadow_reg_v3_valid = 0; 2706d8899132SKalle Valo } 2707d8899132SKalle Valo 2708d8899132SKalle Valo ret = qmi_txn_init(&ab->qmi.handle, &txn, 2709d8899132SKalle Valo qmi_wlanfw_wlan_cfg_resp_msg_v01_ei, &resp); 2710d8899132SKalle Valo if (ret < 0) 2711d8899132SKalle Valo goto out; 2712d8899132SKalle Valo 2713d8899132SKalle Valo ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, 2714d8899132SKalle Valo QMI_WLANFW_WLAN_CFG_REQ_V01, 2715d8899132SKalle Valo QMI_WLANFW_WLAN_CFG_REQ_MSG_V01_MAX_LEN, 2716d8899132SKalle Valo qmi_wlanfw_wlan_cfg_req_msg_v01_ei, req); 2717d8899132SKalle Valo if (ret < 0) { 2718*2e82b5f0SJeff Johnson qmi_txn_cancel(&txn); 2719d8899132SKalle Valo ath12k_warn(ab, "qmi failed to send wlan config request, err = %d\n", 2720d8899132SKalle Valo ret); 2721d8899132SKalle Valo goto out; 2722d8899132SKalle Valo } 2723d8899132SKalle Valo 2724d8899132SKalle Valo ret = qmi_txn_wait(&txn, msecs_to_jiffies(ATH12K_QMI_WLANFW_TIMEOUT_MS)); 2725d8899132SKalle Valo if (ret < 0) { 2726d8899132SKalle Valo ath12k_warn(ab, "qmi failed wlan config request, err = %d\n", ret); 2727d8899132SKalle Valo goto out; 2728d8899132SKalle Valo } 2729d8899132SKalle Valo 2730d8899132SKalle Valo if (resp.resp.result != QMI_RESULT_SUCCESS_V01) { 2731d8899132SKalle Valo ath12k_warn(ab, "qmi wlan config request failed, result: %d, err: %d\n", 2732d8899132SKalle Valo resp.resp.result, resp.resp.error); 2733d8899132SKalle Valo ret = -EINVAL; 2734d8899132SKalle Valo goto out; 2735d8899132SKalle Valo } 2736d8899132SKalle Valo 2737d8899132SKalle Valo out: 2738d8899132SKalle Valo kfree(req); 2739d8899132SKalle Valo return ret; 2740d8899132SKalle Valo } 2741d8899132SKalle Valo 2742d8899132SKalle Valo void ath12k_qmi_firmware_stop(struct ath12k_base *ab) 2743d8899132SKalle Valo { 2744d8899132SKalle Valo int ret; 2745d8899132SKalle Valo 2746d8899132SKalle Valo ret = ath12k_qmi_wlanfw_mode_send(ab, ATH12K_FIRMWARE_MODE_OFF); 2747d8899132SKalle Valo if (ret < 0) { 2748d8899132SKalle Valo ath12k_warn(ab, "qmi failed to send wlan mode off\n"); 2749d8899132SKalle Valo return; 2750d8899132SKalle Valo } 2751d8899132SKalle Valo } 2752d8899132SKalle Valo 2753d8899132SKalle Valo int ath12k_qmi_firmware_start(struct ath12k_base *ab, 2754d8899132SKalle Valo u32 mode) 2755d8899132SKalle Valo { 2756d8899132SKalle Valo int ret; 2757d8899132SKalle Valo 2758d8899132SKalle Valo ret = ath12k_qmi_wlanfw_wlan_cfg_send(ab); 2759d8899132SKalle Valo if (ret < 0) { 2760d8899132SKalle Valo ath12k_warn(ab, "qmi failed to send wlan cfg:%d\n", ret); 2761d8899132SKalle Valo return ret; 2762d8899132SKalle Valo } 2763d8899132SKalle Valo 2764d8899132SKalle Valo ret = ath12k_qmi_wlanfw_mode_send(ab, mode); 2765d8899132SKalle Valo if (ret < 0) { 2766d8899132SKalle Valo ath12k_warn(ab, "qmi failed to send wlan fw mode:%d\n", ret); 2767d8899132SKalle Valo return ret; 2768d8899132SKalle Valo } 2769d8899132SKalle Valo 2770d8899132SKalle Valo return 0; 2771d8899132SKalle Valo } 2772d8899132SKalle Valo 2773d8899132SKalle Valo static int 2774d8899132SKalle Valo ath12k_qmi_driver_event_post(struct ath12k_qmi *qmi, 2775d8899132SKalle Valo enum ath12k_qmi_event_type type, 2776d8899132SKalle Valo void *data) 2777d8899132SKalle Valo { 2778d8899132SKalle Valo struct ath12k_qmi_driver_event *event; 2779d8899132SKalle Valo 2780d8899132SKalle Valo event = kzalloc(sizeof(*event), GFP_ATOMIC); 2781d8899132SKalle Valo if (!event) 2782d8899132SKalle Valo return -ENOMEM; 2783d8899132SKalle Valo 2784d8899132SKalle Valo event->type = type; 2785d8899132SKalle Valo event->data = data; 2786d8899132SKalle Valo 2787d8899132SKalle Valo spin_lock(&qmi->event_lock); 2788d8899132SKalle Valo list_add_tail(&event->list, &qmi->event_list); 2789d8899132SKalle Valo spin_unlock(&qmi->event_lock); 2790d8899132SKalle Valo 2791d8899132SKalle Valo queue_work(qmi->event_wq, &qmi->event_work); 2792d8899132SKalle Valo 2793d8899132SKalle Valo return 0; 2794d8899132SKalle Valo } 2795d8899132SKalle Valo 2796d8899132SKalle Valo static int ath12k_qmi_event_server_arrive(struct ath12k_qmi *qmi) 2797d8899132SKalle Valo { 2798d8899132SKalle Valo struct ath12k_base *ab = qmi->ab; 2799d8899132SKalle Valo int ret; 2800d8899132SKalle Valo 2801d8899132SKalle Valo ret = ath12k_qmi_fw_ind_register_send(ab); 2802d8899132SKalle Valo if (ret < 0) { 2803d8899132SKalle Valo ath12k_warn(ab, "qmi failed to send FW indication QMI:%d\n", ret); 2804d8899132SKalle Valo return ret; 2805d8899132SKalle Valo } 2806d8899132SKalle Valo 2807d8899132SKalle Valo ret = ath12k_qmi_host_cap_send(ab); 2808d8899132SKalle Valo if (ret < 0) { 2809d8899132SKalle Valo ath12k_warn(ab, "qmi failed to send host cap QMI:%d\n", ret); 2810d8899132SKalle Valo return ret; 2811d8899132SKalle Valo } 2812d8899132SKalle Valo 2813d8899132SKalle Valo return ret; 2814d8899132SKalle Valo } 2815d8899132SKalle Valo 2816d8899132SKalle Valo static int ath12k_qmi_event_mem_request(struct ath12k_qmi *qmi) 2817d8899132SKalle Valo { 2818d8899132SKalle Valo struct ath12k_base *ab = qmi->ab; 2819d8899132SKalle Valo int ret; 2820d8899132SKalle Valo 2821d8899132SKalle Valo ret = ath12k_qmi_respond_fw_mem_request(ab); 2822d8899132SKalle Valo if (ret < 0) { 2823d8899132SKalle Valo ath12k_warn(ab, "qmi failed to respond fw mem req:%d\n", ret); 2824d8899132SKalle Valo return ret; 2825d8899132SKalle Valo } 2826d8899132SKalle Valo 2827d8899132SKalle Valo return ret; 2828d8899132SKalle Valo } 2829d8899132SKalle Valo 2830d8899132SKalle Valo static int ath12k_qmi_event_load_bdf(struct ath12k_qmi *qmi) 2831d8899132SKalle Valo { 2832d8899132SKalle Valo struct ath12k_base *ab = qmi->ab; 2833d8899132SKalle Valo int ret; 2834d8899132SKalle Valo 2835d8899132SKalle Valo ret = ath12k_qmi_request_target_cap(ab); 2836d8899132SKalle Valo if (ret < 0) { 2837d8899132SKalle Valo ath12k_warn(ab, "qmi failed to req target capabilities:%d\n", ret); 2838d8899132SKalle Valo return ret; 2839d8899132SKalle Valo } 2840d8899132SKalle Valo 2841d8899132SKalle Valo ret = ath12k_qmi_load_bdf_qmi(ab, ATH12K_QMI_BDF_TYPE_REGDB); 2842d8899132SKalle Valo if (ret < 0) { 2843d8899132SKalle Valo ath12k_warn(ab, "qmi failed to load regdb file:%d\n", ret); 2844d8899132SKalle Valo return ret; 2845d8899132SKalle Valo } 2846d8899132SKalle Valo 2847d8899132SKalle Valo ret = ath12k_qmi_load_bdf_qmi(ab, ATH12K_QMI_BDF_TYPE_ELF); 2848d8899132SKalle Valo if (ret < 0) { 2849d8899132SKalle Valo ath12k_warn(ab, "qmi failed to load board data file:%d\n", ret); 2850d8899132SKalle Valo return ret; 2851d8899132SKalle Valo } 2852d8899132SKalle Valo 285342982259SDinesh Karthikeyan if (ab->hw_params->download_calib) { 285442982259SDinesh Karthikeyan ret = ath12k_qmi_load_bdf_qmi(ab, ATH12K_QMI_BDF_TYPE_CALIBRATION); 285542982259SDinesh Karthikeyan if (ret < 0) 285642982259SDinesh Karthikeyan ath12k_warn(ab, "qmi failed to load calibrated data :%d\n", ret); 285742982259SDinesh Karthikeyan } 285842982259SDinesh Karthikeyan 2859d8899132SKalle Valo ret = ath12k_qmi_wlanfw_m3_info_send(ab); 2860d8899132SKalle Valo if (ret < 0) { 2861d8899132SKalle Valo ath12k_warn(ab, "qmi failed to send m3 info req:%d\n", ret); 2862d8899132SKalle Valo return ret; 2863d8899132SKalle Valo } 2864d8899132SKalle Valo 2865d8899132SKalle Valo return ret; 2866d8899132SKalle Valo } 2867d8899132SKalle Valo 2868d8899132SKalle Valo static void ath12k_qmi_msg_mem_request_cb(struct qmi_handle *qmi_hdl, 2869d8899132SKalle Valo struct sockaddr_qrtr *sq, 2870d8899132SKalle Valo struct qmi_txn *txn, 2871d8899132SKalle Valo const void *data) 2872d8899132SKalle Valo { 2873d8899132SKalle Valo struct ath12k_qmi *qmi = container_of(qmi_hdl, struct ath12k_qmi, handle); 2874d8899132SKalle Valo struct ath12k_base *ab = qmi->ab; 2875d8899132SKalle Valo const struct qmi_wlanfw_request_mem_ind_msg_v01 *msg = data; 2876d8899132SKalle Valo int i, ret; 2877d8899132SKalle Valo 2878d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi firmware request memory request\n"); 2879d8899132SKalle Valo 2880d8899132SKalle Valo if (msg->mem_seg_len == 0 || 2881d8899132SKalle Valo msg->mem_seg_len > ATH12K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01) 2882d8899132SKalle Valo ath12k_warn(ab, "Invalid memory segment length: %u\n", 2883d8899132SKalle Valo msg->mem_seg_len); 2884d8899132SKalle Valo 2885d8899132SKalle Valo ab->qmi.mem_seg_count = msg->mem_seg_len; 2886d8899132SKalle Valo 2887d8899132SKalle Valo for (i = 0; i < qmi->mem_seg_count ; i++) { 2888d8899132SKalle Valo ab->qmi.target_mem[i].type = msg->mem_seg[i].type; 2889d8899132SKalle Valo ab->qmi.target_mem[i].size = msg->mem_seg[i].size; 2890d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi mem seg type %d size %d\n", 2891d8899132SKalle Valo msg->mem_seg[i].type, msg->mem_seg[i].size); 2892d8899132SKalle Valo } 2893d8899132SKalle Valo 2894d8899132SKalle Valo ret = ath12k_qmi_alloc_target_mem_chunk(ab); 2895d8899132SKalle Valo if (ret) { 2896d8899132SKalle Valo ath12k_warn(ab, "qmi failed to alloc target memory: %d\n", 2897d8899132SKalle Valo ret); 2898d8899132SKalle Valo return; 2899d8899132SKalle Valo } 2900d8899132SKalle Valo 2901d8899132SKalle Valo ath12k_qmi_driver_event_post(qmi, ATH12K_QMI_EVENT_REQUEST_MEM, NULL); 2902d8899132SKalle Valo } 2903d8899132SKalle Valo 2904d8899132SKalle Valo static void ath12k_qmi_msg_mem_ready_cb(struct qmi_handle *qmi_hdl, 2905d8899132SKalle Valo struct sockaddr_qrtr *sq, 2906d8899132SKalle Valo struct qmi_txn *txn, 2907d8899132SKalle Valo const void *decoded) 2908d8899132SKalle Valo { 2909d8899132SKalle Valo struct ath12k_qmi *qmi = container_of(qmi_hdl, struct ath12k_qmi, handle); 2910d8899132SKalle Valo struct ath12k_base *ab = qmi->ab; 2911d8899132SKalle Valo 2912d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi firmware memory ready indication\n"); 2913d8899132SKalle Valo ath12k_qmi_driver_event_post(qmi, ATH12K_QMI_EVENT_FW_MEM_READY, NULL); 2914d8899132SKalle Valo } 2915d8899132SKalle Valo 2916d8899132SKalle Valo static void ath12k_qmi_msg_fw_ready_cb(struct qmi_handle *qmi_hdl, 2917d8899132SKalle Valo struct sockaddr_qrtr *sq, 2918d8899132SKalle Valo struct qmi_txn *txn, 2919d8899132SKalle Valo const void *decoded) 2920d8899132SKalle Valo { 2921d8899132SKalle Valo struct ath12k_qmi *qmi = container_of(qmi_hdl, struct ath12k_qmi, handle); 2922d8899132SKalle Valo struct ath12k_base *ab = qmi->ab; 2923d8899132SKalle Valo 2924d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi firmware ready\n"); 2925d8899132SKalle Valo ath12k_qmi_driver_event_post(qmi, ATH12K_QMI_EVENT_FW_READY, NULL); 2926d8899132SKalle Valo } 2927d8899132SKalle Valo 2928d8899132SKalle Valo static const struct qmi_msg_handler ath12k_qmi_msg_handlers[] = { 2929d8899132SKalle Valo { 2930d8899132SKalle Valo .type = QMI_INDICATION, 2931d8899132SKalle Valo .msg_id = QMI_WLFW_REQUEST_MEM_IND_V01, 2932d8899132SKalle Valo .ei = qmi_wlanfw_request_mem_ind_msg_v01_ei, 2933d8899132SKalle Valo .decoded_size = sizeof(struct qmi_wlanfw_request_mem_ind_msg_v01), 2934d8899132SKalle Valo .fn = ath12k_qmi_msg_mem_request_cb, 2935d8899132SKalle Valo }, 2936d8899132SKalle Valo { 2937d8899132SKalle Valo .type = QMI_INDICATION, 2938d8899132SKalle Valo .msg_id = QMI_WLFW_FW_MEM_READY_IND_V01, 2939d8899132SKalle Valo .ei = qmi_wlanfw_mem_ready_ind_msg_v01_ei, 2940d8899132SKalle Valo .decoded_size = sizeof(struct qmi_wlanfw_fw_mem_ready_ind_msg_v01), 2941d8899132SKalle Valo .fn = ath12k_qmi_msg_mem_ready_cb, 2942d8899132SKalle Valo }, 2943d8899132SKalle Valo { 2944d8899132SKalle Valo .type = QMI_INDICATION, 2945d8899132SKalle Valo .msg_id = QMI_WLFW_FW_READY_IND_V01, 2946d8899132SKalle Valo .ei = qmi_wlanfw_fw_ready_ind_msg_v01_ei, 2947d8899132SKalle Valo .decoded_size = sizeof(struct qmi_wlanfw_fw_ready_ind_msg_v01), 2948d8899132SKalle Valo .fn = ath12k_qmi_msg_fw_ready_cb, 2949d8899132SKalle Valo }, 2950d8899132SKalle Valo }; 2951d8899132SKalle Valo 2952d8899132SKalle Valo static int ath12k_qmi_ops_new_server(struct qmi_handle *qmi_hdl, 2953d8899132SKalle Valo struct qmi_service *service) 2954d8899132SKalle Valo { 2955d8899132SKalle Valo struct ath12k_qmi *qmi = container_of(qmi_hdl, struct ath12k_qmi, handle); 2956d8899132SKalle Valo struct ath12k_base *ab = qmi->ab; 2957d8899132SKalle Valo struct sockaddr_qrtr *sq = &qmi->sq; 2958d8899132SKalle Valo int ret; 2959d8899132SKalle Valo 2960d8899132SKalle Valo sq->sq_family = AF_QIPCRTR; 2961d8899132SKalle Valo sq->sq_node = service->node; 2962d8899132SKalle Valo sq->sq_port = service->port; 2963d8899132SKalle Valo 2964d8899132SKalle Valo ret = kernel_connect(qmi_hdl->sock, (struct sockaddr *)sq, 2965d8899132SKalle Valo sizeof(*sq), 0); 2966d8899132SKalle Valo if (ret) { 2967d8899132SKalle Valo ath12k_warn(ab, "qmi failed to connect to remote service %d\n", ret); 2968d8899132SKalle Valo return ret; 2969d8899132SKalle Valo } 2970d8899132SKalle Valo 2971d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi wifi fw qmi service connected\n"); 2972d8899132SKalle Valo ath12k_qmi_driver_event_post(qmi, ATH12K_QMI_EVENT_SERVER_ARRIVE, NULL); 2973d8899132SKalle Valo 2974d8899132SKalle Valo return ret; 2975d8899132SKalle Valo } 2976d8899132SKalle Valo 2977d8899132SKalle Valo static void ath12k_qmi_ops_del_server(struct qmi_handle *qmi_hdl, 2978d8899132SKalle Valo struct qmi_service *service) 2979d8899132SKalle Valo { 2980d8899132SKalle Valo struct ath12k_qmi *qmi = container_of(qmi_hdl, struct ath12k_qmi, handle); 2981d8899132SKalle Valo struct ath12k_base *ab = qmi->ab; 2982d8899132SKalle Valo 2983d8899132SKalle Valo ath12k_dbg(ab, ATH12K_DBG_QMI, "qmi wifi fw del server\n"); 2984d8899132SKalle Valo ath12k_qmi_driver_event_post(qmi, ATH12K_QMI_EVENT_SERVER_EXIT, NULL); 2985d8899132SKalle Valo } 2986d8899132SKalle Valo 2987d8899132SKalle Valo static const struct qmi_ops ath12k_qmi_ops = { 2988d8899132SKalle Valo .new_server = ath12k_qmi_ops_new_server, 2989d8899132SKalle Valo .del_server = ath12k_qmi_ops_del_server, 2990d8899132SKalle Valo }; 2991d8899132SKalle Valo 2992d8899132SKalle Valo static void ath12k_qmi_driver_event_work(struct work_struct *work) 2993d8899132SKalle Valo { 2994d8899132SKalle Valo struct ath12k_qmi *qmi = container_of(work, struct ath12k_qmi, 2995d8899132SKalle Valo event_work); 2996d8899132SKalle Valo struct ath12k_qmi_driver_event *event; 2997d8899132SKalle Valo struct ath12k_base *ab = qmi->ab; 2998d8899132SKalle Valo int ret; 2999d8899132SKalle Valo 3000d8899132SKalle Valo spin_lock(&qmi->event_lock); 3001d8899132SKalle Valo while (!list_empty(&qmi->event_list)) { 3002d8899132SKalle Valo event = list_first_entry(&qmi->event_list, 3003d8899132SKalle Valo struct ath12k_qmi_driver_event, list); 3004d8899132SKalle Valo list_del(&event->list); 3005d8899132SKalle Valo spin_unlock(&qmi->event_lock); 3006d8899132SKalle Valo 3007d8899132SKalle Valo if (test_bit(ATH12K_FLAG_UNREGISTERING, &ab->dev_flags)) 3008960412beSRajat Soni goto skip; 3009d8899132SKalle Valo 3010d8899132SKalle Valo switch (event->type) { 3011d8899132SKalle Valo case ATH12K_QMI_EVENT_SERVER_ARRIVE: 3012d8899132SKalle Valo ret = ath12k_qmi_event_server_arrive(qmi); 3013d8899132SKalle Valo if (ret < 0) 3014d8899132SKalle Valo set_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags); 3015d8899132SKalle Valo break; 3016d8899132SKalle Valo case ATH12K_QMI_EVENT_SERVER_EXIT: 3017d8899132SKalle Valo set_bit(ATH12K_FLAG_CRASH_FLUSH, &ab->dev_flags); 3018d8899132SKalle Valo set_bit(ATH12K_FLAG_RECOVERY, &ab->dev_flags); 3019d8899132SKalle Valo break; 3020d8899132SKalle Valo case ATH12K_QMI_EVENT_REQUEST_MEM: 3021d8899132SKalle Valo ret = ath12k_qmi_event_mem_request(qmi); 3022d8899132SKalle Valo if (ret < 0) 3023d8899132SKalle Valo set_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags); 3024d8899132SKalle Valo break; 3025d8899132SKalle Valo case ATH12K_QMI_EVENT_FW_MEM_READY: 3026d8899132SKalle Valo ret = ath12k_qmi_event_load_bdf(qmi); 3027d8899132SKalle Valo if (ret < 0) 3028d8899132SKalle Valo set_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags); 3029d8899132SKalle Valo break; 3030d8899132SKalle Valo case ATH12K_QMI_EVENT_FW_READY: 3031d8899132SKalle Valo clear_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags); 3032d8899132SKalle Valo if (test_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags)) { 3033d8899132SKalle Valo ath12k_hal_dump_srng_stats(ab); 3034d8899132SKalle Valo queue_work(ab->workqueue, &ab->restart_work); 3035d8899132SKalle Valo break; 3036d8899132SKalle Valo } 3037d8899132SKalle Valo 3038d8899132SKalle Valo clear_bit(ATH12K_FLAG_CRASH_FLUSH, 3039d8899132SKalle Valo &ab->dev_flags); 3040d8899132SKalle Valo clear_bit(ATH12K_FLAG_RECOVERY, &ab->dev_flags); 3041d8899132SKalle Valo ath12k_core_qmi_firmware_ready(ab); 3042d8899132SKalle Valo set_bit(ATH12K_FLAG_REGISTERED, &ab->dev_flags); 3043d8899132SKalle Valo 3044d8899132SKalle Valo break; 3045d8899132SKalle Valo default: 3046d8899132SKalle Valo ath12k_warn(ab, "invalid event type: %d", event->type); 3047d8899132SKalle Valo break; 3048d8899132SKalle Valo } 3049960412beSRajat Soni 3050960412beSRajat Soni skip: 3051d8899132SKalle Valo kfree(event); 3052d8899132SKalle Valo spin_lock(&qmi->event_lock); 3053d8899132SKalle Valo } 3054d8899132SKalle Valo spin_unlock(&qmi->event_lock); 3055d8899132SKalle Valo } 3056d8899132SKalle Valo 3057d8899132SKalle Valo int ath12k_qmi_init_service(struct ath12k_base *ab) 3058d8899132SKalle Valo { 3059d8899132SKalle Valo int ret; 3060d8899132SKalle Valo 3061d8899132SKalle Valo memset(&ab->qmi.target, 0, sizeof(struct target_info)); 3062d8899132SKalle Valo memset(&ab->qmi.target_mem, 0, sizeof(struct target_mem_chunk)); 3063d8899132SKalle Valo ab->qmi.ab = ab; 3064d8899132SKalle Valo 3065d8899132SKalle Valo ab->qmi.target_mem_mode = ATH12K_QMI_TARGET_MEM_MODE_DEFAULT; 3066d8899132SKalle Valo ret = qmi_handle_init(&ab->qmi.handle, ATH12K_QMI_RESP_LEN_MAX, 3067d8899132SKalle Valo &ath12k_qmi_ops, ath12k_qmi_msg_handlers); 3068d8899132SKalle Valo if (ret < 0) { 3069d8899132SKalle Valo ath12k_warn(ab, "failed to initialize qmi handle\n"); 3070d8899132SKalle Valo return ret; 3071d8899132SKalle Valo } 3072d8899132SKalle Valo 30731e80449eSTejun Heo ab->qmi.event_wq = alloc_ordered_workqueue("ath12k_qmi_driver_event", 0); 3074d8899132SKalle Valo if (!ab->qmi.event_wq) { 3075d8899132SKalle Valo ath12k_err(ab, "failed to allocate workqueue\n"); 3076d8899132SKalle Valo return -EFAULT; 3077d8899132SKalle Valo } 3078d8899132SKalle Valo 3079d8899132SKalle Valo INIT_LIST_HEAD(&ab->qmi.event_list); 3080d8899132SKalle Valo spin_lock_init(&ab->qmi.event_lock); 3081d8899132SKalle Valo INIT_WORK(&ab->qmi.event_work, ath12k_qmi_driver_event_work); 3082d8899132SKalle Valo 3083d8899132SKalle Valo ret = qmi_add_lookup(&ab->qmi.handle, ATH12K_QMI_WLFW_SERVICE_ID_V01, 3084d8899132SKalle Valo ATH12K_QMI_WLFW_SERVICE_VERS_V01, 3085d8899132SKalle Valo ab->qmi.service_ins_id); 3086d8899132SKalle Valo if (ret < 0) { 3087d8899132SKalle Valo ath12k_warn(ab, "failed to add qmi lookup\n"); 3088d8899132SKalle Valo destroy_workqueue(ab->qmi.event_wq); 3089d8899132SKalle Valo return ret; 3090d8899132SKalle Valo } 3091d8899132SKalle Valo 3092d8899132SKalle Valo return ret; 3093d8899132SKalle Valo } 3094d8899132SKalle Valo 3095d8899132SKalle Valo void ath12k_qmi_deinit_service(struct ath12k_base *ab) 3096d8899132SKalle Valo { 3097d8899132SKalle Valo qmi_handle_release(&ab->qmi.handle); 3098d8899132SKalle Valo cancel_work_sync(&ab->qmi.event_work); 3099d8899132SKalle Valo destroy_workqueue(ab->qmi.event_wq); 3100d8899132SKalle Valo ath12k_qmi_m3_free(ab); 3101d8899132SKalle Valo ath12k_qmi_free_target_mem_chunk(ab); 3102d8899132SKalle Valo } 310392448f87SWen Gong 310492448f87SWen Gong void ath12k_qmi_free_resource(struct ath12k_base *ab) 310592448f87SWen Gong { 310692448f87SWen Gong ath12k_qmi_free_target_mem_chunk(ab); 310792448f87SWen Gong ath12k_qmi_m3_free(ab); 310892448f87SWen Gong } 3109