1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0-only
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun * Generic PowerPC 44x platform support
4*4882a593Smuzhiyun *
5*4882a593Smuzhiyun * Copyright 2008 IBM Corporation
6*4882a593Smuzhiyun *
7*4882a593Smuzhiyun * This implements simple platform support for PowerPC 44x chips. This is
8*4882a593Smuzhiyun * mostly used for eval boards or other simple and "generic" 44x boards. If
9*4882a593Smuzhiyun * your board has custom functions or hardware, then you will likely want to
10*4882a593Smuzhiyun * implement your own board.c file to accommodate it.
11*4882a593Smuzhiyun */
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun #include <asm/machdep.h>
14*4882a593Smuzhiyun #include <asm/pci-bridge.h>
15*4882a593Smuzhiyun #include <asm/ppc4xx.h>
16*4882a593Smuzhiyun #include <asm/prom.h>
17*4882a593Smuzhiyun #include <asm/time.h>
18*4882a593Smuzhiyun #include <asm/udbg.h>
19*4882a593Smuzhiyun #include <asm/uic.h>
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun #include <linux/init.h>
22*4882a593Smuzhiyun #include <linux/of_platform.h>
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun static const struct of_device_id ppc44x_of_bus[] __initconst = {
25*4882a593Smuzhiyun { .compatible = "ibm,plb4", },
26*4882a593Smuzhiyun { .compatible = "ibm,opb", },
27*4882a593Smuzhiyun { .compatible = "ibm,ebc", },
28*4882a593Smuzhiyun { .compatible = "simple-bus", },
29*4882a593Smuzhiyun {},
30*4882a593Smuzhiyun };
31*4882a593Smuzhiyun
ppc44x_device_probe(void)32*4882a593Smuzhiyun static int __init ppc44x_device_probe(void)
33*4882a593Smuzhiyun {
34*4882a593Smuzhiyun of_platform_bus_probe(NULL, ppc44x_of_bus, NULL);
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun return 0;
37*4882a593Smuzhiyun }
38*4882a593Smuzhiyun machine_device_initcall(ppc44x_simple, ppc44x_device_probe);
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun /* This is the list of boards that can be supported by this simple
41*4882a593Smuzhiyun * platform code. This does _not_ mean the boards are compatible,
42*4882a593Smuzhiyun * as they most certainly are not from a device tree perspective.
43*4882a593Smuzhiyun * However, their differences are handled by the device tree and the
44*4882a593Smuzhiyun * drivers and therefore they don't need custom board support files.
45*4882a593Smuzhiyun *
46*4882a593Smuzhiyun * Again, if your board needs to do things differently then create a
47*4882a593Smuzhiyun * board.c file for it rather than adding it to this list.
48*4882a593Smuzhiyun */
49*4882a593Smuzhiyun static char *board[] __initdata = {
50*4882a593Smuzhiyun "amcc,arches",
51*4882a593Smuzhiyun "amcc,bamboo",
52*4882a593Smuzhiyun "apm,bluestone",
53*4882a593Smuzhiyun "amcc,glacier",
54*4882a593Smuzhiyun "ibm,ebony",
55*4882a593Smuzhiyun "amcc,eiger",
56*4882a593Smuzhiyun "amcc,katmai",
57*4882a593Smuzhiyun "amcc,rainier",
58*4882a593Smuzhiyun "amcc,redwood",
59*4882a593Smuzhiyun "amcc,sequoia",
60*4882a593Smuzhiyun "amcc,taishan",
61*4882a593Smuzhiyun "amcc,yosemite",
62*4882a593Smuzhiyun "mosaixtech,icon"
63*4882a593Smuzhiyun };
64*4882a593Smuzhiyun
ppc44x_probe(void)65*4882a593Smuzhiyun static int __init ppc44x_probe(void)
66*4882a593Smuzhiyun {
67*4882a593Smuzhiyun int i = 0;
68*4882a593Smuzhiyun
69*4882a593Smuzhiyun for (i = 0; i < ARRAY_SIZE(board); i++) {
70*4882a593Smuzhiyun if (of_machine_is_compatible(board[i])) {
71*4882a593Smuzhiyun pci_set_flags(PCI_REASSIGN_ALL_RSRC);
72*4882a593Smuzhiyun return 1;
73*4882a593Smuzhiyun }
74*4882a593Smuzhiyun }
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun return 0;
77*4882a593Smuzhiyun }
78*4882a593Smuzhiyun
define_machine(ppc44x_simple)79*4882a593Smuzhiyun define_machine(ppc44x_simple) {
80*4882a593Smuzhiyun .name = "PowerPC 44x Platform",
81*4882a593Smuzhiyun .probe = ppc44x_probe,
82*4882a593Smuzhiyun .progress = udbg_progress,
83*4882a593Smuzhiyun .init_IRQ = uic_init_tree,
84*4882a593Smuzhiyun .get_irq = uic_get_irq,
85*4882a593Smuzhiyun .restart = ppc4xx_reset_system,
86*4882a593Smuzhiyun .calibrate_decr = generic_calibrate_decr,
87*4882a593Smuzhiyun };
88