Back to home page

OSCL-LXR

 
 

    


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