All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Johannes Berg <johannes.berg@intel.com>,
	Luca Coelho <luciano.coelho@intel.com>,
	Kalle Valo <kvalo@codeaurora.org>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.4 05/36] iwlwifi: pcie: set LTR to avoid completion timeout
Date: Mon, 14 Dec 2020 18:27:49 +0100	[thread overview]
Message-ID: <20201214172543.578735535@linuxfoundation.org> (raw)
In-Reply-To: <20201214172543.302523401@linuxfoundation.org>

From: Johannes Berg <johannes.berg@intel.com>

[ Upstream commit edb625208d84aef179e3f16590c1c582fc5fdae6 ]

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 <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/iwlwifi.20201107104557.d83d591c05ba.I42885c9fb500bc08b9a4c07c4ff3d436cc7a3c84@changeid
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/wireless/intel/iwlwifi/iwl-csr.h  | 10 ++++++++++
 .../intel/iwlwifi/pcie/ctxt-info-gen3.c       | 20 +++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-csr.h b/drivers/net/wireless/intel/iwlwifi/iwl-csr.h
index 695bbaa86273d..12ef3a0420515 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-csr.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-csr.h
@@ -147,6 +147,16 @@
 #define CSR_MAC_SHADOW_REG_CTL2		(CSR_BASE + 0x0AC)
 #define CSR_MAC_SHADOW_REG_CTL2_RX_WAKE	0xFFFF
 
+/* LTR control (since IWL_DEVICE_FAMILY_22000) */
+#define CSR_LTR_LONG_VAL_AD			(CSR_BASE + 0x0D4)
+#define CSR_LTR_LONG_VAL_AD_NO_SNOOP_REQ	0x80000000
+#define CSR_LTR_LONG_VAL_AD_NO_SNOOP_SCALE	0x1c000000
+#define CSR_LTR_LONG_VAL_AD_NO_SNOOP_VAL	0x03ff0000
+#define CSR_LTR_LONG_VAL_AD_SNOOP_REQ		0x00008000
+#define CSR_LTR_LONG_VAL_AD_SNOOP_SCALE		0x00001c00
+#define CSR_LTR_LONG_VAL_AD_SNOOP_VAL		0x000003ff
+#define CSR_LTR_LONG_VAL_AD_SCALE_USEC		2
+
 /* GIO Chicken Bits (PCI Express bus link power management) */
 #define CSR_GIO_CHICKEN_BITS    (CSR_BASE+0x100)
 
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c
index 74980382e64c8..7a5b024a6d384 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c
@@ -180,6 +180,26 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans,
 
 	iwl_set_bit(trans, CSR_CTXT_INFO_BOOT_CTRL,
 		    CSR_AUTO_FUNC_BOOT_ENA);
+
+	if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_AX210) {
+		/*
+		 * The firmware initializes this again later (to a smaller
+		 * value), but for the boot process initialize the LTR to
+		 * ~250 usec.
+		 */
+		u32 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);
+
+		iwl_write32(trans, CSR_LTR_LONG_VAL_AD, val);
+	}
+
 	if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210)
 		iwl_write_umac_prph(trans, UREG_CPU_INIT_RUN, 1);
 	else
-- 
2.27.0




  parent reply	other threads:[~2020-12-14 17:38 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14 17:27 [PATCH 5.4 00/36] 5.4.84-rc1 review Greg Kroah-Hartman
2020-12-14 17:27 ` [PATCH 5.4 01/36] Kbuild: do not emit debug info for assembly with LLVM_IAS=1 Greg Kroah-Hartman
2020-12-14 17:27 ` [PATCH 5.4 02/36] x86/lib: Change .weak to SYM_FUNC_START_WEAK for arch/x86/lib/mem*_64.S Greg Kroah-Hartman
2020-12-14 17:27 ` [PATCH 5.4 03/36] iwlwifi: pcie: limit memory read spin time Greg Kroah-Hartman
2020-12-14 17:27 ` [PATCH 5.4 04/36] arm64: dts: rockchip: Assign a fixed index to mmc devices on rk3399 boards Greg Kroah-Hartman
2020-12-14 17:27 ` Greg Kroah-Hartman [this message]
2020-12-14 17:27 ` [PATCH 5.4 06/36] iwlwifi: mvm: fix kernel panic in case of assert during CSA Greg Kroah-Hartman
2020-12-14 17:27 ` [PATCH 5.4 07/36] powerpc: Drop -me200 addition to build flags Greg Kroah-Hartman
2020-12-14 17:27 ` [PATCH 5.4 08/36] arm64: dts: broadcom: clear the warnings caused by empty dma-ranges Greg Kroah-Hartman
2020-12-14 17:27 ` [PATCH 5.4 09/36] ARC: stack unwinding: dont assume non-current task is sleeping Greg Kroah-Hartman
2020-12-14 17:27 ` [PATCH 5.4 10/36] scsi: ufs: Make sure clk scaling happens only when HBA is runtime ACTIVE Greg Kroah-Hartman
2020-12-14 17:27 ` [PATCH 5.4 11/36] interconnect: qcom: qcs404: Remove GPU and display RPM IDs Greg Kroah-Hartman
2020-12-14 17:27 ` [PATCH 5.4 12/36] ibmvnic: skip tx timeout reset while in resetting Greg Kroah-Hartman
2020-12-14 17:27 ` [PATCH 5.4 13/36] irqchip/gic-v3-its: Unconditionally save/restore the ITS state on suspend Greg Kroah-Hartman
2020-12-14 17:27 ` [PATCH 5.4 14/36] spi: spi-nxp-fspi: fix fspi panic by unexpected interrupts Greg Kroah-Hartman
2020-12-14 17:27 ` [PATCH 5.4 15/36] soc: fsl: dpio: Get the cpumask through cpumask_of(cpu) Greg Kroah-Hartman
2020-12-14 17:28 ` [PATCH 5.4 16/36] arm64: tegra: Disable the ACONNECT for Jetson TX2 Greg Kroah-Hartman
2020-12-14 17:28 ` [PATCH 5.4 17/36] platform/x86: thinkpad_acpi: Do not report SW_TABLET_MODE on Yoga 11e Greg Kroah-Hartman
2020-12-14 17:28 ` [PATCH 5.4 18/36] platform/x86: thinkpad_acpi: Add BAT1 is primary battery quirk for Thinkpad Yoga 11e 4th gen Greg Kroah-Hartman
2020-12-14 17:28 ` [PATCH 5.4 19/36] platform/x86: acer-wmi: add automatic keyboard background light toggle key as KEY_LIGHTS_TOGGLE Greg Kroah-Hartman
2020-12-14 17:28 ` [PATCH 5.4 20/36] platform/x86: intel-vbtn: Support for tablet mode on HP Pavilion 13 x360 PC Greg Kroah-Hartman
2020-12-14 17:28 ` [PATCH 5.4 21/36] platform/x86: touchscreen_dmi: Add info for the Irbis TW118 tablet Greg Kroah-Hartman
2020-12-14 17:28 ` [PATCH 5.4 22/36] can: m_can: m_can_dev_setup(): add support for bosch mcan version 3.3.0 Greg Kroah-Hartman
2020-12-14 17:28 ` [PATCH 5.4 23/36] ktest.pl: Fix incorrect reboot for grub2bls Greg Kroah-Hartman
2020-12-14 17:28 ` [PATCH 5.4 24/36] Input: cm109 - do not stomp on control URB Greg Kroah-Hartman
2020-12-14 17:28 ` [PATCH 5.4 25/36] Input: i8042 - add Acer laptops to the i8042 reset list Greg Kroah-Hartman
2020-12-14 17:28 ` [PATCH 5.4 26/36] pinctrl: amd: remove debounce filter setting in IRQ type setting Greg Kroah-Hartman
2020-12-14 17:28 ` [PATCH 5.4 27/36] mmc: block: Fixup condition for CMD13 polling for RPMB requests Greg Kroah-Hartman
2020-12-14 17:28 ` [PATCH 5.4 28/36] drm/i915/display/dp: Compute the correct slice count for VDSC on DP Greg Kroah-Hartman
2020-12-14 17:28 ` [PATCH 5.4 29/36] kbuild: avoid static_assert for genksyms Greg Kroah-Hartman
2020-12-14 17:28 ` [PATCH 5.4 30/36] proc: use untagged_addr() for pagemap_read addresses Greg Kroah-Hartman
2020-12-14 17:28 ` [PATCH 5.4 31/36] scsi: be2iscsi: Revert "Fix a theoretical leak in beiscsi_create_eqs()" Greg Kroah-Hartman
2020-12-14 17:28 ` [PATCH 5.4 32/36] x86/mm/mem_encrypt: Fix definition of PMD_FLAGS_DEC_WP Greg Kroah-Hartman
2020-12-14 17:28 ` [PATCH 5.4 33/36] x86/membarrier: Get rid of a dubious optimization Greg Kroah-Hartman
2020-12-14 17:28 ` [PATCH 5.4 34/36] x86/apic/vector: Fix ordering in vector assignment Greg Kroah-Hartman
2020-12-14 17:28 ` [PATCH 5.4 35/36] mm/zsmalloc.c: drop ZSMALLOC_PGTABLE_MAPPING Greg Kroah-Hartman
2020-12-14 17:28 ` [PATCH 5.4 36/36] compiler.h: fix barrier_data() on clang Greg Kroah-Hartman
2020-12-14 22:21 ` [PATCH 5.4 00/36] 5.4.84-rc1 review Shuah Khan
2020-12-15  6:51 ` Naresh Kamboju
2020-12-15  9:06 ` Jon Hunter
2020-12-15 20:31 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201214172543.578735535@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=johannes.berg@intel.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luciano.coelho@intel.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.