mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 3/3] fixup! sandbox: add support to pass dtb to barebox
Date: Thu,  5 Mar 2015 15:36:41 +0100	[thread overview]
Message-ID: <1425566201-31989-4-git-send-email-mkl@pengutronix.de> (raw)
In-Reply-To: <1425566201-31989-1-git-send-email-mkl@pengutronix.de>

This patch will generate a oftree on the fly, if no dtb is specified on the cmd
line.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 arch/sandbox/board/dtb.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/arch/sandbox/board/dtb.c b/arch/sandbox/board/dtb.c
index 9d4210164e01..708eca903a38 100644
--- a/arch/sandbox/board/dtb.c
+++ b/arch/sandbox/board/dtb.c
@@ -38,15 +38,25 @@ int barebox_register_dtb(const void *new_dtb)
 static int of_sandbox_init(void)
 {
 	struct device_node *root;
+	int ret;
 
-	if (!dtb)
-		return 0;
+	if (dtb) {
+		root = of_unflatten_dtb(dtb);
+	} else {
+		root = of_new_node(NULL, NULL);
+				
+		ret = of_property_write_u32(root, "#address-cells", 2);
+		if (ret)
+			return ret;
 
-	root = of_unflatten_dtb(dtb);
-	if (IS_ERR(root)) {
-		return PTR_ERR(root);
+		ret = of_property_write_u32(root, "#size-cells", 1);
+		if (ret)
+			return ret;
 	}
 
+	if (IS_ERR(root))
+		return PTR_ERR(root);
+
 	of_set_root_node(root);
 	of_fix_tree(root);
 	if (IS_ENABLED(CONFIG_OFDEVICE))
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2015-03-05 14:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-05 14:36 [PATCH 0/3] sandbox cleanups Marc Kleine-Budde
2015-03-05 14:36 ` [PATCH 1/3] fixup! sandbox: hostfile: completely switch to OF based probing Marc Kleine-Budde
2015-03-05 14:36 ` [PATCH 2/3] " Marc Kleine-Budde
2015-03-05 14:36 ` Marc Kleine-Budde [this message]
2015-03-06  6:42 ` [PATCH 0/3] sandbox cleanups Sascha Hauer
2015-03-10 14:24 ` Jean-Christophe PLAGNIOL-VILLARD
2015-03-10 14:26   ` Marc Kleine-Budde
2015-03-10 14:52     ` Marc Kleine-Budde
2015-03-10 16:35       ` Marc Kleine-Budde
2015-03-10 14:32   ` Marc Kleine-Budde
2015-03-10 14:59     ` Jean-Christophe PLAGNIOL-VILLARD
2015-03-10 15:01       ` Marc Kleine-Budde

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=1425566201-31989-4-git-send-email-mkl@pengutronix.de \
    --to=mkl@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