diff --git a/dp/wifi3.0/dp_ipa.c b/dp/wifi3.0/dp_ipa.c index 43a69b10c5..914fc556a3 100644 --- a/dp/wifi3.0/dp_ipa.c +++ b/dp/wifi3.0/dp_ipa.c @@ -317,7 +317,8 @@ static void dp_tx_ipa_uc_detach(struct dp_soc *soc, struct dp_pdev *pdev) soc->ipa_uc_tx_rsc.tx_buf_pool_vaddr_unaligned = NULL; ipa_res = &pdev->ipa_resource; - iounmap(ipa_res->tx_comp_doorbell_vaddr); + if (!ipa_res->is_db_ddr_mapped) + iounmap(ipa_res->tx_comp_doorbell_vaddr); qdf_mem_free_sgtable(&ipa_res->tx_ring.sgtable); qdf_mem_free_sgtable(&ipa_res->tx_comp_ring.sgtable); @@ -763,7 +764,11 @@ QDF_STATUS dp_ipa_set_doorbell_paddr(struct cdp_soc_t *soc_hdl, uint8_t pdev_id) if (!wlan_cfg_is_ipa_enabled(soc->wlan_cfg_ctx)) return QDF_STATUS_SUCCESS; - ipa_res->tx_comp_doorbell_vaddr = + if (ipa_res->is_db_ddr_mapped) + ipa_res->tx_comp_doorbell_vaddr = + phys_to_virt(ipa_res->tx_comp_doorbell_paddr); + else + ipa_res->tx_comp_doorbell_vaddr = ioremap(ipa_res->tx_comp_doorbell_paddr, 4); if (qdf_mem_smmu_s1_enabled(soc->osdev)) { @@ -1311,6 +1316,9 @@ QDF_STATUS dp_ipa_setup(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, ipa_res->rx_ready_doorbell_paddr = QDF_IPA_WDI_CONN_OUT_PARAMS_RX_UC_DB_PA(&pipe_out); + ipa_res->is_db_ddr_mapped = + QDF_IPA_WDI_CONN_OUT_PARAMS_IS_DB_DDR_MAPPED(&pipe_out); + soc->ipa_first_tx_db_access = true; return QDF_STATUS_SUCCESS; diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index dc255a3e87..d911941c7a 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -1704,6 +1704,8 @@ struct dp_ipa_resources { qdf_dma_addr_t tx_comp_doorbell_paddr; uint32_t *tx_comp_doorbell_vaddr; qdf_dma_addr_t rx_ready_doorbell_paddr; + + bool is_db_ddr_mapped; }; #endif diff --git a/qdf/inc/qdf_ipa_wdi3.h b/qdf/inc/qdf_ipa_wdi3.h index cdb133e262..b1b8bd145f 100644 --- a/qdf/inc/qdf_ipa_wdi3.h +++ b/qdf/inc/qdf_ipa_wdi3.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -260,6 +260,8 @@ typedef __qdf_ipa_wdi_conn_out_params_t qdf_ipa_wdi_conn_out_params_t; __QDF_IPA_WDI_CONN_OUT_PARAMS_TX_UC_DB_VA(pipe_out) #define QDF_IPA_WDI_CONN_OUT_PARAMS_RX_UC_DB_PA(pipe_out) \ __QDF_IPA_WDI_CONN_OUT_PARAMS_RX_UC_DB_PA(pipe_out) +#define QDF_IPA_WDI_CONN_OUT_PARAMS_IS_DB_DDR_MAPPED(pipe_out) \ + __QDF_IPA_WDI_CONN_OUT_PARAMS_IS_DB_DDR_MAPPED(pipe_out) /** * qdf_ipa_wdi_perf_profile_t - To set BandWidth profile diff --git a/qdf/linux/src/i_qdf_ipa_wdi3.h b/qdf/linux/src/i_qdf_ipa_wdi3.h index 1b7ee00a39..789f7e1f11 100644 --- a/qdf/linux/src/i_qdf_ipa_wdi3.h +++ b/qdf/linux/src/i_qdf_ipa_wdi3.h @@ -222,6 +222,12 @@ typedef struct ipa_wdi_conn_out_params __qdf_ipa_wdi_conn_out_params_t; (((struct ipa_wdi_conn_out_params *)(pipe_out))->tx_uc_db_pa) #define __QDF_IPA_WDI_CONN_OUT_PARAMS_RX_UC_DB_PA(pipe_out) \ (((struct ipa_wdi_conn_out_params *)(pipe_out))->rx_uc_db_pa) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) +#define __QDF_IPA_WDI_CONN_OUT_PARAMS_IS_DB_DDR_MAPPED(pipe_out) \ + (((struct ipa_wdi_conn_out_params *)(pipe_out))->is_ddr_mapped) +#else +#define __QDF_IPA_WDI_CONN_OUT_PARAMS_IS_DB_DDR_MAPPED(pipe_out) false +#endif /** * __qdf_ipa_wdi_perf_profile_t - To set BandWidth profile