Linux-libre 5.3.12-gnu
[librecmc/linux-libre.git] / arch / powerpc / platforms / 52xx / mpc5200_simple.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Support for 'mpc5200-simple-platform' compatible boards.
4  *
5  * Written by Marian Balakowicz <m8@semihalf.com>
6  * Copyright (C) 2007 Semihalf
7  *
8  * Description:
9  * This code implements support for a simple MPC52xx based boards which
10  * do not need a custom platform specific setup. Such boards are
11  * supported assuming the following:
12  *
13  * - GPIO pins are configured by the firmware,
14  * - CDM configuration (clocking) is setup correctly by firmware,
15  * - if the 'fsl,has-wdt' property is present in one of the
16  *   gpt nodes, then it is safe to use such gpt to reset the board,
17  * - PCI is supported if enabled in the kernel configuration
18  *   and if there is a PCI bus node defined in the device tree.
19  *
20  * Boards that are compatible with this generic platform support
21  * are listed in a 'board' table.
22  */
23
24 #undef DEBUG
25 #include <asm/time.h>
26 #include <asm/prom.h>
27 #include <asm/machdep.h>
28 #include <asm/mpc52xx.h>
29
30 /*
31  * Setup the architecture
32  */
33 static void __init mpc5200_simple_setup_arch(void)
34 {
35         if (ppc_md.progress)
36                 ppc_md.progress("mpc5200_simple_setup_arch()", 0);
37
38         /* Map important registers from the internal memory map */
39         mpc52xx_map_common_devices();
40
41         /* Some mpc5200 & mpc5200b related configuration */
42         mpc5200_setup_xlb_arbiter();
43
44         mpc52xx_setup_pci();
45 }
46
47 /* list of the supported boards */
48 static const char *board[] __initdata = {
49         "anonymous,a3m071",
50         "anonymous,a4m072",
51         "anon,charon",
52         "ifm,o2d",
53         "intercontrol,digsy-mtc",
54         "manroland,mucmc52",
55         "manroland,uc101",
56         "phytec,pcm030",
57         "phytec,pcm032",
58         "promess,motionpro",
59         "schindler,cm5200",
60         "tqc,tqm5200",
61         NULL
62 };
63
64 /*
65  * Called very early, MMU is off, device-tree isn't unflattened
66  */
67 static int __init mpc5200_simple_probe(void)
68 {
69         return of_device_compatible_match(of_root, board);
70 }
71
72 define_machine(mpc5200_simple_platform) {
73         .name           = "mpc5200-simple-platform",
74         .probe          = mpc5200_simple_probe,
75         .setup_arch     = mpc5200_simple_setup_arch,
76         .init           = mpc52xx_declare_of_platform_devices,
77         .init_IRQ       = mpc52xx_init_irq,
78         .get_irq        = mpc52xx_get_irq,
79         .restart        = mpc52xx_restart,
80         .calibrate_decr = generic_calibrate_decr,
81 };