xref: /OK3568_Linux_fs/kernel/arch/powerpc/boot/cuboot-85xx.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0-only
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Old U-boot compatibility for 85xx
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * Author: Scott Wood <scottwood@freescale.com>
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * Copyright (c) 2007 Freescale Semiconductor, Inc.
8*4882a593Smuzhiyun  */
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun #include "ops.h"
11*4882a593Smuzhiyun #include "stdio.h"
12*4882a593Smuzhiyun #include "cuboot.h"
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun #define TARGET_85xx
15*4882a593Smuzhiyun #define TARGET_HAS_ETH3
16*4882a593Smuzhiyun #include "ppcboot.h"
17*4882a593Smuzhiyun 
18*4882a593Smuzhiyun static bd_t bd;
19*4882a593Smuzhiyun 
platform_fixups(void)20*4882a593Smuzhiyun static void platform_fixups(void)
21*4882a593Smuzhiyun {
22*4882a593Smuzhiyun 	void *soc;
23*4882a593Smuzhiyun 
24*4882a593Smuzhiyun 	dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);
25*4882a593Smuzhiyun 	dt_fixup_mac_address_by_alias("ethernet0", bd.bi_enetaddr);
26*4882a593Smuzhiyun 	dt_fixup_mac_address_by_alias("ethernet1", bd.bi_enet1addr);
27*4882a593Smuzhiyun 	dt_fixup_mac_address_by_alias("ethernet2", bd.bi_enet2addr);
28*4882a593Smuzhiyun 	dt_fixup_mac_address_by_alias("ethernet3", bd.bi_enet3addr);
29*4882a593Smuzhiyun 	dt_fixup_cpu_clocks(bd.bi_intfreq, bd.bi_busfreq / 8, bd.bi_busfreq);
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun 	/* Unfortunately, the specific model number is encoded in the
32*4882a593Smuzhiyun 	 * soc node name in existing dts files -- once that is fixed,
33*4882a593Smuzhiyun 	 * this can do a simple path lookup.
34*4882a593Smuzhiyun 	 */
35*4882a593Smuzhiyun 	soc = find_node_by_devtype(NULL, "soc");
36*4882a593Smuzhiyun 	if (soc) {
37*4882a593Smuzhiyun 		void *serial = NULL;
38*4882a593Smuzhiyun 
39*4882a593Smuzhiyun 		setprop(soc, "bus-frequency", &bd.bi_busfreq,
40*4882a593Smuzhiyun 		        sizeof(bd.bi_busfreq));
41*4882a593Smuzhiyun 
42*4882a593Smuzhiyun 		while ((serial = find_node_by_devtype(serial, "serial"))) {
43*4882a593Smuzhiyun 			if (get_parent(serial) != soc)
44*4882a593Smuzhiyun 				continue;
45*4882a593Smuzhiyun 
46*4882a593Smuzhiyun 			setprop(serial, "clock-frequency", &bd.bi_busfreq,
47*4882a593Smuzhiyun 			        sizeof(bd.bi_busfreq));
48*4882a593Smuzhiyun 		}
49*4882a593Smuzhiyun 	}
50*4882a593Smuzhiyun }
51*4882a593Smuzhiyun 
platform_init(unsigned long r3,unsigned long r4,unsigned long r5,unsigned long r6,unsigned long r7)52*4882a593Smuzhiyun void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
53*4882a593Smuzhiyun                    unsigned long r6, unsigned long r7)
54*4882a593Smuzhiyun {
55*4882a593Smuzhiyun 	CUBOOT_INIT();
56*4882a593Smuzhiyun 	fdt_init(_dtb_start);
57*4882a593Smuzhiyun 	serial_console_init();
58*4882a593Smuzhiyun 	platform_ops.fixups = platform_fixups;
59*4882a593Smuzhiyun }
60