aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/chrp/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/chrp/setup.c')
-rw-r--r--arch/powerpc/platforms/chrp/setup.c65
1 files changed, 61 insertions, 4 deletions
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 59306261f5b2..116babbaaf81 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -115,7 +115,7 @@ void chrp_show_cpuinfo(struct seq_file *m)
115 seq_printf(m, "machine\t\t: CHRP %s\n", model); 115 seq_printf(m, "machine\t\t: CHRP %s\n", model);
116 116
117 /* longtrail (goldengate) stuff */ 117 /* longtrail (goldengate) stuff */
118 if (!strncmp(model, "IBM,LongTrail", 13)) { 118 if (model && !strncmp(model, "IBM,LongTrail", 13)) {
119 /* VLSI VAS96011/12 `Golden Gate 2' */ 119 /* VLSI VAS96011/12 `Golden Gate 2' */
120 /* Memory banks */ 120 /* Memory banks */
121 sdramen = (in_le32(gg2_pci_config_base + GG2_PCI_DRAM_CTRL) 121 sdramen = (in_le32(gg2_pci_config_base + GG2_PCI_DRAM_CTRL)
@@ -203,15 +203,20 @@ static void __init sio_fixup_irq(const char *name, u8 device, u8 level,
203static void __init sio_init(void) 203static void __init sio_init(void)
204{ 204{
205 struct device_node *root; 205 struct device_node *root;
206 const char *model;
206 207
207 if ((root = of_find_node_by_path("/")) && 208 root = of_find_node_by_path("/");
208 !strncmp(of_get_property(root, "model", NULL), 209 if (!root)
209 "IBM,LongTrail", 13)) { 210 return;
211
212 model = of_get_property(root, "model", NULL);
213 if (model && !strncmp(model, "IBM,LongTrail", 13)) {
210 /* logical device 0 (KBC/Keyboard) */ 214 /* logical device 0 (KBC/Keyboard) */
211 sio_fixup_irq("keyboard", 0, 1, 2); 215 sio_fixup_irq("keyboard", 0, 1, 2);
212 /* select logical device 1 (KBC/Mouse) */ 216 /* select logical device 1 (KBC/Mouse) */
213 sio_fixup_irq("mouse", 1, 12, 2); 217 sio_fixup_irq("mouse", 1, 12, 2);
214 } 218 }
219
215 of_node_put(root); 220 of_node_put(root);
216} 221}
217 222
@@ -251,6 +256,57 @@ static void briq_restart(char *cmd)
251 for(;;); 256 for(;;);
252} 257}
253 258
259/*
260 * Per default, input/output-device points to the keyboard/screen
261 * If no card is installed, the built-in serial port is used as a fallback.
262 * But unfortunately, the firmware does not connect /chosen/{stdin,stdout}
263 * the the built-in serial node. Instead, a /failsafe node is created.
264 */
265static void chrp_init_early(void)
266{
267 struct device_node *node;
268 const char *property;
269
270 if (strstr(cmd_line, "console="))
271 return;
272 /* find the boot console from /chosen/stdout */
273 if (!of_chosen)
274 return;
275 node = of_find_node_by_path("/");
276 if (!node)
277 return;
278 property = of_get_property(node, "model", NULL);
279 if (!property)
280 goto out_put;
281 if (strcmp(property, "Pegasos2"))
282 goto out_put;
283 /* this is a Pegasos2 */
284 property = of_get_property(of_chosen, "linux,stdout-path", NULL);
285 if (!property)
286 goto out_put;
287 of_node_put(node);
288 node = of_find_node_by_path(property);
289 if (!node)
290 return;
291 property = of_get_property(node, "device_type", NULL);
292 if (!property)
293 goto out_put;
294 if (strcmp(property, "serial"))
295 goto out_put;
296 /*
297 * The 9pin connector is either /failsafe
298 * or /pci@80000000/isa@C/serial@i2F8
299 * The optional graphics card has also type 'serial' in VGA mode.
300 */
301 property = of_get_property(node, "name", NULL);
302 if (!property)
303 goto out_put;
304 if (!strcmp(property, "failsafe") || !strcmp(property, "serial"))
305 add_preferred_console("ttyS", 0, NULL);
306out_put:
307 of_node_put(node);
308}
309
254void __init chrp_setup_arch(void) 310void __init chrp_setup_arch(void)
255{ 311{
256 struct device_node *root = of_find_node_by_path("/"); 312 struct device_node *root = of_find_node_by_path("/");
@@ -594,6 +650,7 @@ define_machine(chrp) {
594 .probe = chrp_probe, 650 .probe = chrp_probe,
595 .setup_arch = chrp_setup_arch, 651 .setup_arch = chrp_setup_arch,
596 .init = chrp_init2, 652 .init = chrp_init2,
653 .init_early = chrp_init_early,
597 .show_cpuinfo = chrp_show_cpuinfo, 654 .show_cpuinfo = chrp_show_cpuinfo,
598 .init_IRQ = chrp_init_IRQ, 655 .init_IRQ = chrp_init_IRQ,
599 .restart = rtas_restart, 656 .restart = rtas_restart,