aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of/base.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/of/base.c')
-rw-r--r--drivers/of/base.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c
index b9864806e9b8..e4f95ba0a3eb 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -17,6 +17,7 @@
17 * as published by the Free Software Foundation; either version 17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version. 18 * 2 of the License, or (at your option) any later version.
19 */ 19 */
20#include <linux/console.h>
20#include <linux/ctype.h> 21#include <linux/ctype.h>
21#include <linux/cpu.h> 22#include <linux/cpu.h>
22#include <linux/module.h> 23#include <linux/module.h>
@@ -35,7 +36,7 @@ struct device_node *of_allnodes;
35EXPORT_SYMBOL(of_allnodes); 36EXPORT_SYMBOL(of_allnodes);
36struct device_node *of_chosen; 37struct device_node *of_chosen;
37struct device_node *of_aliases; 38struct device_node *of_aliases;
38static struct device_node *of_stdout; 39struct device_node *of_stdout;
39 40
40static struct kset *of_kset; 41static struct kset *of_kset;
41 42
@@ -2062,9 +2063,12 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align))
2062 of_chosen = of_find_node_by_path("/chosen@0"); 2063 of_chosen = of_find_node_by_path("/chosen@0");
2063 2064
2064 if (of_chosen) { 2065 if (of_chosen) {
2066 /* linux,stdout-path and /aliases/stdout are for legacy compatibility */
2065 const char *name = of_get_property(of_chosen, "stdout-path", NULL); 2067 const char *name = of_get_property(of_chosen, "stdout-path", NULL);
2066 if (!name) 2068 if (!name)
2067 name = of_get_property(of_chosen, "linux,stdout-path", NULL); 2069 name = of_get_property(of_chosen, "linux,stdout-path", NULL);
2070 if (IS_ENABLED(CONFIG_PPC) && !name)
2071 name = of_get_property(of_aliases, "stdout", NULL);
2068 if (name) 2072 if (name)
2069 of_stdout = of_find_node_by_path(name); 2073 of_stdout = of_find_node_by_path(name);
2070 } 2074 }
@@ -2180,20 +2184,22 @@ const char *of_prop_next_string(struct property *prop, const char *cur)
2180EXPORT_SYMBOL_GPL(of_prop_next_string); 2184EXPORT_SYMBOL_GPL(of_prop_next_string);
2181 2185
2182/** 2186/**
2183 * of_device_is_stdout_path - check if a device node matches the 2187 * of_console_check() - Test and setup console for DT setup
2184 * linux,stdout-path property 2188 * @dn - Pointer to device node
2185 * 2189 * @name - Name to use for preferred console without index. ex. "ttyS"
2186 * Check if this device node matches the linux,stdout-path property 2190 * @index - Index to use for preferred console.
2187 * in the chosen node. return true if yes, false otherwise. 2191 *
2192 * Check if the given device node matches the stdout-path property in the
2193 * /chosen node. If it does then register it as the preferred console and return
2194 * TRUE. Otherwise return FALSE.
2188 */ 2195 */
2189int of_device_is_stdout_path(struct device_node *dn) 2196bool of_console_check(struct device_node *dn, char *name, int index)
2190{ 2197{
2191 if (!of_stdout) 2198 if (!dn || dn != of_stdout || console_set_on_cmdline)
2192 return false; 2199 return false;
2193 2200 return add_preferred_console(name, index, NULL);
2194 return of_stdout == dn;
2195} 2201}
2196EXPORT_SYMBOL_GPL(of_device_is_stdout_path); 2202EXPORT_SYMBOL_GPL(of_console_check);
2197 2203
2198/** 2204/**
2199 * of_find_next_cache_node - Find a node's subsidiary cache 2205 * of_find_next_cache_node - Find a node's subsidiary cache