diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2020-10-05 10:28:35 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-10-12 16:30:28 +0200 |
commit | bfccbcb14155fd7aa267a3647f7a7e6fb12962f7 (patch) | |
tree | cb55b76f3b0591d719102101bea5993272f843e5 /arch/sandbox/board | |
parent | bbda04ce43996baa5d57a6e7fb482a34c7ef9d38 (diff) | |
download | barebox-bfccbcb14155fd7aa267a3647f7a7e6fb12962f7.tar.gz barebox-bfccbcb14155fd7aa267a3647f7a7e6fb12962f7.tar.xz |
sandbox: compile in a fallback device tree
The sandbox architecture is device tree only and so far when no --dtb
was passed, it created a basic one itself and used that.
Instead of creating the default device tree in C, just build the dtb
into barebox like we do on other platforms.
When --dtb is specified, that device tree will be used instead.
This results in functional change: Model and hostname are now more
accurate.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/sandbox/board')
-rw-r--r-- | arch/sandbox/board/devices.c | 3 | ||||
-rw-r--r-- | arch/sandbox/board/dtb.c | 25 |
2 files changed, 5 insertions, 23 deletions
diff --git a/arch/sandbox/board/devices.c b/arch/sandbox/board/devices.c index 72e62552a3..7ec37a4e29 100644 --- a/arch/sandbox/board/devices.c +++ b/arch/sandbox/board/devices.c @@ -23,9 +23,6 @@ static int sandbox_device_init(void) { struct device_d *dev, *tmp; - barebox_set_model("barebox sandbox"); - barebox_set_hostname("barebox"); - list_for_each_entry_safe(dev, tmp, &sandbox_device_list, list) { /* reset the list_head before registering for real */ dev->list.prev = NULL; diff --git a/arch/sandbox/board/dtb.c b/arch/sandbox/board/dtb.c index da24521992..4a8cbfb26f 100644 --- a/arch/sandbox/board/dtb.c +++ b/arch/sandbox/board/dtb.c @@ -32,29 +32,14 @@ int barebox_register_dtb(const void *new_dtb) return 0; } +extern char __dtb_sandbox_start[]; + static int of_sandbox_init(void) { - struct device_node *root; - int ret; - - 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; - - ret = of_property_write_u32(root, "#size-cells", 2); - if (ret) - return ret; - } - - if (IS_ERR(root)) - return PTR_ERR(root); + if (!dtb) + dtb = __dtb_sandbox_start; - barebox_register_of(root); + barebox_register_fdt(dtb); return 0; } |