Jon Loeliger | 13f5433 | 2008-02-18 14:01:56 -0600 | [diff] [blame] | 1 | /* |
Kumar Gala | 8f3a7fa | 2010-06-09 22:33:53 -0500 | [diff] [blame] | 2 | * Copyright 2008,2010 Freescale Semiconductor, Inc. |
Jon Loeliger | 13f5433 | 2008-02-18 14:01:56 -0600 | [diff] [blame] | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * Version 2 as published by the Free Software Foundation. |
| 7 | */ |
| 8 | |
| 9 | #include <common.h> |
| 10 | #include <libfdt.h> |
| 11 | #include <fdt_support.h> |
Kumar Gala | 7649a59 | 2009-03-31 23:02:38 -0500 | [diff] [blame] | 12 | #include <asm/mp.h> |
Becky Bruce | 1266df8 | 2008-11-03 15:44:01 -0600 | [diff] [blame] | 13 | |
| 14 | DECLARE_GLOBAL_DATA_PTR; |
Jon Loeliger | 13f5433 | 2008-02-18 14:01:56 -0600 | [diff] [blame] | 15 | |
Poonam Aggrwal | f8027f6 | 2009-09-02 19:40:36 +0530 | [diff] [blame] | 16 | extern void ft_fixup_num_cores(void *blob); |
| 17 | |
Jon Loeliger | 13f5433 | 2008-02-18 14:01:56 -0600 | [diff] [blame] | 18 | void ft_cpu_setup(void *blob, bd_t *bd) |
| 19 | { |
Kumar Gala | 7649a59 | 2009-03-31 23:02:38 -0500 | [diff] [blame] | 20 | #ifdef CONFIG_MP |
Becky Bruce | 1266df8 | 2008-11-03 15:44:01 -0600 | [diff] [blame] | 21 | int off; |
Kumar Gala | 7649a59 | 2009-03-31 23:02:38 -0500 | [diff] [blame] | 22 | u32 bootpg = determine_mp_bootpg(); |
Becky Bruce | 1266df8 | 2008-11-03 15:44:01 -0600 | [diff] [blame] | 23 | #endif |
| 24 | |
Jon Loeliger | 13f5433 | 2008-02-18 14:01:56 -0600 | [diff] [blame] | 25 | do_fixup_by_prop_u32(blob, "device_type", "cpu", 4, |
| 26 | "timebase-frequency", bd->bi_busfreq / 4, 1); |
| 27 | do_fixup_by_prop_u32(blob, "device_type", "cpu", 4, |
| 28 | "bus-frequency", bd->bi_busfreq, 1); |
| 29 | do_fixup_by_prop_u32(blob, "device_type", "cpu", 4, |
| 30 | "clock-frequency", bd->bi_intfreq, 1); |
| 31 | do_fixup_by_prop_u32(blob, "device_type", "soc", 4, |
| 32 | "bus-frequency", bd->bi_busfreq, 1); |
| 33 | |
Trent Piepho | 58ec486 | 2008-12-03 15:16:38 -0800 | [diff] [blame] | 34 | #if defined(CONFIG_MPC8641) |
| 35 | do_fixup_by_compat_u32(blob, "fsl,mpc8641-localbus", |
| 36 | "bus-frequency", gd->lbc_clk, 1); |
| 37 | #endif |
| 38 | do_fixup_by_compat_u32(blob, "fsl,elbc", |
| 39 | "bus-frequency", gd->lbc_clk, 1); |
| 40 | |
Jon Loeliger | 13f5433 | 2008-02-18 14:01:56 -0600 | [diff] [blame] | 41 | fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize); |
| 42 | |
| 43 | #if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) \ |
| 44 | || defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3) |
Kumar Gala | ba37aa0 | 2008-08-19 15:41:18 -0500 | [diff] [blame] | 45 | fdt_fixup_ethernet(blob); |
Jon Loeliger | 13f5433 | 2008-02-18 14:01:56 -0600 | [diff] [blame] | 46 | #endif |
| 47 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 48 | #ifdef CONFIG_SYS_NS16550 |
Jon Loeliger | 13f5433 | 2008-02-18 14:01:56 -0600 | [diff] [blame] | 49 | do_fixup_by_compat_u32(blob, "ns16550", |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 50 | "clock-frequency", CONFIG_SYS_NS16550_CLK, 1); |
Jon Loeliger | 13f5433 | 2008-02-18 14:01:56 -0600 | [diff] [blame] | 51 | #endif |
Becky Bruce | 1266df8 | 2008-11-03 15:44:01 -0600 | [diff] [blame] | 52 | |
Kumar Gala | 7649a59 | 2009-03-31 23:02:38 -0500 | [diff] [blame] | 53 | #ifdef CONFIG_MP |
Becky Bruce | 1266df8 | 2008-11-03 15:44:01 -0600 | [diff] [blame] | 54 | /* Reserve the boot page so OSes dont use it */ |
| 55 | off = fdt_add_mem_rsv(blob, bootpg, (u64)4096); |
| 56 | if (off < 0) |
| 57 | printf("%s: %s\n", __FUNCTION__, fdt_strerror(off)); |
Kumar Gala | 8f3a7fa | 2010-06-09 22:33:53 -0500 | [diff] [blame] | 58 | |
Poonam Aggrwal | f8027f6 | 2009-09-02 19:40:36 +0530 | [diff] [blame] | 59 | ft_fixup_num_cores(blob); |
Kumar Gala | 8f3a7fa | 2010-06-09 22:33:53 -0500 | [diff] [blame] | 60 | #endif |
Jon Loeliger | 13f5433 | 2008-02-18 14:01:56 -0600 | [diff] [blame] | 61 | } |