Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1324293

Re: [PATCH v7 2/2] add new platform driver for PCI RC

From Bjorn Helgaas <helgaas@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH v7 2/2] add new platform driver for PCI RC
Date 2016-02-02 18:20 +0100
Message-ID <qXMMr-6gE-3@gated-at.bofh.it> (permalink)
References <qXr5j-6K9-43@gated-at.bofh.it> <qXr5j-6K9-47@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 <jpinto@synopsys.com>

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 <manjumb@synopsys.com>,
+ * Authors: Manjunath Bettegowda <manjumb@synopsys.com>
  *	    Jie Deng <jiedeng@synopsys.com>
  *	    Joao Pinto <jpinto@synopsys.com>
  *
@@ -12,17 +12,13 @@
  * published by the Free Software Foundation.
  */
 
-#include <linux/clk.h>
 #include <linux/delay.h>
-#include <linux/gpio.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/of_gpio.h>
 #include <linux/pci.h>
 #include <linux/platform_device.h>
 #include <linux/resource.h>
-#include <linux/signal.h>
 #include <linux/types.h>
 
 #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;
 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v7 0/2] adding PCI support to AXS10x Joao Pinto <Joao.Pinto@synopsys.com> - 2016-02-01 19:10 +0100
  [PATCH v7 2/2] add new platform driver for PCI RC Joao Pinto <Joao.Pinto@synopsys.com> - 2016-02-01 19:10 +0100
    Re: [PATCH v7 2/2] add new platform driver for PCI RC Bjorn Helgaas <helgaas@kernel.org> - 2016-02-02 18:20 +0100
    Re: [PATCH v7 2/2] add new platform driver for PCI RC Arnd Bergmann <arnd@arndb.de> - 2016-02-02 21:30 +0100
      Re: [PATCH v7 2/2] add new platform driver for PCI RC Bjorn Helgaas <helgaas@kernel.org> - 2016-02-03 00:20 +0100
        Re: [PATCH v7 2/2] add new platform driver for PCI RC Arnd Bergmann <arnd@arndb.de> - 2016-02-03 00:30 +0100
      Re: [PATCH v7 2/2] add new platform driver for PCI RC Bjorn Helgaas <helgaas@kernel.org> - 2016-02-03 19:10 +0100
        Re: [PATCH v7 2/2] add new platform driver for PCI RC Joao Pinto <Joao.Pinto@synopsys.com> - 2016-02-03 19:20 +0100
          Re: [PATCH v7 2/2] add new platform driver for PCI RC Bjorn Helgaas <helgaas@kernel.org> - 2016-02-03 19:40 +0100
            Re: [PATCH v7 2/2] add new platform driver for PCI RC Arnd Bergmann <arnd@arndb.de> - 2016-02-03 22:10 +0100
              Re: [PATCH v7 2/2] add new platform driver for PCI RC Joao Pinto <Joao.Pinto@synopsys.com> - 2016-02-04 12:20 +0100
                Re: [PATCH v7 2/2] add new platform driver for PCI RC Arnd Bergmann <arnd@arndb.de> - 2016-02-04 14:20 +0100
            Re: [PATCH v7 2/2] add new platform driver for PCI RC Joao Pinto <Joao.Pinto@synopsys.com> - 2016-02-04 12:20 +0100
              Re: [PATCH v7 2/2] add new platform driver for PCI RC Joao Pinto <Joao.Pinto@synopsys.com> - 2016-02-04 15:10 +0100
                Re: [PATCH v7 2/2] add new platform driver for PCI RC Arnd Bergmann <arnd@arndb.de> - 2016-02-04 16:30 +0100
  [PATCH v7 1/2] PCI support added to ARC Joao Pinto <Joao.Pinto@synopsys.com> - 2016-02-01 19:10 +0100
    Re: [PATCH v7 1/2] PCI support added to ARC Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2016-02-02 12:00 +0100
  Re: [PATCH v7 0/2] adding PCI support to AXS10x Bjorn Helgaas <helgaas@kernel.org> - 2016-02-02 18:20 +0100
    Re: [PATCH v7 0/2] adding PCI support to AXS10x Joao Pinto <Joao.Pinto@synopsys.com> - 2016-02-02 18:20 +0100
      Re: [PATCH v7 0/2] adding PCI support to AXS10x Joao Pinto <Joao.Pinto@synopsys.com> - 2016-02-02 18:30 +0100

csiph-web