]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/pci.c
Merge git://www.denx.de/git/u-boot
[karo-tx-uboot.git] / drivers / pci.c
index 3c24b99c3767fc89d7ceff71d84021e63ea1ed1e..50ca6b0bad67a2345992799f5bd24db101e147a6 100644 (file)
@@ -82,8 +82,10 @@ int pci_hose_read_config_##size##_via_dword(struct pci_controller *hose,\
 {                                                                      \
        u32 val32;                                                      \
                                                                        \
-       if (pci_hose_read_config_dword(hose, dev, offset & 0xfc, &val32) < 0)\
+       if (pci_hose_read_config_dword(hose, dev, offset & 0xfc, &val32) < 0) { \
+               *val = -1;                                              \
                return -1;                                              \
+       }                                                               \
                                                                        \
        *val = (val32 >> ((offset & (int)off_mask) * 8));               \
                                                                        \
@@ -163,7 +165,7 @@ pci_dev_t pci_find_devices(struct pci_device_id *ids, int index)
                for (bus = hose->first_busno; bus <= hose->last_busno; bus++)
 #endif
                        for (bdf = PCI_BDF(bus,0,0);
-#ifdef CONFIG_ELPPC
+#if defined(CONFIG_ELPPC) || defined(CONFIG_PPMC7XX)
                             bdf < PCI_BDF(bus,PCI_MAX_PCI_DEVICES-1,PCI_MAX_PCI_FUNCTIONS-1);
 #else
                             bdf < PCI_BDF(bus+1,0,0);
@@ -490,10 +492,16 @@ int pci_hose_scan_bus(struct pci_controller *hose, int bus)
 
 int pci_hose_scan(struct pci_controller *hose)
 {
+       /* Start scan at current_busno.
+        * PCIe will start scan at first_busno+1.
+        */
+       /* For legacy support, ensure current>=first */
+       if (hose->first_busno > hose->current_busno)
+               hose->current_busno = hose->first_busno;
 #ifdef CONFIG_PCI_PNP
        pciauto_config_init(hose);
 #endif
-       return pci_hose_scan_bus(hose, hose->first_busno);
+       return pci_hose_scan_bus(hose, hose->current_busno);
 }
 
 void pci_init(void)