Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2962249pxu; Mon, 14 Dec 2020 16:08:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJy3qM324LZS4IgecjpU7r9PVxgb+cw4AcbE7V/GRwiWObqZbXgMcBJ1EJRKc4xxDKTJt7xH X-Received: by 2002:a05:6402:22e1:: with SMTP id dn1mr27811764edb.347.1607990900008; Mon, 14 Dec 2020 16:08:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607990900; cv=none; d=google.com; s=arc-20160816; b=gRJexZl4IX2k1GWaCVazXvFU043KD5F21nol5rK5bttB1rdeIcJMlQ+Xjp6yptk9qX xF+wV0yozg73ZlDw8adPIMyZ4pnTUs2BdZCPpJoIcHbUOqNBim1S7h+l7IcjLzwuuOzX l2QBqc4/P92xvpvVC5frszF9sy4J8y+qy6reB14ywSTQHOcBBHyv2u/X0C5pgcKeqyp7 kAlZHygsM5Mcpjp2nioPzzuHb5Ncf0a7B4Qssgsk6R8DfCS8cs0UERDXO/pPdhbF/Hkq E6ZU2kRpB2/cD0pMu0CFjnNBOIHlGmu0qlo3nHj9ROOXToFCcSAhmu+I39aNLy9sSzyG fYBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=5NpjlJMnaNb4NVIiXHV1onKAEZUKYYeeNmQ16bZ2KY0=; b=dcZu6X4WDaBO6r+p3qb2PiBYSeKteethQ52/6Vlp453q3I8wuXT6eCDGMiR72A0awM 6IRq9dj8dkl1wbTrCCMDTZBnXhPAKkVvEzX7sz/rVjvuAA5D92bRqAA23gQ8mr1Xixv4 G4yRhSfCjMqE34RQM+NYCyOULFwg2/jQ1v3zEEmkoOZisIY2fqSyW/FM7ry3/rqZbx8d 3EYjlKMAd5BADTqtHCs/O+jw0FKxIb4DzMbhSFfgDbk8eGbeIcSaFMjSy/ZUMQBSfpvr cCHctTTv6d9f7PoZ0z38yFzzIb1yEcXQRDmeY/kfgEnWuCnKHVePDLGc2nTusC9Q4iUJ kLmg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b4si45551ejv.71.2020.12.14.16.07.57; Mon, 14 Dec 2020 16:08:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2441010AbgLNSvw (ORCPT + 99 others); Mon, 14 Dec 2020 13:51:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:47320 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502243AbgLNRhh (ORCPT ); Mon, 14 Dec 2020 12:37:37 -0500 From: Greg Kroah-Hartman Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Luca Coelho , Kalle Valo , Sasha Levin Subject: [PATCH 5.9 044/105] iwlwifi: pcie: set LTR to avoid completion timeout Date: Mon, 14 Dec 2020 18:28:18 +0100 Message-Id: <20201214172557.402820686@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201214172555.280929671@linuxfoundation.org> References: <20201214172555.280929671@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johannes Berg [ 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 Signed-off-by: Luca Coelho Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/iwlwifi.20201107104557.d83d591c05ba.I42885c9fb500bc08b9a4c07c4ff3d436cc7a3c84@changeid Signed-off-by: Sasha Levin --- 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 cb9e8e189a1a4..1d48c7d7fffd4 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 1ab1366004159..0fc2a6e49f9ee 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c @@ -252,6 +252,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