From patchwork Tue Aug 4 21:54:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 6944751 Return-Path: X-Original-To: patchwork-linux-arm@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 926349F358 for ; Tue, 4 Aug 2015 21:57:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C3B142053C for ; Tue, 4 Aug 2015 21:57:52 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E9CF42056E for ; Tue, 4 Aug 2015 21:57:51 +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 1ZMkBE-0002BN-QO; Tue, 04 Aug 2015 21:55:28 +0000 Received: from mail-ig0-x22b.google.com ([2607:f8b0:4001:c05::22b]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZMkB6-0000uT-LD for linux-arm-kernel@lists.infradead.org; Tue, 04 Aug 2015 21:55:22 +0000 Received: by igr7 with SMTP id 7so83745893igr.0 for ; Tue, 04 Aug 2015 14:54:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:to:from:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; bh=F3h5EGoyvG0mZAU6ip2wwQ7CZuQZ10C39gEd6n+pnuU=; b=fbIhuoc1gLL7kxFhnaZo0YCsb444mwT3QJh0D95QKKkLqIUcSWfmJTr4HtJoWj8A2/ vhPLr4UKS4sjXBlUbjmJwqj8polMD1KGglydj+xzw+rlvbqYpUFqo982OhaTwCX/48ME Rtft+nK7ClGPypbwvXFT0QcKcXTSRmWant48OODsLdyRHCtpbbTYp57agyFVZ8GvBXa2 0KxnH+dNBG56sky6yITznu+nx2IGlV51A+bl8qGd0b4n2pmUCSt+06Oz9Ppu36u5rHFV NdoHwnEQiKFdxOh4qKplii2Lyrm7qfgafBIfNjUAkdYSKRBFAOxa0xWzfjel8p4bGGAt xqaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:from:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-type :content-transfer-encoding; bh=F3h5EGoyvG0mZAU6ip2wwQ7CZuQZ10C39gEd6n+pnuU=; b=fVicNH386H0tOcJW88379vB8WESHbFdz1+YOXB6cBVw+SzOWwBW7q0nBkuILjALXgH Ynv5G65ooA3YUw7IButa998T/BEAixyu81NRWE2IO/eb013M7WMvxSm0zjdmvJ3exHG9 kfDn2V1IKQKvSxQmvb1GqYkm/tTpOrBVt0xgdSYPnsXrMJ8oNLRzSFOJt9QvsSXLdkCN s4vmLkEyvuQv0a/yA4TthOtAiBJUuKi58gyIkkdjj7kbfn0obYJdhVj9p6OHjrNjh3QJ tBBsHYbPOeWLGcnWb3l/e+LuhzrECCKILrRhXy0maAyI9/ouzlHOvJYibMqJD1Vi1153 OAoQ== X-Gm-Message-State: ALoCoQlEXuHaZN5ObhYJxURzCsq3vF/p/l2UECFsLL08f3EpckL6A1Bysn0e/KaYoUUwFUZJOSgK X-Received: by 10.50.132.70 with SMTP id os6mr6604197igb.27.1438725299682; Tue, 04 Aug 2015 14:54:59 -0700 (PDT) Received: from localhost ([69.71.1.1]) by smtp.gmail.com with ESMTPSA id 7sm524726iot.6.2015.08.04.14.54.58 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 04 Aug 2015 14:54:58 -0700 (PDT) Subject: [PATCH v5 9/9] PCI: xgene: Use pci_scan_root_bus_msi() To: Lorenzo Pieralisi From: Bjorn Helgaas Date: Tue, 04 Aug 2015 16:54:57 -0500 Message-ID: <20150804215457.9189.27595.stgit@bhelgaas-glaptop2.roam.corp.google.com> In-Reply-To: <20150804214234.9189.42548.stgit@bhelgaas-glaptop2.roam.corp.google.com> References: <20150804214234.9189.42548.stgit@bhelgaas-glaptop2.roam.corp.google.com> User-Agent: StGit/0.16 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150804_145520_871279_C316C150 X-CRM114-Status: GOOD ( 15.57 ) X-Spam-Score: -2.9 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Petazzoni , Duc Dang , Russell King , Arnd Bergmann , Gabriele Paoloni , Marc Zyngier , linux-pci@vger.kernel.org, Pratyush Anand , Michal Simek , Simon Horman , James Morse , Tanmay Inamdar , Jingoo Han , Thierry Reding , Jayachandran C , linux-arm-kernel@lists.infradead.org, Jason Cooper Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID, 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 Previously there was no way to specify the MSI controller when creating a new PCI root bus, so we had to create the bus, set its MSI controller, then scan the bus. With the new pci_scan_root_bus_msi() interface, we can specify the MSI controller up front and get rid of that intermediate step. Look up the MSI controller first, then use pci_scan_root_bus_msi() to create and scan the root PCI bus. Signed-off-by: Bjorn Helgaas --- drivers/pci/host/pci-xgene.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c index 3cb58a3..514f41b 100644 --- a/drivers/pci/host/pci-xgene.c +++ b/drivers/pci/host/pci-xgene.c @@ -68,6 +68,7 @@ struct xgene_pcie_port { struct device_node *node; struct device *dev; + struct msi_controller *msi; struct clk *clk; void __iomem *csr_base; void __iomem *cfg_base; @@ -501,8 +502,7 @@ static int xgene_pcie_setup(struct xgene_pcie_port *port, return 0; } -static int xgene_pcie_msi_enable(struct xgene_pcie_port *port, - struct pci_bus *bus) +static int xgene_pcie_msi_enable(struct xgene_pcie_port *port) { struct device_node *msi_node; @@ -510,12 +510,12 @@ static int xgene_pcie_msi_enable(struct xgene_pcie_port *port, if (!msi_node) return -ENODEV; - bus->msi = of_pci_find_msi_chip_by_node(msi_node); - if (!bus->msi) + port->msi = of_pci_find_msi_chip_by_node(msi_node); + if (!port->msi) return -ENODEV; of_node_put(msi_node); - bus->msi->dev = &port->dev; + port->msi->dev = &port->dev; return 0; } @@ -554,16 +554,15 @@ static int xgene_pcie_probe_bridge(struct platform_device *pdev) if (ret) return ret; - bus = pci_create_root_bus(&pdev->dev, 0, - &xgene_pcie_ops, port, &res); - if (!bus) - return -ENOMEM; - if (IS_ENABLED(CONFIG_PCI_MSI)) - if (xgene_pcie_msi_enable(port, bus)) + if (xgene_pcie_msi_enable(port)) dev_info(port->dev, "failed to enable MSI\n"); - pci_scan_child_bus(bus); + bus = pci_scan_root_bus_msi(&pdev->dev, 0, &xgene_pcie_ops, port, + &res, port->msi); + if (!bus) + return -ENOMEM; + pci_assign_unassigned_bus_resources(bus); pci_bus_add_devices(bus);