From: Anatolij Gustschin Date: Fri, 27 May 2011 16:08:21 +0200 Subject: [U-Boot] [PATCH 2/5] pci: option for configurable delay between pci reset and pci bus scan In-Reply-To: <1306505304-9593-1-git-send-email-agust@denx.de> References: <1306505304-9593-1-git-send-email-agust@denx.de> Message-ID: <1306505304-9593-3-git-send-email-agust@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- 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@first_busno+1. */ -- 1.7.4.4