9
0
Fork 0

console/of: evaluate linux,stdout-path property

When a linux,stdout-path property is given in the devicetree
activate the corresponding console.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2012-10-07 00:15:17 +02:00
parent b3dbaa9a60
commit 3510a4b0f5
3 changed files with 32 additions and 0 deletions

View File

@ -164,6 +164,9 @@ int console_register(struct console_device *newcdev)
activate = 1;
}
if (newcdev->dev && of_device_is_stdout_path(newcdev->dev))
activate = 1;
list_add_tail(&newcdev->list, &console_list);
if (activate)

View File

@ -711,11 +711,15 @@ static void __of_probe(struct device_node *node)
__of_probe(n);
}
struct device_node *of_chosen;
int of_probe(void)
{
if(!root_node)
return -ENODEV;
of_chosen = of_find_node_by_path("/chosen");
__of_probe(root_node);
return 0;
@ -800,3 +804,22 @@ int of_parse_dtb(struct fdt_header *fdt)
return 0;
}
int of_device_is_stdout_path(struct device_d *dev)
{
struct device_node *dn;
const char *name;
name = of_get_property(of_chosen, "linux,stdout-path", NULL);
if (name == NULL)
return 0;
dn = of_find_node_by_path(name);
if (!dn)
return 0;
if (dn == dev->device_node)
return 1;
return 0;
}

View File

@ -114,6 +114,7 @@ int of_parse_partitions(const char *cdevname,
struct device_node *of_get_root_node(void);
int of_alias_get_id(struct device_node *np, const char *stem);
int of_device_is_stdout_path(struct device_d *dev);
#else
static inline int of_parse_partitions(const char *cdevname,
struct device_node *node)
@ -130,6 +131,11 @@ static inline int of_alias_get_id(struct device_node *np, const char *stem)
{
return -ENOENT;
}
static inline int of_device_is_stdout_path(struct device_d *dev)
{
return 0;
}
#endif
#endif /* __OF_H */