]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
of: Enable console on serial ports specified by /chosen/stdout-path
authorGrant Likely <grant.likely@linaro.org>
Fri, 28 Mar 2014 01:29:46 +0000 (18:29 -0700)
committerGrant Likely <grant.likely@linaro.org>
Thu, 26 Jun 2014 16:12:22 +0000 (17:12 +0100)
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 <grant.likely@linaro.org>
Tested-by: Sascha Hauer <s.hauer@pengutronix.de>
drivers/tty/serial/serial_core.c

index fbf6c5ad222f55015d79598ff4295723dd396456..3ce68f962c9238275c3d8b11aa12a14ea9561a32 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/console.h>
+#include <linux/of.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/device.h>
@@ -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);