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