[U-Boot] [RFC] RFC: convert MPC8536DS to use generic board

York Sun yorksun at freescale.com
Sat Apr 26 03:10:22 CEST 2014


This patch converts MC8536DS to use generic board. This is for discussion.
Do NOT apply.

To make it work

Add #ifdef CONFIG_OF_CONTROL for reserve_fdt(), setup_fdt(), reloc_fdt().
Set initial value for gd. Powerpc SoCs use locked cache as init RAM.
Change return value for mac_read_from_eeprom() when mismatch happens to
prevent calling hang().

Signed-off-by: York Sun <yorksun at freescale.com>
---
 board/freescale/common/sys_eeprom.c |    2 +-
 common/board_f.c                    |   18 +++++++++++++++++-
 include/configs/MPC8536DS.h         |    2 ++
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/board/freescale/common/sys_eeprom.c b/board/freescale/common/sys_eeprom.c
index 9c18dd8..a3c37ff 100644
--- a/board/freescale/common/sys_eeprom.c
+++ b/board/freescale/common/sys_eeprom.c
@@ -447,7 +447,7 @@ int mac_read_from_eeprom(void)
 	crcp = (void *)&e + crc_offset;
 	if (crc != be32_to_cpu(*crcp)) {
 		printf("CRC mismatch (%08x != %08x)\n", crc, be32_to_cpu(e.crc));
-		return -1;
+		return 0;
 	}
 
 #ifdef CONFIG_SYS_I2C_EEPROM_NXID
diff --git a/common/board_f.c b/common/board_f.c
index f285bad..b972db8 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -335,6 +335,7 @@ static int setup_ram_buf(void)
 }
 #endif
 
+#ifdef CONFIG_OF_CONTROL
 static int setup_fdt(void)
 {
 #ifdef CONFIG_OF_EMBED
@@ -354,6 +355,7 @@ static int setup_fdt(void)
 						(uintptr_t)gd->fdt_blob);
 	return 0;
 }
+#endif
 
 /* Get the top of usable RAM */
 __weak ulong board_get_usable_ram_top(ulong total_size)
@@ -549,6 +551,7 @@ static int reserve_global_data(void)
 	return 0;
 }
 
+#ifdef CONFIG_OF_CONTROL
 static int reserve_fdt(void)
 {
 	/*
@@ -567,6 +570,7 @@ static int reserve_fdt(void)
 
 	return 0;
 }
+#endif
 
 static int reserve_stacks(void)
 {
@@ -584,7 +588,6 @@ static int reserve_stacks(void)
 	gd->start_addr_sp -= 16;
 	gd->start_addr_sp &= ~0xf;
 	gd->irq_sp = gd->start_addr_sp;
-
 	/*
 	 * Handle architecture-specific things here
 	 * TODO(sjg at chromium.org): Perhaps create arch_reserve_stack()
@@ -724,6 +727,7 @@ static int setup_dram_config(void)
 	return 0;
 }
 
+#ifdef CONFIG_OF_CONTROL
 static int reloc_fdt(void)
 {
 	if (gd->new_fdt) {
@@ -733,6 +737,7 @@ static int reloc_fdt(void)
 
 	return 0;
 }
+#endif
 
 static int setup_reloc(void)
 {
@@ -789,7 +794,9 @@ static init_fnc_t init_sequence_f[] = {
 	setup_ram_buf,
 #endif
 	setup_mon_len,
+#ifdef CONFIG_OF_CONTROL
 	setup_fdt,
+#endif
 	trace_early_init,
 #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
 	/* TODO: can this go into arch_cpu_init()? */
@@ -945,7 +952,9 @@ static init_fnc_t init_sequence_f[] = {
 #endif
 	setup_machine,
 	reserve_global_data,
+#ifdef CONFIG_OF_CONTROL
 	reserve_fdt,
+#endif
 	reserve_stacks,
 	setup_dram_config,
 	show_dram_config,
@@ -960,7 +969,9 @@ static init_fnc_t init_sequence_f[] = {
 	setup_board_extra,
 #endif
 	INIT_FUNC_WATCHDOG_RESET
+#ifdef CONFIG_OF_CONTROL
 	reloc_fdt,
+#endif
 	setup_reloc,
 #if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX)
 	jump_to_copy,
@@ -976,6 +987,11 @@ void board_init_f(ulong boot_flags)
 	gd = &data;
 #endif
 
+#ifdef CONFIG_PPC
+	gd = (gd_t *) (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET);
+	__asm__ __volatile__("":::"memory");
+#endif
+
 	/*
 	 * Clear global data before it is accessed at debug print
 	 * in initcall_run_list. Otherwise the debug print probably
diff --git a/include/configs/MPC8536DS.h b/include/configs/MPC8536DS.h
index f15e162..c241736 100644
--- a/include/configs/MPC8536DS.h
+++ b/include/configs/MPC8536DS.h
@@ -11,6 +11,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#define CONFIG_SYS_GENERIC_BOARD
+
 #include "../board/freescale/common/ics307_clk.h"
 
 #ifdef CONFIG_36BIT
-- 
1.7.9.5



More information about the U-Boot mailing list