Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * Old U-boot compatibility for 83xx
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 "cuboot.h"
0013 
0014 #define TARGET_83xx
0015 #include "ppcboot.h"
0016 
0017 static bd_t bd;
0018 
0019 static void platform_fixups(void)
0020 {
0021     void *soc;
0022 
0023     dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);
0024     dt_fixup_mac_address_by_alias("ethernet0", bd.bi_enetaddr);
0025     dt_fixup_mac_address_by_alias("ethernet1", bd.bi_enet1addr);
0026     dt_fixup_cpu_clocks(bd.bi_intfreq, bd.bi_busfreq / 4, bd.bi_busfreq);
0027 
0028     /* Unfortunately, the specific model number is encoded in the
0029      * soc node name in existing dts files -- once that is fixed,
0030      * this can do a simple path lookup.
0031      */
0032     soc = find_node_by_devtype(NULL, "soc");
0033     if (soc) {
0034         void *serial = NULL;
0035 
0036         setprop(soc, "bus-frequency", &bd.bi_busfreq,
0037                 sizeof(bd.bi_busfreq));
0038 
0039         while ((serial = find_node_by_devtype(serial, "serial"))) {
0040             if (get_parent(serial) != soc)
0041                 continue;
0042 
0043             setprop(serial, "clock-frequency", &bd.bi_busfreq,
0044                     sizeof(bd.bi_busfreq));
0045         }
0046     }
0047 }
0048 
0049 void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
0050                    unsigned long r6, unsigned long r7)
0051 {
0052     CUBOOT_INIT();
0053     fdt_init(_dtb_start);
0054     serial_console_init();
0055     platform_ops.fixups = platform_fixups;
0056 }