xref: /OK3568_Linux_fs/kernel/arch/powerpc/platforms/40x/ppc40x_simple.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0-only
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Generic PowerPC 40x 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 ppc40x_of_bus[] __initconst = {
25*4882a593Smuzhiyun 	{ .compatible = "ibm,plb3", },
26*4882a593Smuzhiyun 	{ .compatible = "ibm,plb4", },
27*4882a593Smuzhiyun 	{ .compatible = "ibm,opb", },
28*4882a593Smuzhiyun 	{ .compatible = "ibm,ebc", },
29*4882a593Smuzhiyun 	{ .compatible = "simple-bus", },
30*4882a593Smuzhiyun 	{},
31*4882a593Smuzhiyun };
32*4882a593Smuzhiyun 
ppc40x_device_probe(void)33*4882a593Smuzhiyun static int __init ppc40x_device_probe(void)
34*4882a593Smuzhiyun {
35*4882a593Smuzhiyun 	of_platform_bus_probe(NULL, ppc40x_of_bus, NULL);
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun 	return 0;
38*4882a593Smuzhiyun }
39*4882a593Smuzhiyun machine_device_initcall(ppc40x_simple, ppc40x_device_probe);
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun /* This is the list of boards that can be supported by this simple
42*4882a593Smuzhiyun  * platform code.  This does _not_ mean the boards are compatible,
43*4882a593Smuzhiyun  * as they most certainly are not from a device tree perspective.
44*4882a593Smuzhiyun  * However, their differences are handled by the device tree and the
45*4882a593Smuzhiyun  * drivers and therefore they don't need custom board support files.
46*4882a593Smuzhiyun  *
47*4882a593Smuzhiyun  * Again, if your board needs to do things differently then create a
48*4882a593Smuzhiyun  * board.c file for it rather than adding it to this list.
49*4882a593Smuzhiyun  */
50*4882a593Smuzhiyun static const char * const board[] __initconst = {
51*4882a593Smuzhiyun 	"amcc,acadia",
52*4882a593Smuzhiyun 	"amcc,haleakala",
53*4882a593Smuzhiyun 	"amcc,kilauea",
54*4882a593Smuzhiyun 	"amcc,makalu",
55*4882a593Smuzhiyun 	"apm,klondike",
56*4882a593Smuzhiyun 	"est,hotfoot",
57*4882a593Smuzhiyun 	"plathome,obs600",
58*4882a593Smuzhiyun 	NULL
59*4882a593Smuzhiyun };
60*4882a593Smuzhiyun 
ppc40x_probe(void)61*4882a593Smuzhiyun static int __init ppc40x_probe(void)
62*4882a593Smuzhiyun {
63*4882a593Smuzhiyun 	if (of_device_compatible_match(of_root, board)) {
64*4882a593Smuzhiyun 		pci_set_flags(PCI_REASSIGN_ALL_RSRC);
65*4882a593Smuzhiyun 		return 1;
66*4882a593Smuzhiyun 	}
67*4882a593Smuzhiyun 
68*4882a593Smuzhiyun 	return 0;
69*4882a593Smuzhiyun }
70*4882a593Smuzhiyun 
define_machine(ppc40x_simple)71*4882a593Smuzhiyun define_machine(ppc40x_simple) {
72*4882a593Smuzhiyun 	.name = "PowerPC 40x Platform",
73*4882a593Smuzhiyun 	.probe = ppc40x_probe,
74*4882a593Smuzhiyun 	.progress = udbg_progress,
75*4882a593Smuzhiyun 	.init_IRQ = uic_init_tree,
76*4882a593Smuzhiyun 	.get_irq = uic_get_irq,
77*4882a593Smuzhiyun 	.restart = ppc4xx_reset_system,
78*4882a593Smuzhiyun 	.calibrate_decr = generic_calibrate_decr,
79*4882a593Smuzhiyun };
80