Honour stdout-path from Device Tree. (Closes: #770212)

svn path=/dists/sid/linux/; revision=22074
This commit is contained in:
Ian Campbell 2014-11-22 10:12:45 +00:00
parent 787cba99f2
commit b31a3607a2
5 changed files with 187 additions and 0 deletions

1
debian/changelog vendored
View File

@ -14,6 +14,7 @@ linux (3.16.7-3) UNRELEASED; urgency=medium
* [armhf] Enable FB_SIMPLE, used on some Exynos platforms and elsewhere.
* [arm64] Backport various upstream fixes and improvements to the APM X-gene
Ethernet driver.
* Honour stdout-path from Device Tree. (Closes: #770212)
-- Ben Hutchings <ben@decadent.org.uk> Sun, 09 Nov 2014 10:13:09 +0000

View File

@ -0,0 +1,95 @@
From 3482f2c52b77bf6596e24aae82e204a0603eba66 Mon Sep 17 00:00:00 2001
From: Grant Likely <grant.likely@linaro.org>
Date: Thu, 27 Mar 2014 17:18:55 -0700
Subject: [PATCH] of: Create of_console_check() for selecting a console
specified in /chosen
Origin: https://git.kernel.org/linus/3482f2c52b77bf6596e24aae82e204a0603eba66
The devicetree has a binding for specifying the console device in the
/chosen node, but the kernel doesn't use it consistently. This change
adds an API for testing if a device node is a console, and adds a
preferred console entry if it is.
At the same time this patch removes the of_device_is_stdout_path() API
since it is unused.
Signed-off-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/of/base.c | 23 +++++++++++++----------
include/linux/of.h | 6 +++---
2 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index b986480..df9b2bb 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -17,6 +17,7 @@
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
+#include <linux/console.h>
#include <linux/ctype.h>
#include <linux/cpu.h>
#include <linux/module.h>
@@ -2180,20 +2181,22 @@ const char *of_prop_next_string(struct property *prop, const char *cur)
EXPORT_SYMBOL_GPL(of_prop_next_string);
/**
- * of_device_is_stdout_path - check if a device node matches the
- * linux,stdout-path property
- *
- * Check if this device node matches the linux,stdout-path property
- * in the chosen node. return true if yes, false otherwise.
+ * of_console_check() - Test and setup console for DT setup
+ * @dn - Pointer to device node
+ * @name - Name to use for preferred console without index. ex. "ttyS"
+ * @index - Index to use for preferred console.
+ *
+ * Check if the given device node matches the stdout-path property in the
+ * /chosen node. If it does then register it as the preferred console and return
+ * TRUE. Otherwise return FALSE.
*/
-int of_device_is_stdout_path(struct device_node *dn)
+bool of_console_check(struct device_node *dn, char *name, int index)
{
- if (!of_stdout)
+ if (!dn || dn != of_stdout || console_set_on_cmdline)
return false;
-
- return of_stdout == dn;
+ return add_preferred_console(name, index, NULL);
}
-EXPORT_SYMBOL_GPL(of_device_is_stdout_path);
+EXPORT_SYMBOL_GPL(of_console_check);
/**
* of_find_next_cache_node - Find a node's subsidiary cache
diff --git a/include/linux/of.h b/include/linux/of.h
index 196b34c..9d97340 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -352,7 +352,7 @@ const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
*/
const char *of_prop_next_string(struct property *prop, const char *cur);
-int of_device_is_stdout_path(struct device_node *dn);
+bool of_console_check(struct device_node *dn, char *name, int index);
#else /* CONFIG_OF */
@@ -564,9 +564,9 @@ static inline int of_machine_is_compatible(const char *compat)
return 0;
}
-static inline int of_device_is_stdout_path(struct device_node *dn)
+static inline bool of_console_check(const struct device_node *dn, const char *name, int index)
{
- return 0;
+ return false;
}
static inline const __be32 *of_prop_next_u32(struct property *prop,
--
2.1.0

View File

@ -0,0 +1,49 @@
From a208ffd251d08ed7ba6bdf3ae1e423373fb12d3d Mon Sep 17 00:00:00 2001
From: Grant Likely <grant.likely@linaro.org>
Date: Thu, 27 Mar 2014 18:29:46 -0700
Subject: [PATCH] of: Enable console on serial ports specified by
/chosen/stdout-path
Origin: https://git.kernel.org/linus/a208ffd251d08ed7ba6bdf3ae1e423373fb12d3d
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 | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index fbf6c5a..3ce68f9 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -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);
--
2.1.0

View File

@ -0,0 +1,39 @@
From 5f74d8b7b8546255db6af45b017e9cbb18aed609 Mon Sep 17 00:00:00 2001
From: Brian Norris <computersforpeace@gmail.com>
Date: Wed, 3 Sep 2014 11:06:43 -0700
Subject: [PATCH] of: correct of_console_check()'s return value
Origin: https://git.kernel.org/linus/5f74d8b7b8546255db6af45b017e9cbb18aed609
The comments above of_console_check() say that it will return TRUE if it
registers a preferred console, but add_preferred_console() uses a
0-equals-success convention, so this leaves of_console_check() with an
inconsistent policy for its return values.
Fortunately, nobody was actually checking the return value of
of_console_check(), so this isn't significant at the moment.
But let's match the comments, so we're doing what we say.
Fixes: 3482f2c52b77 ('of: Create of_console_check() for selecting a console specified in /chosen')
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
---
drivers/of/base.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index d8574ad..bcfd08c 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1986,7 +1986,7 @@ bool of_console_check(struct device_node *dn, char *name, int index)
{
if (!dn || dn != of_stdout || console_set_on_cmdline)
return false;
- return add_preferred_console(name, index, NULL);
+ return !add_preferred_console(name, index, NULL);
}
EXPORT_SYMBOL_GPL(of_console_check);
--
2.1.0

View File

@ -199,6 +199,9 @@ features/all/sfc-Adding-PCI-ID-for-Solarflare-7000-series-40G-net.patch
features/all/sfc-Add-40G-link-capability-decoding.patch
features/all/mmc_block-increase-max_devices.patch
features/all/wireless-rt2x00-add-new-rt2800usb-device.patch
features/all/of-Create-of_console_check-for-selecting-a-console-s.patch
features/all/of-Enable-console-on-serial-ports-specified-by-chose.patch
features/all/of-correct-of_console_check-s-return-value.patch
# Update r8723au to 3.17
features/all/r8723au/0001-staging-rtl8723au-rtw_get_wps_ie23a-Remove-unused-de.patch