[U-Boot-Users] [PATCH] cpu/mpc8260/: ported new fdt code from cpu/mpc83xx/

Nikita V. Youshchenko yoush at cs.msu.su
Mon Feb 25 16:19:19 CET 2008


This is an updated version, that actually works.

commit 817027b43687a34d0c8e9880fcdea40a424ceb8d
Author: Nikita Youshchenko <yoush at cs.msu.su>
Date:   Mon Feb 25 11:27:06 2008 +0000

    cpu/mpc8260/: ported new fdt code from cpu/mpc83xx/
    
    This patch:
    - splits mpc8260 fdt fixup code into individual file, fdt.c,
    - adds some fixups from cpu/mpc83xx/fdt.c,
    - adds additional fixups, under #ifdef CONFIG_OF_COMPAT, that assist
      booting older (e.g. 2.6.18-based) vendor kernels.
    
    Since cpu/mpc8260/config.mk unconditionally defines CONFIG_CPM2, checks
    for that macro are ommitted in cpu/mpc8260/fdt.c
    
    Signed-off-by: Nikita Youshchenko <yoush at cs.msu.su>

diff --git a/cpu/mpc8260/Makefile b/cpu/mpc8260/Makefile
index 80d7852..d2a9f79 100644
--- a/cpu/mpc8260/Makefile
+++ b/cpu/mpc8260/Makefile
@@ -28,7 +28,7 @@ LIB	= $(obj)lib$(CPU).a
 START	= start.o kgdb.o
 COBJS	= traps.o serial_smc.o serial_scc.o cpu.o cpu_init.o speed.o \
 	  interrupts.o ether_scc.o ether_fcc.o i2c.o commproc.o \
-	  bedbug_603e.o pci.o spi.o
+	  bedbug_603e.o pci.o spi.o fdt.o
 
 SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
diff --git a/cpu/mpc8260/cpu.c b/cpu/mpc8260/cpu.c
index 55e61a1..f6383c3 100644
--- a/cpu/mpc8260/cpu.c
+++ b/cpu/mpc8260/cpu.c
@@ -47,12 +47,6 @@
 #include <asm/processor.h>
 #include <asm/cpm_8260.h>
 
-#if defined(CONFIG_OF_LIBFDT)
-#include <libfdt.h>
-#include <libfdt_env.h>
-#include <fdt_support.h>
-#endif
-
 DECLARE_GLOBAL_DATA_PTR;
 
 #if defined(CONFIG_GET_CPU_STR_F)
@@ -298,15 +292,3 @@ void watchdog_reset (void)
 		enable_interrupts ();
 }
 #endif /* CONFIG_WATCHDOG */
-
-/* ------------------------------------------------------------------------- */
-#if defined(CONFIG_OF_LIBFDT)
-void ft_cpu_setup (void *blob, bd_t *bd)
-{
-	char * cpu_path = "/cpus/" OF_CPU;
-
-	do_fixup_by_path_u32(blob, cpu_path, "bus-frequency", bd->bi_busfreq, 1);
-	do_fixup_by_path_u32(blob, cpu_path, "timebase-frequency", OF_TBCLK, 1);
-	do_fixup_by_path_u32(blob, cpu_path, "clock-frequency", bd->bi_intfreq, 1);
-}
-#endif /* CONFIG_OF_LIBFDT */
diff --git a/cpu/mpc8260/fdt.c b/cpu/mpc8260/fdt.c
new file mode 100644
index 0000000..a077b06
--- /dev/null
+++ b/cpu/mpc8260/fdt.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2007 Freescale Semiconductor, Inc.
+ *
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+
+#if defined(CONFIG_OF_LIBFDT)
+
+#include <libfdt.h>
+#include <fdt_support.h>
+
+void ft_cpu_setup (void *blob, bd_t *bd)
+{
+
+#if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) ||\
+    defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3)
+	fdt_fixup_ethernet(blob, bd);
+#endif
+
+	do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
+		"timebase-frequency", (bd->bi_busfreq / 4), 1);
+	do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
+		"bus-frequency", bd->bi_busfreq, 1);
+	do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
+		"clock-frequency", bd->bi_intfreq, 1);
+	do_fixup_by_prop_u32(blob, "device_type", "soc", 4,
+		"bus-frequency", bd->bi_busfreq, 1);
+
+#ifdef CONFIG_OF_COMPAT
+	do_fixup_by_prop_u32(blob, "device_type", "cpm", 4,
+		"brg-frequency", bd->bi_brgfreq, 0);
+	do_fixup_by_compat_u32(blob, "cpm_uart",
+		"current-speed", bd->bi_baudrate, 1);
+#endif
+
+	do_fixup_by_compat_u32(blob, "fsl,cpm2-brg",
+		"clock-frequency", bd->bi_brgfreq, 1);
+	do_fixup_by_compat_u32(blob, "fsl,cpm2-smc-uart",
+		"current-speed", bd->bi_baudrate, 1);
+	do_fixup_by_compat_u32(blob, "fsl,cpm2-scc-uart",
+		"current-speed", bd->bi_baudrate, 1);
+
+	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
+}
+
+#endif /* CONFIG_OF_LIBFDT */




More information about the U-Boot mailing list