diff --git a/include/linux/ipa_qdss.h b/include/linux/ipa_qdss.h new file mode 100644 index 000000000000..9562db6b738a --- /dev/null +++ b/include/linux/ipa_qdss.h @@ -0,0 +1,100 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2020, The Linux Foundation. All rights reserved. + */ + +#ifndef _IPA_QDSS_H_ +#define _IPA_QDSS_H_ + +#include + +/** + * enum ipa_qdss_notify - these are the only return items + * @IPA_QDSS_SUCCESS: will be returned as it is for both conn + * and disconn + * @IPA_QDSS_PIPE_CONN_FAILURE: will be returned as negative value + * @IPA_QDSS_PIPE_DISCONN_FAILURE: will be returned as negative value + */ +enum ipa_qdss_notify { + IPA_QDSS_SUCCESS, + IPA_QDSS_PIPE_CONN_FAILURE, + IPA_QDSS_PIPE_DISCONN_FAILURE, +}; + +/** + * struct ipa_qdss_conn_in_params - QDSS -> IPA TX configuration + * @data_fifo_base_addr: Base address of the data FIFO used by BAM + * @data_fifo_size: Size of the data FIFO + * @desc_fifo_base_addr: Base address of the descriptor FIFO by BAM + * @desc_fifo_size: Should be configured to 1 by QDSS + * @bam_p_evt_dest_addr: equivalent to event_ring_doorbell_pa + * physical address of the doorbell that IPA uC + * will update the headpointer of the event ring. + * QDSS should send BAM_P_EVNT_REG address in this var + * Configured with the GSI Doorbell Address. + * GSI sends Update RP by doing a write to this address + * @bam_p_evt_threshold: Threshold level of how many bytes consumed + * @override_eot: if override EOT==1, it doesn't check the EOT bit in + * the descriptor + */ +struct ipa_qdss_conn_in_params { + phys_addr_t data_fifo_base_addr; + u32 data_fifo_size; + phys_addr_t desc_fifo_base_addr; + u32 desc_fifo_size; + phys_addr_t bam_p_evt_dest_addr; + u32 bam_p_evt_threshold; + u32 override_eot; +}; + +/** + * struct ipa_qdss_conn_out_params - information provided + * to QDSS driver + * @rx_db_pa: physical address of IPA doorbell for RX (QDSS->IPA transactions) + * QDSS to take this address and assign it to BAM_P_EVENT_DEST_ADDR + */ +struct ipa_qdss_conn_out_params { + phys_addr_t ipa_rx_db_pa; +}; + +#if defined CONFIG_IPA3 + +/** + * ipa_qdss_conn_pipes - Client should call this + * function to connect QDSS -> IPA pipe + * + * @in: [in] input parameters from client + * @out: [out] output params to client + * + * Note: Should not be called from atomic context + * + * @Return 0 on success, negative on failure + */ +int ipa_qdss_conn_pipes(struct ipa_qdss_conn_in_params *in, + struct ipa_qdss_conn_out_params *out); + +/** + * ipa_qdss_disconn_pipes() - Client should call this + * function to disconnect pipes + * + * Note: Should not be called from atomic context + * + * Returns: 0 on success, negative on failure + */ +int ipa_qdss_disconn_pipes(void); + +#else /* CONFIG_IPA3 */ + +static inline int ipa_qdss_conn_pipes(struct ipa_qdss_conn_in_params *in, + struct ipa_qdss_conn_out_params *out) +{ + return -IPA_QDSS_PIPE_CONN_FAILURE; +} + +static inline int ipa_qdss_disconn_pipes(void) +{ + return -IPA_QDSS_PIPE_DISCONN_FAILURE; +} + +#endif /* CONFIG_IPA3 */ +#endif /* _IPA_QDSS_H_ */ diff --git a/include/uapi/linux/msm_ipa.h b/include/uapi/linux/msm_ipa.h index 2b49aa195d84..7852144e6f73 100644 --- a/include/uapi/linux/msm_ipa.h +++ b/include/uapi/linux/msm_ipa.h @@ -425,6 +425,8 @@ enum ipa_client_type { #define IPA_CLIENT_MHI_PRIME_DPL_PROD IPA_CLIENT_MHI_PRIME_DPL_PROD #define IPA_CLIENT_AQC_ETHERNET_PROD IPA_CLIENT_AQC_ETHERNET_PROD #define IPA_CLIENT_AQC_ETHERNET_CONS IPA_CLIENT_AQC_ETHERNET_CONS +#define IPA_CLIENT_MHI_QDSS_CONS IPA_CLIENT_MHI_QDSS_CONS +#define IPA_CLIENT_QDSS_PROD IPA_CLIENT_QDSS_PROD #define IPA_CLIENT_IS_APPS_CONS(client) \ ((client) == IPA_CLIENT_APPS_LAN_CONS || \