diff options
author | Michal Simek <michal.simek@xilinx.com> | 2019-02-14 13:14:30 +0100 |
---|---|---|
committer | Michal Simek <michal.simek@xilinx.com> | 2019-02-15 15:04:01 +0100 |
commit | 91d7e0c47f51e73cd8357f023ffc7c217a3c7291 (patch) | |
tree | 431333d103b4083dfb8b1e25801a0e9d01aefc82 /board | |
parent | 053d4bd4727185f292a0bb2ac080c8c6ae794cbe (diff) | |
download | u-boot-91d7e0c47f51e73cd8357f023ffc7c217a3c7291.zip u-boot-91d7e0c47f51e73cd8357f023ffc7c217a3c7291.tar.gz u-boot-91d7e0c47f51e73cd8357f023ffc7c217a3c7291.tar.bz2 |
arm64: zynqmp: Create fdtfile from compatible string
distro boot expects that fdtfile name is setup for alternative DTB.
Create this file based on the first platform compatible string.
This should ensure that one rootfs can store multiple DTBs for different
boards.
Reflect structure which is used in Linux kernel. It means dtbs are
strored in xilinx folder.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'board')
-rw-r--r-- | board/xilinx/zynqmp/zynqmp.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index e7dfd49..5e1d211 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -514,6 +514,36 @@ static u32 reset_reason(void) return ret; } +static int set_fdtfile(void) +{ + char *compatible, *fdtfile; + const char *suffix = ".dtb"; + const char *vendor = "xilinx/"; + + if (env_get("fdtfile")) + return 0; + + compatible = (char *)fdt_getprop(gd->fdt_blob, 0, "compatible", NULL); + if (compatible) { + debug("Compatible: %s\n", compatible); + + /* Discard vendor prefix */ + strsep(&compatible, ","); + + fdtfile = calloc(1, strlen(vendor) + strlen(compatible) + + strlen(suffix) + 1); + if (!fdtfile) + return -ENOMEM; + + sprintf(fdtfile, "%s%s%s", vendor, compatible, suffix); + + env_set("fdtfile", fdtfile); + free(fdtfile); + } + + return 0; +} + int board_late_init(void) { u32 reg = 0; @@ -536,6 +566,10 @@ int board_late_init(void) return 0; } + ret = set_fdtfile(); + if (ret) + return ret; + ret = zynqmp_mmio_read((ulong)&crlapb_base->boot_mode, ®); if (ret) return -EINVAL; |