diff options
Diffstat (limited to 'drivers/serial')
| -rw-r--r-- | drivers/serial/suncore.c | 37 | ||||
| -rw-r--r-- | drivers/serial/suncore.h | 5 | ||||
| -rw-r--r-- | drivers/serial/sunhv.c | 2 | ||||
| -rw-r--r-- | drivers/serial/sunsab.c | 9 | ||||
| -rw-r--r-- | drivers/serial/sunsu.c | 36 | ||||
| -rw-r--r-- | drivers/serial/sunzilog.c | 8 |
6 files changed, 62 insertions, 35 deletions
diff --git a/drivers/serial/suncore.c b/drivers/serial/suncore.c index a2d4a19550ab..ed7d958b0a01 100644 --- a/drivers/serial/suncore.c +++ b/drivers/serial/suncore.c | |||
| @@ -53,20 +53,21 @@ void sunserial_unregister_minors(struct uart_driver *drv, int count) | |||
| 53 | EXPORT_SYMBOL(sunserial_unregister_minors); | 53 | EXPORT_SYMBOL(sunserial_unregister_minors); |
| 54 | 54 | ||
| 55 | int sunserial_console_match(struct console *con, struct device_node *dp, | 55 | int sunserial_console_match(struct console *con, struct device_node *dp, |
| 56 | struct uart_driver *drv, int line) | 56 | struct uart_driver *drv, int line, bool ignore_line) |
| 57 | { | 57 | { |
| 58 | int off; | ||
| 59 | |||
| 60 | if (!con || of_console_device != dp) | 58 | if (!con || of_console_device != dp) |
| 61 | return 0; | 59 | return 0; |
| 62 | 60 | ||
| 63 | off = 0; | 61 | if (!ignore_line) { |
| 64 | if (of_console_options && | 62 | int off = 0; |
| 65 | *of_console_options == 'b') | ||
| 66 | off = 1; | ||
| 67 | 63 | ||
| 68 | if ((line & 1) != off) | 64 | if (of_console_options && |
| 69 | return 0; | 65 | *of_console_options == 'b') |
| 66 | off = 1; | ||
| 67 | |||
| 68 | if ((line & 1) != off) | ||
| 69 | return 0; | ||
| 70 | } | ||
| 70 | 71 | ||
| 71 | con->index = line; | 72 | con->index = line; |
| 72 | drv->cons = con; | 73 | drv->cons = con; |
| @@ -76,23 +77,24 @@ int sunserial_console_match(struct console *con, struct device_node *dp, | |||
| 76 | } | 77 | } |
| 77 | EXPORT_SYMBOL(sunserial_console_match); | 78 | EXPORT_SYMBOL(sunserial_console_match); |
| 78 | 79 | ||
| 79 | void | 80 | void sunserial_console_termios(struct console *con, struct device_node *uart_dp) |
| 80 | sunserial_console_termios(struct console *con) | ||
| 81 | { | 81 | { |
| 82 | struct device_node *dp; | 82 | const char *mode, *s; |
| 83 | const char *od, *mode, *s; | ||
| 84 | char mode_prop[] = "ttyX-mode"; | 83 | char mode_prop[] = "ttyX-mode"; |
| 85 | int baud, bits, stop, cflag; | 84 | int baud, bits, stop, cflag; |
| 86 | char parity; | 85 | char parity; |
| 87 | 86 | ||
| 88 | dp = of_find_node_by_path("/options"); | 87 | if (!strcmp(uart_dp->name, "rsc") || |
| 89 | od = of_get_property(dp, "output-device", NULL); | 88 | !strcmp(uart_dp->name, "rsc-console") || |
| 90 | if (!strcmp(od, "rsc")) { | 89 | !strcmp(uart_dp->name, "rsc-control")) { |
| 91 | mode = of_get_property(of_console_device, | 90 | mode = of_get_property(uart_dp, |
| 92 | "ssp-console-modes", NULL); | 91 | "ssp-console-modes", NULL); |
| 93 | if (!mode) | 92 | if (!mode) |
| 94 | mode = "115200,8,n,1,-"; | 93 | mode = "115200,8,n,1,-"; |
| 94 | } else if (!strcmp(uart_dp->name, "lom-console")) { | ||
| 95 | mode = "9600,8,n,1,-"; | ||
| 95 | } else { | 96 | } else { |
| 97 | struct device_node *dp; | ||
| 96 | char c; | 98 | char c; |
| 97 | 99 | ||
| 98 | c = 'a'; | 100 | c = 'a'; |
| @@ -101,6 +103,7 @@ sunserial_console_termios(struct console *con) | |||
| 101 | 103 | ||
| 102 | mode_prop[3] = c; | 104 | mode_prop[3] = c; |
| 103 | 105 | ||
| 106 | dp = of_find_node_by_path("/options"); | ||
| 104 | mode = of_get_property(dp, mode_prop, NULL); | 107 | mode = of_get_property(dp, mode_prop, NULL); |
| 105 | if (!mode) | 108 | if (!mode) |
| 106 | mode = "9600,8,n,1,-"; | 109 | mode = "9600,8,n,1,-"; |
diff --git a/drivers/serial/suncore.h b/drivers/serial/suncore.h index 042668aa602e..db2057936c31 100644 --- a/drivers/serial/suncore.h +++ b/drivers/serial/suncore.h | |||
| @@ -26,7 +26,8 @@ extern int sunserial_register_minors(struct uart_driver *, int); | |||
| 26 | extern void sunserial_unregister_minors(struct uart_driver *, int); | 26 | extern void sunserial_unregister_minors(struct uart_driver *, int); |
| 27 | 27 | ||
| 28 | extern int sunserial_console_match(struct console *, struct device_node *, | 28 | extern int sunserial_console_match(struct console *, struct device_node *, |
| 29 | struct uart_driver *, int); | 29 | struct uart_driver *, int, bool); |
| 30 | extern void sunserial_console_termios(struct console *); | 30 | extern void sunserial_console_termios(struct console *, |
| 31 | struct device_node *); | ||
| 31 | 32 | ||
| 32 | #endif /* !(_SERIAL_SUN_H) */ | 33 | #endif /* !(_SERIAL_SUN_H) */ |
diff --git a/drivers/serial/sunhv.c b/drivers/serial/sunhv.c index d548652dee50..d14cca7fb88d 100644 --- a/drivers/serial/sunhv.c +++ b/drivers/serial/sunhv.c | |||
| @@ -566,7 +566,7 @@ static int __devinit hv_probe(struct of_device *op, const struct of_device_id *m | |||
| 566 | goto out_free_con_read_page; | 566 | goto out_free_con_read_page; |
| 567 | 567 | ||
| 568 | sunserial_console_match(&sunhv_console, op->node, | 568 | sunserial_console_match(&sunhv_console, op->node, |
| 569 | &sunhv_reg, port->line); | 569 | &sunhv_reg, port->line, false); |
| 570 | 570 | ||
| 571 | err = uart_add_one_port(&sunhv_reg, port); | 571 | err = uart_add_one_port(&sunhv_reg, port); |
| 572 | if (err) | 572 | if (err) |
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c index d1ad34128635..d514e28d0755 100644 --- a/drivers/serial/sunsab.c +++ b/drivers/serial/sunsab.c | |||
| @@ -883,7 +883,7 @@ static int sunsab_console_setup(struct console *con, char *options) | |||
| 883 | printk("Console: ttyS%d (SAB82532)\n", | 883 | printk("Console: ttyS%d (SAB82532)\n", |
| 884 | (sunsab_reg.minor - 64) + con->index); | 884 | (sunsab_reg.minor - 64) + con->index); |
| 885 | 885 | ||
| 886 | sunserial_console_termios(con); | 886 | sunserial_console_termios(con, to_of_device(up->port.dev)->node); |
| 887 | 887 | ||
| 888 | switch (con->cflag & CBAUD) { | 888 | switch (con->cflag & CBAUD) { |
| 889 | case B150: baud = 150; break; | 889 | case B150: baud = 150; break; |
| @@ -1027,10 +1027,12 @@ static int __devinit sab_probe(struct of_device *op, const struct of_device_id * | |||
| 1027 | goto out1; | 1027 | goto out1; |
| 1028 | 1028 | ||
| 1029 | sunserial_console_match(SUNSAB_CONSOLE(), op->node, | 1029 | sunserial_console_match(SUNSAB_CONSOLE(), op->node, |
| 1030 | &sunsab_reg, up[0].port.line); | 1030 | &sunsab_reg, up[0].port.line, |
| 1031 | false); | ||
| 1031 | 1032 | ||
| 1032 | sunserial_console_match(SUNSAB_CONSOLE(), op->node, | 1033 | sunserial_console_match(SUNSAB_CONSOLE(), op->node, |
| 1033 | &sunsab_reg, up[1].port.line); | 1034 | &sunsab_reg, up[1].port.line, |
| 1035 | false); | ||
| 1034 | 1036 | ||
| 1035 | err = uart_add_one_port(&sunsab_reg, &up[0].port); | 1037 | err = uart_add_one_port(&sunsab_reg, &up[0].port); |
| 1036 | if (err) | 1038 | if (err) |
| @@ -1116,7 +1118,6 @@ static int __init sunsab_init(void) | |||
| 1116 | if (!sunsab_ports) | 1118 | if (!sunsab_ports) |
| 1117 | return -ENOMEM; | 1119 | return -ENOMEM; |
| 1118 | 1120 | ||
| 1119 | sunsab_reg.cons = SUNSAB_CONSOLE(); | ||
| 1120 | err = sunserial_register_minors(&sunsab_reg, num_channels); | 1121 | err = sunserial_register_minors(&sunsab_reg, num_channels); |
| 1121 | if (err) { | 1122 | if (err) { |
| 1122 | kfree(sunsab_ports); | 1123 | kfree(sunsab_ports); |
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c index 68d262b15749..170d3d68c8f0 100644 --- a/drivers/serial/sunsu.c +++ b/drivers/serial/sunsu.c | |||
| @@ -1329,11 +1329,9 @@ static void sunsu_console_write(struct console *co, const char *s, | |||
| 1329 | */ | 1329 | */ |
| 1330 | static int __init sunsu_console_setup(struct console *co, char *options) | 1330 | static int __init sunsu_console_setup(struct console *co, char *options) |
| 1331 | { | 1331 | { |
| 1332 | static struct ktermios dummy; | ||
| 1333 | struct ktermios termios; | ||
| 1332 | struct uart_port *port; | 1334 | struct uart_port *port; |
| 1333 | int baud = 9600; | ||
| 1334 | int bits = 8; | ||
| 1335 | int parity = 'n'; | ||
| 1336 | int flow = 'n'; | ||
| 1337 | 1335 | ||
| 1338 | printk("Console: ttyS%d (SU)\n", | 1336 | printk("Console: ttyS%d (SU)\n", |
| 1339 | (sunsu_reg.minor - 64) + co->index); | 1337 | (sunsu_reg.minor - 64) + co->index); |
| @@ -1352,10 +1350,15 @@ static int __init sunsu_console_setup(struct console *co, char *options) | |||
| 1352 | */ | 1350 | */ |
| 1353 | spin_lock_init(&port->lock); | 1351 | spin_lock_init(&port->lock); |
| 1354 | 1352 | ||
| 1355 | if (options) | 1353 | /* Get firmware console settings. */ |
| 1356 | uart_parse_options(options, &baud, &parity, &bits, &flow); | 1354 | sunserial_console_termios(co, to_of_device(port->dev)->node); |
| 1357 | 1355 | ||
| 1358 | return uart_set_options(port, co, baud, parity, bits, flow); | 1356 | memset(&termios, 0, sizeof(struct ktermios)); |
| 1357 | termios.c_cflag = co->cflag; | ||
| 1358 | port->mctrl |= TIOCM_DTR; | ||
| 1359 | port->ops->set_termios(port, &termios, &dummy); | ||
| 1360 | |||
| 1361 | return 0; | ||
| 1359 | } | 1362 | } |
| 1360 | 1363 | ||
| 1361 | static struct console sunsu_console = { | 1364 | static struct console sunsu_console = { |
| @@ -1409,6 +1412,7 @@ static int __devinit su_probe(struct of_device *op, const struct of_device_id *m | |||
| 1409 | struct uart_sunsu_port *up; | 1412 | struct uart_sunsu_port *up; |
| 1410 | struct resource *rp; | 1413 | struct resource *rp; |
| 1411 | enum su_type type; | 1414 | enum su_type type; |
| 1415 | bool ignore_line; | ||
| 1412 | int err; | 1416 | int err; |
| 1413 | 1417 | ||
| 1414 | type = su_get_type(dp); | 1418 | type = su_get_type(dp); |
| @@ -1467,8 +1471,14 @@ static int __devinit su_probe(struct of_device *op, const struct of_device_id *m | |||
| 1467 | 1471 | ||
| 1468 | up->port.ops = &sunsu_pops; | 1472 | up->port.ops = &sunsu_pops; |
| 1469 | 1473 | ||
| 1474 | ignore_line = false; | ||
| 1475 | if (!strcmp(dp->name, "rsc-console") || | ||
| 1476 | !strcmp(dp->name, "lom-console")) | ||
| 1477 | ignore_line = true; | ||
| 1478 | |||
| 1470 | sunserial_console_match(SUNSU_CONSOLE(), dp, | 1479 | sunserial_console_match(SUNSU_CONSOLE(), dp, |
| 1471 | &sunsu_reg, up->port.line); | 1480 | &sunsu_reg, up->port.line, |
| 1481 | ignore_line); | ||
| 1472 | err = uart_add_one_port(&sunsu_reg, &up->port); | 1482 | err = uart_add_one_port(&sunsu_reg, &up->port); |
| 1473 | if (err) | 1483 | if (err) |
| 1474 | goto out_unmap; | 1484 | goto out_unmap; |
| @@ -1517,6 +1527,10 @@ static const struct of_device_id su_match[] = { | |||
| 1517 | .name = "serial", | 1527 | .name = "serial", |
| 1518 | .compatible = "su", | 1528 | .compatible = "su", |
| 1519 | }, | 1529 | }, |
| 1530 | { | ||
| 1531 | .type = "serial", | ||
| 1532 | .compatible = "su", | ||
| 1533 | }, | ||
| 1520 | {}, | 1534 | {}, |
| 1521 | }; | 1535 | }; |
| 1522 | MODULE_DEVICE_TABLE(of, su_match); | 1536 | MODULE_DEVICE_TABLE(of, su_match); |
| @@ -1548,6 +1562,12 @@ static int __init sunsu_init(void) | |||
| 1548 | num_uart++; | 1562 | num_uart++; |
| 1549 | } | 1563 | } |
| 1550 | } | 1564 | } |
| 1565 | for_each_node_by_type(dp, "serial") { | ||
| 1566 | if (of_device_is_compatible(dp, "su")) { | ||
| 1567 | if (su_get_type(dp) == SU_PORT_PORT) | ||
| 1568 | num_uart++; | ||
| 1569 | } | ||
| 1570 | } | ||
| 1551 | 1571 | ||
| 1552 | if (num_uart) { | 1572 | if (num_uart) { |
| 1553 | err = sunserial_register_minors(&sunsu_reg, num_uart); | 1573 | err = sunserial_register_minors(&sunsu_reg, num_uart); |
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c index ef693ae22e7f..2c7a66af4f52 100644 --- a/drivers/serial/sunzilog.c +++ b/drivers/serial/sunzilog.c | |||
| @@ -1180,7 +1180,7 @@ static int __init sunzilog_console_setup(struct console *con, char *options) | |||
| 1180 | (sunzilog_reg.minor - 64) + con->index, con->index); | 1180 | (sunzilog_reg.minor - 64) + con->index, con->index); |
| 1181 | 1181 | ||
| 1182 | /* Get firmware console settings. */ | 1182 | /* Get firmware console settings. */ |
| 1183 | sunserial_console_termios(con); | 1183 | sunserial_console_termios(con, to_of_device(up->port.dev)->node); |
| 1184 | 1184 | ||
| 1185 | /* Firmware console speed is limited to 150-->38400 baud so | 1185 | /* Firmware console speed is limited to 150-->38400 baud so |
| 1186 | * this hackish cflag thing is OK. | 1186 | * this hackish cflag thing is OK. |
| @@ -1416,7 +1416,8 @@ static int __devinit zs_probe(struct of_device *op, const struct of_device_id *m | |||
| 1416 | 1416 | ||
| 1417 | if (!keyboard_mouse) { | 1417 | if (!keyboard_mouse) { |
| 1418 | if (sunserial_console_match(SUNZILOG_CONSOLE(), op->node, | 1418 | if (sunserial_console_match(SUNZILOG_CONSOLE(), op->node, |
| 1419 | &sunzilog_reg, up[0].port.line)) | 1419 | &sunzilog_reg, up[0].port.line, |
| 1420 | false)) | ||
| 1420 | up->flags |= SUNZILOG_FLAG_IS_CONS; | 1421 | up->flags |= SUNZILOG_FLAG_IS_CONS; |
| 1421 | err = uart_add_one_port(&sunzilog_reg, &up[0].port); | 1422 | err = uart_add_one_port(&sunzilog_reg, &up[0].port); |
| 1422 | if (err) { | 1423 | if (err) { |
| @@ -1425,7 +1426,8 @@ static int __devinit zs_probe(struct of_device *op, const struct of_device_id *m | |||
| 1425 | return err; | 1426 | return err; |
| 1426 | } | 1427 | } |
| 1427 | if (sunserial_console_match(SUNZILOG_CONSOLE(), op->node, | 1428 | if (sunserial_console_match(SUNZILOG_CONSOLE(), op->node, |
| 1428 | &sunzilog_reg, up[1].port.line)) | 1429 | &sunzilog_reg, up[1].port.line, |
| 1430 | false)) | ||
| 1429 | up->flags |= SUNZILOG_FLAG_IS_CONS; | 1431 | up->flags |= SUNZILOG_FLAG_IS_CONS; |
| 1430 | err = uart_add_one_port(&sunzilog_reg, &up[1].port); | 1432 | err = uart_add_one_port(&sunzilog_reg, &up[1].port); |
| 1431 | if (err) { | 1433 | if (err) { |
