Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * Embedded Planet EP8248E with PlanetCore firmware
0004  *
0005  * Author: Scott Wood <scottwood@freescale.com>
0006  *
0007  * Copyright (c) 2007 Freescale Semiconductor, Inc.
0008  */
0009 
0010 #include "ops.h"
0011 #include "stdio.h"
0012 #include "planetcore.h"
0013 #include "pq2.h"
0014 
0015 static char *table;
0016 static u64 mem_size;
0017 
0018 #include <io.h>
0019 
0020 static void platform_fixups(void)
0021 {
0022     u64 val;
0023 
0024     dt_fixup_memory(0, mem_size);
0025     planetcore_set_mac_addrs(table);
0026 
0027     if (!planetcore_get_decimal(table, PLANETCORE_KEY_CRYSTAL_HZ, &val)) {
0028         printf("No PlanetCore crystal frequency key.\r\n");
0029         return;
0030     }
0031 
0032     pq2_fixup_clocks(val);
0033 }
0034 
0035 void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
0036                    unsigned long r6, unsigned long r7)
0037 {
0038     table = (char *)r3;
0039     planetcore_prepare_table(table);
0040 
0041     if (!planetcore_get_decimal(table, PLANETCORE_KEY_MB_RAM, &mem_size))
0042         return;
0043 
0044     mem_size *= 1024 * 1024;
0045     simple_alloc_init(_end, mem_size - (unsigned long)_end, 32, 64);
0046 
0047     fdt_init(_dtb_start);
0048 
0049     planetcore_set_stdout_path(table);
0050     serial_console_init();
0051     platform_ops.fixups = platform_fixups;
0052 }