Backport patches to support serial driver options via DT /chosen/stdout-path

svn path=/dists/sid/linux/; revision=22126
This commit is contained in:
Ian Campbell 2014-12-07 19:18:47 +00:00
parent 34264d5fa9
commit c2bcb2baef
4 changed files with 185 additions and 1 deletions

3
debian/changelog vendored
View File

@ -126,7 +126,8 @@ linux (3.16.7-ckt1-1) 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)
* Honour stdout-path from Device Tree, along with supporting any supplied
options. (Closes: #770212)
* [armhf] Add udeb modules to support video and keyboard for imx6. Patch from
Vagrant Cascadian (Closes: #770635)
* [device-tree] Reserve memreserve regions even if they partially overlap

View File

@ -0,0 +1,128 @@
From 7130f1ef9a22b7fbfea43443a437a92b19f02309 Mon Sep 17 00:00:00 2001
From: Leif Lindholm <leif.lindholm@linaro.org>
Date: Fri, 28 Nov 2014 11:34:28 +0000
Subject: [PATCH 1/2] of: add optional options parameter to
of_find_node_by_path()
Origin: https://git.kernel.org/cgit/linux/kernel/git/glikely/linux.git/commit/?id=75c28c09af99a0db0ccd8b4395469761aa736543
Update of_find_node_by_path():
1) Rename function to of_find_node_opts_by_path(), adding an optional
pointer argument. Provide a static inline wrapper version of
of_find_node_by_path() which calls the new function with NULL as
the optional argument.
2) Ignore any part of the path beyond and including the ':' separator.
3) Set the new provided pointer argument to the beginning of the string
following the ':' separator.
4: Add tests.
---
drivers/of/base.c | 20 ++++++++++++++++----
include/linux/of.h | 14 +++++++++++++-
2 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 9fd1415..da9a8d2 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -796,10 +796,15 @@ static struct device_node *__of_find_node_by_path(struct device_node *parent,
{
struct device_node *child;
int len = strchrnul(path, '/') - path;
+ int term;
if (!len)
return NULL;
+ term = strchrnul(path, ':') - path;
+ if (term < len)
+ len = term;
+
__for_each_child_of_node(parent, child) {
const char *name = strrchr(child->full_name, '/');
if (WARN(!name, "malformed device_node %s\n", child->full_name))
@@ -812,11 +817,14 @@ static struct device_node *__of_find_node_by_path(struct device_node *parent,
}
/**
- * of_find_node_by_path - Find a node matching a full OF path
+ * of_find_node_opts_by_path - Find a node matching a full OF path
* @path: Either the full path to match, or if the path does not
* start with '/', the name of a property of the /aliases
* node (an alias). In the case of an alias, the node
* matching the alias' value will be returned.
+ * @opts: Address of a pointer into which to store the start of
+ * an options string appended to the end of the path with
+ * a ':' separator.
*
* Valid paths:
* /foo/bar Full path
@@ -826,11 +834,15 @@ static struct device_node *__of_find_node_by_path(struct device_node *parent,
* Returns a node pointer with refcount incremented, use
* of_node_put() on it when done.
*/
-struct device_node *of_find_node_by_path(const char *path)
+struct device_node *of_find_node_opts_by_path(const char *path, const char **opts)
{
struct device_node *np = NULL;
struct property *pp;
unsigned long flags;
+ const char *separator = strchr(path, ':');
+
+ if (opts)
+ *opts = separator ? separator + 1 : NULL;
if (strcmp(path, "/") == 0)
return of_node_get(of_allnodes);
@@ -838,7 +850,7 @@ struct device_node *of_find_node_by_path(const char *path)
/* The path could begin with an alias */
if (*path != '/') {
char *p = strchrnul(path, '/');
- int len = p - path;
+ int len = separator ? separator - path : p - path;
/* of_aliases must not be NULL */
if (!of_aliases)
@@ -867,7 +879,7 @@ struct device_node *of_find_node_by_path(const char *path)
raw_spin_unlock_irqrestore(&devtree_lock, flags);
return np;
}
-EXPORT_SYMBOL(of_find_node_by_path);
+EXPORT_SYMBOL(of_find_node_opts_by_path);
/**
* of_find_node_by_name - Find a node by its "name" property
diff --git a/include/linux/of.h b/include/linux/of.h
index 9d97340..0d2b4c4 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -228,7 +228,13 @@ extern struct device_node *of_find_matching_node_and_match(
const struct of_device_id *matches,
const struct of_device_id **match);
-extern struct device_node *of_find_node_by_path(const char *path);
+extern struct device_node *of_find_node_opts_by_path(const char *path,
+ const char **opts);
+static inline struct device_node *of_find_node_by_path(const char *path)
+{
+ return of_find_node_opts_by_path(path, NULL);
+}
+
extern struct device_node *of_find_node_by_phandle(phandle handle);
extern struct device_node *of_get_parent(const struct device_node *node);
extern struct device_node *of_get_next_parent(struct device_node *node);
@@ -386,6 +392,12 @@ static inline struct device_node *of_find_node_by_path(const char *path)
return NULL;
}
+static inline struct device_node *of_find_node_opts_by_path(const char *path,
+ const char **opts)
+{
+ return NULL;
+}
+
static inline struct device_node *of_get_parent(const struct device_node *node)
{
return NULL;
--
2.1.3

View File

@ -0,0 +1,53 @@
From 469319d402ab844778cf7fbcd94ba1c9d9cfc9ed Mon Sep 17 00:00:00 2001
From: Leif Lindholm <leif.lindholm@linaro.org>
Date: Thu, 27 Nov 2014 17:56:07 +0000
Subject: [PATCH 2/2] of: support passing console options with stdout-path
Origin: https://git.kernel.org/cgit/linux/kernel/git/glikely/linux.git/commit/?id=7914a7c5651a51617d952e8fa745000ed8c4f001
Support specifying console options (like with console=ttyXN,<options>)
by appending them to the stdout-path property after a separating ':'.
Example:
stdout-path = "uart0:115200";
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
[grant.likely: minor rework to shorten the diffstat]
Signed-off-by: Grant Likely <grant.likely@linaro.org>
---
drivers/of/base.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index da9a8d2..bad67ca 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -37,6 +37,7 @@ EXPORT_SYMBOL(of_allnodes);
struct device_node *of_chosen;
struct device_node *of_aliases;
static struct device_node *of_stdout;
+static const char *of_stdout_options;
static struct kset *of_kset;
@@ -2079,7 +2080,7 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align))
if (!name)
name = of_get_property(of_chosen, "linux,stdout-path", NULL);
if (name)
- of_stdout = of_find_node_by_path(name);
+ of_stdout = of_find_node_opts_by_path(name, &of_stdout_options);
}
of_aliases = of_find_node_by_path("/aliases");
@@ -2206,7 +2207,8 @@ 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,
+ kstrdup(of_stdout_options, GFP_KERNEL));
}
EXPORT_SYMBOL_GPL(of_console_check);
--
2.1.3

View File

@ -184,6 +184,8 @@ features/all/mmc_block-increase-max_devices.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
features/all/of-add-optional-options-parameter-to-of_find_node_by.patch
features/all/of-support-passing-console-options-with-stdout-path.patch
# Update r8723au to 3.17
features/all/r8723au/0001-staging-rtl8723au-rtw_get_wps_ie23a-Remove-unused-de.patch