xref: /linux/arch/powerpc/boot/mvme7100.c (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1*2874c5fdSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
297493e2eSAlessio Igor Bogani /*
397493e2eSAlessio Igor Bogani  * Motload compatibility for the Emerson/Artesyn MVME7100
497493e2eSAlessio Igor Bogani  *
597493e2eSAlessio Igor Bogani  * Copyright 2016 Elettra-Sincrotrone Trieste S.C.p.A.
697493e2eSAlessio Igor Bogani  *
797493e2eSAlessio Igor Bogani  * Author: Alessio Igor Bogani <alessio.bogani@elettra.eu>
897493e2eSAlessio Igor Bogani  */
997493e2eSAlessio Igor Bogani 
1097493e2eSAlessio Igor Bogani #include "ops.h"
1197493e2eSAlessio Igor Bogani #include "stdio.h"
1297493e2eSAlessio Igor Bogani #include "cuboot.h"
1397493e2eSAlessio Igor Bogani 
1497493e2eSAlessio Igor Bogani #define TARGET_86xx
1597493e2eSAlessio Igor Bogani #define TARGET_HAS_ETH1
1697493e2eSAlessio Igor Bogani #define TARGET_HAS_ETH2
1797493e2eSAlessio Igor Bogani #define TARGET_HAS_ETH3
1897493e2eSAlessio Igor Bogani #include "ppcboot.h"
1997493e2eSAlessio Igor Bogani 
2097493e2eSAlessio Igor Bogani static bd_t bd;
2197493e2eSAlessio Igor Bogani 
2297493e2eSAlessio Igor Bogani BSS_STACK(16384);
2397493e2eSAlessio Igor Bogani 
mvme7100_fixups(void)2497493e2eSAlessio Igor Bogani static void mvme7100_fixups(void)
2597493e2eSAlessio Igor Bogani {
2697493e2eSAlessio Igor Bogani 	void *devp;
2797493e2eSAlessio Igor Bogani 	unsigned long busfreq = bd.bi_busfreq * 1000000;
2897493e2eSAlessio Igor Bogani 
2997493e2eSAlessio Igor Bogani 	dt_fixup_cpu_clocks(bd.bi_intfreq * 1000000, busfreq / 4, busfreq);
3097493e2eSAlessio Igor Bogani 
3197493e2eSAlessio Igor Bogani 	devp = finddevice("/soc@f1000000");
3297493e2eSAlessio Igor Bogani 	if (devp)
3397493e2eSAlessio Igor Bogani 		setprop(devp, "bus-frequency", &busfreq, sizeof(busfreq));
3497493e2eSAlessio Igor Bogani 
3597493e2eSAlessio Igor Bogani 	devp = finddevice("/soc/serial@4500");
3697493e2eSAlessio Igor Bogani 	if (devp)
3797493e2eSAlessio Igor Bogani 		setprop(devp, "clock-frequency", &busfreq, sizeof(busfreq));
3897493e2eSAlessio Igor Bogani 
3997493e2eSAlessio Igor Bogani 	dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);
4097493e2eSAlessio Igor Bogani 
4197493e2eSAlessio Igor Bogani 	dt_fixup_mac_address_by_alias("ethernet0", bd.bi_enetaddr);
4297493e2eSAlessio Igor Bogani 	dt_fixup_mac_address_by_alias("ethernet1", bd.bi_enet1addr);
4397493e2eSAlessio Igor Bogani 	dt_fixup_mac_address_by_alias("ethernet2", bd.bi_enet2addr);
4497493e2eSAlessio Igor Bogani 	dt_fixup_mac_address_by_alias("ethernet3", bd.bi_enet3addr);
4597493e2eSAlessio Igor Bogani }
4697493e2eSAlessio Igor Bogani 
platform_init(unsigned long r3,unsigned long r4,unsigned long r5,unsigned long r6,unsigned long r7)4797493e2eSAlessio Igor Bogani void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
4897493e2eSAlessio Igor Bogani 		   unsigned long r6, unsigned long r7)
4997493e2eSAlessio Igor Bogani {
5097493e2eSAlessio Igor Bogani 	CUBOOT_INIT();
5197493e2eSAlessio Igor Bogani 	fdt_init(_dtb_start);
5297493e2eSAlessio Igor Bogani 	serial_console_init();
5397493e2eSAlessio Igor Bogani 	platform_ops.fixups = mvme7100_fixups;
5497493e2eSAlessio Igor Bogani }
55