aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/sunsu.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2007-07-20 19:59:26 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-07-20 19:59:26 -0400
commitc73fcc846c91f53fd2c67fd9c6c04888a9e5892e (patch)
tree31faa68b4176636756926535a0f50ff780973275 /drivers/serial/sunsu.c
parentede13d81b4dda409a6d271b34b8e2ec9383e255d (diff)
[SPARC]: Fix serial console device detection.
The current scheme works on static interpretation of text names, which is wrong. The output-device setting, for example, must be resolved via an alias or similar to a full path name to the console device. Paths also contain an optional set of 'options', which starts with a colon at the end of the path. The option area is used to specify which of two serial ports ('a' or 'b') the path refers to when a device node drives multiple ports. 'a' is assumed if the option specification is missing. This was caught by the UltraSPARC-T1 simulator. The 'output-device' property was set to 'ttya' and we didn't pick upon the fact that this is an OBP alias set to '/virtual-devices/console'. Instead we saw it as the first serial console device, instead of the hypervisor console. The infrastructure is now there to take advantage of this to resolve the console correctly even in multi-head situations in fbcon too. Thanks to Greg Onufer for the bug report. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/serial/sunsu.c')
-rw-r--r--drivers/serial/sunsu.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index 26d720baf88c..79b13685bdfa 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -1371,28 +1371,12 @@ static struct console sunsu_console = {
1371 * Register console. 1371 * Register console.
1372 */ 1372 */
1373 1373
1374static inline struct console *SUNSU_CONSOLE(int num_uart) 1374static inline struct console *SUNSU_CONSOLE(void)
1375{ 1375{
1376 int i;
1377
1378 if (con_is_present())
1379 return NULL;
1380
1381 for (i = 0; i < num_uart; i++) {
1382 int this_minor = sunsu_reg.minor + i;
1383
1384 if ((this_minor - 64) == (serial_console - 1))
1385 break;
1386 }
1387 if (i == num_uart)
1388 return NULL;
1389
1390 sunsu_console.index = i;
1391
1392 return &sunsu_console; 1376 return &sunsu_console;
1393} 1377}
1394#else 1378#else
1395#define SUNSU_CONSOLE(num_uart) (NULL) 1379#define SUNSU_CONSOLE() (NULL)
1396#define sunsu_serial_console_init() do { } while (0) 1380#define sunsu_serial_console_init() do { } while (0)
1397#endif 1381#endif
1398 1382
@@ -1482,6 +1466,8 @@ static int __devinit su_probe(struct of_device *op, const struct of_device_id *m
1482 1466
1483 up->port.ops = &sunsu_pops; 1467 up->port.ops = &sunsu_pops;
1484 1468
1469 sunserial_console_match(SUNSU_CONSOLE(), dp,
1470 &sunsu_reg, up->port.line);
1485 err = uart_add_one_port(&sunsu_reg, &up->port); 1471 err = uart_add_one_port(&sunsu_reg, &up->port);
1486 if (err) 1472 if (err)
1487 goto out_unmap; 1473 goto out_unmap;
@@ -1572,7 +1558,6 @@ static int __init sunsu_init(void)
1572 return err; 1558 return err;
1573 sunsu_reg.tty_driver->name_base = sunsu_reg.minor - 64; 1559 sunsu_reg.tty_driver->name_base = sunsu_reg.minor - 64;
1574 sunserial_current_minor += num_uart; 1560 sunserial_current_minor += num_uart;
1575 sunsu_reg.cons = SUNSU_CONSOLE(num_uart);
1576 } 1561 }
1577 1562
1578 err = of_register_driver(&su_driver, &of_bus_type); 1563 err = of_register_driver(&su_driver, &of_bus_type);