1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00

iwlwifi: pcie: set LTR on more devices

To avoid completion timeouts during device boot, set up the
LTR timeouts on more devices - similar to what we had before
for AX210.

This also corrects the AX210 workaround to be done only on
discrete (non-integrated) devices, otherwise the registers
have no effect.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Fixes: edb625208d ("iwlwifi: pcie: set LTR to avoid completion timeout")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/iwlwifi.20210115130252.fb819e19530b.I0396f82922db66426f52fbb70d32a29c8fd66951@changeid
This commit is contained in:
Johannes Berg 2021-01-15 13:05:54 +02:00 committed by Kalle Valo
parent 0f8d5656b3
commit ed0022da8b
2 changed files with 28 additions and 17 deletions

View file

@ -301,6 +301,12 @@
#define RADIO_RSP_ADDR_POS (6) #define RADIO_RSP_ADDR_POS (6)
#define RADIO_RSP_RD_CMD (3) #define RADIO_RSP_RD_CMD (3)
/* LTR control (Qu only) */
#define HPM_MAC_LTR_CSR 0xa0348c
#define HPM_MAC_LRT_ENABLE_ALL 0xf
/* also uses CSR_LTR_* for values */
#define HPM_UMAC_LTR 0xa03480
/* FW monitor */ /* FW monitor */
#define MON_BUFF_SAMPLE_CTL (0xa03c00) #define MON_BUFF_SAMPLE_CTL (0xa03c00)
#define MON_BUFF_BASE_ADDR (0xa03c1c) #define MON_BUFF_BASE_ADDR (0xa03c1c)

View file

@ -75,6 +75,15 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans,
const struct fw_img *fw) const struct fw_img *fw)
{ {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
u32 ltr_val = CSR_LTR_LONG_VAL_AD_NO_SNOOP_REQ |
u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC,
CSR_LTR_LONG_VAL_AD_NO_SNOOP_SCALE) |
u32_encode_bits(250,
CSR_LTR_LONG_VAL_AD_NO_SNOOP_VAL) |
CSR_LTR_LONG_VAL_AD_SNOOP_REQ |
u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC,
CSR_LTR_LONG_VAL_AD_SNOOP_SCALE) |
u32_encode_bits(250, CSR_LTR_LONG_VAL_AD_SNOOP_VAL);
struct iwl_context_info_gen3 *ctxt_info_gen3; struct iwl_context_info_gen3 *ctxt_info_gen3;
struct iwl_prph_scratch *prph_scratch; struct iwl_prph_scratch *prph_scratch;
struct iwl_prph_scratch_ctrl_cfg *prph_sc_ctrl; struct iwl_prph_scratch_ctrl_cfg *prph_sc_ctrl;
@ -206,23 +215,19 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans,
iwl_set_bit(trans, CSR_CTXT_INFO_BOOT_CTRL, iwl_set_bit(trans, CSR_CTXT_INFO_BOOT_CTRL,
CSR_AUTO_FUNC_BOOT_ENA); CSR_AUTO_FUNC_BOOT_ENA);
if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_AX210) {
/* /*
* The firmware initializes this again later (to a smaller * To workaround hardware latency issues during the boot process,
* value), but for the boot process initialize the LTR to * initialize the LTR to ~250 usec (see ltr_val above).
* ~250 usec. * The firmware initializes this again later (to a smaller value).
*/ */
u32 val = CSR_LTR_LONG_VAL_AD_NO_SNOOP_REQ | if ((trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_AX210 ||
u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC, trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000) &&
CSR_LTR_LONG_VAL_AD_NO_SNOOP_SCALE) | !trans->trans_cfg->integrated) {
u32_encode_bits(250, iwl_write32(trans, CSR_LTR_LONG_VAL_AD, ltr_val);
CSR_LTR_LONG_VAL_AD_NO_SNOOP_VAL) | } else if (trans->trans_cfg->integrated &&
CSR_LTR_LONG_VAL_AD_SNOOP_REQ | trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000) {
u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC, iwl_write_prph(trans, HPM_MAC_LTR_CSR, HPM_MAC_LRT_ENABLE_ALL);
CSR_LTR_LONG_VAL_AD_SNOOP_SCALE) | iwl_write_prph(trans, HPM_UMAC_LTR, ltr_val);
u32_encode_bits(250, CSR_LTR_LONG_VAL_AD_SNOOP_VAL);
iwl_write32(trans, CSR_LTR_LONG_VAL_AD, val);
} }
if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210)