]> git.sur5r.net Git - u-boot/blobdiff - common/fdt_support.c
rockchip: spi: rk3399: move CONFIG_SPI and CONFIG_SPI_FLASH to defconfig
[u-boot] / common / fdt_support.c
index 202058621ae2016f4457160ef6079b6c539b6608..c6a76b7ad299f365d08542ed7f583f8f1f2720ea 100644 (file)
@@ -381,6 +381,7 @@ void do_fixup_by_compat_u32(void *fdt, const char *compat,
        do_fixup_by_compat(fdt, compat, prop, &tmp, 4, create);
 }
 
+#ifdef CONFIG_ARCH_FIXUP_FDT_MEMORY
 /*
  * fdt_pack_reg - pack address and size array into the "reg"-suitable stream
  */
@@ -459,6 +460,7 @@ int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)
        }
        return 0;
 }
+#endif
 
 int fdt_fixup_memory(void *blob, u64 start, u64 size)
 {
@@ -471,7 +473,7 @@ void fdt_fixup_ethernet(void *fdt)
        char *tmp, *end;
        char mac[16];
        const char *path;
-       unsigned char mac_addr[6];
+       unsigned char mac_addr[ARP_HLEN];
        int offset;
 
        if (fdt_path_offset(fdt, "/aliases") < 0)
@@ -480,7 +482,6 @@ void fdt_fixup_ethernet(void *fdt)
        /* Cycle through all aliases */
        for (prop = 0; ; prop++) {
                const char *name;
-               int len = strlen("ethernet");
 
                /* FDT might have been edited, recompute the offset */
                offset = fdt_first_property_offset(fdt,
@@ -493,8 +494,13 @@ void fdt_fixup_ethernet(void *fdt)
                        break;
 
                path = fdt_getprop_by_offset(fdt, offset, &name, NULL);
-               if (!strncmp(name, "ethernet", len)) {
-                       i = trailing_strtol(name);
+               if (!strncmp(name, "ethernet", 8)) {
+                       /* Treat plain "ethernet" same as "ethernet0". */
+                       if (!strcmp(name, "ethernet"))
+                               i = 0;
+                       else
+                               i = trailing_strtol(name);
+
                        if (i != -1) {
                                if (i == 0)
                                        strcpy(mac, "ethaddr");
@@ -523,7 +529,7 @@ void fdt_fixup_ethernet(void *fdt)
 }
 
 /* Resize the fdt to its actual size + a bit of padding */
-int fdt_shrink_to_minimum(void *blob)
+int fdt_shrink_to_minimum(void *blob, uint extrasize)
 {
        int i;
        uint64_t addr, size;
@@ -551,6 +557,7 @@ int fdt_shrink_to_minimum(void *blob)
        actualsize = fdt_off_dt_strings(blob) +
                fdt_size_dt_strings(blob) + 5 * sizeof(struct fdt_reserve_entry);
 
+       actualsize += extrasize;
        /* Make it so the fdt ends on a page boundary */
        actualsize = ALIGN(actualsize + ((uintptr_t)blob & 0xfff), 0x1000);
        actualsize = actualsize - ((uintptr_t)blob & 0xfff);
@@ -900,14 +907,9 @@ void fdt_fixup_mtdparts(void *blob, void *node_info, int node_info_size)
 {
        struct node_info *ni = node_info;
        struct mtd_device *dev;
-       char *parts;
        int i, idx;
        int noff;
 
-       parts = getenv("mtdparts");
-       if (!parts)
-               return;
-
        if (mtdparts_init() != 0)
                return;