From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andre Przywara Date: Wed, 1 Mar 2017 02:25:29 +0000 Subject: [U-Boot] [PATCH 17/17] sunxi: use SPL header DT name for FIT board matching In-Reply-To: <1488335129-12363-1-git-send-email-andre.przywara@arm.com> References: <1488335129-12363-1-git-send-email-andre.przywara@arm.com> Message-ID: <1488335129-12363-18-git-send-email-andre.przywara@arm.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Now that we can store a DT name in the SPL header, use this string (if available) when finding the right DT blob to load for U-Boot proper. This allows a generic U-Boot (proper) image to be combined with a bunch of supported DTs, with just the SPL (possibly only that string) to be different. Eventually this string can be written after the build process by some firmware update tool. Signed-off-by: Andre Przywara --- board/sunxi/board.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/board/sunxi/board.c b/board/sunxi/board.c index 2ddff28..714f8fd 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -729,13 +729,19 @@ int ft_board_setup(void *blob, bd_t *bd) #ifdef CONFIG_SPL_LOAD_FIT int board_fit_config_name_match(const char *name) { - const char *cmp_str; + struct boot_file_head *spl = (void *)(ulong)SPL_ADDR; + const char *cmp_str = (void *)(ulong)SPL_ADDR; + /* Check if there is a DT name stored in the SPL header and use that. */ + if (spl->dt_name_offset) { + cmp_str += spl->dt_name_offset; + } else { #ifdef CONFIG_DEFAULT_DEVICE_TREE - cmp_str = CONFIG_DEFAULT_DEVICE_TREE; + cmp_str = CONFIG_DEFAULT_DEVICE_TREE; #else - return 0; + return 0; #endif + }; /* Differentiate the two Pine64 board DTs by their DRAM size. */ if (strstr(name, "-pine64") && strstr(cmp_str, "-pine64")) { -- 2.8.2