xref: /openbmc/linux/arch/powerpc/boot/cuboot-85xx.c (revision d2912cb1)
1d2912cb1SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
24536b937SScott Wood /*
34536b937SScott Wood  * Old U-boot compatibility for 85xx
44536b937SScott Wood  *
54536b937SScott Wood  * Author: Scott Wood <scottwood@freescale.com>
64536b937SScott Wood  *
74536b937SScott Wood  * Copyright (c) 2007 Freescale Semiconductor, Inc.
84536b937SScott Wood  */
94536b937SScott Wood 
104536b937SScott Wood #include "ops.h"
114536b937SScott Wood #include "stdio.h"
1285aecac8SDavid Gibson #include "cuboot.h"
134536b937SScott Wood 
144536b937SScott Wood #define TARGET_85xx
157b9edb9dSNate Case #define TARGET_HAS_ETH3
164536b937SScott Wood #include "ppcboot.h"
174536b937SScott Wood 
184536b937SScott Wood static bd_t bd;
194536b937SScott Wood 
platform_fixups(void)204536b937SScott Wood static void platform_fixups(void)
214536b937SScott Wood {
224536b937SScott Wood 	void *soc;
234536b937SScott Wood 
244536b937SScott Wood 	dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);
253e6f4394SKumar Gala 	dt_fixup_mac_address_by_alias("ethernet0", bd.bi_enetaddr);
263e6f4394SKumar Gala 	dt_fixup_mac_address_by_alias("ethernet1", bd.bi_enet1addr);
273e6f4394SKumar Gala 	dt_fixup_mac_address_by_alias("ethernet2", bd.bi_enet2addr);
287b9edb9dSNate Case 	dt_fixup_mac_address_by_alias("ethernet3", bd.bi_enet3addr);
294536b937SScott Wood 	dt_fixup_cpu_clocks(bd.bi_intfreq, bd.bi_busfreq / 8, bd.bi_busfreq);
304536b937SScott Wood 
314536b937SScott Wood 	/* Unfortunately, the specific model number is encoded in the
324536b937SScott Wood 	 * soc node name in existing dts files -- once that is fixed,
334536b937SScott Wood 	 * this can do a simple path lookup.
344536b937SScott Wood 	 */
354536b937SScott Wood 	soc = find_node_by_devtype(NULL, "soc");
364536b937SScott Wood 	if (soc) {
374536b937SScott Wood 		void *serial = NULL;
384536b937SScott Wood 
394536b937SScott Wood 		setprop(soc, "bus-frequency", &bd.bi_busfreq,
404536b937SScott Wood 		        sizeof(bd.bi_busfreq));
414536b937SScott Wood 
424536b937SScott Wood 		while ((serial = find_node_by_devtype(serial, "serial"))) {
434536b937SScott Wood 			if (get_parent(serial) != soc)
444536b937SScott Wood 				continue;
454536b937SScott Wood 
464536b937SScott Wood 			setprop(serial, "clock-frequency", &bd.bi_busfreq,
474536b937SScott Wood 			        sizeof(bd.bi_busfreq));
484536b937SScott Wood 		}
494536b937SScott Wood 	}
504536b937SScott Wood }
514536b937SScott Wood 
platform_init(unsigned long r3,unsigned long r4,unsigned long r5,unsigned long r6,unsigned long r7)524536b937SScott Wood void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
534536b937SScott Wood                    unsigned long r6, unsigned long r7)
544536b937SScott Wood {
5585aecac8SDavid Gibson 	CUBOOT_INIT();
562f0dfeaaSDavid Gibson 	fdt_init(_dtb_start);
574536b937SScott Wood 	serial_console_init();
584536b937SScott Wood 	platform_ops.fixups = platform_fixups;
594536b937SScott Wood }
60