]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
sunxi: use SPL header DT name for FIT board matching
authorAndre Przywara <andre.przywara@arm.com>
Wed, 26 Apr 2017 00:32:50 +0000 (01:32 +0100)
committerJagan Teki <jagan@openedev.com>
Wed, 17 May 2017 17:54:13 +0000 (23:24 +0530)
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 <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
board/sunxi/board.c

index c2755b2c6dfd4429b65d93ea5aacffd7f9ed029a..f79bd5c62c193b3034e69eb2d9463e1689c2e116 100644 (file)
@@ -761,13 +761,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")) {