aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/cell/celleb_setup.c
diff options
context:
space:
mode:
authorIshizaki Kou <kou.ishizaki@toshiba.co.jp>2008-04-24 05:25:16 -0400
committerPaul Mackerras <paulus@samba.org>2008-04-24 07:08:13 -0400
commit116bdc425c7e01e97cff2f3e6d0134511e8f13e3 (patch)
tree929479057a31e2f8bd97a30380e91f24d14e8eb1 /arch/powerpc/platforms/cell/celleb_setup.c
parent6ec859e1b21ab42bfc36bb3b51db275480165c8a (diff)
[POWERPC] celleb: Move the files for celleb base support
This moves the base code for celleb support into platforms/cell/. All files in this patch are used by celleb-beat and celleb-native commonly. Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms/cell/celleb_setup.c')
-rw-r--r--arch/powerpc/platforms/cell/celleb_setup.c256
1 files changed, 256 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/cell/celleb_setup.c b/arch/powerpc/platforms/cell/celleb_setup.c
new file mode 100644
index 000000000000..d0dad24f2de2
--- /dev/null
+++ b/arch/powerpc/platforms/cell/celleb_setup.c
@@ -0,0 +1,256 @@
1/*
2 * Celleb setup code
3 *
4 * (C) Copyright 2006-2007 TOSHIBA CORPORATION
5 *
6 * This code is based on arch/powerpc/platforms/cell/setup.c:
7 * Copyright (C) 1995 Linus Torvalds
8 * Adapted from 'alpha' version by Gary Thomas
9 * Modified by Cort Dougan (cort@cs.nmt.edu)
10 * Modified by PPC64 Team, IBM Corp
11 * Modified by Cell Team, IBM Deutschland Entwicklung GmbH
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 */
27
28#undef DEBUG
29
30#include <linux/cpu.h>
31#include <linux/sched.h>
32#include <linux/kernel.h>
33#include <linux/mm.h>
34#include <linux/stddef.h>
35#include <linux/unistd.h>
36#include <linux/reboot.h>
37#include <linux/init.h>
38#include <linux/delay.h>
39#include <linux/irq.h>
40#include <linux/seq_file.h>
41#include <linux/root_dev.h>
42#include <linux/console.h>
43#include <linux/of_platform.h>
44
45#include <asm/mmu.h>
46#include <asm/processor.h>
47#include <asm/io.h>
48#include <asm/kexec.h>
49#include <asm/prom.h>
50#include <asm/machdep.h>
51#include <asm/cputable.h>
52#include <asm/irq.h>
53#include <asm/time.h>
54#include <asm/spu_priv1.h>
55#include <asm/firmware.h>
56#include <asm/rtas.h>
57#include <asm/cell-regs.h>
58
59#include "../celleb/interrupt.h"
60#include "../celleb/beat_wrapper.h"
61#include "../celleb/beat.h"
62#include "celleb_pci.h"
63#include "interrupt.h"
64#include "pervasive.h"
65#include "ras.h"
66
67static char celleb_machine_type[128] = "Celleb";
68
69static void celleb_show_cpuinfo(struct seq_file *m)
70{
71 struct device_node *root;
72 const char *model = "";
73
74 root = of_find_node_by_path("/");
75 if (root)
76 model = of_get_property(root, "model", NULL);
77 /* using "CHRP" is to trick anaconda into installing FCx into Celleb */
78 seq_printf(m, "machine\t\t: %s %s\n", celleb_machine_type, model);
79 of_node_put(root);
80}
81
82static int __init celleb_machine_type_hack(char *ptr)
83{
84 strncpy(celleb_machine_type, ptr, sizeof(celleb_machine_type));
85 celleb_machine_type[sizeof(celleb_machine_type)-1] = 0;
86 return 0;
87}
88
89__setup("celleb_machine_type_hack=", celleb_machine_type_hack);
90
91static void celleb_progress(char *s, unsigned short hex)
92{
93 printk("*** %04x : %s\n", hex, s ? s : "");
94}
95
96static void __init celleb_setup_arch_common(void)
97{
98 /* init to some ~sane value until calibrate_delay() runs */
99 loops_per_jiffy = 50000000;
100
101#ifdef CONFIG_DUMMY_CONSOLE
102 conswitchp = &dummy_con;
103#endif
104}
105
106static struct of_device_id celleb_bus_ids[] __initdata = {
107 { .type = "scc", },
108 { .type = "ioif", }, /* old style */
109 {},
110};
111
112static int __init celleb_publish_devices(void)
113{
114 /* Publish OF platform devices for southbridge IOs */
115 of_platform_bus_probe(NULL, celleb_bus_ids, NULL);
116
117 return 0;
118}
119machine_device_initcall(celleb_beat, celleb_publish_devices);
120machine_device_initcall(celleb_native, celleb_publish_devices);
121
122
123/*
124 * functions for Celleb-Beat
125 */
126static void __init celleb_setup_arch_beat(void)
127{
128#ifdef CONFIG_SPU_BASE
129 spu_priv1_ops = &spu_priv1_beat_ops;
130 spu_management_ops = &spu_management_of_ops;
131#endif
132
133#ifdef CONFIG_SMP
134 smp_init_celleb();
135#endif
136
137 celleb_setup_arch_common();
138}
139
140static int __init celleb_probe_beat(void)
141{
142 unsigned long root = of_get_flat_dt_root();
143
144 if (!of_flat_dt_is_compatible(root, "Beat"))
145 return 0;
146
147 powerpc_firmware_features |= FW_FEATURE_CELLEB_ALWAYS
148 | FW_FEATURE_BEAT | FW_FEATURE_LPAR;
149 hpte_init_beat_v3();
150
151 return 1;
152}
153
154
155/*
156 * functions for Celleb-native
157 */
158static void __init celleb_init_IRQ_native(void)
159{
160 iic_init_IRQ();
161 spider_init_IRQ();
162}
163
164static void __init celleb_setup_arch_native(void)
165{
166#ifdef CONFIG_SPU_BASE
167 spu_priv1_ops = &spu_priv1_mmio_ops;
168 spu_management_ops = &spu_management_of_ops;
169#endif
170
171 cbe_regs_init();
172
173#ifdef CONFIG_CBE_RAS
174 cbe_ras_init();
175#endif
176
177#ifdef CONFIG_SMP
178 smp_init_cell();
179#endif
180
181 cbe_pervasive_init();
182
183 /* XXX: nvram initialization should be added */
184
185 celleb_setup_arch_common();
186}
187
188static int __init celleb_probe_native(void)
189{
190 unsigned long root = of_get_flat_dt_root();
191
192 if (of_flat_dt_is_compatible(root, "Beat") ||
193 !of_flat_dt_is_compatible(root, "TOSHIBA,Celleb"))
194 return 0;
195
196 powerpc_firmware_features |= FW_FEATURE_CELLEB_ALWAYS;
197 hpte_init_native();
198
199 return 1;
200}
201
202
203/*
204 * machine definitions
205 */
206define_machine(celleb_beat) {
207 .name = "Cell Reference Set (Beat)",
208 .probe = celleb_probe_beat,
209 .setup_arch = celleb_setup_arch_beat,
210 .show_cpuinfo = celleb_show_cpuinfo,
211 .restart = beat_restart,
212 .power_off = beat_power_off,
213 .halt = beat_halt,
214 .get_rtc_time = beat_get_rtc_time,
215 .set_rtc_time = beat_set_rtc_time,
216 .calibrate_decr = generic_calibrate_decr,
217 .progress = celleb_progress,
218 .power_save = beat_power_save,
219 .nvram_size = beat_nvram_get_size,
220 .nvram_read = beat_nvram_read,
221 .nvram_write = beat_nvram_write,
222 .set_dabr = beat_set_xdabr,
223 .init_IRQ = beatic_init_IRQ,
224 .get_irq = beatic_get_irq,
225 .pci_probe_mode = celleb_pci_probe_mode,
226 .pci_setup_phb = celleb_setup_phb,
227#ifdef CONFIG_KEXEC
228 .kexec_cpu_down = beat_kexec_cpu_down,
229 .machine_kexec = default_machine_kexec,
230 .machine_kexec_prepare = default_machine_kexec_prepare,
231 .machine_crash_shutdown = default_machine_crash_shutdown,
232#endif
233};
234
235define_machine(celleb_native) {
236 .name = "Cell Reference Set (native)",
237 .probe = celleb_probe_native,
238 .setup_arch = celleb_setup_arch_native,
239 .show_cpuinfo = celleb_show_cpuinfo,
240 .restart = rtas_restart,
241 .power_off = rtas_power_off,
242 .halt = rtas_halt,
243 .get_boot_time = rtas_get_boot_time,
244 .get_rtc_time = rtas_get_rtc_time,
245 .set_rtc_time = rtas_set_rtc_time,
246 .calibrate_decr = generic_calibrate_decr,
247 .progress = celleb_progress,
248 .pci_probe_mode = celleb_pci_probe_mode,
249 .pci_setup_phb = celleb_setup_phb,
250 .init_IRQ = celleb_init_IRQ_native,
251#ifdef CONFIG_KEXEC
252 .machine_kexec = default_machine_kexec,
253 .machine_kexec_prepare = default_machine_kexec_prepare,
254 .machine_crash_shutdown = default_machine_crash_shutdown,
255#endif
256};