From 915d352b94903ed457d4d7c84588629bbc693b3c Mon Sep 17 00:00:00 2001 From: Michael Adisumarta Date: Tue, 25 Aug 2020 17:49:51 -0700 Subject: [PATCH] msm: ipa3: Following HPG sequence for HOLB enabling Correcting the sequence to dynamically change the HOLB timer. Change-Id: Iefcac36b93f3aee037628e3b0ec81aa5f5636caa Acked-by: Suhas mallesh Signed-off-by: Michael Adisumarta --- .../platform/msm/ipa/ipa_clients/ipa_usb.c | 2 -- drivers/platform/msm/ipa/ipa_v3/ipa_client.c | 2 -- drivers/platform/msm/ipa/ipa_v3/ipa_i.h | 2 ++ drivers/platform/msm/ipa/ipa_v3/ipa_mpm.c | 2 -- drivers/platform/msm/ipa/ipa_v3/ipa_uc_wdi.c | 4 +-- drivers/platform/msm/ipa/ipa_v3/ipa_utils.c | 30 ++++++++++++++----- 6 files changed, 25 insertions(+), 17 deletions(-) diff --git a/drivers/platform/msm/ipa/ipa_clients/ipa_usb.c b/drivers/platform/msm/ipa/ipa_clients/ipa_usb.c index 4c96108e8f15..f2cc0068ae02 100644 --- a/drivers/platform/msm/ipa/ipa_clients/ipa_usb.c +++ b/drivers/platform/msm/ipa/ipa_clients/ipa_usb.c @@ -17,8 +17,6 @@ #define IPA_USB_DEV_READY_TIMEOUT_MSEC 10000 -#define IPA_HOLB_TMR_EN 0x1 - /* GSI channels weights */ #define IPA_USB_DL_CHAN_LOW_WEIGHT 0x5 #define IPA_USB_UL_CHAN_LOW_WEIGHT 0x4 diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_client.c b/drivers/platform/msm/ipa/ipa_v3/ipa_client.c index ccafe882a891..22d92a3e1c1d 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_client.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_client.c @@ -14,8 +14,6 @@ * These values were determined empirically and shows good E2E bi- * directional throughputs */ -#define IPA_HOLB_TMR_EN 0x1 -#define IPA_HOLB_TMR_DIS 0x0 #define IPA_POLL_AGGR_STATE_RETRIES_NUM 3 #define IPA_POLL_AGGR_STATE_SLEEP_MSEC 1 diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h index 0502966ae26b..e00ee682e10f 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h @@ -63,6 +63,8 @@ #define IPA_UC_WAIT_MIN_SLEEP 1000 #define IPA_UC_WAII_MAX_SLEEP 1200 #define IPA_HOLB_TMR_VAL_4_5 31 +#define IPA_HOLB_TMR_DIS 0x0 +#define IPA_HOLB_TMR_EN 0x1 /* * The transport descriptor size was changed to GSI_CHAN_RE_SIZE_16B, but * IPA users still use sps_iovec size as FIFO element size. diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_mpm.c b/drivers/platform/msm/ipa/ipa_v3/ipa_mpm.c index 8902c93ca04f..8b900ec01748 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_mpm.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_mpm.c @@ -65,8 +65,6 @@ #define TETH_AGGR_BYTE_LIMIT 24 #define TETH_AGGR_DL_BYTE_LIMIT 16 #define TRE_BUFF_SIZE 32768 -#define IPA_HOLB_TMR_EN 0x1 -#define IPA_HOLB_TMR_DIS 0x0 #define RNDIS_IPA_DFLT_RT_HDL 0 #define IPA_POLL_FOR_EMPTINESS_NUM 50 #define IPA_POLL_FOR_EMPTINESS_SLEEP_USEC 20 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 1c627357e96b..1260c115afb1 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_uc_wdi.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_uc_wdi.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. */ #include "ipa_i.h" @@ -9,8 +9,6 @@ #include #include "ipa_qmi_service.h" -#define IPA_HOLB_TMR_DIS 0x0 - #define IPA_HW_INTERFACE_WDI_VERSION 0x0001 #define IPA_HW_WDI_RX_MBOX_START_INDEX 48 #define IPA_HW_WDI_TX_MBOX_START_INDEX 50 diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c index 4025c3fd8dce..4f86abbca147 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c @@ -6095,19 +6095,23 @@ int ipa3_cfg_ep_holb(u32 clnt_hdl, const struct ipa_ep_cfg_holb *ep_holb) IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl)); - ipahal_write_reg_n_fields(IPA_ENDP_INIT_HOL_BLOCK_EN_n, clnt_hdl, - ep_holb); - - /* IPA4.5 issue requires HOLB_EN to be written twice */ - if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_5) + if (ep_holb->en == IPA_HOLB_TMR_DIS) { ipahal_write_reg_n_fields(IPA_ENDP_INIT_HOL_BLOCK_EN_n, clnt_hdl, ep_holb); + goto success; + } + + /* Follow HPG sequence to DIS_HOLB, Configure Timer, and HOLB_EN */ + if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_5) { + ipa3_ctx->ep[clnt_hdl].holb.en = IPA_HOLB_TMR_DIS; + ipahal_write_reg_n_fields(IPA_ENDP_INIT_HOL_BLOCK_EN_n, + clnt_hdl, ep_holb); + } /* Configure timer */ if (ipa3_ctx->ipa_hw_type == IPA_HW_v4_2) { ipa3_cal_ep_holb_scale_base_val(ep_holb->tmr_val, - &ipa3_ctx->ep[clnt_hdl].holb); - goto success; + &ipa3_ctx->ep[clnt_hdl].holb); } if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_5) { int res; @@ -6123,9 +6127,19 @@ int ipa3_cfg_ep_holb(u32 clnt_hdl, const struct ipa_ep_cfg_holb *ep_holb) } } -success: ipahal_write_reg_n_fields(IPA_ENDP_INIT_HOL_BLOCK_TIMER_n, clnt_hdl, &ipa3_ctx->ep[clnt_hdl].holb); + + /* Enable HOLB */ + ipa3_ctx->ep[clnt_hdl].holb.en = IPA_HOLB_TMR_EN; + ipahal_write_reg_n_fields(IPA_ENDP_INIT_HOL_BLOCK_EN_n, + clnt_hdl, ep_holb); + /* IPA4.5 issue requires HOLB_EN to be written twice */ + if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_5) + ipahal_write_reg_n_fields(IPA_ENDP_INIT_HOL_BLOCK_EN_n, + clnt_hdl, ep_holb); + +success: IPA_ACTIVE_CLIENTS_DEC_EP(ipa3_get_client_mapping(clnt_hdl)); IPADBG("cfg holb %u ep=%d tmr=%d\n", ep_holb->en, clnt_hdl, ep_holb->tmr_val);