[U-Boot] [PATCH] sunxi: disable Pine A64 model detection code on non-A64 SoCs

Icenowy Zheng icenowy at aosc.io
Sat Aug 4 18:55:35 UTC 2018


The Pine A64 Plus/non-Plus model detection code is now built on all
64-bit ARM SoCs, even if the code cannot be triggered when H5/H6 is in
use.

Disable them when the SoC is not A64 by use #ifdef to wrap them.

On GCC 7.3.1 this makes the size of the function reduces 184 bytes, and
saves a 104 byte strstr() function, then makes SPL on H6 succeed to
build.

Signed-off-by: Icenowy Zheng <icenowy at aosc.io>
---
 board/sunxi/board.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 857d5ff010..4fb0ff2529 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -823,13 +823,14 @@ int board_fit_config_name_match(const char *name)
 	};
 
 /* Differentiate the two Pine64 board DTs by their DRAM size. */
+#ifdef CONFIG_MACH_SUN50I
 	if (strstr(name, "-pine64") && strstr(cmp_str, "-pine64")) {
 		if ((gd->ram_size > 512 * 1024 * 1024))
 			return !strstr(name, "plus");
 		else
 			return !!strstr(name, "plus");
-	} else {
-		return strcmp(name, cmp_str);
 	}
+#endif
+	return strcmp(name, cmp_str);
 }
 #endif
-- 
2.18.0



More information about the U-Boot mailing list