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


Groups > linux.kernel > #1474557

[PATCH 9/9] Move msleeps to address Guenter's comments.

From Bjorn Helgaas <bhelgaas@google.com>
Newsgroups linux.kernel
Subject [PATCH 9/9] Move msleeps to address Guenter's comments.
Date 2016-09-01 18:50 +0200
Message-ID <scDlE-4lf-53@gated-at.bofh.it> (permalink)
References <scDlD-4lf-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


---
 drivers/pci/host/pcie-rockchip.c |   34 +++++++---------------------------
 1 file changed, 7 insertions(+), 27 deletions(-)

diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
index 61b0630..6623598 100644
--- a/drivers/pci/host/pcie-rockchip.c
+++ b/drivers/pci/host/pcie-rockchip.c
@@ -476,23 +476,12 @@ static int rockchip_pcie_init_port(struct rockchip_pcie *rockchip)
 			break;
 		}
 
-		msleep(20);
-
-		if (!time_before(jiffies, timeout)) {
-			err = -ETIMEDOUT;
-			break;
-		}
-	}
-
-	/* Double check gen1 training */
-	if (err) {
-		status = rockchip_pcie_read(rockchip, PCIE_CLIENT_BASIC_STATUS1);
-		err = ((status & PCIE_CLIENT_LINK_STATUS_MASK) ==
-		       PCIE_CLIENT_LINK_STATUS_UP) ? 0 : -ETIMEDOUT;
-		if (err) {
+		if (time_after(jiffies, timeout)) {
 			dev_err(dev, "PCIe link training gen1 timeout!\n");
-			return err;
+			return -ETIMEDOUT;
 		}
+
+		msleep(20);
 	}
 
 	/*
@@ -514,21 +503,12 @@ static int rockchip_pcie_init_port(struct rockchip_pcie *rockchip)
 			break;
 		}
 
-		msleep(20);
-
-		if (!time_before(jiffies, timeout)) {
-			err = -ETIMEDOUT;
+		if (time_after(jiffies, timeout)) {
+			dev_dbg(dev, "PCIe link training gen2 timeout, fall back to gen1!\n");
 			break;
 		}
-	}
 
-	/* Double check gen2 training */
-	if (err) {
-		status = rockchip_pcie_read(rockchip, PCIE_CORE_CTRL_MGMT_BASE);
-		err = ((status & PCIE_CORE_PL_CONF_SPEED_MASK) ==
-		       PCIE_CORE_PL_CONF_SPEED_5G) ? 0 : -ETIMEDOUT;
-		if (err)
-			dev_dbg(dev, "PCIe link training gen2 timeout, fall back to gen1!\n");
+		msleep(20);
 	}
 
 	/* Check the final link width from negotiated lane counter from MGMT */

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


Thread

[PATCH 0/9] PCI: rockchip: Cleanups against v10 Bjorn Helgaas <bhelgaas@google.com> - 2016-09-01 18:50 +0200
  [PATCH 4/9] Rename struct rockchip_pcie_port to struct  rockchip_pcie. Bjorn Helgaas <bhelgaas@google.com> - 2016-09-01 18:50 +0200
  [PATCH 9/9] Move msleeps to address Guenter's comments. Bjorn Helgaas <bhelgaas@google.com> - 2016-09-01 18:50 +0200
  [PATCH 5/9] Use a local "dev" to avoid repetition of  "rockchip->dev". Bjorn Helgaas <bhelgaas@google.com> - 2016-09-01 18:50 +0200
  [PATCH 7/9] Simplify the confusing HIWORD_UPDATE scheme. Bjorn Helgaas <bhelgaas@google.com> - 2016-09-01 18:50 +0200
  [PATCH 6/9] Add comment about why 32-bit read/modify/write isn't  safe. Bjorn Helgaas <bhelgaas@google.com> - 2016-09-01 18:50 +0200
  Re: [PATCH 0/9] PCI: rockchip: Cleanups against v10 Arnd Bergmann <arnd@arndb.de> - 2016-09-01 23:20 +0200

csiph-web