Skip to contentSkip to conversation

86xx: Convert sbc8641d to use libfdt.

PATCH New Jon Loeliger 1 participant 2 messages Feb 18, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 86xx: Convert sbc8641d to use libfdt.

This is the proper fix for a missing closing brace in the function ft_cpu_setup() noticed by joe.hamman <at> embeddedspecialties.com. The ft_cpu_setup() function in mpc8641hpcn.c should have been removed earlier as it was under the obsolete CONFIG_OF_FLAT_TREE, but was missed. Only, the sbc8641d was nominally still using it. It all got ripped out, and the funcality that was in ft_board_setup() was refactored to remove the CPU portions into the new file cpu/mpc86xx/fdt.c instead. Make sbc8641d use this now.

Based loosely on an original patch from joe.hamman at embeddedspecialties.com

---

Wolfgang,

Although the sbc8641d isn't really a FSL board, I'm going to include this patch in my -mpc86xx repository as this board will need to be brought up-to-date to fix the rest of the 86xx board builds now too.

Built on all 86xx boards, booted and tested on 8641HPCN. Can someone who has an sbc8641d please verify this?

Thanks,
jdl

 board/freescale/mpc8641hpcn/mpc8641hpcn.c |   18 +-------
 board/sbc8641d/sbc8641d.c                 |   41 +++++++++++++-------
 cpu/mpc86xx/Makefile                      |   17 ++++++--
 cpu/mpc86xx/cpu.c                         |   61 -----------------------------
 cpu/mpc86xx/fdt.c                         |   35 ++++++++++++++++
 include/configs/sbc8641d.h                |   10 +---
 6 files changed, 80 insertions(+), 102 deletions(-)
 create mode 100644 cpu/mpc86xx/fdt.c
board/freescale/mpc8641hpcn/mpc8641hpcn.c +3 -15
index 8278789..ae79143 100644
@@ -321,28 +321,16 @@ void pci_init_board(void)
 
 }
 
+
 #if defined(CONFIG_OF_BOARD_SETUP)
+
 void
 ft_board_setup(void *blob, bd_t *bd)
 {
 	int node, tmp[2];
 	const char *path;
 
-	fdt_fixup_ethernet(blob, bd);
-
-	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);
-
-	do_fixup_by_compat_u32(blob, "ns16550",
-			       "clock-frequency", bd->bi_busfreq, 1);
-
-	fdt_fixup_memory(blob, bd->bi_memstart, bd->bi_memsize);
+	ft_cpu_setup(blob, bd);
 
 	node = fdt_path_offset(blob, "/aliases");
 	tmp[0] = 0;
board/sbc8641d/sbc8641d.c +27 -14

56 lines not on this page · raw message

cpu/mpc86xx/Makefile +12 -5
index 6d9300e..537f62a 100644
@@ -28,13 +28,20 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(CPU).a
 
-START	= start.o #resetvec.o
+START	= start.o
 SOBJS	= cache.o
-COBJS	= traps.o cpu.o cpu_init.o speed.o interrupts.o \
-	  spd_sdram.o
 
-SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
+COBJS-y	+= traps.o
+COBJS-y	+= cpu.o
+COBJS-y	+= cpu_init.o
+COBJS-y	+= speed.o
+COBJS-y	+= interrupts.o
+COBJS-y	+= spd_sdram.o
+
+COBJS-$(CONFIG_OF_LIBFDT) += fdt.o
+
+SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS-y))
 START	:= $(addprefix $(obj),$(START))
 
 all:	$(obj).depend $(START) $(LIB)
cpu/mpc86xx/cpu.c +0 -61

73 lines not on this page · raw message

cpu/mpc86xx/fdt.c new file +35 -0
new file mode 100644
index 0000000..379306e
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2008 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * Version 2 as published by the Free Software Foundation.
+ */
+
+#include <common.h>
+#include <libfdt.h>
+#include <fdt_support.h>
+
+void ft_cpu_setup(void *blob, bd_t *bd)
+{
+	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);
+
+	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
+
+#if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) \
+    || defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3)
+	fdt_fixup_ethernet(blob, bd);
+#endif
+
+#ifdef CFG_NS16550
+	do_fixup_by_compat_u32(blob, "ns16550",
+			       "clock-frequency", bd->bi_busfreq, 1);
+#endif
+}
include/configs/sbc8641d.h +3 -7
index 1991a8c..18cedff 100644
@@ -268,13 +268,9 @@
 /*
  * Pass open firmware flat tree to kernel
  */
-#define CONFIG_OF_FLAT_TREE	1
-#define CONFIG_OF_BOARD_SETUP	1
-
-#define OF_CPU		"PowerPC,8641 at 0"
-#define OF_SOC		"soc at f8000000"
-#define OF_TBCLK	(bd->bi_busfreq / 4)
-#define OF_STDOUT_PATH	"/soc at f8000000/serial at 4500"
+#define CONFIG_OF_LIBFDT		1
+#define CONFIG_OF_BOARD_SETUP		1
+#define CONFIG_OF_STDOUT_VIA_ALIAS	1
 
 #define CFG_64BIT_VSPRINTF	1
 #define CFG_64BIT_STRTOUL	1
Signature · 1 line
1.5.4.rc5.19.g0509eb
#1 lore raw

PATCH 1/1 86xx: Convert sbc8641d to use libfdt.

Quoted 7 lines · Jon Loeliger

Wolfgang,

Although the sbc8641d isn't really a FSL board, I'm going to include this patch in my -mpc86xx repository as this board will need to be brought up-to-date to fix the rest of the 86xx board builds now too.

Quoted 5 lines

Built on all 86xx boards, booted and tested on 8641HPCN. Can someone who has an sbc8641d please verify this?

Thanks,
jdl

I've pushed these patches to the u-boot-mpc86xx.git repo on denx.de to expedite the testing of the sbc8641d!

Enjoy,
jdl