GNU Linux-libre 4.9.309-gnu1
[releases.git] / arch / powerpc / boot / mvme7100.c
1 /*
2  * Motload compatibility for the Emerson/Artesyn MVME7100
3  *
4  * Copyright 2016 Elettra-Sincrotrone Trieste S.C.p.A.
5  *
6  * Author: Alessio Igor Bogani <alessio.bogani@elettra.eu>
7  *
8  * This program is free software; you can redistribute  it and/or modify it
9  * under  the terms of  the GNU General  Public License as published by the
10  * Free Software Foundation;  either version 2 of the  License, or (at your
11  * option) any later version.
12  *
13  */
14
15 #include "ops.h"
16 #include "stdio.h"
17 #include "cuboot.h"
18
19 #define TARGET_86xx
20 #define TARGET_HAS_ETH1
21 #define TARGET_HAS_ETH2
22 #define TARGET_HAS_ETH3
23 #include "ppcboot.h"
24
25 static bd_t bd;
26
27 BSS_STACK(16384);
28
29 static void mvme7100_fixups(void)
30 {
31         void *devp;
32         unsigned long busfreq = bd.bi_busfreq * 1000000;
33
34         dt_fixup_cpu_clocks(bd.bi_intfreq * 1000000, busfreq / 4, busfreq);
35
36         devp = finddevice("/soc@f1000000");
37         if (devp)
38                 setprop(devp, "bus-frequency", &busfreq, sizeof(busfreq));
39
40         devp = finddevice("/soc/serial@4500");
41         if (devp)
42                 setprop(devp, "clock-frequency", &busfreq, sizeof(busfreq));
43
44         dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);
45
46         dt_fixup_mac_address_by_alias("ethernet0", bd.bi_enetaddr);
47         dt_fixup_mac_address_by_alias("ethernet1", bd.bi_enet1addr);
48         dt_fixup_mac_address_by_alias("ethernet2", bd.bi_enet2addr);
49         dt_fixup_mac_address_by_alias("ethernet3", bd.bi_enet3addr);
50 }
51
52 void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
53                    unsigned long r6, unsigned long r7)
54 {
55         CUBOOT_INIT();
56         fdt_init(_dtb_start);
57         serial_console_init();
58         platform_ops.fixups = mvme7100_fixups;
59 }