linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ray Jui <rjui@broadcom.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Hauke Mehrtens <hauke@hauke-m.de>, <linux-pci@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<bcm-kernel-feedback-list@broadcom.com>,
	Ray Jui <rjui@broadcom.com>
Subject: [PATCH 4/8] PCI: iproc: Fix PCIe reset logic
Date: Tue, 15 Sep 2015 17:39:18 -0700	[thread overview]
Message-ID: <1442363962-29805-5-git-send-email-rjui@broadcom.com> (raw)
In-Reply-To: <1442363962-29805-1-git-send-email-rjui@broadcom.com>

The current iProc PCIe reset logic does not always properly reset the
device. For example, in the case when the perst_b signal is already
de-asserted in the bootloader, the current reset logic fails to trigger
a proper asssert -> de-assert reset sequence. This patch fixes the issue
by always triggering the proper reset sequence

This patch also explicitly selects the desired reset source, i.e.,
perst_b and reduces the wait time after the device comes out of reset
from 250 ms to 100 ms, based on recommendation from the ASIC team

Signed-off-by: Ray Jui <rjui@broadcom.com>
Reviewed-by: Vladimir Dreizin <vdreizin@broadcom.com>
Reviewed-by: Trac Hoang <trhoang@broadcom.com>
Reviewed-by: Scott Branden <sbranden@broadcom.com>
Tested-by: Vladimir Dreizin <vdreizin@broadcom.com>
Tested-by: Darren Edamura <dedamura@broadcom.com>
---
 drivers/pci/host/pcie-iproc.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
index 52e7ff2..80e0541 100644
--- a/drivers/pci/host/pcie-iproc.c
+++ b/drivers/pci/host/pcie-iproc.c
@@ -31,6 +31,8 @@
 #include "pcie-iproc.h"
 
 #define CLK_CONTROL_OFFSET           0x000
+#define EP_PERST_SOURCE_SELECT_SHIFT 2
+#define EP_PERST_SOURCE_SELECT       BIT(EP_PERST_SOURCE_SELECT_SHIFT)
 #define EP_MODE_SURVIVE_PERST_SHIFT  1
 #define EP_MODE_SURVIVE_PERST        BIT(EP_MODE_SURVIVE_PERST_SHIFT)
 #define RC_PCIE_RST_OUTPUT_SHIFT     0
@@ -119,15 +121,18 @@ static void iproc_pcie_reset(struct iproc_pcie *pcie)
 	u32 val;
 
 	/*
-	 * Configure the PCIe controller as root complex and send a downstream
-	 * reset
+	 * Select perst_b signal as reset source. Put the device into reset,
+	 * and then bring it out of reset
 	 */
-	val = EP_MODE_SURVIVE_PERST | RC_PCIE_RST_OUTPUT;
+	val = readl(pcie->base + CLK_CONTROL_OFFSET);
+	val &= ~EP_PERST_SOURCE_SELECT & ~EP_MODE_SURVIVE_PERST &
+		~RC_PCIE_RST_OUTPUT;
 	writel(val, pcie->base + CLK_CONTROL_OFFSET);
 	udelay(250);
-	val &= ~EP_MODE_SURVIVE_PERST;
+
+	val |= RC_PCIE_RST_OUTPUT;
 	writel(val, pcie->base + CLK_CONTROL_OFFSET);
-	msleep(250);
+	msleep(100);
 }
 
 static int iproc_pcie_check_link(struct iproc_pcie *pcie, struct pci_bus *bus)
-- 
1.9.1


  parent reply	other threads:[~2015-09-16  0:39 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-16  0:39 [PATCH 0/8] Broadcom iProc PCIe fixes and outbound mapping support Ray Jui
2015-09-16  0:39 ` [PATCH 1/8] PCI: iproc: Fix code comment Ray Jui
2015-09-16  0:39 ` [PATCH 2/8] PCI: iproc: Remove unused code Ray Jui
2015-09-16  0:39 ` [PATCH 3/8] PCI: iproc: Remove ARCH specific flag Ray Jui
2015-09-16  0:39 ` Ray Jui [this message]
2015-09-16  0:39 ` [PATCH 5/8] PCI: iproc: Improve link detection logic Ray Jui
2015-09-16  0:39 ` [PATCH 6/8] PCI: iproc: Update iProc PCIe device tree bindings Ray Jui
2015-09-16  0:39 ` [PATCH 7/8] PCI: iproc: Add outbound mapping support Ray Jui
2015-10-13 17:58   ` Kevin Hilman
2015-10-13 20:02     ` [PATCH] PCI: iproc: fix 32-bit build error Arnd Bergmann
2015-10-13 20:06       ` Hauke Mehrtens
2015-10-13 20:11         ` Ray Jui
2015-10-13 21:00           ` Arnd Bergmann
2015-10-15 16:00             ` Bjorn Helgaas
2015-10-15 16:19               ` Ray Jui
2015-10-15 19:40                 ` [PATCH v2] " Arnd Bergmann
2015-10-15 20:57                   ` Hauke Mehrtens
2015-10-15 21:01                   ` Bjorn Helgaas
2015-10-16  9:47                     ` Arnd Bergmann
2015-10-16 13:23                       ` Bjorn Helgaas
2015-10-13 21:21       ` [PATCH] " Kevin Hilman
2015-09-16  0:39 ` [PATCH 8/8] PCI: iproc: Fix compile warnings Ray Jui
2015-09-25 23:21 ` [PATCH 0/8] Broadcom iProc PCIe fixes and outbound mapping support Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1442363962-29805-5-git-send-email-rjui@broadcom.com \
    --to=rjui@broadcom.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bhelgaas@google.com \
    --cc=hauke@hauke-m.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).