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