From patchwork Fri Aug 5 11:10:36 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislaw Gruszka X-Patchwork-Id: 1038292 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p75BBO85013141 for ; Fri, 5 Aug 2011 11:11:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754408Ab1HELLW (ORCPT ); Fri, 5 Aug 2011 07:11:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51197 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751612Ab1HELLW (ORCPT ); Fri, 5 Aug 2011 07:11:22 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p75BB7UP031319 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 5 Aug 2011 07:11:07 -0400 Received: from localhost (dhcp-27-232.brq.redhat.com [10.34.27.232]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p75BB5tT003035; Fri, 5 Aug 2011 07:11:06 -0400 From: Stanislaw Gruszka To: "John W. Linville" , linux-wireless Cc: ath9k-devel@venema.h4ckr.net, camilo@mesias.co.uk, Jonathan Nieder , Tony Houghton , Rajkumar Manoharan , ath9k-devel@venema.h4ckr.net, Adrian Chadd , Subject: [PATCH -next 5/8] ath9k: use common function for disabling ASPM Date: Fri, 5 Aug 2011 13:10:36 +0200 Message-Id: <1312542639-4274-6-git-send-email-sgruszka@redhat.com> In-Reply-To: <1312542639-4274-1-git-send-email-sgruszka@redhat.com> References: <1312542639-4274-1-git-send-email-sgruszka@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 05 Aug 2011 11:11:24 +0000 (UTC) Disable ASPM using common function, this works also with CONFIG_PCIEASPM=y. Signed-off-by: Stanislaw Gruszka --- drivers/net/wireless/ath/ath9k/pci.c | 23 +++-------------------- 1 files changed, 3 insertions(+), 20 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c index 7d94b64..67a2c96 100644 --- a/drivers/net/wireless/ath/ath9k/pci.c +++ b/drivers/net/wireless/ath/ath9k/pci.c @@ -110,33 +110,16 @@ static void ath_pci_aspm_init(struct ath_common *common) int pos; u8 aspm; - pos = pci_pcie_cap(pdev); - if (!pos) + if (!pci_is_pcie(pdev)) return; - parent = pdev->bus->self; - if (ah->btcoex_hw.scheme != ATH_BTCOEX_CFG_NONE) { /* Bluetooth coexistance requires disabling ASPM. */ - pci_read_config_byte(pdev, pos + PCI_EXP_LNKCTL, &aspm); - aspm &= ~(PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1); - pci_write_config_byte(pdev, pos + PCI_EXP_LNKCTL, aspm); - - /* - * Both upstream and downstream PCIe components should - * have the same ASPM settings. - */ - if (WARN_ON(!parent)) - return; - - pos = pci_pcie_cap(parent); - pci_read_config_byte(parent, pos + PCI_EXP_LNKCTL, &aspm); - aspm &= ~(PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1); - pci_write_config_byte(parent, pos + PCI_EXP_LNKCTL, aspm); - + pcie_disable_aspm(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1); return; } + parent = pdev->bus->self; if (WARN_ON(!parent)) return;