]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - common/fdt_support.c
83xx: Replace CONFIG_MPC83XX with CONFIG_MPC83xx
[karo-tx-uboot.git] / common / fdt_support.c
index d483d66f11d2e8b7cb17d516927d72d4b9fd09eb..fc077e82927b420202a6b7ae2ff130f237c8627c 100644 (file)
@@ -495,7 +495,7 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd)
 }
 #endif /* CONFIG_HAS_FSL_DR_USB */
 
-#if defined(CONFIG_MPC83XX) || defined(CONFIG_MPC85xx)
+#if defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx)
 /*
  * update crypto node properties to a specified revision of the SEC
  * called with sec_rev == 0 if not on an mpc8xxxE processor
@@ -580,7 +580,7 @@ void fdt_fixup_crypto_node(void *blob, int sec_rev)
                printf("WARNING: could not set crypto property: %s\n",
                       fdt_strerror(err));
 }
-#endif /* defined(CONFIG_MPC83XX) || defined(CONFIG_MPC85xx) */
+#endif /* defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) */
 
 /* Resize the fdt to its actual size + a bit of padding */
 int fdt_resize(void *blob)
@@ -602,12 +602,15 @@ int fdt_resize(void *blob)
                }
        }
 
-       /* Calculate the actual size of the fdt */
+       /*
+        * Calculate the actual size of the fdt
+        * plus the size needed for fdt_add_mem_rsv
+        */
        actualsize = fdt_off_dt_strings(blob) +
-               fdt_size_dt_strings(blob);
+               fdt_size_dt_strings(blob) + sizeof(struct fdt_reserve_entry);
 
        /* Make it so the fdt ends on a page boundary */
-       actualsize = ALIGN(actualsize, 0x1000);
+       actualsize = ALIGN(actualsize + ((uint)blob & 0xfff), 0x1000);
        actualsize = actualsize - ((uint)blob & 0xfff);
 
        /* Change the fdt header to reflect the correct size */
@@ -643,8 +646,8 @@ int fdt_pci_dma_ranges(void *blob, int phb_off, struct pci_controller *hose) {
        for (r = 0; r < hose->region_count; r++) {
                u64 bus_start, phys_start, size;
 
-               /* skip if !PCI_REGION_MEMORY */
-               if (!(hose->regions[r].flags & PCI_REGION_MEMORY))
+               /* skip if !PCI_REGION_SYS_MEMORY */
+               if (!(hose->regions[r].flags & PCI_REGION_SYS_MEMORY))
                        continue;
 
                bus_start = (u64)hose->regions[r].bus_start;