xref: /openbmc/linux/arch/powerpc/boot/mvme7100.c (revision cd238eff)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Motload compatibility for the Emerson/Artesyn MVME7100
4  *
5  * Copyright 2016 Elettra-Sincrotrone Trieste S.C.p.A.
6  *
7  * Author: Alessio Igor Bogani <alessio.bogani@elettra.eu>
8  */
9 
10 #include "ops.h"
11 #include "stdio.h"
12 #include "cuboot.h"
13 
14 #define TARGET_86xx
15 #define TARGET_HAS_ETH1
16 #define TARGET_HAS_ETH2
17 #define TARGET_HAS_ETH3
18 #include "ppcboot.h"
19 
20 static bd_t bd;
21 
22 BSS_STACK(16384);
23 
24 static void mvme7100_fixups(void)
25 {
26 	void *devp;
27 	unsigned long busfreq = bd.bi_busfreq * 1000000;
28 
29 	dt_fixup_cpu_clocks(bd.bi_intfreq * 1000000, busfreq / 4, busfreq);
30 
31 	devp = finddevice("/soc@f1000000");
32 	if (devp)
33 		setprop(devp, "bus-frequency", &busfreq, sizeof(busfreq));
34 
35 	devp = finddevice("/soc/serial@4500");
36 	if (devp)
37 		setprop(devp, "clock-frequency", &busfreq, sizeof(busfreq));
38 
39 	dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);
40 
41 	dt_fixup_mac_address_by_alias("ethernet0", bd.bi_enetaddr);
42 	dt_fixup_mac_address_by_alias("ethernet1", bd.bi_enet1addr);
43 	dt_fixup_mac_address_by_alias("ethernet2", bd.bi_enet2addr);
44 	dt_fixup_mac_address_by_alias("ethernet3", bd.bi_enet3addr);
45 }
46 
47 void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
48 		   unsigned long r6, unsigned long r7)
49 {
50 	CUBOOT_INIT();
51 	fdt_init(_dtb_start);
52 	serial_console_init();
53 	platform_ops.fixups = mvme7100_fixups;
54 }
55