diff --git a/drivers/platform/msm/gsi/gsi.c b/drivers/platform/msm/gsi/gsi.c index 857109d0df31..d196133dd899 100644 --- a/drivers/platform/msm/gsi/gsi.c +++ b/drivers/platform/msm/gsi/gsi.c @@ -2105,7 +2105,7 @@ static void gsi_program_chan_ctx_qos(struct gsi_chan_props *props, GSI_EE_n_GSI_CH_k_QOS_MAX_PREFETCH_BMSK) | ((props->use_db_eng << GSI_EE_n_GSI_CH_k_QOS_USE_DB_ENG_SHFT) & - GSI_EE_n_GSI_CH_k_QOS_USE_DB_ENG_BMSK)); + GSI_EE_n_GSI_CH_k_QOS_USE_DB_ENG_BMSK)); if (gsi_ctx->per.ver >= GSI_VER_2_0) val |= ((props->prefetch_mode << GSI_EE_n_GSI_CH_k_QOS_USE_ESCAPE_BUF_ONLY_SHFT) @@ -2141,6 +2141,35 @@ static void gsi_program_chan_ctx_qos_v2_5(struct gsi_chan_props *props, GSI_V2_5_EE_n_GSI_CH_k_QOS_OFFS(props->ch_id, ee)); } +static void gsi_program_chan_ctx_qos_v2_9(struct gsi_chan_props *props, + unsigned int ee) +{ + uint32_t val; + + val = + (((props->low_weight << + GSI_V2_9_EE_n_GSI_CH_k_QOS_WRR_WEIGHT_SHFT) & + GSI_V2_9_EE_n_GSI_CH_k_QOS_WRR_WEIGHT_BMSK) | + ((props->max_prefetch << + GSI_V2_9_EE_n_GSI_CH_k_QOS_MAX_PREFETCH_SHFT) & + GSI_V2_9_EE_n_GSI_CH_k_QOS_MAX_PREFETCH_BMSK) | + ((props->use_db_eng << + GSI_V2_9_EE_n_GSI_CH_k_QOS_USE_DB_ENG_SHFT) & + GSI_V2_9_EE_n_GSI_CH_k_QOS_USE_DB_ENG_BMSK) | + ((props->prefetch_mode << + GSI_V2_9_EE_n_GSI_CH_k_QOS_PREFETCH_MODE_SHFT) & + GSI_V2_9_EE_n_GSI_CH_k_QOS_PREFETCH_MODE_BMSK) | + ((props->empty_lvl_threshold << + GSI_V2_9_EE_n_GSI_CH_k_QOS_EMPTY_LVL_THRSHOLD_SHFT) & + GSI_V2_9_EE_n_GSI_CH_k_QOS_EMPTY_LVL_THRSHOLD_BMSK) | + ((props->db_in_bytes << + GSI_V2_9_EE_n_GSI_CH_k_QOS_DB_IN_BYTES_SHFT) & + GSI_V2_9_EE_n_GSI_CH_k_QOS_DB_IN_BYTES_BMSK)); + + gsi_writel(val, gsi_ctx->base + + GSI_V2_9_EE_n_GSI_CH_k_QOS_OFFS(props->ch_id, ee)); +} + static void gsi_program_chan_ctx(struct gsi_chan_props *props, unsigned int ee, uint8_t erindex) { @@ -2205,7 +2234,9 @@ static void gsi_program_chan_ctx(struct gsi_chan_props *props, unsigned int ee, gsi_writel(val, gsi_ctx->base + GSI_EE_n_GSI_CH_k_CNTXT_3_OFFS(props->ch_id, ee)); - if (gsi_ctx->per.ver >= GSI_VER_2_5) + if (gsi_ctx->per.ver >= GSI_VER_2_9) + gsi_program_chan_ctx_qos_v2_9(props, ee); + else if (gsi_ctx->per.ver >= GSI_VER_2_5) gsi_program_chan_ctx_qos_v2_5(props, ee); else gsi_program_chan_ctx_qos(props, ee); diff --git a/drivers/platform/msm/gsi/gsi_reg_v2.h b/drivers/platform/msm/gsi/gsi_reg_v2.h index e93180c5dee2..1615697521a0 100644 --- a/drivers/platform/msm/gsi/gsi_reg_v2.h +++ b/drivers/platform/msm/gsi/gsi_reg_v2.h @@ -550,6 +550,20 @@ #define GSI_V2_5_EE_n_GSI_CH_k_QOS_WRR_WEIGHT_BMSK 0xf #define GSI_V2_5_EE_n_GSI_CH_k_QOS_WRR_WEIGHT_SHFT 0x0 +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_OFFS(k, n) \ + (GSI_GSI_REG_BASE_OFFS + 0x0000f05c + 0x4000 * (n) + 0x80 * (k)) +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_DB_IN_BYTES_BMSK 0x1000000 +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_DB_IN_BYTES_SHFT 0x18 +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_EMPTY_LVL_THRSHOLD_BMSK 0xff0000 +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_EMPTY_LVL_THRSHOLD_SHFT 0x10 +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_PREFETCH_MODE_BMSK 0x3c00 +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_PREFETCH_MODE_SHFT 0xa +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_USE_DB_ENG_BMSK 0x200 +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_USE_DB_ENG_SHFT 0x9 +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_MAX_PREFETCH_BMSK 0x100 +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_MAX_PREFETCH_SHFT 0x8 +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_WRR_WEIGHT_BMSK 0xf +#define GSI_V2_9_EE_n_GSI_CH_k_QOS_WRR_WEIGHT_SHFT 0x0 #define GSI_EE_n_GSI_CH_k_SCRATCH_0_OFFS(k, n) \ (GSI_GSI_REG_BASE_OFFS + 0x0000f060 + 0x4000 * (n) + 0x80 * (k)) diff --git a/drivers/platform/msm/ipa/ipa_clients/ipa_usb.c b/drivers/platform/msm/ipa/ipa_clients/ipa_usb.c index 06093bffc554..24535a2a31d7 100644 --- a/drivers/platform/msm/ipa/ipa_clients/ipa_usb.c +++ b/drivers/platform/msm/ipa/ipa_clients/ipa_usb.c @@ -1192,6 +1192,7 @@ static int ipa3_usb_request_xdci_channel( chan_params.chan_params.use_db_eng = GSI_CHAN_DIRECT_MODE; else chan_params.chan_params.use_db_eng = GSI_CHAN_DB_MODE; + chan_params.chan_params.db_in_bytes = 1; chan_params.chan_params.max_prefetch = GSI_ONE_PREFETCH_SEG; if (params->dir == GSI_CHAN_DIR_FROM_GSI) chan_params.chan_params.low_weight = diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c index ed77d983c392..ac0d6f0f2777 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c @@ -4481,6 +4481,7 @@ static int ipa_gsi_setup_transfer_ring(struct ipa3_ep_context *ep, gsi_channel_props.low_weight = IPA_GSI_MAX_CH_LOW_WEIGHT; else gsi_channel_props.low_weight = 1; + gsi_channel_props.db_in_bytes = 1; gsi_channel_props.prefetch_mode = gsi_ep_info->prefetch_mode; gsi_channel_props.empty_lvl_threshold = gsi_ep_info->prefetch_threshold; gsi_channel_props.chan_user_data = user_data; @@ -4805,6 +4806,7 @@ int ipa_gsi_ch20_wa(void) else gsi_channel_props.use_db_eng = GSI_CHAN_DB_MODE; + gsi_channel_props.db_in_bytes = 1; gsi_channel_props.max_prefetch = GSI_ONE_PREFETCH_SEG; gsi_channel_props.low_weight = 1; gsi_channel_props.err_cb = ipa_gsi_chan_err_cb; diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_mhi.c b/drivers/platform/msm/ipa/ipa_v3/ipa_mhi.c index a9816c6d4096..184c622f173c 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_mhi.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_mhi.c @@ -289,6 +289,7 @@ static int ipa_mhi_start_gsi_channel(enum ipa_client_type client, else ch_props.use_db_eng = GSI_CHAN_DB_MODE; + ch_props.db_in_bytes = 1; ch_props.max_prefetch = GSI_ONE_PREFETCH_SEG; ch_props.low_weight = 1; ch_props.prefetch_mode = ep_cfg->prefetch_mode; 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 26d9b338a8e8..eb3b3ad0222b 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_wdi3_i.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_wdi3_i.c @@ -151,6 +151,7 @@ static int ipa3_setup_wdi3_gsi_channel(u8 is_smmu_enabled, } else gsi_channel_props.ch_id = gsi_ep_info->ipa_gsi_chan_num; + gsi_channel_props.db_in_bytes = 0; gsi_channel_props.evt_ring_hdl = ep->gsi_evt_ring_hdl; gsi_channel_props.re_size = GSI_CHAN_RE_SIZE_16B; gsi_channel_props.use_db_eng = GSI_CHAN_DB_MODE; diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_wigig_i.c b/drivers/platform/msm/ipa/ipa_v3/ipa_wigig_i.c index 52546bd0374b..faab2b1fe689 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_wigig_i.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_wigig_i.c @@ -683,6 +683,7 @@ static int ipa3_wigig_config_gsi(bool Rx, channel_props.evt_ring_hdl = ep->gsi_evt_ring_hdl; channel_props.xfer_cb = NULL; + channel_props.db_in_bytes = 0; channel_props.use_db_eng = GSI_CHAN_DB_MODE; channel_props.max_prefetch = GSI_ONE_PREFETCH_SEG; channel_props.prefetch_mode = ep_gsi->prefetch_mode; diff --git a/include/linux/msm_gsi.h b/include/linux/msm_gsi.h index 33c7f3582911..7a680da1416f 100644 --- a/include/linux/msm_gsi.h +++ b/include/linux/msm_gsi.h @@ -418,6 +418,7 @@ struct gsi_chan_props { uint16_t ring_len; uint16_t max_re_expected; uint64_t ring_base_addr; + uint8_t db_in_bytes; void *ring_base_vaddr; enum gsi_chan_use_db_eng use_db_eng; enum gsi_max_prefetch max_prefetch;