diff options
author | Ilias Apalodimas <ilias.apalodimas@linaro.org> | 2021-10-26 09:12:33 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-10-27 16:38:26 -0400 |
commit | e7fb789612e39653f9f20ad08ad40896c7f61742 (patch) | |
tree | 2a16e7d6ebd67449b5c0fca8f7841d879564889f /arch/sandbox/cpu | |
parent | 670d657dfb6ede2957043dd0ac868297ac093857 (diff) | |
download | u-boot-e7fb789612e39653f9f20ad08ad40896c7f61742.tar.gz |
sandbox: Remove OF_HOSTFILEWIP/27Oct2021
OF_HOSTFILE is used on sandbox configs only. Although it's pretty
unique and not causing any confusions, we are better of having simpler
config options for the DTB.
So let's replace that with the existing OF_BOARD. U-Boot would then
have only three config options for the DTB origin.
- OF_SEPARATE, build separately from U-Boot
- OF_BOARD, board specific way of providing the DTB
- OF_EMBED embedded in the u-boot binary(should not be used in production
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/sandbox/cpu')
-rw-r--r-- | arch/sandbox/cpu/cpu.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c index 48636ab6391..9887d09272a 100644 --- a/arch/sandbox/cpu/cpu.c +++ b/arch/sandbox/cpu/cpu.c @@ -291,44 +291,51 @@ void invalidate_dcache_range(unsigned long start, unsigned long stop) { } -int sandbox_read_fdt_from_file(void) +void *board_fdt_blob_setup(int *ret) { struct sandbox_state *state = state_get_current(); const char *fname = state->fdt_fname; - void *blob; + void *blob = NULL; loff_t size; int err; int fd; blob = map_sysmem(CONFIG_SYS_FDT_LOAD_ADDR, 0); + *ret = 0; if (!state->fdt_fname) { err = fdt_create_empty_tree(blob, 256); if (!err) goto done; printf("Unable to create empty FDT: %s\n", fdt_strerror(err)); - return -EINVAL; + *ret = -EINVAL; + goto fail; } err = os_get_filesize(fname, &size); if (err < 0) { - printf("Failed to file FDT file '%s'\n", fname); - return err; + printf("Failed to find FDT file '%s'\n", fname); + *ret = err; + goto fail; } fd = os_open(fname, OS_O_RDONLY); if (fd < 0) { printf("Failed to open FDT file '%s'\n", fname); - return -EACCES; + *ret = -EACCES; + goto fail; } + if (os_read(fd, blob, size) != size) { os_close(fd); - return -EIO; + printf("Failed to read FDT file '%s'\n", fname); + *ret = -EIO; + goto fail; } os_close(fd); done: - gd->fdt_blob = blob; - - return 0; + return blob; +fail: + return NULL; } ulong timer_get_boot_us(void) |