Merge git://www.denx.de/git/u-boot
[oweals/u-boot.git] / board / amcc / katmai / katmai.c
index 286bdc1f21dd23bd8a9e5fa8615495d424cbb996..afd60ece6247fda08de2000829ce81255926c2f4 100644 (file)
@@ -292,7 +292,7 @@ int testdram (void)
  *     certain pre-initialization actions.
  *
  ************************************************************************/
-#if defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT)
+#if defined(CONFIG_PCI)
 int pci_pre_init(struct pci_controller * hose )
 {
        unsigned long strap;
@@ -309,7 +309,7 @@ int pci_pre_init(struct pci_controller * hose )
 
        return 1;
 }
-#endif /* defined(CONFIG_PCI) && defined(CFG_PCI_PRE_INIT) */
+#endif /* defined(CONFIG_PCI) */
 
 /*************************************************************************
  *  pci_target_init
@@ -392,16 +392,18 @@ int katmai_pcie_card_present(int port)
 
 static struct pci_controller pcie_hose[3] = {{0},{0},{0}};
 
-void pcie_setup_hoses(void)
+void pcie_setup_hoses(int busno)
 {
        struct pci_controller *hose;
        int i, bus;
+       char *env;
+       unsigned int delay;
 
        /*
         * assume we're called after the PCIX hose is initialized, which takes
         * bus ID 0 and therefore start numbering PCIe's from 1.
         */
-       bus = 1;
+       bus = busno;
        for (i = 0; i <= 2; i++) {
                /* Check for katmai card presence */
                if (!katmai_pcie_card_present(i))
@@ -418,8 +420,8 @@ void pcie_setup_hoses(void)
 
                hose = &pcie_hose[i];
                hose->first_busno = bus;
-               hose->last_busno  = bus;
-               bus++;
+               hose->last_busno = bus;
+               hose->current_busno = bus;
 
                /* setup mem resource */
                pci_set_region(hose->regions + 0,
@@ -439,10 +441,21 @@ void pcie_setup_hoses(void)
                 */
 #else
                ppc440spe_setup_pcie_rootpoint(hose, i);
+
+               env = getenv ("pciscandelay");
+               if (env != NULL) {
+                       delay = simple_strtoul (env, NULL, 10);
+                       if (delay > 5)
+                               printf ("Warning, expect noticable delay before PCIe"
+                                       "scan due to 'pciscandelay' value!\n");
+                       mdelay (delay * 1000);
+               }
+
                /*
                 * Config access can only go down stream
                 */
                hose->last_busno = pci_hose_scan(hose);
+               bus = hose->last_busno + 1;
 #endif
        }
 }