From: Grant Likely Date: Sun, 29 Oct 2006 15:54:10 -0700 Subject: [U-Boot-Users] [PATCH] Enable the IceCube/lite5200 variants to pass a device tree to Linux. In-Reply-To: <1162162451757-git-send-email-grant.likely@secretlab.ca> References: <11621624501057-git-send-email-grant.likely@secretlab.ca> <11621624503973-git-send-email-grant.likely@secretlab.ca> <1162162451844-git-send-email-grant.likely@secretlab.ca> <1162162451805-git-send-email-grant.likely@secretlab.ca> <1162162451757-git-send-email-grant.likely@secretlab.ca> Message-ID: <11621624513123-git-send-email-grant.likely@secretlab.ca> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de This patch adds the code and configuration necessary to boot with an arch/powerpc Linux kernel. Signed-off-by: Grant Likely --- board/icecube/icecube.c | 12 ++++++++++++ cpu/mpc5xxx/cpu.c | 28 ++++++++++++++++++++++++++++ include/configs/IceCube.h | 13 +++++++++++++ 3 files changed, 53 insertions(+), 0 deletions(-) diff --git a/board/icecube/icecube.c b/board/icecube/icecube.c index 4f056b2..9b222da 100644 --- a/board/icecube/icecube.c +++ b/board/icecube/icecube.c @@ -29,6 +29,10 @@ #include #include #include +#if defined(CONFIG_OF_FLAT_TREE) +#include +#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 diff --git a/cpu/mpc5xxx/cpu.c b/cpu/mpc5xxx/cpu.c index 6b6f828..20e6735 100644 --- a/cpu/mpc5xxx/cpu.c +++ b/cpu/mpc5xxx/cpu.c @@ -31,6 +31,10 @@ #include #include #include +#if defined(CONFIG_OF_FLAT_TREE) +#include +#endif + DECLARE_GLOBAL_DATA_PTR; int checkcpu (void) @@ -102,3 +106,27 @@ unsigned long get_tbclk (void) } /* ------------------------------------------------------------------------- */ + +#ifdef CONFIG_OF_FLAT_TREE +void +ft_cpu_setup(void *blob, bd_t *bd) +{ + u32 *p; + ulong clock; + int len; + + clock = bd->bi_busfreq; + 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 "/bus-frequency", &len); + if (p != NULL) + *p = cpu_to_be32(clock); + + p = ft_get_prop(blob, "/" OF_SOC "/ethernet at 3000/mac-address", &len); + if (p != NULL) + memcpy(p, bd->bi_enetaddr, 6); + +} +#endif diff --git a/include/configs/IceCube.h b/include/configs/IceCube.h index 1152f83..0d38254 100644 --- a/include/configs/IceCube.h +++ b/include/configs/IceCube.h @@ -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 */ -- 1.4.3.rc2.g0503