powerpc/85xx: consolidate of_platform_bus_probe calls
[deliverable/linux.git] / arch / powerpc / platforms / 85xx / stx_gp3.c
1 /*
2 * Based on MPC8560 ADS and arch/ppc stx_gp3 ports
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
6 * Copyright 2008 Freescale Semiconductor Inc.
7 *
8 * Dan Malek <dan@embeddededge.com>
9 * Copyright 2004 Embedded Edge, LLC
10 *
11 * Copied from mpc8560_ads.c
12 * Copyright 2002, 2003 Motorola Inc.
13 *
14 * Ported to 2.6, Matt Porter <mporter@kernel.crashing.org>
15 * Copyright 2004-2005 MontaVista Software, Inc.
16 *
17 * This program is free software; you can redistribute it and/or modify it
18 * under the terms of the GNU General Public License as published by the
19 * Free Software Foundation; either version 2 of the License, or (at your
20 * option) any later version.
21 */
22
23 #include <linux/stddef.h>
24 #include <linux/kernel.h>
25 #include <linux/pci.h>
26 #include <linux/kdev_t.h>
27 #include <linux/delay.h>
28 #include <linux/seq_file.h>
29 #include <linux/of_platform.h>
30
31 #include <asm/system.h>
32 #include <asm/time.h>
33 #include <asm/machdep.h>
34 #include <asm/pci-bridge.h>
35 #include <asm/mpic.h>
36 #include <asm/prom.h>
37 #include <mm/mmu_decl.h>
38 #include <asm/udbg.h>
39
40 #include <sysdev/fsl_soc.h>
41 #include <sysdev/fsl_pci.h>
42
43 #include "mpc85xx.h"
44
45 #ifdef CONFIG_CPM2
46 #include <asm/cpm2.h>
47 #endif /* CONFIG_CPM2 */
48
49 static void __init stx_gp3_pic_init(void)
50 {
51 struct mpic *mpic;
52 struct resource r;
53 struct device_node *np;
54
55 np = of_find_node_by_type(NULL, "open-pic");
56 if (!np) {
57 printk(KERN_ERR "Could not find open-pic node\n");
58 return;
59 }
60
61 if (of_address_to_resource(np, 0, &r)) {
62 printk(KERN_ERR "Could not map mpic register space\n");
63 of_node_put(np);
64 return;
65 }
66
67 mpic = mpic_alloc(np, r.start,
68 MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
69 0, 256, " OpenPIC ");
70 BUG_ON(mpic == NULL);
71 of_node_put(np);
72
73 mpic_init(mpic);
74
75 mpc85xx_cpm2_pic_init();
76 }
77
78 /*
79 * Setup the architecture
80 */
81 static void __init stx_gp3_setup_arch(void)
82 {
83 #ifdef CONFIG_PCI
84 struct device_node *np;
85 #endif
86
87 if (ppc_md.progress)
88 ppc_md.progress("stx_gp3_setup_arch()", 0);
89
90 #ifdef CONFIG_CPM2
91 cpm2_reset();
92 #endif
93
94 #ifdef CONFIG_PCI
95 for_each_compatible_node(np, "pci", "fsl,mpc8540-pci")
96 fsl_add_bridge(np, 1);
97 #endif
98 }
99
100 static void stx_gp3_show_cpuinfo(struct seq_file *m)
101 {
102 uint pvid, svid, phid1;
103
104 pvid = mfspr(SPRN_PVR);
105 svid = mfspr(SPRN_SVR);
106
107 seq_printf(m, "Vendor\t\t: RPC Electronics STx\n");
108 seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
109 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
110
111 /* Display cpu Pll setting */
112 phid1 = mfspr(SPRN_HID1);
113 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
114 }
115
116 machine_device_initcall(stx_gp3, mpc85xx_common_publish_devices);
117
118 /*
119 * Called very early, device-tree isn't unflattened
120 */
121 static int __init stx_gp3_probe(void)
122 {
123 unsigned long root = of_get_flat_dt_root();
124
125 return of_flat_dt_is_compatible(root, "stx,gp3-8560");
126 }
127
128 define_machine(stx_gp3) {
129 .name = "STX GP3",
130 .probe = stx_gp3_probe,
131 .setup_arch = stx_gp3_setup_arch,
132 .init_IRQ = stx_gp3_pic_init,
133 .show_cpuinfo = stx_gp3_show_cpuinfo,
134 .get_irq = mpic_get_irq,
135 .restart = fsl_rstcr_restart,
136 .calibrate_decr = generic_calibrate_decr,
137 .progress = udbg_progress,
138 };
This page took 0.03314 seconds and 5 git commands to generate.