0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include "ops.h"
0012 #include "stdio.h"
0013 #include "io.h"
0014 #include "cuboot.h"
0015
0016 #define TARGET_PPC_MPC52xx
0017 #include "ppcboot.h"
0018
0019 static bd_t bd;
0020
0021 static void platform_fixups(void)
0022 {
0023 void *soc, *reg;
0024 int div;
0025 u32 sysfreq;
0026
0027
0028 dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);
0029 dt_fixup_mac_addresses(bd.bi_enetaddr);
0030 dt_fixup_cpu_clocks(bd.bi_intfreq, bd.bi_busfreq / 4, bd.bi_busfreq);
0031
0032
0033
0034
0035
0036 soc = find_node_by_devtype(NULL, "soc");
0037 if (!soc)
0038 soc = find_node_by_compatible(NULL, "fsl,mpc5200-immr");
0039 if (!soc)
0040 soc = find_node_by_compatible(NULL, "fsl,mpc5200b-immr");
0041 if (soc) {
0042 setprop(soc, "bus-frequency", &bd.bi_ipbfreq,
0043 sizeof(bd.bi_ipbfreq));
0044
0045 if (!dt_xlate_reg(soc, 0, (void*)®, NULL))
0046 return;
0047 div = in_8(reg + 0x204) & 0x0020 ? 8 : 4;
0048 sysfreq = bd.bi_busfreq * div;
0049 setprop(soc, "system-frequency", &sysfreq, sizeof(sysfreq));
0050 }
0051 }
0052
0053 void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
0054 unsigned long r6, unsigned long r7)
0055 {
0056 CUBOOT_INIT();
0057 fdt_init(_dtb_start);
0058 serial_console_init();
0059 platform_ops.fixups = platform_fixups;
0060 }