[PATCH 3/3] fixup! sandbox: add support to pass dtb to barebox
Marc Kleine-Budde
mkl at pengutronix.de
Thu Mar 5 06:36:41 PST 2015
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 at 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
More information about the barebox
mailing list