]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - arch/powerpc/cpu/mpc85xx/fdt.c
powerpc/85xx: fix compatible property for the L2 cache node
[karo-tx-uboot.git] / arch / powerpc / cpu / mpc85xx / fdt.c
index 00fa752996593353216e183a7f6547737817bc97..97d3928e1d5124f908c543a9bfe90ad0e9c8f063 100644 (file)
@@ -165,7 +165,6 @@ static inline void ft_fixup_l2cache(void *blob)
        int len, off;
        u32 *ph;
        struct cpu_type *cpu = identify_cpu(SVR_SOC_VER(get_svr()));
-       char compat_buf[38];
 
        const u32 line_size = 32;
        const u32 num_ways = 8;
@@ -192,22 +191,32 @@ static inline void ft_fixup_l2cache(void *blob)
        }
 
        if (cpu) {
-               if (isdigit(cpu->name[0]))
-                       len = sprintf(compat_buf,
-                               "fsl,mpc%s-l2-cache-controller", cpu->name);
-               else
-                       len = sprintf(compat_buf,
-                               "fsl,%c%s-l2-cache-controller",
-                               tolower(cpu->name[0]), cpu->name + 1);
+               char buf[40];
+
+               if (isdigit(cpu->name[0])) {
+                       /* MPCxxxx, where xxxx == 4-digit number */
+                       len = sprintf(buf, "fsl,mpc%s-l2-cache-controller",
+                               cpu->name) + 1;
+               } else {
+                       /* Pxxxx or Txxxx, where xxxx == 4-digit number */
+                       len = sprintf(buf, "fsl,%c%s-l2-cache-controller",
+                               tolower(cpu->name[0]), cpu->name + 1) + 1;
+               }
+
+               /*
+                * append "cache" after the NULL character that the previous
+                * sprintf wrote.  This is how a device tree stores multiple
+                * strings in a property.
+                */
+               len += sprintf(buf + len, "cache") + 1;
 
-               sprintf(&compat_buf[len + 1], "cache");
+               fdt_setprop(blob, off, "compatible", buf, len);
        }
        fdt_setprop(blob, off, "cache-unified", NULL, 0);
        fdt_setprop_cell(blob, off, "cache-block-size", line_size);
        fdt_setprop_cell(blob, off, "cache-size", size);
        fdt_setprop_cell(blob, off, "cache-sets", num_sets);
        fdt_setprop_cell(blob, off, "cache-level", 2);
-       fdt_setprop(blob, off, "compatible", compat_buf, sizeof(compat_buf));
 
        /* we dont bother w/L3 since no platform of this type has one */
 }
@@ -338,6 +347,9 @@ void fdt_add_enet_stashing(void *fdt)
        do_fixup_by_compat_u32(fdt, "gianfar", "rx-stash-len", 96, 1);
 
        do_fixup_by_compat_u32(fdt, "gianfar", "rx-stash-idx", 0, 1);
+       do_fixup_by_compat(fdt, "fsl,etsec2", "bd-stash", NULL, 0, 1);
+       do_fixup_by_compat_u32(fdt, "fsl,etsec2", "rx-stash-len", 96, 1);
+       do_fixup_by_compat_u32(fdt, "fsl,etsec2", "rx-stash-idx", 0, 1);
 }
 
 #if defined(CONFIG_SYS_DPAA_FMAN) || defined(CONFIG_SYS_DPAA_PME)
@@ -470,6 +482,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
        fdt_portal(blob, "fsl,bman-portal", "bman-portals",
                        (u64)CONFIG_SYS_BMAN_MEM_PHYS,
                        CONFIG_SYS_BMAN_MEM_SIZE);
+       fdt_fixup_bportals(blob);
 #endif
 
 #if defined(CONFIG_SYS_QMAN_MEM_PHYS)
@@ -483,4 +496,13 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 #ifdef CONFIG_SYS_SRIO
        ft_srio_setup(blob);
 #endif
+
+       /*
+        * system-clock = CCB clock/2
+        * Here gd->bus_clk = CCB clock
+        * We are using the system clock as 1588 Timer reference
+        * clock source select
+        */
+       do_fixup_by_compat_u32(blob, "fsl,gianfar-ptp-timer",
+                       "timer-frequency", gd->bus_clk/2, 1);
 }