Skip to contentSkip to conversation

Add Device tree support to lite5200b eval board

RFC PATCH New Grant Likely 2 participants 2 messages Oct 25, 2006

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Add Device tree support to lite5200b eval board

Please comment on this patch. This is not the final patch as applying this one prevents booting an arch/ppc kernel (due to adding CONFIG_OF_FLAT_TREE to include/configs/IceCube.h).

I have not yet successfully booted an arch/powerpc kernel using this change, but I want feedback to ensure I've twiddled the correct bits. :)

---
 board/icecube/icecube.c   |   12 +++++++++++
 cpu/mpc5xxx/cpu.c         |   47 +++++++++++++++++++++++++++++++++++++++++++++
 include/configs/IceCube.h |   13 ++++++++++++
 3 files changed, 72 insertions(+), 0 deletions(-)
board/icecube/icecube.c +12 -0
index 4f056b2..9b222da 100644
@@ -29,6 +29,10 @@ #include <mpc5xxx.h>
 #include <pci.h>
 #include <asm/processor.h>
 
+#if defined(CONFIG_OF_FLAT_TREE)
+#include <ft_build.h>
+#endif
+
 #if defined(CONFIG_LITE5200B)
 #include "mt46v32m16.h"
 #else
@@ -334,3 +338,11 @@ void ide_set_reset (int idereset)
 	}
 }
 #endif /* defined (CFG_CMD_IDE) && defined (CONFIG_IDE_RESET) */
+
+#if defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP)
+void
+ft_board_setup(void *blob, bd_t *bd)
+{
+	ft_cpu_setup(blob, bd);
+}
+#endif
cpu/mpc5xxx/cpu.c +47 -0

56 lines not on this page · raw message

include/configs/IceCube.h +13 -0
index 1152f83..0d38254 100644
@@ -172,6 +172,19 @@ #else
 #undef CFG_IPBSPEED_133   	/* define for 133MHz speed */
 #endif
 #endif /* CONFIG_MPC5200 */
+
+/* pass open firmware flat tree */
+#define CONFIG_OF_FLAT_TREE	1
+#define CONFIG_OF_BOARD_SETUP	1
+
+/* maximum size of the flat tree (8K) */
+#define OF_FLAT_TREE_MAX_SIZE	8192
+
+#define OF_CPU			"PowerPC,5200 at 0"
+#define OF_SOC			"soc5200 at f0000000"
+#define OF_TBCLK		(bd->bi_busfreq / 8)
+#define OF_STDOUT_PATH		"/soc5200 at f0000000/serial at 2000"
+
 /*
  * I2C configuration
  */
Signature · 1 line
1.4.3.rc2.g0503
#1 lore raw

RFC PATCH 1/1 Add Device tree support to lite5200b eval board

Quoted 6 lines · In message <[email protected]> you wrote:

Please comment on this patch. This is not the final patch as applying this one prevents booting an arch/ppc kernel (due to adding CONFIG_OF_FLAT_TREE to include/configs/IceCube.h).

I have not yet successfully booted an arch/powerpc kernel using this change, but I want feedback to ensure I've twiddled the correct bits. :)

I can just comment on formal things.

Quoted 17 lines
cpu/mpc5xxx/cpu.c +17 -0
+	p = ft_get_prop(blob, "/cpus/" OF_CPU "/bus-frequency", &len);
+	if (p != NULL)
+		*p = cpu_to_be32(clock);
+
+	p = ft_get_prop(blob, "/" OF_SOC "/serial at 2000/clock-frequency", &len);
+	if (p != NULL)
+		*p = cpu_to_be32(clock);
+
+	p = ft_get_prop(blob, "/" OF_SOC "/serial at 2200/clock-frequency", &len);
+	if (p != NULL)
+		*p = cpu_to_be32(clock);
+
+	p = ft_get_prop(blob, "/" OF_SOC "/serial at 2400/clock-frequency", &len);
+	if (p != NULL)
+		*p = cpu_to_be32(clock);
+
+	p = ft_get_prop(blob, "/" OF_SOC "/serial at 2600/clock-frequency", &len);

cpu/mpc5xxx/cpu.c unsigned long get_tbclk (void) · line 145

Quoted 10 lines
cpu/mpc5xxx/cpu.c +10 -0
+	if (p != NULL)
+		*p = cpu_to_be32(clock);
+
+	p = ft_get_prop(blob, "/" OF_SOC "/serial at 2800/clock-frequency", &len);
+	if (p != NULL)
+		*p = cpu_to_be32(clock);
+
+	p = ft_get_prop(blob, "/" OF_SOC "/serial at 2c00/clock-frequency", &len);
+	if (p != NULL)
+		*p = cpu_to_be32(clock);

Please write this as a loop.

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It may be that your whole purpose in life is simply  to  serve  as  a
warning to others.