From f02a0729636ff3b2f631cb4aa8e40be9bdfe687f Mon Sep 17 00:00:00 2001 From: Amir Levy Date: Tue, 23 Jun 2020 17:08:36 +0300 Subject: [PATCH] msm: ipa3: Cache gsi_ver Caching gsi_ver in static global variable ipa3_res. Added gsi_ver to struct ipa3_plat_drv_res. Caching gsi_ver in function ipa3_post_init in gsi_props of type struct gsi_per_props. Change-Id: I63e286d907be8d6151ed3a19bb1ef3c0601b9dc7 Acked-by: Eliad Ben Yishay Signed-off-by: Amir Levy --- drivers/platform/msm/ipa/ipa_v3/ipa.c | 16 ++++++++++------ drivers/platform/msm/ipa/ipa_v3/ipa_i.h | 2 ++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa.c b/drivers/platform/msm/ipa/ipa_v3/ipa.c index 56405a390016..4d21af11a402 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa.c @@ -5693,7 +5693,7 @@ static int ipa3_gsi_pre_fw_load_init(void) result = gsi_configure_regs( ipa3_res.ipa_mem_base, - ipa3_get_gsi_ver(ipa3_res.ipa_hw_type)); + ipa3_ctx->gsi_ver); if (result) { IPAERR("Failed to configure GSI registers\n"); @@ -5996,7 +5996,7 @@ static int ipa3_post_init(const struct ipa3_plat_drv_res *resource_p, ipa3_disable_prefetch(IPA_CLIENT_MHI_CONS); memset(&gsi_props, 0, sizeof(gsi_props)); - gsi_props.ver = ipa3_get_gsi_ver(resource_p->ipa_hw_type); + gsi_props.ver = ipa3_ctx->gsi_ver; gsi_props.ee = resource_p->ee; gsi_props.intr = GSI_INTR_IRQ; gsi_props.phys_addr = resource_p->transport_mem_base; @@ -6035,7 +6035,7 @@ static int ipa3_post_init(const struct ipa3_plat_drv_res *resource_p, /* GSI 2.2 requires to allocate all EE GSI channel * during device bootup. */ - if (ipa3_get_gsi_ver(resource_p->ipa_hw_type) == GSI_VER_2_2) { + if (gsi_props.ver == GSI_VER_2_2) { result = ipa3_alloc_gsi_channel(); if (result) { IPAERR("Failed to alloc the GSI channels\n"); @@ -6148,6 +6148,7 @@ static int ipa3_manual_load_ipa_fws(void) int result; const struct firmware *fw; const char *path = IPA_FWS_PATH; + enum gsi_ver gsi_ver = ipa3_ctx->gsi_ver; if (ipa3_ctx->ipa3_hw_mode == IPA_HW_MODE_EMULATION) { switch (ipa3_get_emulation_type()) { @@ -6179,10 +6180,10 @@ static int ipa3_manual_load_ipa_fws(void) result = emulator_load_fws(fw, ipa3_res.transport_mem_base, ipa3_res.transport_mem_size, - ipa3_get_gsi_ver(ipa3_res.ipa_hw_type)); + gsi_ver); } else { result = ipa3_load_fws(fw, ipa3_res.transport_mem_base, - ipa3_get_gsi_ver(ipa3_res.ipa_hw_type)); + gsi_ver); } if (result) { @@ -6193,7 +6194,7 @@ static int ipa3_manual_load_ipa_fws(void) result = gsi_enable_fw(ipa3_res.transport_mem_base, ipa3_res.transport_mem_size, - ipa3_get_gsi_ver(ipa3_res.ipa_hw_type)); + gsi_ver); if (result) { IPAERR("Failed to enable GSI FW\n"); release_firmware(fw); @@ -8596,6 +8597,9 @@ int ipa3_plat_drv_probe(struct platform_device *pdev_p, return result; } + /* Get GSI version */ + ipa3_ctx->gsi_ver = ipa3_get_gsi_ver(ipa3_res.ipa_hw_type); + result = ipa3_bind_api_controller(ipa3_res.ipa_hw_type, api_ctrl); if (result) { IPAERR("IPA API binding failed\n"); diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h index 354f8cdf2321..c7e7f8e0268b 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h @@ -1868,6 +1868,7 @@ struct ipa3_app_clock_vote { * @ipa_hw_type: type of IPA HW type (e.g. IPA 1.0, IPA 1.1 etc') * @ipa_hw_type_index: index of IPA HW type (e.g. IPA_4_0, IPA_4_0_MHI etc') * @ipa3_hw_mode: mode of IPA HW mode (e.g. Normal, Virtual or over PCIe) + * @gsi_ver: version of GSI * @use_ipa_teth_bridge: use tethering bridge driver * @modem_cfg_emb_pipe_flt: modem configure embedded pipe filtering rules * @logbuf: ipc log buffer for high priority messages @@ -1988,6 +1989,7 @@ struct ipa3_context { enum ipa_hw_type ipa_hw_type; u8 hw_type_index; enum ipa3_hw_mode ipa3_hw_mode; + enum gsi_ver gsi_ver; enum ipa3_platform_type platform_type; bool ipa_config_is_mhi; bool use_ipa_teth_bridge;