Hi Anatolij, in general this is a good idea. It also fixes an issue on dual role boards that can act as pci host and target like the PMC440 and PMC405DE. When these boards are configured as target, the pcidelay variable must be ignored or _target_ initialization must be done before the delay.
That's why I put my own pcidelay implementation in our board code. But I see a problem on boards with more than one PCI bus/PCIe rootcomplex like some 440 parts. In this case the delay is executed multiple times. So it might be a good idea to restrict pci_hose_scan to wait for only during its initial call and to ignore pcidelay for any further call. BTW, 4xx_pcie.c also implements an additional delay controlled by the pciscandelay variable before calling pci_hose_scan() :-) I think this is obsolete. Matthias On 11.10.2011 17:18, Anatolij Gustschin wrote: > 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_init_board() time, so we currently can not use available > "pcidelay" option for waiting before PCI bus scan since this > waiting takes place before calling pci_init_board(). By moving > the pcidelay code to the new location using of the "pcidelay" > option is possible on mpc5200 or mpc8260 based boards, too. > > Signed-off-by: Anatolij Gustschin <ag...@denx.de> > --- > drivers/pci/pci.c | 26 +++++++++++++------------- > 1 files changed, 13 insertions(+), 13 deletions(-) > > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > index 1a0b14c..b65cdd1 100644 > --- a/drivers/pci/pci.c > +++ b/drivers/pci/pci.c > @@ -695,6 +695,19 @@ int pci_hose_scan_bus(struct pci_controller *hose, int > bus) > > int pci_hose_scan(struct pci_controller *hose) > { > +#if defined(CONFIG_PCI_BOOTDELAY) > + char *s; > + int i; > + > + /* wait "pcidelay" ms (if defined)... */ > + s = getenv("pcidelay"); > + if (s) { > + int val = simple_strtoul(s, NULL, 10); > + for (i = 0; i < val; i++) > + udelay(1000); > + } > +#endif /* CONFIG_PCI_BOOTDELAY */ > + > /* Start scan at current_busno. > * PCIe will start scan at first_busno+1. > */ > @@ -709,19 +722,6 @@ int pci_hose_scan(struct pci_controller *hose) > > void pci_init(void) > { > -#if defined(CONFIG_PCI_BOOTDELAY) > - char *s; > - int i; > - > - /* wait "pcidelay" ms (if defined)... */ > - s = getenv ("pcidelay"); > - if (s) { > - int val = simple_strtoul (s, NULL, 10); > - for (i=0; i<val; i++) > - udelay (1000); > - } > -#endif /* CONFIG_PCI_BOOTDELAY */ > - > hose_head = NULL; > > /* now call board specific pci_init()... */ -- ------------------------------------------------------------------------ Dipl.-Ing. Matthias Fuchs Head of System Design esd electronic system design gmbh Vahrenwalder Str. 207 - 30165 Hannover - GERMANY Phone: +49-511-37298-0 - Fax: +49-511-37298-68 Please visit our homepage http://www.esd.eu Quality Products - Made in Germany Besuchen Sie uns auf der Hannover Messe 2011 in Halle 9, Stand D13 vom 04.-08. April 2011 in Hannover! ------------------------------------------------------------------------- Geschäftsführer: Klaus Detering Amtsgericht Hannover HRB 51373 - VAT-ID DE 115672832 ------------------------------------------------------------------------- _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot