Merge tag 'u-boot-atmel-fixes-2020.07-a' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / drivers / pci / pci_auto.c
index 1a3bf708347d2269cff25aa7b4f566335ac6ad15..3f46b7697d7caa7ad3c78f4d9bf3ffc031d0d641 100644 (file)
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <pci.h>
 
 /* the user can define CONFIG_SYS_PCI_CACHE_LINE_SIZE to avoid problems */
@@ -39,6 +40,8 @@ void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
 
        for (bar = PCI_BASE_ADDRESS_0;
             bar < PCI_BASE_ADDRESS_0 + (bars_num * 4); bar += 4) {
+               int ret = 0;
+
                /* Tickle the BAR and get the response */
                if (!enum_only)
                        dm_pci_write_config32(dev, bar, 0xffffffff);
@@ -97,9 +100,13 @@ void dm_pciauto_setup_device(struct udevice *dev, int bars_num,
                              (unsigned long long)bar_size);
                }
 
-               if (!enum_only && pciauto_region_allocate(bar_res, bar_size,
-                                                         &bar_value,
-                                                         found_mem64) == 0) {
+               if (!enum_only) {
+                       ret = pciauto_region_allocate(bar_res, bar_size,
+                                                     &bar_value, found_mem64);
+                       if (ret)
+                               printf("PCI: Failed autoconfig bar %x\n", bar);
+               }
+               if (!enum_only && !ret) {
                        /* Write it out and update our limit */
                        dm_pci_write_config32(dev, bar, (u32)bar_value);