0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include "ops.h"
0011 #include "stdio.h"
0012 #include "redboot.h"
0013 #include "fsl-soc.h"
0014 #include "io.h"
0015
0016 static bd_t bd;
0017 BSS_STACK(4096);
0018
0019 #define MHZ(x) ((x + 500000) / 1000000)
0020
0021 static void platform_fixups(void)
0022 {
0023 void *node;
0024
0025 dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);
0026 dt_fixup_mac_addresses(bd.bi_enetaddr);
0027 dt_fixup_cpu_clocks(bd.bi_intfreq, bd.bi_busfreq / 16, bd.bi_busfreq);
0028
0029 node = finddevice("/soc/cpm/brg");
0030 if (node) {
0031 printf("BRG clock-frequency <- 0x%x (%dMHz)\r\n",
0032 bd.bi_busfreq, MHZ(bd.bi_busfreq));
0033 setprop(node, "clock-frequency", &bd.bi_busfreq, 4);
0034 }
0035 }
0036
0037 void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
0038 unsigned long r6, unsigned long r7)
0039 {
0040 memcpy(&bd, (char *)r3, sizeof(bd));
0041
0042 if (bd.bi_tag != 0x42444944)
0043 return;
0044
0045 simple_alloc_init(_end,
0046 bd.bi_memstart + bd.bi_memsize - (unsigned long)_end,
0047 32, 64);
0048
0049 fdt_init(_dtb_start);
0050 serial_console_init();
0051 platform_ops.fixups = platform_fixups;
0052
0053 loader_info.cmdline = (char *)bd.bi_cmdline;
0054 loader_info.cmdline_len = strlen((char *)bd.bi_cmdline);
0055 }