2 * Copyright 2007 Freescale Semiconductor, Inc.
5 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
7 * See file CREDITS for list of people who contributed to this
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 #include <fdt_support.h>
30 extern void ft_qe_setup(void *blob);
33 DECLARE_GLOBAL_DATA_PTR;
35 void ft_fixup_cpu(void *blob, u64 memory_limit)
38 ulong spin_tbl_addr = get_spin_addr();
39 u32 bootpg, id = get_my_id();
41 /* if we have 4G or more of memory, put the boot page at 4Gb-4k */
42 if ((u64)gd->ram_size > 0xfffff000)
45 bootpg = gd->ram_size - 4096;
47 off = fdt_node_offset_by_prop_value(blob, -1, "device_type", "cpu", 4);
48 while (off != -FDT_ERR_NOTFOUND) {
49 u32 *reg = (u32 *)fdt_getprop(blob, off, "reg", 0);
53 fdt_setprop_string(blob, off, "status", "okay");
55 u32 val = *reg * SIZE_BOOT_ENTRY + spin_tbl_addr;
56 val = cpu_to_fdt32(val);
57 fdt_setprop_string(blob, off, "status",
59 fdt_setprop_string(blob, off, "enable-method",
61 fdt_setprop(blob, off, "cpu-release-addr",
65 printf ("cpu NULL\n");
67 off = fdt_node_offset_by_prop_value(blob, off,
68 "device_type", "cpu", 4);
71 /* Reserve the boot page so OSes dont use it */
72 if ((u64)bootpg < memory_limit) {
73 off = fdt_add_mem_rsv(blob, bootpg, (u64)4096);
75 printf("%s: %s\n", __FUNCTION__, fdt_strerror(off));
80 void ft_cpu_setup(void *blob, bd_t *bd)
82 #if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) ||\
83 defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3)
84 fdt_fixup_ethernet(blob, bd);
87 do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
88 "timebase-frequency", bd->bi_busfreq / 8, 1);
89 do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
90 "bus-frequency", bd->bi_busfreq, 1);
91 do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
92 "clock-frequency", bd->bi_intfreq, 1);
93 do_fixup_by_prop_u32(blob, "device_type", "soc", 4,
94 "bus-frequency", bd->bi_busfreq, 1);
100 do_fixup_by_compat_u32(blob, "ns16550",
101 "clock-frequency", bd->bi_busfreq, 1);
105 do_fixup_by_compat_u32(blob, "fsl,cpm2-scc-uart",
106 "current-speed", bd->bi_baudrate, 1);
108 do_fixup_by_compat_u32(blob, "fsl,cpm2-brg",
109 "clock-frequency", bd->bi_brgfreq, 1);
112 fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
115 ft_fixup_cpu(blob, (u64)bd->bi_memstart + (u64)bd->bi_memsize);