Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * Embedded Planet EP88xC 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 "mpc8xx.h"
0014 
0015 static char *table;
0016 static u64 mem_size;
0017 
0018 static void platform_fixups(void)
0019 {
0020     u64 val;
0021 
0022     dt_fixup_memory(0, mem_size);
0023     planetcore_set_mac_addrs(table);
0024 
0025     if (!planetcore_get_decimal(table, PLANETCORE_KEY_CRYSTAL_HZ, &val)) {
0026         printf("No PlanetCore crystal frequency key.\r\n");
0027         return;
0028     }
0029 
0030     mpc885_fixup_clocks(val);
0031 }
0032 
0033 void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
0034                    unsigned long r6, unsigned long r7)
0035 {
0036     table = (char *)r3;
0037     planetcore_prepare_table(table);
0038 
0039     if (!planetcore_get_decimal(table, PLANETCORE_KEY_MB_RAM, &mem_size))
0040         return;
0041 
0042     mem_size *= 1024 * 1024;
0043     simple_alloc_init(_end, mem_size - (unsigned long)_end, 32, 64);
0044 
0045     fdt_init(_dtb_start);
0046 
0047     planetcore_set_stdout_path(table);
0048 
0049     serial_console_init();
0050     platform_ops.fixups = platform_fixups;
0051 }