Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7a350084 authored by Gidon Studinski's avatar Gidon Studinski
Browse files

msm: ipa3: add a dispatcher layer for IPA APIs



The dispatcher layer enables compilation of IPA 2.x and IPA 3.0
drivers, which shares the same external API, at the same time. The
dispatcher implements all of the external APIs. This implementation
calls a function pointer which is populated by each sub driver.

For example: ipa_connect() is implemented in ipa_api.c. According to the
DTS file, ipa2_connect() will be called for IPA 2.x driver, and
ipa3_connect() will be called for IPA 3.0 driver.

Change-Id: I34ca837094c8c0940f0e267fbc94746414d64d8f
Acked-by: default avatarAdy Abraham <adya@qti.qualcomm.com>
Signed-off-by: default avatarNadine Toledano <nadinet@codeaurora.org>
Signed-off-by: default avatarAmir Levy <alevy@codeaurora.org>
Signed-off-by: default avatarGidon Studinski <gidons@codeaurora.org>
parent c82c8a5b
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
* Qualcomm Technologies, Inc. RmNet IPA driver module

This module enables embedded data calls using IPA v3 HW.

Required properties:
- compatible:		Must be "qcom,rmnet-ipa3"

Optional:
- qcom,rmnet-ipa-ssr: determine if modem SSR is supported
- qcom,ipa-loaduC: indicate that ipa uC should be loaded

Example:
	qcom,rmnet-ipa3 {
		compatible = "qcom,rmnet-ipa3";
	}
+2 −0
Original line number Diff line number Diff line
obj-$(CONFIG_IPA) += ipa_v2/
obj-$(CONFIG_IPA3) += ipa_v3/

obj-$(CONFIG_IPA) += ipa_api.o
obj-$(CONFIG_IPA3) += ipa_api.o
+2589 −0

File added.

Preview size limit exceeded, changes collapsed.

+338 −0
Original line number Diff line number Diff line
/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef _IPA_API_H_
#define _IPA_API_H_

struct ipa_api_controller {
	int (*ipa_connect)(const struct ipa_connect_params *in,
		struct ipa_sps_params *sps, u32 *clnt_hdl);

	int (*ipa_disconnect)(u32 clnt_hdl);

	int (*ipa_reset_endpoint)(u32 clnt_hdl);

	int (*ipa_cfg_ep)(u32 clnt_hdl, const struct ipa_ep_cfg *ipa_ep_cfg);

	int (*ipa_cfg_ep_nat)(u32 clnt_hdl,
		const struct ipa_ep_cfg_nat *ipa_ep_cfg);

	int (*ipa_cfg_ep_hdr)(u32 clnt_hdl,
		const struct ipa_ep_cfg_hdr *ipa_ep_cfg);

	int (*ipa_cfg_ep_hdr_ext)(u32 clnt_hdl,
			const struct ipa_ep_cfg_hdr_ext *ipa_ep_cfg);

	int (*ipa_cfg_ep_mode)(u32 clnt_hdl,
		const struct ipa_ep_cfg_mode *ipa_ep_cfg);

	int (*ipa_cfg_ep_aggr)(u32 clnt_hdl,
		const struct ipa_ep_cfg_aggr *ipa_ep_cfg);

	int (*ipa_cfg_ep_deaggr)(u32 clnt_hdl,
		const struct ipa_ep_cfg_deaggr *ipa_ep_cfg);

	int (*ipa_cfg_ep_route)(u32 clnt_hdl,
		const struct ipa_ep_cfg_route *ipa_ep_cfg);

	int (*ipa_cfg_ep_holb)(u32 clnt_hdl,
		const struct ipa_ep_cfg_holb *ipa_ep_cfg);

	int (*ipa_cfg_ep_cfg)(u32 clnt_hdl,
		const struct ipa_ep_cfg_cfg *ipa_ep_cfg);

	int (*ipa_cfg_ep_metadata_mask)(u32 clnt_hdl,
		const struct ipa_ep_cfg_metadata_mask *ipa_ep_cfg);

	int (*ipa_cfg_ep_holb_by_client)(enum ipa_client_type client,
		const struct ipa_ep_cfg_holb *ipa_ep_cfg);

	int (*ipa_cfg_ep_ctrl)(u32 clnt_hdl,
		const struct ipa_ep_cfg_ctrl *ep_ctrl);

	int (*ipa_add_hdr)(struct ipa_ioc_add_hdr *hdrs);

	int (*ipa_del_hdr)(struct ipa_ioc_del_hdr *hdls);

	int (*ipa_commit_hdr)(void);

	int (*ipa_reset_hdr)(void);

	int (*ipa_get_hdr)(struct ipa_ioc_get_hdr *lookup);

	int (*ipa_put_hdr)(u32 hdr_hdl);

	int (*ipa_copy_hdr)(struct ipa_ioc_copy_hdr *copy);

	int (*ipa_add_hdr_proc_ctx)(struct ipa_ioc_add_hdr_proc_ctx *proc_ctxs);

	int (*ipa_del_hdr_proc_ctx)(struct ipa_ioc_del_hdr_proc_ctx *hdls);

	int (*ipa_add_rt_rule)(struct ipa_ioc_add_rt_rule *rules);

	int (*ipa_del_rt_rule)(struct ipa_ioc_del_rt_rule *hdls);

	int (*ipa_commit_rt)(enum ipa_ip_type ip);

	int (*ipa_reset_rt)(enum ipa_ip_type ip);

	int (*ipa_get_rt_tbl)(struct ipa_ioc_get_rt_tbl *lookup);

	int (*ipa_put_rt_tbl)(u32 rt_tbl_hdl);

	int (*ipa_query_rt_index)(struct ipa_ioc_get_rt_tbl_indx *in);

	int (*ipa_mdfy_rt_rule)(struct ipa_ioc_mdfy_rt_rule *rules);

	int (*ipa_add_flt_rule)(struct ipa_ioc_add_flt_rule *rules);

	int (*ipa_del_flt_rule)(struct ipa_ioc_del_flt_rule *hdls);

	int (*ipa_mdfy_flt_rule)(struct ipa_ioc_mdfy_flt_rule *rules);

	int (*ipa_commit_flt)(enum ipa_ip_type ip);

	int (*ipa_reset_flt)(enum ipa_ip_type ip);

	int (*allocate_nat_device)(struct ipa_ioc_nat_alloc_mem *mem);

	int (*ipa_nat_init_cmd)(struct ipa_ioc_v4_nat_init *init);

	int (*ipa_nat_dma_cmd)(struct ipa_ioc_nat_dma_cmd *dma);

	int (*ipa_nat_del_cmd)(struct ipa_ioc_v4_nat_del *del);

	int (*ipa_send_msg)(struct ipa_msg_meta *meta, void *buff,
		ipa_msg_free_fn callback);

	int (*ipa_register_pull_msg)(struct ipa_msg_meta *meta,
		ipa_msg_pull_fn callback);

	int (*ipa_deregister_pull_msg)(struct ipa_msg_meta *meta);

	int (*ipa_register_intf)(const char *name,
		const struct ipa_tx_intf *tx,
		const struct ipa_rx_intf *rx);

	int (*ipa_register_intf_ext)(const char *name,
		const struct ipa_tx_intf *tx,
		const struct ipa_rx_intf *rx,
		const struct ipa_ext_intf *ext);

	int (*ipa_deregister_intf)(const char *name);

	int (*ipa_set_aggr_mode)(enum ipa_aggr_mode mode);

	int (*ipa_set_qcncm_ndp_sig)(char sig[3]);

	int (*ipa_set_single_ndp_per_mbim)(bool enable);

	int (*ipa_tx_dp)(enum ipa_client_type dst, struct sk_buff *skb,
		struct ipa_tx_meta *metadata);

	int (*ipa_tx_dp_mul)(enum ipa_client_type dst,
			struct ipa_tx_data_desc *data_desc);

	void (*ipa_free_skb)(struct ipa_rx_data *);

	int (*ipa_setup_sys_pipe)(struct ipa_sys_connect_params *sys_in,
		u32 *clnt_hdl);

	int (*ipa_teardown_sys_pipe)(u32 clnt_hdl);

	int (*ipa_sys_setup)(struct ipa_sys_connect_params *sys_in,
		unsigned long *ipa_bam_hdl,
		u32 *ipa_pipe_num, u32 *clnt_hdl);

	int (*ipa_sys_teardown)(u32 clnt_hdl);

	int (*ipa_connect_wdi_pipe)(struct ipa_wdi_in_params *in,
		struct ipa_wdi_out_params *out);

	int (*ipa_disconnect_wdi_pipe)(u32 clnt_hdl);

	int (*ipa_enable_wdi_pipe)(u32 clnt_hdl);

	int (*ipa_disable_wdi_pipe)(u32 clnt_hdl);

	int (*ipa_resume_wdi_pipe)(u32 clnt_hdl);

	int (*ipa_suspend_wdi_pipe)(u32 clnt_hdl);

	int (*ipa_get_wdi_stats)(struct IpaHwStatsWDIInfoData_t *stats);

	u16 (*ipa_get_smem_restr_bytes)(void);

	int (*ipa_uc_wdi_get_dbpa)(struct ipa_wdi_db_params *out);

	int (*ipa_uc_reg_rdyCB)(struct ipa_wdi_uc_ready_params *param);

	int (*ipa_rm_create_resource)(
		struct ipa_rm_create_params *create_params);

	int (*ipa_rm_delete_resource)(enum ipa_rm_resource_name resource_name);

	int (*ipa_rm_register)(enum ipa_rm_resource_name resource_name,
		struct ipa_rm_register_params *reg_params);

	int (*ipa_rm_deregister)(enum ipa_rm_resource_name resource_name,
		struct ipa_rm_register_params *reg_params);

	int (*ipa_rm_set_perf_profile)(enum ipa_rm_resource_name resource_name,
		struct ipa_rm_perf_profile *profile);

	int (*ipa_rm_add_dependency)(enum ipa_rm_resource_name resource_name,
		enum ipa_rm_resource_name depends_on_name);

	int (*ipa_rm_delete_dependency)(enum ipa_rm_resource_name resource_name,
			enum ipa_rm_resource_name depends_on_name);

	int (*ipa_rm_request_resource)(enum ipa_rm_resource_name resource_name);

	int (*ipa_rm_release_resource)(enum ipa_rm_resource_name resource_name);

	int (*ipa_rm_notify_completion)(enum ipa_rm_event event,
		enum ipa_rm_resource_name resource_name);

	int (*ipa_rm_inactivity_timer_init)(enum ipa_rm_resource_name
		resource_name, unsigned long msecs);

	int (*ipa_rm_inactivity_timer_destroy)(
		enum ipa_rm_resource_name resource_name);

	int (*ipa_rm_inactivity_timer_request_resource)(
		enum ipa_rm_resource_name resource_name);

	int (*ipa_rm_inactivity_timer_release_resource)(
				enum ipa_rm_resource_name resource_name);

	int (*teth_bridge_init)(struct teth_bridge_init_params *params);

	int (*teth_bridge_disconnect)(enum ipa_client_type client);

	int (*teth_bridge_connect)(
		struct teth_bridge_connect_params *connect_params);

	int (*odu_bridge_init)(struct odu_bridge_params *params);

	int (*odu_bridge_connect)(void);

	int (*odu_bridge_disconnect)(void);

	int (*odu_bridge_tx_dp)(struct sk_buff *skb,
		struct ipa_tx_meta *metadata);

	int (*odu_bridge_cleanup)(void);

	int (*ipa_dma_init)(void);

	int (*ipa_dma_enable)(void);

	int (*ipa_dma_disable)(void);

	int (*ipa_dma_sync_memcpy)(phys_addr_t dest, phys_addr_t src, int len);

	int (*ipa_dma_async_memcpy)(phys_addr_t dest, phys_addr_t src, int len,
		void (*user_cb)(void *user1), void *user_param);

	int (*ipa_dma_uc_memcpy)(phys_addr_t dest, phys_addr_t src, int len);

	void (*ipa_dma_destroy)(void);

	int (*ipa_mhi_init)(struct ipa_mhi_init_params *params);

	int (*ipa_mhi_start)(struct ipa_mhi_start_params *params);

	int (*ipa_mhi_connect_pipe)(struct ipa_mhi_connect_params *in,
		u32 *clnt_hdl);

	int (*ipa_mhi_disconnect_pipe)(u32 clnt_hdl);

	int (*ipa_mhi_suspend)(bool force);

	int (*ipa_mhi_resume)(void);

	int (*ipa_mhi_destroy)(void);

	int (*ipa_write_qmap_id)(struct ipa_ioc_write_qmapid *param_in);

	int (*ipa_add_interrupt_handler)(enum ipa_irq_type interrupt,
		ipa_irq_handler_t handler,
		bool deferred_flag,
		void *private_data);

	int (*ipa_remove_interrupt_handler)(enum ipa_irq_type interrupt);

	void (*ipa_bam_reg_dump)(void);

	int (*ipa_get_ep_mapping)(enum ipa_client_type client);

	bool (*ipa_is_ready)(void);

	void (*ipa_proxy_clk_vote)(void);

	void (*ipa_proxy_clk_unvote)(void);

	bool (*ipa_is_client_handle_valid)(u32 clnt_hdl);

	enum ipa_client_type (*ipa_get_client_mapping)(int pipe_idx);

	enum ipa_rm_resource_name (*ipa_get_rm_resource_from_ep)(int pipe_idx);

	bool (*ipa_get_modem_cfg_emb_pipe_flt)(void);

	int (*ipa_ap_suspend)(struct device *dev);

	int (*ipa_ap_resume)(struct device *dev);

	struct iommu_domain *(*ipa_get_smmu_domain)(void);

	int (*ipa_disable_apps_wan_cons_deaggr)(uint32_t agg_size,
						uint32_t agg_count);

	int (*ipa_rm_add_dependency_sync)(
		enum ipa_rm_resource_name resource_name,
		enum ipa_rm_resource_name depends_on_name);

	struct device *(*ipa_get_dma_dev)(void);

	int (*ipa_release_wdi_mapping)(u32 num_buffers,
		struct ipa_wdi_buffer_info *info);

	int (*ipa_create_wdi_mapping)(u32 num_buffers,
		struct ipa_wdi_buffer_info *info);

};

#ifdef CONFIG_IPA
int ipa_plat_drv_probe(struct platform_device *pdev_p,
	struct ipa_api_controller *api_ctrl, struct of_device_id *pdrv_match);
#else
static inline int ipa_plat_drv_probe(struct platform_device *pdev_p,
	struct ipa_api_controller *api_ctrl, struct of_device_id *pdrv_match)
{
	return -ENODEV;
}
#endif /* (CONFIG_IPA) */

#ifdef CONFIG_IPA3
int ipa3_plat_drv_probe(struct platform_device *pdev_p,
	struct ipa_api_controller *api_ctrl, struct of_device_id *pdrv_match);
#else
static inline int ipa3_plat_drv_probe(struct platform_device *pdev_p,
	struct ipa_api_controller *api_ctrl, struct of_device_id *pdrv_match)
{
	return -ENODEV;
}
#endif /* (CONFIG_IPA3) */

#endif /* _IPA_API_H_ */
+93 −176

File changed.

Preview size limit exceeded, changes collapsed.

Loading