From patchwork Mon Mar 2 12:22:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 5912021 Return-Path: X-Original-To: patchwork-ath10k@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3A24A9F380 for ; Mon, 2 Mar 2015 12:26:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 54458201B9 for ; Mon, 2 Mar 2015 12:26:27 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 795522015E for ; Mon, 2 Mar 2015 12:26:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YSPQP-0007bK-R6; Mon, 02 Mar 2015 12:26:17 +0000 Received: from mail-lb0-x233.google.com ([2a00:1450:4010:c04::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YSPO2-0005Ui-9a for ath10k@lists.infradead.org; Mon, 02 Mar 2015 12:23:50 +0000 Received: by lbiz11 with SMTP id z11so3613346lbi.13 for ; Mon, 02 Mar 2015 04:23:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bqyXue1g2f0MjhzmOojxzcGEp2jzknl+pc4gncimONA=; b=LBjxQhfgTh8Uog4IpbIFdBILouDiLthWJpEe5lRMPhNUCcTddqmdit8W5jLDKPDLdn 4J31hF6ed4uk4nEj+MBz52fWdhQjxzgVFWsr8r4ENK+pGwOD/GdzpZXjdDoontkv0Tk/ xANPI1lAVDhj4iLkRZdWfzsghb5mPaeRI4ulw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bqyXue1g2f0MjhzmOojxzcGEp2jzknl+pc4gncimONA=; b=Ne42VRW+3/WGq2epqLMWPDSJOdiWJ9y3JQi01QPFWlfRSIsWqziBRg2dMzSZFI3jEo iqroz51Fzm0JOWUFt2VPy1TtpEp4n5dzrUAsxvjKIn1zbO4HaWxHaTp/mbWUsg6NO061 JPP6sS8W4W5bct3CwPwhk0dCwLf2JJ2sHgnMSZ0Ktg5RgGdEkJWkg0Iut/+yo8Wpkk1I xtCf0muj4B9LK+TP9sU3SqE0JmEVAcd6U2LNSH7UTZkwsmQw1ltdEyCf5mm8o8CmQ2to k03pxfpWVRulSYKPdca84RTeenTwha3g86pyOUIxUlNwSdfTqYNch3KLG7QU60mgaKFp dnUQ== X-Gm-Message-State: ALoCoQk6+91tWtC7OyXPPbsXwpf6MT/+qhGtUz5p4ZMOxqZYvD0akNGQsWFo2bD/h7ddzcTNLyxqx8OXQjJnKOrL4OUpYSZMikEz0sCiV0DPhU3qeWnHCNi59vBiwgHsf2k+16RhWXAsbBUw0U0KCtemg3KNy322IVEqF0N46AXZsqhCi4DxdxA= X-Received: by 10.112.155.137 with SMTP id vw9mr23858286lbb.70.1425299007369; Mon, 02 Mar 2015 04:23:27 -0800 (PST) Received: from bob.homerouter.cpe (apn-77-113-114-198.dynamic.gprs.plus.pl. [77.113.114.198]) by mx.google.com with ESMTPSA id ps2sm2508497lbb.20.2015.03.02.04.23.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Mar 2015 04:23:26 -0800 (PST) From: Michal Kazior To: ath10k@lists.infradead.org Subject: [PATCH v2 2/2] ath10k: save/restore pci config space properly Date: Mon, 2 Mar 2015 13:22:14 +0100 Message-Id: <1425298934-12370-2-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1425298934-12370-1-git-send-email-michal.kazior@tieto.com> References: <1425298934-12370-1-git-send-email-michal.kazior@tieto.com> X-DomainID: tieto.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150302_042350_544469_16C8C171 X-CRM114-Status: GOOD ( 10.65 ) X-Spam-Score: -0.8 (/) Cc: linux-wireless@vger.kernel.org, Michal Kazior X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The check was't really necessary and couldn't even work to begin with because pci_restore_state() restores only first 64 bytes of PCI configuration space. Actually the PCI subsystem takes care of this so there's no need for explicit calls to save PCI state in ath10k. This is necessary for future WoWLAN support. Signed-off-by: Michal Kazior --- Notes: v2: * don't call pci save/restore/enable/disable explicitly and leave it to the PCI subsystem [Johannes] * adjust commit message * the [PATCH 3/3] is effectivelly dropped since there's nothing to balance anymore drivers/net/wireless/ath/ath10k/pci.c | 39 +++++++---------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index cbf82ff..a79b204 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -2053,25 +2053,10 @@ static void ath10k_pci_hif_power_down(struct ath10k *ar) #ifdef CONFIG_PM -#define ATH10K_PCI_PM_CONTROL 0x44 - static int ath10k_pci_hif_suspend(struct ath10k *ar) { - struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); - struct pci_dev *pdev = ar_pci->pdev; - u32 val; - ath10k_pci_sleep(ar); - pci_read_config_dword(pdev, ATH10K_PCI_PM_CONTROL, &val); - - if ((val & 0x000000ff) != 0x3) { - pci_save_state(pdev); - pci_disable_device(pdev); - pci_write_config_dword(pdev, ATH10K_PCI_PM_CONTROL, - (val & 0xffffff00) | 0x03); - } - return 0; } @@ -2088,22 +2073,14 @@ static int ath10k_pci_hif_resume(struct ath10k *ar) return ret; } - pci_read_config_dword(pdev, ATH10K_PCI_PM_CONTROL, &val); - - if ((val & 0x000000ff) != 0) { - pci_restore_state(pdev); - pci_write_config_dword(pdev, ATH10K_PCI_PM_CONTROL, - val & 0xffffff00); - /* - * Suspend/Resume resets the PCI configuration space, - * so we have to re-disable the RETRY_TIMEOUT register (0x41) - * to keep PCI Tx retries from interfering with C3 CPU state - */ - pci_read_config_dword(pdev, 0x40, &val); - - if ((val & 0x0000ff00) != 0) - pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); - } + /* Suspend/Resume resets the PCI configuration space, so we have to + * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries + * from interfering with C3 CPU state. pci_restore_state won't help + * here since it only restores the first 64 bytes pci config header. + */ + pci_read_config_dword(pdev, 0x40, &val); + if ((val & 0x0000ff00) != 0) + pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); return ret; }