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: 8191961 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@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 984C89F3CD for ; Tue, 2 Feb 2016 17:12:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8C358202F2 for ; Tue, 2 Feb 2016 17:12:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7769B202D1 for ; Tue, 2 Feb 2016 17:12:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932887AbcBBRM3 (ORCPT ); Tue, 2 Feb 2016 12:12:29 -0500 Received: from mail.kernel.org ([198.145.29.136]:41660 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932845AbcBBRMZ (ORCPT ); Tue, 2 Feb 2016 12:12:25 -0500 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 Cc: Vineet.Gupta1@synopsys.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-snps-arc@lists.infradead.org, CARLOS.PALMINHA@synopsys.com, Alexey.Brodkin@synopsys.com, robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, ijc+devicetree@hellion.org.uk, galak@codeaurora.org, arnd@arndb.de 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=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;