Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp851531ybi; Fri, 12 Jul 2019 05:42:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqyELvRoqSZEzjRD3PGF0ev5aoRvntGtmIN2sog1TWf4jqYvk0n8p6uUnMdQviet8U39oVKO X-Received: by 2002:a17:902:2aa9:: with SMTP id j38mr10790099plb.206.1562935361763; Fri, 12 Jul 2019 05:42:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562935361; cv=none; d=google.com; s=arc-20160816; b=iUwybD0avGqzjIIXjPvJU5YXq6yQYyPP0Wj4CgKGgq86B/1u7rWVPVM6Rv74UZU7gT Ei9/TJzuHpDzjEWiIobOevPoEHgmrpYGCFBDYNSlL+zvr8jC2nD5i3uLFeb7sQ+xxA/r HnkQ/I9zpNfl17q0J777IxahMODhwPFVyVqqCeV+1skzkpSlLRb8inpwEVKC94Z/EAux Cd96jw1+9ndKapyNydkmjcYM7NqSdjmhDxta0ociFqJuA8iFKxiXZesey5xRpK5JXSbZ 3XlrSWrtMNYZ8FUy461IpPsQlb8x2BLn/1gQ6fbdyYikueSct6tB3/vo17a71yYbW1jA 2EuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dNJW9bcQ3iCM1Sc7Ud4dJ6bdd2vvrCVSmByTuJ98Luo=; b=BRbjwaF2f2ItlnSe9EA09Ve0VzmddLKcHMDkheo+FkmQHdS4w0cb13W86HbfLc+t+D InT6suOxxpsF8SvsBqCPWqOKCmdDFnoSafs1g0B1yXWLIeSqSKTihGhdWddkauC/XEP5 vQwJHGFxKt+hsKmXnY4eRvXWAodqxmnM4QEMuLransNKodYvwAe9wJJamk+uCHo2SaEP /yXxem2+8OGeN+v6C9Gl/7Mg8/8cSISsWFstp71OTdytv4iZBzQL3FWQnnBeq7bE5nGY zyRpoMDhfnOuOc8bssdBjmY7lqIB3B25ibfxUcQ331GQRCq0nUJkMYhfuJSXUjQDH8iN h+xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WlJeWEBN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x139si3721442pgx.251.2019.07.12.05.42.26; Fri, 12 Jul 2019 05:42:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WlJeWEBN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729181AbfGLMkS (ORCPT + 99 others); Fri, 12 Jul 2019 08:40:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:36234 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728322AbfGLMZs (ORCPT ); Fri, 12 Jul 2019 08:25:48 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 132182084B; Fri, 12 Jul 2019 12:25:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934347; bh=GyHefXivisLVR/eF9qxTNRPybD7EwF9fKQxmdjLmPJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WlJeWEBN3Aqsr3/zJoiW5uYAaSk6gikO2tln5uWuiXC3bSsgIWYvS+RyPzjYe5qse 4aePAfT3dFnH7pb25XM/EpAHWhqG7eq6J/4DB2U1w02IY6M5IwZFdeRBtlnPIZbhHJ hrsQuTTJBrhAy4o0Vz0nV3fwsBhyxyTCMuROJESI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shahar S Matityahu , Luca Coelho , Kalle Valo , Sasha Levin Subject: [PATCH 5.1 025/138] iwlwifi: clear persistence bit according to device family Date: Fri, 12 Jul 2019 14:18:09 +0200 Message-Id: <20190712121629.670987476@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121628.731888964@linuxfoundation.org> References: <20190712121628.731888964@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 44f61b5c832c4085fcf476484efeaeef96dcfb8b ] The driver attempts to clear persistence bit on any device familiy even though only 9000 and 22000 families require it. Clear the bit only on the relevant device families. Each HW has different address to the write protection register. Use the right register for each HW Signed-off-by: Shahar S Matityahu Fixes: 8954e1eb2270 ("iwlwifi: trans: Clear persistence bit when starting the FW") Signed-off-by: Luca Coelho Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- drivers/net/wireless/intel/iwlwifi/iwl-prph.h | 7 ++- .../net/wireless/intel/iwlwifi/pcie/trans.c | 46 +++++++++++++------ 2 files changed, 39 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-prph.h b/drivers/net/wireless/intel/iwlwifi/iwl-prph.h index 1af9f9e1ecd4..0c0799d13e15 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-prph.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-prph.h @@ -402,7 +402,12 @@ enum aux_misc_master1_en { #define AUX_MISC_MASTER1_SMPHR_STATUS 0xA20800 #define RSA_ENABLE 0xA24B08 #define PREG_AUX_BUS_WPROT_0 0xA04CC0 -#define PREG_PRPH_WPROT_0 0xA04CE0 + +/* device family 9000 WPROT register */ +#define PREG_PRPH_WPROT_9000 0xA04CE0 +/* device family 22000 WPROT register */ +#define PREG_PRPH_WPROT_22000 0xA04D00 + #define SB_CPU_1_STATUS 0xA01E30 #define SB_CPU_2_STATUS 0xA01E34 #define UMAG_SB_CPU_1_STATUS 0xA038C0 diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c index c4375b868901..2a03d34afa3b 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c @@ -1696,26 +1696,26 @@ static int iwl_pcie_init_msix_handler(struct pci_dev *pdev, return 0; } -static int _iwl_trans_pcie_start_hw(struct iwl_trans *trans, bool low_power) +static int iwl_trans_pcie_clear_persistence_bit(struct iwl_trans *trans) { - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); - u32 hpm; - int err; - - lockdep_assert_held(&trans_pcie->mutex); + u32 hpm, wprot; - err = iwl_pcie_prepare_card_hw(trans); - if (err) { - IWL_ERR(trans, "Error while preparing HW: %d\n", err); - return err; + switch (trans->cfg->device_family) { + case IWL_DEVICE_FAMILY_9000: + wprot = PREG_PRPH_WPROT_9000; + break; + case IWL_DEVICE_FAMILY_22000: + wprot = PREG_PRPH_WPROT_22000; + break; + default: + return 0; } hpm = iwl_read_umac_prph_no_grab(trans, HPM_DEBUG); if (hpm != 0xa5a5a5a0 && (hpm & PERSISTENCE_BIT)) { - int wfpm_val = iwl_read_umac_prph_no_grab(trans, - PREG_PRPH_WPROT_0); + u32 wprot_val = iwl_read_umac_prph_no_grab(trans, wprot); - if (wfpm_val & PREG_WFPM_ACCESS) { + if (wprot_val & PREG_WFPM_ACCESS) { IWL_ERR(trans, "Error, can not clear persistence bit\n"); return -EPERM; @@ -1724,6 +1724,26 @@ static int _iwl_trans_pcie_start_hw(struct iwl_trans *trans, bool low_power) hpm & ~PERSISTENCE_BIT); } + return 0; +} + +static int _iwl_trans_pcie_start_hw(struct iwl_trans *trans, bool low_power) +{ + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); + int err; + + lockdep_assert_held(&trans_pcie->mutex); + + err = iwl_pcie_prepare_card_hw(trans); + if (err) { + IWL_ERR(trans, "Error while preparing HW: %d\n", err); + return err; + } + + err = iwl_trans_pcie_clear_persistence_bit(trans); + if (err) + return err; + iwl_trans_pcie_sw_reset(trans); err = iwl_pcie_apm_init(trans); -- 2.20.1