From patchwork Mon Mar 2 09:09:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 5910761 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6F325BF440 for ; Mon, 2 Mar 2015 09:10:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 94790201EF for ; Mon, 2 Mar 2015 09:10:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AA6372020F for ; Mon, 2 Mar 2015 09:10:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753508AbbCBJKb (ORCPT ); Mon, 2 Mar 2015 04:10:31 -0500 Received: from mail-la0-f43.google.com ([209.85.215.43]:33087 "EHLO mail-la0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751117AbbCBJKZ (ORCPT ); Mon, 2 Mar 2015 04:10:25 -0500 Received: by lamq1 with SMTP id q1so5725141lam.0 for ; Mon, 02 Mar 2015 01:10:23 -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=MwoSBDsy0D8lvZdC5yNQ/Ut1Ptyz/wi2FVgDnHnP6mo=; b=4K7JhTQmPMtywbm0NbErsvu5ZHAg6zTbkWZtO3JOdHuGD2g8Nb8wpWYO8kFsXF15qJ 4PjFqfZbgUqtvsAKR7amWINRMeHp3qaX9C2BCAGWkWAnIJ936aCEcoaEsQ0dBDOueBaa 1BiGU1BGrx//yW+8TBTvCuSuV9TqWCtLYYVbw= 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=MwoSBDsy0D8lvZdC5yNQ/Ut1Ptyz/wi2FVgDnHnP6mo=; b=MXskth1JKDSxf+MY8M8FkkNrEUrU0hakPqDfa+SlygMwW9UIbVIzdjLAg62koX1W05 NZhnvonMtSAIRsF/mntkOtceM2WBZ1e4YkPjJfLabehxlFNTJHg0wSY0oh7D1O07sEtR 98vykIS8m9K79ycwPIy/grSehxO5JLF7AMSFiwfIALhInF5CyHzYwDazkRJIx5GSKnYw p9IlIWAymWo/YELv+l15Im2u36sqA1JSmIt/jXtyIjJF1y8dciveWBupqL2RQLGjVuXO rOX4eHsBBYIlDc/8T5EJl9cj+MXy3v1HhuwItPU8p9fod+f6W43j7UCej2WMpOIVVtkD 8HHA== X-Gm-Message-State: ALoCoQkM2734KGlyNqYuFgET2jmEos6Av/Y127o67H5hwx1TEDLyyYeZ2ecV/9W2vqZstM0tQyRP6J2/XLS6tsokqN3b5NpW1FSovVJGxpyP7d5diGCn65WNQ2qwil2ShUvGBwfJ2iA9 X-Received: by 10.112.24.235 with SMTP id x11mr23142106lbf.18.1425287423693; Mon, 02 Mar 2015 01:10:23 -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 ud4sm2407775lac.28.2015.03.02.01.10.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Mar 2015 01:10:23 -0800 (PST) From: Michal Kazior To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Michal Kazior Subject: [PATCH 2/3] ath10k: always save/restore pci config space Date: Mon, 2 Mar 2015 10:09:03 +0100 Message-Id: <1425287344-30594-2-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1425287344-30594-1-git-send-email-michal.kazior@tieto.com> References: <1425287344-30594-1-git-send-email-michal.kazior@tieto.com> X-DomainID: tieto.com Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham 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 isn't really necessary and couldn't even work because becase pci_restore_state() restores only first 64 bytes of PCI configuration space. This is necessary for future WoWLAN support. Signed-off-by: Michal Kazior --- drivers/net/wireless/ath/ath10k/pci.c | 37 +++++++++++------------------------ 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index cbf82ff..d06b264 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -2053,24 +2053,15 @@ 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); - } + pci_save_state(pdev); + pci_disable_device(pdev); return 0; } @@ -2088,22 +2079,16 @@ static int ath10k_pci_hif_resume(struct ath10k *ar) return ret; } - pci_read_config_dword(pdev, ATH10K_PCI_PM_CONTROL, &val); + pci_restore_state(pdev); - 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; }