1*da8fa4e3SBjoern A. Zeeb /* SPDX-License-Identifier: ISC */ 2*da8fa4e3SBjoern A. Zeeb /* 3*da8fa4e3SBjoern A. Zeeb * Copyright (c) 2018 The Linux Foundation. All rights reserved. 4*da8fa4e3SBjoern A. Zeeb */ 5*da8fa4e3SBjoern A. Zeeb #ifndef _ATH10K_QMI_H_ 6*da8fa4e3SBjoern A. Zeeb #define _ATH10K_QMI_H_ 7*da8fa4e3SBjoern A. Zeeb 8*da8fa4e3SBjoern A. Zeeb #include <linux/soc/qcom/qmi.h> 9*da8fa4e3SBjoern A. Zeeb #include <linux/qrtr.h> 10*da8fa4e3SBjoern A. Zeeb #include "qmi_wlfw_v01.h" 11*da8fa4e3SBjoern A. Zeeb 12*da8fa4e3SBjoern A. Zeeb #define MAX_NUM_MEMORY_REGIONS 2 13*da8fa4e3SBjoern A. Zeeb #define MAX_TIMESTAMP_LEN 32 14*da8fa4e3SBjoern A. Zeeb #define MAX_BUILD_ID_LEN 128 15*da8fa4e3SBjoern A. Zeeb #define MAX_NUM_CAL_V01 5 16*da8fa4e3SBjoern A. Zeeb 17*da8fa4e3SBjoern A. Zeeb enum ath10k_qmi_driver_event_type { 18*da8fa4e3SBjoern A. Zeeb ATH10K_QMI_EVENT_SERVER_ARRIVE, 19*da8fa4e3SBjoern A. Zeeb ATH10K_QMI_EVENT_SERVER_EXIT, 20*da8fa4e3SBjoern A. Zeeb ATH10K_QMI_EVENT_FW_READY_IND, 21*da8fa4e3SBjoern A. Zeeb ATH10K_QMI_EVENT_FW_DOWN_IND, 22*da8fa4e3SBjoern A. Zeeb ATH10K_QMI_EVENT_MSA_READY_IND, 23*da8fa4e3SBjoern A. Zeeb ATH10K_QMI_EVENT_MAX, 24*da8fa4e3SBjoern A. Zeeb }; 25*da8fa4e3SBjoern A. Zeeb 26*da8fa4e3SBjoern A. Zeeb struct ath10k_msa_mem_info { 27*da8fa4e3SBjoern A. Zeeb phys_addr_t addr; 28*da8fa4e3SBjoern A. Zeeb u32 size; 29*da8fa4e3SBjoern A. Zeeb bool secure; 30*da8fa4e3SBjoern A. Zeeb }; 31*da8fa4e3SBjoern A. Zeeb 32*da8fa4e3SBjoern A. Zeeb struct ath10k_qmi_chip_info { 33*da8fa4e3SBjoern A. Zeeb u32 chip_id; 34*da8fa4e3SBjoern A. Zeeb u32 chip_family; 35*da8fa4e3SBjoern A. Zeeb }; 36*da8fa4e3SBjoern A. Zeeb 37*da8fa4e3SBjoern A. Zeeb struct ath10k_qmi_board_info { 38*da8fa4e3SBjoern A. Zeeb u32 board_id; 39*da8fa4e3SBjoern A. Zeeb }; 40*da8fa4e3SBjoern A. Zeeb 41*da8fa4e3SBjoern A. Zeeb struct ath10k_qmi_soc_info { 42*da8fa4e3SBjoern A. Zeeb u32 soc_id; 43*da8fa4e3SBjoern A. Zeeb }; 44*da8fa4e3SBjoern A. Zeeb 45*da8fa4e3SBjoern A. Zeeb struct ath10k_qmi_cal_data { 46*da8fa4e3SBjoern A. Zeeb u32 cal_id; 47*da8fa4e3SBjoern A. Zeeb u32 total_size; 48*da8fa4e3SBjoern A. Zeeb u8 *data; 49*da8fa4e3SBjoern A. Zeeb }; 50*da8fa4e3SBjoern A. Zeeb 51*da8fa4e3SBjoern A. Zeeb struct ath10k_tgt_pipe_cfg { 52*da8fa4e3SBjoern A. Zeeb __le32 pipe_num; 53*da8fa4e3SBjoern A. Zeeb __le32 pipe_dir; 54*da8fa4e3SBjoern A. Zeeb __le32 nentries; 55*da8fa4e3SBjoern A. Zeeb __le32 nbytes_max; 56*da8fa4e3SBjoern A. Zeeb __le32 flags; 57*da8fa4e3SBjoern A. Zeeb __le32 reserved; 58*da8fa4e3SBjoern A. Zeeb }; 59*da8fa4e3SBjoern A. Zeeb 60*da8fa4e3SBjoern A. Zeeb struct ath10k_svc_pipe_cfg { 61*da8fa4e3SBjoern A. Zeeb __le32 service_id; 62*da8fa4e3SBjoern A. Zeeb __le32 pipe_dir; 63*da8fa4e3SBjoern A. Zeeb __le32 pipe_num; 64*da8fa4e3SBjoern A. Zeeb }; 65*da8fa4e3SBjoern A. Zeeb 66*da8fa4e3SBjoern A. Zeeb struct ath10k_shadow_reg_cfg { 67*da8fa4e3SBjoern A. Zeeb __le16 ce_id; 68*da8fa4e3SBjoern A. Zeeb __le16 reg_offset; 69*da8fa4e3SBjoern A. Zeeb }; 70*da8fa4e3SBjoern A. Zeeb 71*da8fa4e3SBjoern A. Zeeb struct ath10k_qmi_wlan_enable_cfg { 72*da8fa4e3SBjoern A. Zeeb u32 num_ce_tgt_cfg; 73*da8fa4e3SBjoern A. Zeeb struct ath10k_tgt_pipe_cfg *ce_tgt_cfg; 74*da8fa4e3SBjoern A. Zeeb u32 num_ce_svc_pipe_cfg; 75*da8fa4e3SBjoern A. Zeeb struct ath10k_svc_pipe_cfg *ce_svc_cfg; 76*da8fa4e3SBjoern A. Zeeb u32 num_shadow_reg_cfg; 77*da8fa4e3SBjoern A. Zeeb struct ath10k_shadow_reg_cfg *shadow_reg_cfg; 78*da8fa4e3SBjoern A. Zeeb }; 79*da8fa4e3SBjoern A. Zeeb 80*da8fa4e3SBjoern A. Zeeb struct ath10k_qmi_driver_event { 81*da8fa4e3SBjoern A. Zeeb struct list_head list; 82*da8fa4e3SBjoern A. Zeeb enum ath10k_qmi_driver_event_type type; 83*da8fa4e3SBjoern A. Zeeb void *data; 84*da8fa4e3SBjoern A. Zeeb }; 85*da8fa4e3SBjoern A. Zeeb 86*da8fa4e3SBjoern A. Zeeb enum ath10k_qmi_state { 87*da8fa4e3SBjoern A. Zeeb ATH10K_QMI_STATE_INIT_DONE, 88*da8fa4e3SBjoern A. Zeeb ATH10K_QMI_STATE_DEINIT, 89*da8fa4e3SBjoern A. Zeeb }; 90*da8fa4e3SBjoern A. Zeeb 91*da8fa4e3SBjoern A. Zeeb struct ath10k_qmi { 92*da8fa4e3SBjoern A. Zeeb struct ath10k *ar; 93*da8fa4e3SBjoern A. Zeeb struct qmi_handle qmi_hdl; 94*da8fa4e3SBjoern A. Zeeb struct sockaddr_qrtr sq; 95*da8fa4e3SBjoern A. Zeeb struct work_struct event_work; 96*da8fa4e3SBjoern A. Zeeb struct workqueue_struct *event_wq; 97*da8fa4e3SBjoern A. Zeeb struct list_head event_list; 98*da8fa4e3SBjoern A. Zeeb spinlock_t event_lock; /* spinlock for qmi event list */ 99*da8fa4e3SBjoern A. Zeeb u32 nr_mem_region; 100*da8fa4e3SBjoern A. Zeeb struct ath10k_msa_mem_info mem_region[MAX_NUM_MEMORY_REGIONS]; 101*da8fa4e3SBjoern A. Zeeb struct ath10k_qmi_chip_info chip_info; 102*da8fa4e3SBjoern A. Zeeb struct ath10k_qmi_board_info board_info; 103*da8fa4e3SBjoern A. Zeeb struct ath10k_qmi_soc_info soc_info; 104*da8fa4e3SBjoern A. Zeeb char fw_build_id[MAX_BUILD_ID_LEN + 1]; 105*da8fa4e3SBjoern A. Zeeb u32 fw_version; 106*da8fa4e3SBjoern A. Zeeb bool fw_ready; 107*da8fa4e3SBjoern A. Zeeb char fw_build_timestamp[MAX_TIMESTAMP_LEN + 1]; 108*da8fa4e3SBjoern A. Zeeb struct ath10k_qmi_cal_data cal_data[MAX_NUM_CAL_V01]; 109*da8fa4e3SBjoern A. Zeeb bool msa_fixed_perm; 110*da8fa4e3SBjoern A. Zeeb enum ath10k_qmi_state state; 111*da8fa4e3SBjoern A. Zeeb }; 112*da8fa4e3SBjoern A. Zeeb 113*da8fa4e3SBjoern A. Zeeb int ath10k_qmi_wlan_enable(struct ath10k *ar, 114*da8fa4e3SBjoern A. Zeeb struct ath10k_qmi_wlan_enable_cfg *config, 115*da8fa4e3SBjoern A. Zeeb enum wlfw_driver_mode_enum_v01 mode, 116*da8fa4e3SBjoern A. Zeeb const char *version); 117*da8fa4e3SBjoern A. Zeeb int ath10k_qmi_wlan_disable(struct ath10k *ar); 118*da8fa4e3SBjoern A. Zeeb int ath10k_qmi_init(struct ath10k *ar, u32 msa_size); 119*da8fa4e3SBjoern A. Zeeb int ath10k_qmi_deinit(struct ath10k *ar); 120*da8fa4e3SBjoern A. Zeeb int ath10k_qmi_set_fw_log_mode(struct ath10k *ar, u8 fw_log_mode); 121*da8fa4e3SBjoern A. Zeeb 122*da8fa4e3SBjoern A. Zeeb #endif /* ATH10K_QMI_H */ 123