From d788b6f58441522a9e3f913a012903b29df7c7d8 Mon Sep 17 00:00:00 2001 From: Bojun Pan Date: Thu, 27 Dec 2018 02:20:54 -0800 Subject: [PATCH] msm: IPA: differentiate WDI2 and WDI3 over GSI WDI2 and WDI3 pipe configuration will be different, differentiation is needed to support both cases. Change-Id: I6b6b51faf0b3b098522f18e84f3f1d8706b65988 Signed-off-by: Bojun Pan --- .../platform/msm/ipa/ipa_clients/ipa_wdi3.c | 16 +++++++------- drivers/platform/msm/ipa/ipa_v3/ipa.c | 21 +++++++++++++------ drivers/platform/msm/ipa/ipa_v3/ipa_i.h | 6 ++++-- drivers/platform/msm/ipa/ipa_v3/ipa_uc_wdi.c | 18 ++++++++-------- drivers/platform/msm/ipa/ipa_v3/ipa_wdi3_i.c | 12 +++++------ 5 files changed, 42 insertions(+), 31 deletions(-) diff --git a/drivers/platform/msm/ipa/ipa_clients/ipa_wdi3.c b/drivers/platform/msm/ipa/ipa_clients/ipa_wdi3.c index a992d1afe995..0f1b84b2bbd0 100644 --- a/drivers/platform/msm/ipa/ipa_clients/ipa_wdi3.c +++ b/drivers/platform/msm/ipa/ipa_clients/ipa_wdi3.c @@ -121,7 +121,7 @@ int ipa_wdi_init(struct ipa_wdi_init_in_params *in, ipa_wdi_ctx->is_smmu_enabled = out->is_smmu_enabled; - if (ipa3_ctx->ipa_wdi_over_gsi) + if (ipa3_ctx->ipa_wdi3_over_gsi) out->is_over_gsi = true; else out->is_over_gsi = false; @@ -255,7 +255,7 @@ int ipa_wdi_reg_intf(struct ipa_wdi_reg_intf_in_params *in) memset(tx_prop, 0, sizeof(tx_prop)); tx_prop[0].ip = IPA_IP_v4; - if (!ipa3_ctx->ipa_wdi_over_gsi) + if (!ipa3_ctx->ipa_wdi3_over_gsi) tx_prop[0].dst_pipe = IPA_CLIENT_WLAN1_CONS; else tx_prop[0].dst_pipe = IPA_CLIENT_WLAN2_CONS; @@ -265,7 +265,7 @@ int ipa_wdi_reg_intf(struct ipa_wdi_reg_intf_in_params *in) sizeof(tx_prop[0].hdr_name)); tx_prop[1].ip = IPA_IP_v6; - if (!ipa3_ctx->ipa_wdi_over_gsi) + if (!ipa3_ctx->ipa_wdi3_over_gsi) tx_prop[1].dst_pipe = IPA_CLIENT_WLAN1_CONS; else tx_prop[1].dst_pipe = IPA_CLIENT_WLAN2_CONS; @@ -279,7 +279,7 @@ int ipa_wdi_reg_intf(struct ipa_wdi_reg_intf_in_params *in) rx.prop = rx_prop; memset(rx_prop, 0, sizeof(rx_prop)); rx_prop[0].ip = IPA_IP_v4; - if (!ipa3_ctx->ipa_wdi_over_gsi) + if (!ipa3_ctx->ipa_wdi3_over_gsi) rx_prop[0].src_pipe = IPA_CLIENT_WLAN1_PROD; else rx_prop[0].src_pipe = IPA_CLIENT_WLAN2_PROD; @@ -291,7 +291,7 @@ int ipa_wdi_reg_intf(struct ipa_wdi_reg_intf_in_params *in) } rx_prop[1].ip = IPA_IP_v6; - if (!ipa3_ctx->ipa_wdi_over_gsi) + if (!ipa3_ctx->ipa_wdi3_over_gsi) rx_prop[1].src_pipe = IPA_CLIENT_WLAN1_PROD; else rx_prop[1].src_pipe = IPA_CLIENT_WLAN2_PROD; @@ -672,7 +672,7 @@ int ipa_wdi_disconn_pipes(void) } } - if (!ipa3_ctx->ipa_wdi_over_gsi) { + if (!ipa3_ctx->ipa_wdi3_over_gsi) { ipa_ep_idx_rx = ipa_get_ep_mapping(IPA_CLIENT_WLAN1_PROD); ipa_ep_idx_tx = ipa_get_ep_mapping(IPA_CLIENT_WLAN1_CONS); } else { @@ -733,7 +733,7 @@ int ipa_wdi_enable_pipes(void) return -EPERM; } - if (!ipa3_ctx->ipa_wdi_over_gsi) { + if (!ipa3_ctx->ipa_wdi3_over_gsi) { ipa_ep_idx_rx = ipa_get_ep_mapping(IPA_CLIENT_WLAN1_PROD); ipa_ep_idx_tx = ipa_get_ep_mapping(IPA_CLIENT_WLAN1_CONS); } else { @@ -799,7 +799,7 @@ int ipa_wdi_disable_pipes(void) return -EPERM; } - if (!ipa3_ctx->ipa_wdi_over_gsi) { + if (!ipa3_ctx->ipa_wdi3_over_gsi) { ipa_ep_idx_rx = ipa_get_ep_mapping(IPA_CLIENT_WLAN1_PROD); ipa_ep_idx_tx = ipa_get_ep_mapping(IPA_CLIENT_WLAN1_CONS); } else { diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa.c b/drivers/platform/msm/ipa/ipa_v3/ipa.c index 28d4238a0b37..8f31baa07de2 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa.c @@ -5315,7 +5315,8 @@ static int ipa3_pre_init(const struct ipa3_plat_drv_res *resource_p, ipa3_ctx->use_ipa_teth_bridge = resource_p->use_ipa_teth_bridge; ipa3_ctx->modem_cfg_emb_pipe_flt = resource_p->modem_cfg_emb_pipe_flt; ipa3_ctx->ipa_wdi2 = resource_p->ipa_wdi2; - ipa3_ctx->ipa_wdi_over_gsi = resource_p->ipa_wdi_over_gsi; + ipa3_ctx->ipa_wdi2_over_gsi = resource_p->ipa_wdi2_over_gsi; + ipa3_ctx->ipa_wdi3_over_gsi = resource_p->ipa_wdi3_over_gsi; ipa3_ctx->ipa_fltrt_not_hashable = resource_p->ipa_fltrt_not_hashable; ipa3_ctx->use_64_bit_dma_mask = resource_p->use_64_bit_dma_mask; ipa3_ctx->wan_rx_ring_size = resource_p->wan_rx_ring_size; @@ -5922,7 +5923,8 @@ static int get_ipa_dts_configuration(struct platform_device *pdev, ipa_drv_res->platform_type = 0; ipa_drv_res->modem_cfg_emb_pipe_flt = false; ipa_drv_res->ipa_wdi2 = false; - ipa_drv_res->ipa_wdi_over_gsi = false; + ipa_drv_res->ipa_wdi2_over_gsi = false; + ipa_drv_res->ipa_wdi3_over_gsi = false; ipa_drv_res->ipa_mhi_dynamic_config = false; ipa_drv_res->use_64_bit_dma_mask = false; ipa_drv_res->use_bw_vote = false; @@ -6014,11 +6016,18 @@ static int get_ipa_dts_configuration(struct platform_device *pdev, IPADBG(": modem configure embedded pipe filtering = %s\n", ipa_drv_res->modem_cfg_emb_pipe_flt ? "True" : "False"); - ipa_drv_res->ipa_wdi_over_gsi = + ipa_drv_res->ipa_wdi2_over_gsi = of_property_read_bool(pdev->dev.of_node, - "qcom,ipa-wdi-over-gsi"); - IPADBG(": WDI over gsi= %s\n", - ipa_drv_res->ipa_wdi_over_gsi + "qcom,ipa-wdi2_over_gsi"); + IPADBG(": WDI-2.0 over gsi= %s\n", + ipa_drv_res->ipa_wdi2_over_gsi + ? "True" : "False"); + + ipa_drv_res->ipa_wdi3_over_gsi = + of_property_read_bool(pdev->dev.of_node, + "qcom,ipa-wdi3-over-gsi"); + IPADBG(": WDI-3.0 over gsi= %s\n", + ipa_drv_res->ipa_wdi3_over_gsi ? "True" : "False"); ipa_drv_res->ipa_wdi2 = diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h index 812d66315f42..7f152f2c099f 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h @@ -1621,7 +1621,8 @@ struct ipa3_context { bool use_ipa_teth_bridge; bool modem_cfg_emb_pipe_flt; bool ipa_wdi2; - bool ipa_wdi_over_gsi; + bool ipa_wdi2_over_gsi; + bool ipa_wdi3_over_gsi; bool ipa_fltrt_not_hashable; bool use_64_bit_dma_mask; /* featurize if memory footprint becomes a concern */ @@ -1713,7 +1714,8 @@ struct ipa3_plat_drv_res { u32 ee; bool modem_cfg_emb_pipe_flt; bool ipa_wdi2; - bool ipa_wdi_over_gsi; + bool ipa_wdi2_over_gsi; + bool ipa_wdi3_over_gsi; bool ipa_fltrt_not_hashable; bool use_64_bit_dma_mask; bool use_bw_vote; diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_uc_wdi.c b/drivers/platform/msm/ipa/ipa_v3/ipa_uc_wdi.c index f158bbac2e3c..c78ab222cd92 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_uc_wdi.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_uc_wdi.c @@ -1367,7 +1367,7 @@ int ipa3_connect_wdi_pipe(struct ipa_wdi_in_params *in, } } - if (ipa3_ctx->ipa_wdi_over_gsi) + if (ipa3_ctx->ipa_wdi2_over_gsi) return ipa3_connect_gsi_wdi_pipe(in, out); result = ipa3_uc_state_check(); @@ -1904,7 +1904,7 @@ int ipa3_disconnect_wdi_pipe(u32 clnt_hdl) return -EINVAL; } - if (ipa3_ctx->ipa_wdi_over_gsi) + if (ipa3_ctx->ipa_wdi2_over_gsi) return ipa3_disconnect_gsi_wdi_pipe(clnt_hdl); result = ipa3_uc_state_check(); @@ -2022,7 +2022,7 @@ int ipa3_disable_gsi_wdi_pipe(u32 clnt_hdl) memset(&ep_cfg_ctrl, 0, sizeof(struct ipa_ep_cfg_ctrl)); ipa3_cfg_ep_ctrl(clnt_hdl, &ep_cfg_ctrl); - cons_hdl = ipa3_get_ep_mapping(IPA_CLIENT_WLAN2_CONS); + cons_hdl = ipa3_get_ep_mapping(IPA_CLIENT_WLAN1_CONS); if (cons_hdl == IPA_EP_NOT_ALLOCATED) { IPAERR("Client %u is not mapped\n", IPA_CLIENT_WLAN1_CONS); @@ -2076,7 +2076,7 @@ int ipa3_enable_wdi_pipe(u32 clnt_hdl) return -EINVAL; } - if (ipa3_ctx->ipa_wdi_over_gsi) + if (ipa3_ctx->ipa_wdi2_over_gsi) return ipa3_enable_gsi_wdi_pipe(clnt_hdl); result = ipa3_uc_state_check(); @@ -2141,7 +2141,7 @@ int ipa3_disable_wdi_pipe(u32 clnt_hdl) return -EINVAL; } - if (ipa3_ctx->ipa_wdi_over_gsi) + if (ipa3_ctx->ipa_wdi2_over_gsi) return ipa3_disable_gsi_wdi_pipe(clnt_hdl); result = ipa3_uc_state_check(); @@ -2178,7 +2178,7 @@ int ipa3_disable_wdi_pipe(u32 clnt_hdl) memset(&ep_cfg_ctrl, 0, sizeof(struct ipa_ep_cfg_ctrl)); ipa3_cfg_ep_ctrl(clnt_hdl, &ep_cfg_ctrl); - cons_hdl = ipa3_get_ep_mapping(IPA_CLIENT_WLAN2_CONS); + cons_hdl = ipa3_get_ep_mapping(IPA_CLIENT_WLAN1_CONS); if (cons_hdl == IPA_EP_NOT_ALLOCATED) { IPAERR("Client %u is not mapped\n", IPA_CLIENT_WLAN1_CONS); @@ -2294,7 +2294,7 @@ int ipa3_resume_wdi_pipe(u32 clnt_hdl) return -EINVAL; } - if (ipa3_ctx->ipa_wdi_over_gsi) + if (ipa3_ctx->ipa_wdi2_over_gsi) return ipa3_resume_gsi_wdi_pipe(clnt_hdl); result = ipa3_uc_state_check(); @@ -2448,7 +2448,7 @@ int ipa3_suspend_wdi_pipe(u32 clnt_hdl) return -EINVAL; } - if (ipa3_ctx->ipa_wdi_over_gsi) + if (ipa3_ctx->ipa_wdi2_over_gsi) return ipa3_suspend_gsi_wdi_pipe(clnt_hdl); result = ipa3_uc_state_check(); @@ -2607,7 +2607,7 @@ int ipa3_write_qmapid_wdi_pipe(u32 clnt_hdl, u8 qmap_id) IPAERR_RL("bad parm, %d\n", clnt_hdl); return -EINVAL; } - if (ipa3_ctx->ipa_wdi_over_gsi) + if (ipa3_ctx->ipa_wdi2_over_gsi) return ipa3_write_qmapid_gsi_wdi_pipe(clnt_hdl, qmap_id); result = ipa3_uc_state_check(); diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_wdi3_i.c b/drivers/platform/msm/ipa/ipa_v3/ipa_wdi3_i.c index 0e0464a3957a..dbd6e06a6e5b 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_wdi3_i.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_wdi3_i.c @@ -296,7 +296,7 @@ int ipa3_conn_wdi3_pipes(struct ipa_wdi_conn_in_params *in, u32 evt_ring_db_addr_low, evt_ring_db_addr_high; /* wdi3 only support over gsi */ - if (!ipa3_ctx->ipa_wdi_over_gsi) { + if (!ipa3_ctx->ipa_wdi3_over_gsi) { IPAERR("wdi3 over uc offload not supported"); WARN_ON(1); return -EFAULT; @@ -374,8 +374,8 @@ int ipa3_conn_wdi3_pipes(struct ipa_wdi_conn_in_params *in, goto fail; } - IPADBG("ipa3_ctx->ipa_wdi_over_gsi %d\n", - ipa3_ctx->ipa_wdi_over_gsi); + IPADBG("ipa3_ctx->ipa_wdi3_over_gsi %d\n", + ipa3_ctx->ipa_wdi3_over_gsi); /* setup RX gsi channel */ if (ipa3_setup_wdi3_gsi_channel(in->is_smmu_enabled, &in->u_rx.rx, &in->u_rx.rx_smmu, IPA_WDI3_RX_DIR, @@ -484,7 +484,7 @@ int ipa3_disconn_wdi3_pipes(int ipa_ep_idx_tx, int ipa_ep_idx_rx) int result = 0; /* wdi3 only support over gsi */ - if (!ipa3_ctx->ipa_wdi_over_gsi) { + if (!ipa3_ctx->ipa_wdi3_over_gsi) { IPAERR("wdi3 over uc offload not supported"); WARN_ON(1); return -EFAULT; @@ -542,7 +542,7 @@ int ipa3_enable_wdi3_pipes(int ipa_ep_idx_tx, int ipa_ep_idx_rx) int result = 0; /* wdi3 only support over gsi */ - if (!ipa3_ctx->ipa_wdi_over_gsi) { + if (!ipa3_ctx->ipa_wdi3_over_gsi) { IPAERR("wdi3 over uc offload not supported"); WARN_ON(1); return -EFAULT; @@ -600,7 +600,7 @@ int ipa3_disable_wdi3_pipes(int ipa_ep_idx_tx, int ipa_ep_idx_rx) struct ipahal_ep_cfg_ctrl_scnd ep_ctrl_scnd = { 0 }; /* wdi3 only support over gsi */ - if (!ipa3_ctx->ipa_wdi_over_gsi) { + if (!ipa3_ctx->ipa_wdi3_over_gsi) { IPAERR("wdi3 over uc offload not supported"); WARN_ON(1); return -EFAULT;