powerpc/85xx: Use fdt_node_offset_by_compat_reg for clock-frequency updates
authorKumar Gala <galak@kernel.crashing.org>
Sat, 10 Jul 2010 11:38:16 +0000 (06:38 -0500)
committerKumar Gala <galak@kernel.crashing.org>
Tue, 20 Jul 2010 09:40:06 +0000 (04:40 -0500)
Move to using fdt_node_offset_by_compat_reg to find the node offsets we
want to update instead of using aliases.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
arch/powerpc/cpu/mpc85xx/fdt.c

index 2628cc5f95023e49b05163dcdb6c0ebc19082028..b4354f90db5b17fa49c07c10a6aaad5356a0ca2c 100644 (file)
@@ -298,17 +298,17 @@ void fdt_add_enet_stashing(void *fdt)
 }
 
 #if defined(CONFIG_SYS_DPAA_FMAN) || defined(CONFIG_SYS_DPAA_PME)
-static void ft_fixup_clks(void *blob, const char *alias, unsigned long freq)
+static void ft_fixup_clks(void *blob, const char *compat, u32 offset,
+                         unsigned long freq)
 {
-       const char *path = fdt_get_alias(blob, alias);
-
-       int off = fdt_path_offset(blob, path);
+       phys_addr_t phys = offset + CONFIG_SYS_CCSRBAR_PHYS;
+       int off = fdt_node_offset_by_compat_reg(blob, compat, phys);
 
        if (off >= 0) {
                off = fdt_setprop_cell(blob, off, "clock-frequency", freq);
                if (off > 0)
                        printf("WARNING enable to set clock-frequency "
-                               "for %s: %s\n", alias, fdt_strerror(off));
+                               "for %s: %s\n", compat, fdt_strerror(off));
        }
 }
 
@@ -317,14 +317,17 @@ static void ft_fixup_dpaa_clks(void *blob)
        sys_info_t sysinfo;
 
        get_sys_info(&sysinfo);
-       ft_fixup_clks(blob, "fman0", sysinfo.freqFMan[0]);
+       ft_fixup_clks(blob, "fsl,fman", CONFIG_SYS_FSL_FM1_OFFSET,
+                       sysinfo.freqFMan[0]);
 
 #if (CONFIG_SYS_NUM_FMAN == 2)
-       ft_fixup_clks(blob, "fman1", sysinfo.freqFMan[1]);
+       ft_fixup_clks(blob, "fsl,fman", CONFIG_SYS_FSL_FM2_OFFSET,
+                       sysinfo.freqFMan[1]);
 #endif
 
 #ifdef CONFIG_SYS_DPAA_PME
-       ft_fixup_clks(blob, "pme", sysinfo.freqPME);
+       do_fixup_by_compat_u32(blob, "fsl,pme",
+               "clock-frequency", sysinfo.freqPME, 1);
 #endif
 }
 #else