aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorOlaf Hering <olaf@aepfle.de>2008-01-21 10:37:45 -0500
committerPaul Mackerras <paulus@samba.org>2008-01-25 06:52:55 -0500
commit5bc977867f36fc36cde43b309b891b2f7b714f52 (patch)
treedf65ee9fe33058b9f31ee6a5166267270487fe37 /arch/powerpc
parent092ca5bd61da6344f3b249754b337f2d48dfe08d (diff)
[POWERPC] Autodetect serial console on pegasos2
Signed-off-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/platforms/chrp/setup.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 42a21bab76c8..116babbaaf81 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -256,6 +256,57 @@ static void briq_restart(char *cmd)
256 for(;;); 256 for(;;);
257} 257}
258 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
259void __init chrp_setup_arch(void) 310void __init chrp_setup_arch(void)
260{ 311{
261 struct device_node *root = of_find_node_by_path("/"); 312 struct device_node *root = of_find_node_by_path("/");
@@ -599,6 +650,7 @@ define_machine(chrp) {
599 .probe = chrp_probe, 650 .probe = chrp_probe,
600 .setup_arch = chrp_setup_arch, 651 .setup_arch = chrp_setup_arch,
601 .init = chrp_init2, 652 .init = chrp_init2,
653 .init_early = chrp_init_early,
602 .show_cpuinfo = chrp_show_cpuinfo, 654 .show_cpuinfo = chrp_show_cpuinfo,
603 .init_IRQ = chrp_init_IRQ, 655 .init_IRQ = chrp_init_IRQ,
604 .restart = rtas_restart, 656 .restart = rtas_restart,