From patchwork Mon Mar 30 10:55:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stach X-Patchwork-Id: 456053 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 6EA6E140161 for ; Mon, 30 Mar 2015 21:55:26 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750710AbbC3KzV (ORCPT ); Mon, 30 Mar 2015 06:55:21 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:58696 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751961AbbC3KzS (ORCPT ); Mon, 30 Mar 2015 06:55:18 -0400 Received: from dude.hi.4.pengutronix.de ([10.1.0.7] helo=dude.pengutronix.de.) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1YcXLf-00025E-84; Mon, 30 Mar 2015 12:55:15 +0200 From: Lucas Stach To: Bjorn Helgaas Cc: Thierry Reding , Stephen Warren , Alexandre Courbot , linux-tegra@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v4 2/2] PCI: tegra: apply relaxed ordering fixup only on Tegra Date: Mon, 30 Mar 2015 12:55:13 +0200 Message-Id: <1427712913-13678-2-git-send-email-l.stach@pengutronix.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1427712913-13678-1-git-send-email-l.stach@pengutronix.de> References: <1427712913-13678-1-git-send-email-l.stach@pengutronix.de> X-SA-Exim-Connect-IP: 10.1.0.7 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-tegra@vger.kernel.org Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org The fixup to enable relaxed ordering on all PCI devices was executed unconditionally if the Tegra PCI host driver was built into the kernel. This doesn't play nice with a multiplatform kernel executed on other platforms which may not need this fixup. Make sure to only apply the fixup if the root port is a Tegra. Signed-off-by: Lucas Stach Acked-by: Thierry Reding --- v2: - split out PCI hierarchy walk - separate code from data by moving PCI IDs into own structure v3: - fixup for helper rename - applied Thierry's ACK v4: - fixup for yet another helper rename --- drivers/pci/host/pci-tegra.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c index 00e92720d7f7..cc3b1ed77754 100644 --- a/drivers/pci/host/pci-tegra.c +++ b/drivers/pci/host/pci-tegra.c @@ -586,10 +586,42 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA, 0x0bf1, tegra_pcie_fixup_class); DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA, 0x0e1c, tegra_pcie_fixup_class); DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA, 0x0e1d, tegra_pcie_fixup_class); +static const struct pci_device_id tegra_rootport_ids[] = { + { + /* Tegra20 4 lane root port */ + .vendor = PCI_VENDOR_ID_NVIDIA, .device = 0x0bf0, + .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID + }, { + /* Tegra20 2 lane root port */ + .vendor = PCI_VENDOR_ID_NVIDIA, .device = 0x0bf1, + .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID + }, { + /* Tegra30 4 lane root port */ + .vendor = PCI_VENDOR_ID_NVIDIA, .device = 0x0e1c, + .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID + }, { + /* Tegra30 2 lane root port */ + .vendor = PCI_VENDOR_ID_NVIDIA, .device = 0x0e1d, + .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID + }, { + /* Tegra124 4 lane root port */ + .vendor = PCI_VENDOR_ID_NVIDIA, .device = 0x0e12, + .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID + }, { + /* Tegra124 1 lane root port */ + .vendor = PCI_VENDOR_ID_NVIDIA, .device = 0x0e13, + .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID + }, { + /* sentinel */ + } +}; + /* Tegra PCIE requires relaxed ordering */ static void tegra_pcie_relax_enable(struct pci_dev *dev) { - pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_RELAX_EN); + if (pci_match_id(tegra_rootport_ids, pcie_find_root_port(dev))) + pcie_capability_set_word(dev, PCI_EXP_DEVCTL, + PCI_EXP_DEVCTL_RELAX_EN); } DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, tegra_pcie_relax_enable);