From a208ffd251d08ed7ba6bdf3ae1e423373fb12d3d Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Thu, 27 Mar 2014 18:29:46 -0700 Subject: of: Enable console on serial ports specified by /chosen/stdout-path If the devicetree specifies a serial port as a stdout device, then the kernel can use it as the default console if nothing else was selected on the command line. For any serial port that uses the uart_add_one_port() feature, the uart_add_one_port() has all the information needed to automatically enable the console device, which is what this patch does. With this change applied, a device tree platform can be booted without any console= parameters on the command line and the kernel will still be able to determine its console. Tested on QEMU Versatile model and i.MX Signed-off-by: Grant Likely Tested-by: Sascha Hauer --- drivers/tty/serial/serial_core.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/tty/serial') diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index fbf6c5ad222f..3ce68f962c92 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -2615,6 +2616,8 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport) spin_lock_init(&uport->lock); lockdep_set_class(&uport->lock, &port_lock_key); } + if (uport->cons && uport->dev) + of_console_check(uport->dev->of_node, uport->cons->name, uport->line); uart_configure_port(drv, state, uport); -- cgit v1.2.3 From ccdb8ed3b3c739fe99a6f2f474f7ffad3203485d Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Wed, 4 Jun 2014 16:42:26 +0100 Subject: of: Migrate of_find_node_by_name() users to for_each_node_by_name() There are a bunch of users open coding the for_each_node_by_name() by calling of_find_node_by_name() directly instead of using the macro. This is getting in the way of some cleanups, and the possibility of removing of_find_node_by_name() entirely. Clean it up so that all the users are consistent. Signed-off-by: Grant Likely Cc: Rob Herring Cc: Benjamin Herrenschmidt Cc: "Rafael J. Wysocki" Cc: Greg Kroah-Hartman Cc: Takashi Iwai --- drivers/tty/serial/pmac_zilog.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'drivers/tty/serial') diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c index 8193635103ee..01e180bc6b5d 100644 --- a/drivers/tty/serial/pmac_zilog.c +++ b/drivers/tty/serial/pmac_zilog.c @@ -1650,8 +1650,7 @@ static int __init pmz_probe(void) /* * Find all escc chips in the system */ - node_p = of_find_node_by_name(NULL, "escc"); - while (node_p) { + for_each_node_by_name(node_p, "escc") { /* * First get channel A/B node pointers * @@ -1669,7 +1668,7 @@ static int __init pmz_probe(void) of_node_put(node_b); printk(KERN_ERR "pmac_zilog: missing node %c for escc %s\n", (!node_a) ? 'a' : 'b', node_p->full_name); - goto next; + continue; } /* @@ -1696,11 +1695,9 @@ static int __init pmz_probe(void) of_node_put(node_b); memset(&pmz_ports[count], 0, sizeof(struct uart_pmac_port)); memset(&pmz_ports[count+1], 0, sizeof(struct uart_pmac_port)); - goto next; + continue; } count += 2; -next: - node_p = of_find_node_by_name(node_p, "escc"); } pmz_ports_count = count; -- cgit v1.2.3