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

Maxime Ripard maxime.ripard at bootlin.com
Mon Aug 20 12:25:19 UTC 2018


Hi!

On Sun, Aug 05, 2018 at 02:55:35AM +0800, Icenowy Zheng wrote:
> 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);

I'd really prefer to have an opt-in option, selected only by the
Pine64, rather than enabling it for all the A64 boards that don't have
any use for that code.

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180820/adb0b070/attachment.sig>


More information about the U-Boot mailing list