Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 106899
b: refs/heads/master
c: 025d791
h: refs/heads/master
i:
  106897: 1b290a9
  106895: 0c81525
v: v3
  • Loading branch information
Benjamin Herrenschmidt committed Jul 28, 2008
1 parent f5fb5fa commit 09bd3ed
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f023bf0f91f1f1b926ec8f5cf0ee24be134bf024
refs/heads/master: 025d7917a5ede982a5669c6735ef73a227b9827e
44 changes: 17 additions & 27 deletions trunk/arch/powerpc/kernel/legacy_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,18 +493,18 @@ static int __init serial_dev_init(void)
device_initcall(serial_dev_init);


#ifdef CONFIG_SERIAL_8250_CONSOLE
/*
* This is called very early, as part of console_init() (typically just after
* time_init()). This function is respondible for trying to find a good
* default console on serial ports. It tries to match the open firmware
* default output with one of the available serial console drivers, either
* one of the platform serial ports that have been probed earlier by
* find_legacy_serial_ports() or some more platform specific ones.
* default output with one of the available serial console drivers that have
* been probed earlier by find_legacy_serial_ports()
*/
static int __init check_legacy_serial_console(void)
{
struct device_node *prom_stdout = NULL;
int speed = 0, offset = 0;
int i, speed = 0, offset = 0;
const char *name;
const u32 *spd;

Expand Down Expand Up @@ -548,31 +548,20 @@ static int __init check_legacy_serial_console(void)
if (spd)
speed = *spd;

if (0)
;
#ifdef CONFIG_SERIAL_8250_CONSOLE
else if (strcmp(name, "serial") == 0) {
int i;
/* Look for it in probed array */
for (i = 0; i < legacy_serial_count; i++) {
if (prom_stdout != legacy_serial_infos[i].np)
continue;
offset = i;
speed = legacy_serial_infos[i].speed;
break;
}
if (i >= legacy_serial_count)
goto not_found;
if (strcmp(name, "serial") != 0)
goto not_found;

/* Look for it in probed array */
for (i = 0; i < legacy_serial_count; i++) {
if (prom_stdout != legacy_serial_infos[i].np)
continue;
offset = i;
speed = legacy_serial_infos[i].speed;
break;
}
#endif /* CONFIG_SERIAL_8250_CONSOLE */
#ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE
else if (strcmp(name, "ch-a") == 0)
offset = 0;
else if (strcmp(name, "ch-b") == 0)
offset = 1;
#endif /* CONFIG_SERIAL_PMACZILOG_CONSOLE */
else
if (i >= legacy_serial_count)
goto not_found;

of_node_put(prom_stdout);

DBG("Found serial console at ttyS%d\n", offset);
Expand All @@ -591,3 +580,4 @@ static int __init check_legacy_serial_console(void)
}
console_initcall(check_legacy_serial_console);

#endif /* CONFIG_SERIAL_8250_CONSOLE */
72 changes: 72 additions & 0 deletions trunk/arch/powerpc/platforms/powermac/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,78 @@ static int __init pmac_declare_of_platform_devices(void)
}
machine_device_initcall(powermac, pmac_declare_of_platform_devices);

#ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE
/*
* This is called very early, as part of console_init() (typically just after
* time_init()). This function is respondible for trying to find a good
* default console on serial ports. It tries to match the open firmware
* default output with one of the available serial console drivers.
*/
static int __init check_pmac_serial_console(void)
{
struct device_node *prom_stdout = NULL;
int offset = 0;
const char *name;
#ifdef CONFIG_SERIAL_PMACZILOG_TTYS
char *devname = "ttyS";
#else
char *devname = "ttyPZ";
#endif

pr_debug(" -> check_pmac_serial_console()\n");

/* The user has requested a console so this is already set up. */
if (strstr(boot_command_line, "console=")) {
pr_debug(" console was specified !\n");
return -EBUSY;
}

if (!of_chosen) {
pr_debug(" of_chosen is NULL !\n");
return -ENODEV;
}

/* We are getting a weird phandle from OF ... */
/* ... So use the full path instead */
name = of_get_property(of_chosen, "linux,stdout-path", NULL);
if (name == NULL) {
pr_debug(" no linux,stdout-path !\n");
return -ENODEV;
}
prom_stdout = of_find_node_by_path(name);
if (!prom_stdout) {
pr_debug(" can't find stdout package %s !\n", name);
return -ENODEV;
}
pr_debug("stdout is %s\n", prom_stdout->full_name);

name = of_get_property(prom_stdout, "name", NULL);
if (!name) {
pr_debug(" stdout package has no name !\n");
goto not_found;
}

if (strcmp(name, "ch-a") == 0)
offset = 0;
else if (strcmp(name, "ch-b") == 0)
offset = 1;
else
goto not_found;
of_node_put(prom_stdout);

pr_debug("Found serial console at %s%d\n", devname, offset);

return add_preferred_console(devname, offset, NULL);

not_found:
pr_debug("No preferred console found !\n");
of_node_put(prom_stdout);
return -ENODEV;
}
console_initcall(check_pmac_serial_console);

#endif /* CONFIG_SERIAL_PMACZILOG_CONSOLE */

/*
* Called very early, MMU is off, device-tree isn't unflattened
*/
Expand Down

0 comments on commit 09bd3ed

Please sign in to comment.