diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-07-27 23:49:15 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-07-28 02:30:53 -0400 |
commit | 025d7917a5ede982a5669c6735ef73a227b9827e (patch) | |
tree | b921600f898523c63cefa79effdc4f917b1cf4ab /arch/powerpc/platforms/powermac/setup.c | |
parent | f023bf0f91f1f1b926ec8f5cf0ee24be134bf024 (diff) |
powerpc/powermac: Fixup default serial port device for pmac_zilog
This removes the non-working code in legacy_serial that tried to handle
the powermac SCC ports, and instead add a (now working) function to the
powermac platform code to find the default serial console if any.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms/powermac/setup.c')
-rw-r--r-- | arch/powerpc/platforms/powermac/setup.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c index 31635446901a..88ccf3a08a9c 100644 --- a/arch/powerpc/platforms/powermac/setup.c +++ b/arch/powerpc/platforms/powermac/setup.c | |||
@@ -541,6 +541,78 @@ static int __init pmac_declare_of_platform_devices(void) | |||
541 | } | 541 | } |
542 | machine_device_initcall(powermac, pmac_declare_of_platform_devices); | 542 | machine_device_initcall(powermac, pmac_declare_of_platform_devices); |
543 | 543 | ||
544 | #ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE | ||
545 | /* | ||
546 | * This is called very early, as part of console_init() (typically just after | ||
547 | * time_init()). This function is respondible for trying to find a good | ||
548 | * default console on serial ports. It tries to match the open firmware | ||
549 | * default output with one of the available serial console drivers. | ||
550 | */ | ||
551 | static int __init check_pmac_serial_console(void) | ||
552 | { | ||
553 | struct device_node *prom_stdout = NULL; | ||
554 | int offset = 0; | ||
555 | const char *name; | ||
556 | #ifdef CONFIG_SERIAL_PMACZILOG_TTYS | ||
557 | char *devname = "ttyS"; | ||
558 | #else | ||
559 | char *devname = "ttyPZ"; | ||
560 | #endif | ||
561 | |||
562 | pr_debug(" -> check_pmac_serial_console()\n"); | ||
563 | |||
564 | /* The user has requested a console so this is already set up. */ | ||
565 | if (strstr(boot_command_line, "console=")) { | ||
566 | pr_debug(" console was specified !\n"); | ||
567 | return -EBUSY; | ||
568 | } | ||
569 | |||
570 | if (!of_chosen) { | ||
571 | pr_debug(" of_chosen is NULL !\n"); | ||
572 | return -ENODEV; | ||
573 | } | ||
574 | |||
575 | /* We are getting a weird phandle from OF ... */ | ||
576 | /* ... So use the full path instead */ | ||
577 | name = of_get_property(of_chosen, "linux,stdout-path", NULL); | ||
578 | if (name == NULL) { | ||
579 | pr_debug(" no linux,stdout-path !\n"); | ||
580 | return -ENODEV; | ||
581 | } | ||
582 | prom_stdout = of_find_node_by_path(name); | ||
583 | if (!prom_stdout) { | ||
584 | pr_debug(" can't find stdout package %s !\n", name); | ||
585 | return -ENODEV; | ||
586 | } | ||
587 | pr_debug("stdout is %s\n", prom_stdout->full_name); | ||
588 | |||
589 | name = of_get_property(prom_stdout, "name", NULL); | ||
590 | if (!name) { | ||
591 | pr_debug(" stdout package has no name !\n"); | ||
592 | goto not_found; | ||
593 | } | ||
594 | |||
595 | if (strcmp(name, "ch-a") == 0) | ||
596 | offset = 0; | ||
597 | else if (strcmp(name, "ch-b") == 0) | ||
598 | offset = 1; | ||
599 | else | ||
600 | goto not_found; | ||
601 | of_node_put(prom_stdout); | ||
602 | |||
603 | pr_debug("Found serial console at %s%d\n", devname, offset); | ||
604 | |||
605 | return add_preferred_console(devname, offset, NULL); | ||
606 | |||
607 | not_found: | ||
608 | pr_debug("No preferred console found !\n"); | ||
609 | of_node_put(prom_stdout); | ||
610 | return -ENODEV; | ||
611 | } | ||
612 | console_initcall(check_pmac_serial_console); | ||
613 | |||
614 | #endif /* CONFIG_SERIAL_PMACZILOG_CONSOLE */ | ||
615 | |||
544 | /* | 616 | /* |
545 | * Called very early, MMU is off, device-tree isn't unflattened | 617 | * Called very early, MMU is off, device-tree isn't unflattened |
546 | */ | 618 | */ |