[U-Boot] [PATCH 2/5] pci: option for configurable delay between pci reset and pci bus scan

Anatolij Gustschin agust at denx.de
Fri May 27 16:08:21 CEST 2011


PCI cards might need some time after reset to respond.
On some boards (mpc5200 or mpc8260 based) the PCI bus reset is
deasserted at pci_board_init() time, so we can not use available
"pcidelay" option for waiting before pci bus scan here. Add an option
to delay bus scan by setting "pci_scan_delay" environment variable.

Signed-off-by: Anatolij Gustschin <agust at denx.de>
---
 drivers/pci/pci.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index cdfc4fb..2206c12 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -699,6 +699,20 @@ int pci_hose_scan_bus(struct pci_controller *hose, int bus)
 
 int pci_hose_scan(struct pci_controller *hose)
 {
+#if defined(CONFIG_PCI_SCAN_DELAY)
+	const char *s;
+	int i;
+
+	/* wait "pci_scan_delay" ms, limit to max. 1 s */
+	s = getenv("pci_scan_delay");
+	if (s) {
+		int val = simple_strtoul(s, NULL, 10);
+		if (val > 1000)
+			val = 1000;
+		for (i = 0; i < val; i++)
+			udelay(1000);
+	}
+#endif
 	/* Start scan at current_busno.
 	 * PCIe will start scan at first_busno+1.
 	 */
-- 
1.7.4.4



More information about the U-Boot mailing list