serial: suncore: Fix RSC/LOM handling in sunserial_console_termios().

RSC and LOM devices have fixed speed settings.

We already had some code to match and handle "rsc" named devices on
E250 systems, but we also have to handle 'rsc-console', 'rsc-control',
and 'lom-console'.

Also, in order to get this right regardless of what 'output-device'
happens to be, explicitly pass the UART device node pointer to this
routine.

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2009-11-24 14:09:56 -08:00
parent 4e3533d05b
commit 457931de3b
5 changed files with 15 additions and 12 deletions

View File

@ -77,23 +77,24 @@ int sunserial_console_match(struct console *con, struct device_node *dp,
} }
EXPORT_SYMBOL(sunserial_console_match); EXPORT_SYMBOL(sunserial_console_match);
void void sunserial_console_termios(struct console *con, struct device_node *uart_dp)
sunserial_console_termios(struct console *con)
{ {
struct device_node *dp; const char *mode, *s;
const char *od, *mode, *s;
char mode_prop[] = "ttyX-mode"; char mode_prop[] = "ttyX-mode";
int baud, bits, stop, cflag; int baud, bits, stop, cflag;
char parity; char parity;
dp = of_find_node_by_path("/options"); if (!strcmp(uart_dp->name, "rsc") ||
od = of_get_property(dp, "output-device", NULL); !strcmp(uart_dp->name, "rsc-console") ||
if (!strcmp(od, "rsc")) { !strcmp(uart_dp->name, "rsc-control")) {
mode = of_get_property(of_console_device, mode = of_get_property(uart_dp,
"ssp-console-modes", NULL); "ssp-console-modes", NULL);
if (!mode) if (!mode)
mode = "115200,8,n,1,-"; mode = "115200,8,n,1,-";
} else if (!strcmp(uart_dp->name, "lom-console")) {
mode = "9600,8,n,1,-";
} else { } else {
struct device_node *dp;
char c; char c;
c = 'a'; c = 'a';
@ -102,6 +103,7 @@ sunserial_console_termios(struct console *con)
mode_prop[3] = c; mode_prop[3] = c;
dp = of_find_node_by_path("/options");
mode = of_get_property(dp, mode_prop, NULL); mode = of_get_property(dp, mode_prop, NULL);
if (!mode) if (!mode)
mode = "9600,8,n,1,-"; mode = "9600,8,n,1,-";

View File

@ -27,6 +27,7 @@ extern void sunserial_unregister_minors(struct uart_driver *, int);
extern int sunserial_console_match(struct console *, struct device_node *, extern int sunserial_console_match(struct console *, struct device_node *,
struct uart_driver *, int, bool); struct uart_driver *, int, bool);
extern void sunserial_console_termios(struct console *); extern void sunserial_console_termios(struct console *,
struct device_node *);
#endif /* !(_SERIAL_SUN_H) */ #endif /* !(_SERIAL_SUN_H) */

View File

@ -566,7 +566,7 @@ static int __devinit hv_probe(struct of_device *op, const struct of_device_id *m
goto out_free_con_read_page; goto out_free_con_read_page;
sunserial_console_match(&sunhv_console, op->node, sunserial_console_match(&sunhv_console, op->node,
&sunhv_reg, port->line); &sunhv_reg, port->line, false);
err = uart_add_one_port(&sunhv_reg, port); err = uart_add_one_port(&sunhv_reg, port);
if (err) if (err)

View File

@ -883,7 +883,7 @@ static int sunsab_console_setup(struct console *con, char *options)
printk("Console: ttyS%d (SAB82532)\n", printk("Console: ttyS%d (SAB82532)\n",
(sunsab_reg.minor - 64) + con->index); (sunsab_reg.minor - 64) + con->index);
sunserial_console_termios(con); sunserial_console_termios(con, to_of_device(up->port.dev)->node);
switch (con->cflag & CBAUD) { switch (con->cflag & CBAUD) {
case B150: baud = 150; break; case B150: baud = 150; break;

View File

@ -1180,7 +1180,7 @@ static int __init sunzilog_console_setup(struct console *con, char *options)
(sunzilog_reg.minor - 64) + con->index, con->index); (sunzilog_reg.minor - 64) + con->index, con->index);
/* Get firmware console settings. */ /* Get firmware console settings. */
sunserial_console_termios(con); sunserial_console_termios(con, to_of_device(up->port.dev)->node);
/* Firmware console speed is limited to 150-->38400 baud so /* Firmware console speed is limited to 150-->38400 baud so
* this hackish cflag thing is OK. * this hackish cflag thing is OK.