From patchwork Tue Feb 2 17:12:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 577261 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E43F2140AD9 for ; Wed, 3 Feb 2016 04:12:49 +1100 (AEDT) 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 1aQeVU-0004Rj-Dt; Tue, 02 Feb 2016 17:12:48 +0000 Received: from mail.kernel.org ([198.145.29.136]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aQeVR-0004Nu-FQ for linux-snps-arc@lists.infradead.org; Tue, 02 Feb 2016 17:12:46 +0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A1F6B20306; Tue, 2 Feb 2016 17:12:23 +0000 (UTC) Received: from localhost (173-27-161-33.client.mchsi.com [173.27.161.33]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 439DB202E9; Tue, 2 Feb 2016 17:12:22 +0000 (UTC) Date: Tue, 2 Feb 2016 11:12:21 -0600 From: Bjorn Helgaas To: Joao Pinto Subject: Re: [PATCH v7 2/2] add new platform driver for PCI RC Message-ID: <20160202171221.GC11085@localhost> References: <10b29adcdb0a31eb8f8071b271da267e44ad8a04.1454349430.git.jpinto@synopsys.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <10b29adcdb0a31eb8f8071b271da267e44ad8a04.1454349430.git.jpinto@synopsys.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160202_091245_572808_0ABEC6B0 X-CRM114-Status: GOOD ( 23.56 ) X-Spam-Score: -4.6 (----) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-4.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [198.145.29.136 listed in list.dnswl.org] -0.4 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, arnd@arndb.de, pawel.moll@arm.com, ijc+devicetree@hellion.org.uk, linux-pci@vger.kernel.org, Vineet.Gupta1@synopsys.com, Alexey.Brodkin@synopsys.com, linux-kernel@vger.kernel.org, CARLOS.PALMINHA@synopsys.com, robh+dt@kernel.org, galak@codeaurora.org, linux-snps-arc@lists.infradead.org Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org On Mon, Feb 01, 2016 at 06:07:45PM +0000, Joao Pinto wrote: > This patch adds a new driver that will be the reference platform driver > for all PCI RC IP Protoyping Kits based on ARC SDP. > This patch is composed by: > > -MAINTAINERS file was updated to include the new driver > -Documentation/devicetree/bindings/pci was updated to include the new > driver documentation > -New driver called pcie-synopsys > > Signed-off-by: Joao Pinto I applied the following changes. Mostly whitespace/comment cleanup, but also removed some include files that I don't think you need and added a message when the link fails to come up. Please test and make sure this still works. Bjorn diff --git a/drivers/pci/host/pcie-synopsys.c b/drivers/pci/host/pcie-synopsys.c index 9702e79..757ba30 100644 --- a/drivers/pci/host/pcie-synopsys.c +++ b/drivers/pci/host/pcie-synopsys.c @@ -3,7 +3,7 @@ * * Copyright (C) 2015-2016 Synopsys, Inc. (www.synopsys.com) * - * Authors: Manjunath Bettegowda , + * Authors: Manjunath Bettegowda * Jie Deng * Joao Pinto * @@ -12,17 +12,13 @@ * published by the Free Software Foundation. */ -#include #include -#include #include #include #include -#include #include #include #include -#include #include #include "pcie-designware.h" @@ -38,8 +34,8 @@ struct synopsys_pcie { */ }; -#define PCI_EQUAL_CONTROL_PHY 0x00000707 -#define PCIE_PHY_DEBUG_R1_LINK_UP 0x00000010 +#define PCI_EQUAL_CONTROL_PHY 0x00000707 +#define PCIE_PHY_DEBUG_R1_LINK_UP 0x00000010 /* PCIe Port Logic registers (memory-mapped) */ #define PLR_OFFSET 0x700 @@ -56,8 +52,6 @@ static irqreturn_t synopsys_pcie_msi_irq_handler(int irq, void *arg) { struct pcie_port *pp = arg; - dw_handle_msi_irq(pp); - return dw_handle_msi_irq(pp); } @@ -74,9 +68,9 @@ static int synopsys_pcie_deassert_core_reset(struct pcie_port *pp) static void synopsys_pcie_establish_link(struct pcie_port *pp) { - int retries = 0; + int retries; - /* check if the link is up or not */ + /* wait for link to come up */ for (retries = 0; retries < 10; retries++) { if (dw_pcie_link_up(pp)) { dev_info(pp->dev, "Link up\n"); @@ -84,6 +78,8 @@ static void synopsys_pcie_establish_link(struct pcie_port *pp) } mdelay(100); } + + dev_err(pp->dev, "Link fail\n"); } /* @@ -142,21 +138,18 @@ static int synopsys_add_pcie_port(struct pcie_port *pp, int ret; pp->irq = platform_get_irq(pdev, 1); - if (pp->irq < 0) return pp->irq; ret = devm_request_irq(&pdev->dev, pp->irq, synopsys_pcie_irq_handler, IRQF_SHARED, "synopsys-pcie", pp); - if (ret) { - dev_err(&pdev->dev, "failed to request irq\n"); + dev_err(&pdev->dev, "failed to request IRQ %d\n", pp->irq); return ret; } if (IS_ENABLED(CONFIG_PCI_MSI)) { pp->msi_irq = platform_get_irq(pdev, 0); - if (pp->msi_irq < 0) return pp->msi_irq; @@ -164,7 +157,8 @@ static int synopsys_add_pcie_port(struct pcie_port *pp, synopsys_pcie_msi_irq_handler, IRQF_SHARED, "synopsys-pcie-msi", pp); if (ret) { - dev_err(&pdev->dev, "failed to request msi irq\n"); + dev_err(&pdev->dev, "failed to request MSI IRQ %d\n", + pp->msi_irq); return ret; } } @@ -194,18 +188,18 @@ static int synopsys_add_pcie_port(struct pcie_port *pp, /** * synopsys_pcie_probe() - * This function gets called as part of pcie registration. if the id matches + * This function gets called as part of PCIe registration. If the ID matches * the platform driver framework will call this function. * * @pdev: Pointer to the platform_device structure * - * Returns zero on success; Negative errorno on failure + * Returns zero on success; Negative errno on failure */ static int synopsys_pcie_probe(struct platform_device *pdev) { struct synopsys_pcie *synopsys_pcie; struct pcie_port *pp; - struct resource *res; /* Resource from DT */ + struct resource *res; int ret; synopsys_pcie = devm_kzalloc(&pdev->dev, sizeof(*synopsys_pcie), @@ -217,7 +211,6 @@ static int synopsys_pcie_probe(struct platform_device *pdev) pp->dev = &pdev->dev; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) return -ENODEV;