blob: 8a798962f662c9f25bd668f4b90cda9a4d379a08 [file] [log] [blame]
Poonam Aggrwalfb8e3e12009-08-07 21:05:16 +05301/*
2 * MPC85xx RDB Board Setup
3 *
4 * Copyright 2009 Freescale Semiconductor Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#include <linux/stddef.h>
13#include <linux/kernel.h>
14#include <linux/pci.h>
15#include <linux/kdev_t.h>
16#include <linux/delay.h>
17#include <linux/seq_file.h>
18#include <linux/interrupt.h>
19#include <linux/of_platform.h>
20
21#include <asm/system.h>
22#include <asm/time.h>
23#include <asm/machdep.h>
24#include <asm/pci-bridge.h>
25#include <mm/mmu_decl.h>
26#include <asm/prom.h>
27#include <asm/udbg.h>
28#include <asm/mpic.h>
29
30#include <sysdev/fsl_soc.h>
31#include <sysdev/fsl_pci.h>
Kyle Moffett582d3e02011-12-02 06:27:58 +000032#include "smp.h"
Poonam Aggrwalfb8e3e12009-08-07 21:05:16 +053033
Dmitry Eremin-Solenikov543a07b2011-11-17 21:56:16 +040034#include "mpc85xx.h"
35
Poonam Aggrwalfb8e3e12009-08-07 21:05:16 +053036#undef DEBUG
37
38#ifdef DEBUG
39#define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args)
40#else
41#define DBG(fmt, args...)
42#endif
43
44
45void __init mpc85xx_rdb_pic_init(void)
46{
47 struct mpic *mpic;
Poonam Aggrwaldc2e6732009-09-19 22:43:56 +053048 unsigned long root = of_get_flat_dt_root();
Poonam Aggrwalfb8e3e12009-08-07 21:05:16 +053049
Fabio Baltieria63e23b2011-07-12 09:49:43 +020050 if (of_flat_dt_is_compatible(root, "fsl,MPC85XXRDB-CAMP")) {
Kyle Moffette55d7f72011-12-22 10:19:14 +000051 mpic = mpic_alloc(NULL, 0, MPIC_NO_RESET |
Kyle Moffett50196092011-12-22 10:19:12 +000052 MPIC_BIG_ENDIAN |
Fabio Baltieria63e23b2011-07-12 09:49:43 +020053 MPIC_SINGLE_DEST_CPU,
Poonam Aggrwaldc2e6732009-09-19 22:43:56 +053054 0, 256, " OpenPIC ");
55 } else {
Kyle Moffett996983b2011-12-02 06:28:02 +000056 mpic = mpic_alloc(NULL, 0,
Kyle Moffett50196092011-12-22 10:19:12 +000057 MPIC_BIG_ENDIAN |
Poonam Aggrwalfb8e3e12009-08-07 21:05:16 +053058 MPIC_SINGLE_DEST_CPU,
59 0, 256, " OpenPIC ");
Poonam Aggrwaldc2e6732009-09-19 22:43:56 +053060 }
Poonam Aggrwalfb8e3e12009-08-07 21:05:16 +053061
62 BUG_ON(mpic == NULL);
Poonam Aggrwalfb8e3e12009-08-07 21:05:16 +053063 mpic_init(mpic);
Poonam Aggrwalfb8e3e12009-08-07 21:05:16 +053064}
65
66/*
67 * Setup the architecture
68 */
Poonam Aggrwalfb8e3e12009-08-07 21:05:16 +053069static void __init mpc85xx_rdb_setup_arch(void)
70{
71#ifdef CONFIG_PCI
72 struct device_node *np;
73#endif
74
75 if (ppc_md.progress)
76 ppc_md.progress("mpc85xx_rdb_setup_arch()", 0);
77
78#ifdef CONFIG_PCI
79 for_each_node_by_type(np, "pci") {
80 if (of_device_is_compatible(np, "fsl,mpc8548-pcie"))
81 fsl_add_bridge(np, 0);
82 }
83
84#endif
85
Poonam Aggrwalfb8e3e12009-08-07 21:05:16 +053086 mpc85xx_smp_init();
Poonam Aggrwalfb8e3e12009-08-07 21:05:16 +053087 printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n");
88}
89
Dmitry Eremin-Solenikov46d026a2011-11-17 21:56:17 +040090machine_device_initcall(p2020_rdb, mpc85xx_common_publish_devices);
Tang Yuantian35ce1b52011-12-28 11:41:47 +080091machine_device_initcall(p2020_rdb_pc, mpc85xx_common_publish_devices);
Jerry Huangd1fb1062012-03-14 17:08:27 +080092machine_device_initcall(p1020_mbg_pc, mpc85xx_common_publish_devices);
Dmitry Eremin-Solenikov46d026a2011-11-17 21:56:17 +040093machine_device_initcall(p1020_rdb, mpc85xx_common_publish_devices);
Jerry Huang1a244b82012-03-14 17:08:28 +080094machine_device_initcall(p1020_utm_pc, mpc85xx_common_publish_devices);
Xu Jiuchengb73bdf42012-01-17 16:01:30 +080095machine_device_initcall(p1021_rdb_pc, mpc85xx_common_publish_devices);
Zhicheng Fan68867802012-02-13 22:06:22 +000096machine_device_initcall(p1025_rdb, mpc85xx_common_publish_devices);
Poonam Aggrwalfb8e3e12009-08-07 21:05:16 +053097
98/*
99 * Called very early, device-tree isn't unflattened
100 */
101static int __init p2020_rdb_probe(void)
102{
103 unsigned long root = of_get_flat_dt_root();
104
105 if (of_flat_dt_is_compatible(root, "fsl,P2020RDB"))
106 return 1;
107 return 0;
108}
109
Poonam Aggrwal52dffd72009-09-25 09:50:28 +0530110static int __init p1020_rdb_probe(void)
111{
112 unsigned long root = of_get_flat_dt_root();
113
114 if (of_flat_dt_is_compatible(root, "fsl,P1020RDB"))
115 return 1;
116 return 0;
117}
118
Xu Jiuchengb73bdf42012-01-17 16:01:30 +0800119static int __init p1021_rdb_pc_probe(void)
120{
121 unsigned long root = of_get_flat_dt_root();
122
123 if (of_flat_dt_is_compatible(root, "fsl,P1021RDB-PC"))
124 return 1;
125 return 0;
126}
127
Tang Yuantian35ce1b52011-12-28 11:41:47 +0800128static int __init p2020_rdb_pc_probe(void)
129{
130 unsigned long root = of_get_flat_dt_root();
131
132 if (of_flat_dt_is_compatible(root, "fsl,P2020RDB-PC"))
133 return 1;
134 return 0;
135}
136
Zhicheng Fan68867802012-02-13 22:06:22 +0000137static int __init p1025_rdb_probe(void)
138{
139 unsigned long root = of_get_flat_dt_root();
140
141 return of_flat_dt_is_compatible(root, "fsl,P1025RDB");
142}
143
Jerry Huangd1fb1062012-03-14 17:08:27 +0800144static int __init p1020_mbg_pc_probe(void)
145{
146 unsigned long root = of_get_flat_dt_root();
147
148 return of_flat_dt_is_compatible(root, "fsl,P1020MBG-PC");
149}
150
Jerry Huang1a244b82012-03-14 17:08:28 +0800151static int __init p1020_utm_pc_probe(void)
152{
153 unsigned long root = of_get_flat_dt_root();
154
155 return of_flat_dt_is_compatible(root, "fsl,P1020UTM-PC");
156}
157
Poonam Aggrwalfb8e3e12009-08-07 21:05:16 +0530158define_machine(p2020_rdb) {
159 .name = "P2020 RDB",
160 .probe = p2020_rdb_probe,
161 .setup_arch = mpc85xx_rdb_setup_arch,
162 .init_IRQ = mpc85xx_rdb_pic_init,
163#ifdef CONFIG_PCI
164 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
165#endif
166 .get_irq = mpic_get_irq,
167 .restart = fsl_rstcr_restart,
168 .calibrate_decr = generic_calibrate_decr,
169 .progress = udbg_progress,
170};
Poonam Aggrwal52dffd72009-09-25 09:50:28 +0530171
172define_machine(p1020_rdb) {
173 .name = "P1020 RDB",
174 .probe = p1020_rdb_probe,
175 .setup_arch = mpc85xx_rdb_setup_arch,
176 .init_IRQ = mpc85xx_rdb_pic_init,
177#ifdef CONFIG_PCI
178 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
179#endif
180 .get_irq = mpic_get_irq,
181 .restart = fsl_rstcr_restart,
182 .calibrate_decr = generic_calibrate_decr,
183 .progress = udbg_progress,
184};
Xu Jiuchengb73bdf42012-01-17 16:01:30 +0800185
186define_machine(p1021_rdb_pc) {
187 .name = "P1021 RDB-PC",
188 .probe = p1021_rdb_pc_probe,
189 .setup_arch = mpc85xx_rdb_setup_arch,
190 .init_IRQ = mpc85xx_rdb_pic_init,
191#ifdef CONFIG_PCI
192 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
193#endif
194 .get_irq = mpic_get_irq,
195 .restart = fsl_rstcr_restart,
196 .calibrate_decr = generic_calibrate_decr,
197 .progress = udbg_progress,
198};
Tang Yuantian35ce1b52011-12-28 11:41:47 +0800199
200define_machine(p2020_rdb_pc) {
201 .name = "P2020RDB-PC",
202 .probe = p2020_rdb_pc_probe,
203 .setup_arch = mpc85xx_rdb_setup_arch,
204 .init_IRQ = mpc85xx_rdb_pic_init,
205#ifdef CONFIG_PCI
206 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
207#endif
208 .get_irq = mpic_get_irq,
209 .restart = fsl_rstcr_restart,
210 .calibrate_decr = generic_calibrate_decr,
211 .progress = udbg_progress,
212};
Zhicheng Fan68867802012-02-13 22:06:22 +0000213
214define_machine(p1025_rdb) {
215 .name = "P1025 RDB",
216 .probe = p1025_rdb_probe,
217 .setup_arch = mpc85xx_rdb_setup_arch,
218 .init_IRQ = mpc85xx_rdb_pic_init,
219#ifdef CONFIG_PCI
220 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
221#endif
222 .get_irq = mpic_get_irq,
223 .restart = fsl_rstcr_restart,
224 .calibrate_decr = generic_calibrate_decr,
225 .progress = udbg_progress,
226};
Jerry Huangd1fb1062012-03-14 17:08:27 +0800227
228define_machine(p1020_mbg_pc) {
229 .name = "P1020 MBG-PC",
230 .probe = p1020_mbg_pc_probe,
231 .setup_arch = mpc85xx_rdb_setup_arch,
232 .init_IRQ = mpc85xx_rdb_pic_init,
233#ifdef CONFIG_PCI
234 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
235#endif
236 .get_irq = mpic_get_irq,
237 .restart = fsl_rstcr_restart,
238 .calibrate_decr = generic_calibrate_decr,
239 .progress = udbg_progress,
240};
Jerry Huang1a244b82012-03-14 17:08:28 +0800241
242define_machine(p1020_utm_pc) {
243 .name = "P1020 UTM-PC",
244 .probe = p1020_utm_pc_probe,
245 .setup_arch = mpc85xx_rdb_setup_arch,
246 .init_IRQ = mpc85xx_rdb_pic_init,
247#ifdef CONFIG_PCI
248 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
249#endif
250 .get_irq = mpic_get_irq,
251 .restart = fsl_rstcr_restart,
252 .calibrate_decr = generic_calibrate_decr,
253 .progress = udbg_progress,
254};