From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 3/5] console/of: evaluate linux,stdout-path property
Date: Mon, 8 Oct 2012 21:46:22 +0200 [thread overview]
Message-ID: <1349725584-20509-4-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1349725584-20509-1-git-send-email-s.hauer@pengutronix.de>
When a linux,stdout-path property is given in the devicetree
activate the corresponding console.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/console.c | 3 +++
drivers/of/base.c | 23 +++++++++++++++++++++++
include/of.h | 6 ++++++
3 files changed, 32 insertions(+)
diff --git a/common/console.c b/common/console.c
index 3dd964c..2766981 100644
--- a/common/console.c
+++ b/common/console.c
@@ -161,6 +161,9 @@ int console_register(struct console_device *newcdev)
}
#endif
+ if (newcdev->dev && of_device_is_stdout_path(newcdev->dev))
+ activate = 1;
+
list_add_tail(&newcdev->list, &console_list);
while (kfifo_getc(console_output_fifo, &ch) == 0)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 09785fb..3d26343 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -758,11 +758,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;
@@ -847,3 +851,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;
+}
diff --git a/include/of.h b/include/of.h
index 7b6a23a..e6342b6 100644
--- a/include/of.h
+++ b/include/of.h
@@ -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 */
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2012-10-08 19:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-08 19:46 [PATCH] of patches Sascha Hauer
2012-10-08 19:46 ` [PATCH 1/5] memory: return error in barebox_add_memory_bank Sascha Hauer
2012-10-08 19:46 ` [PATCH 2/5] of: find and register memory during probe Sascha Hauer
2012-10-08 19:46 ` Sascha Hauer [this message]
2012-10-08 19:46 ` [PATCH 4/5] of: Add function to get the model name Sascha Hauer
2012-10-08 19:46 ` [PATCH 5/5] of: Print model name in banner Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1349725584-20509-4-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox