Skip to content

Commit edb6252

Browse files
jmberg-intelKalle Valo
authored andcommitted
iwlwifi: pcie: set LTR to avoid completion timeout
On some platforms, the preset values aren't correct and then we may get a completion timeout in the firmware. Change the LTR configuration to avoid that. The firmware will do some more complex reinit of this later, but for the boot process we use ~250usec. Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Luca Coelho <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/iwlwifi.20201107104557.d83d591c05ba.I42885c9fb500bc08b9a4c07c4ff3d436cc7a3c84@changeid
1 parent 97cc169 commit edb6252

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

drivers/net/wireless/intel/iwlwifi/iwl-csr.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,16 @@
147147
#define CSR_MAC_SHADOW_REG_CTL2 (CSR_BASE + 0x0AC)
148148
#define CSR_MAC_SHADOW_REG_CTL2_RX_WAKE 0xFFFF
149149

150+
/* LTR control (since IWL_DEVICE_FAMILY_22000) */
151+
#define CSR_LTR_LONG_VAL_AD (CSR_BASE + 0x0D4)
152+
#define CSR_LTR_LONG_VAL_AD_NO_SNOOP_REQ 0x80000000
153+
#define CSR_LTR_LONG_VAL_AD_NO_SNOOP_SCALE 0x1c000000
154+
#define CSR_LTR_LONG_VAL_AD_NO_SNOOP_VAL 0x03ff0000
155+
#define CSR_LTR_LONG_VAL_AD_SNOOP_REQ 0x00008000
156+
#define CSR_LTR_LONG_VAL_AD_SNOOP_SCALE 0x00001c00
157+
#define CSR_LTR_LONG_VAL_AD_SNOOP_VAL 0x000003ff
158+
#define CSR_LTR_LONG_VAL_AD_SCALE_USEC 2
159+
150160
/* GIO Chicken Bits (PCI Express bus link power management) */
151161
#define CSR_GIO_CHICKEN_BITS (CSR_BASE+0x100)
152162

drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,26 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans,
252252

253253
iwl_set_bit(trans, CSR_CTXT_INFO_BOOT_CTRL,
254254
CSR_AUTO_FUNC_BOOT_ENA);
255+
256+
if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_AX210) {
257+
/*
258+
* The firmware initializes this again later (to a smaller
259+
* value), but for the boot process initialize the LTR to
260+
* ~250 usec.
261+
*/
262+
u32 val = CSR_LTR_LONG_VAL_AD_NO_SNOOP_REQ |
263+
u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC,
264+
CSR_LTR_LONG_VAL_AD_NO_SNOOP_SCALE) |
265+
u32_encode_bits(250,
266+
CSR_LTR_LONG_VAL_AD_NO_SNOOP_VAL) |
267+
CSR_LTR_LONG_VAL_AD_SNOOP_REQ |
268+
u32_encode_bits(CSR_LTR_LONG_VAL_AD_SCALE_USEC,
269+
CSR_LTR_LONG_VAL_AD_SNOOP_SCALE) |
270+
u32_encode_bits(250, CSR_LTR_LONG_VAL_AD_SNOOP_VAL);
271+
272+
iwl_write32(trans, CSR_LTR_LONG_VAL_AD, val);
273+
}
274+
255275
if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210)
256276
iwl_write_umac_prph(trans, UREG_CPU_INIT_RUN, 1);
257277
else

0 commit comments

Comments
 (0)