[PATCH 3/4] ARM: imx: Add support for reading out the primary/secondary bmode

Stefano Babic sbabic at denx.de
Wed Aug 5 18:01:39 CEST 2020


On 05.08.20 15:34, Marek Vasut wrote:
> Add new 'getprisec' subcommand to 'bmode' command, which sets the return
> value of the 'bmode' command to either 0 if the system booted from primary
> copy or to 1 if the system booted from secondary copy. This can be used
> e.g. in 'test' command to determine which copy of the system is running.
> 
> Signed-off-by: Marek Vasut <marex at denx.de>
> Cc: Fabio Estevam <festevam at gmail.com>
> Cc: NXP i.MX U-Boot Team <uboot-imx at nxp.com>
> Cc: Peng Fan <peng.fan at nxp.com>
> Cc: Stefano Babic <sbabic at denx.de>
> ---
>  arch/arm/mach-imx/cmd_bmode.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/cmd_bmode.c b/arch/arm/mach-imx/cmd_bmode.c
> index 19bfd9f9a0..cb317499d5 100644
> --- a/arch/arm/mach-imx/cmd_bmode.c
> +++ b/arch/arm/mach-imx/cmd_bmode.c
> @@ -51,9 +51,19 @@ static int create_usage(char *dest)
>  	if (dest)
>  		memcpy(dest - 1, " [noreset]", 11);	/* include trailing 0 */
>  	size += 10;
> +
> +	if (dest)
> +		memcpy(dest - 1, "\nbmode - getprisec", 19);
> +	size += 18;
> +
>  	return size;
>  }
>  
> +__weak int boot_mode_getprisec(void)
> +{
> +	return 0;
> +}
> +
>  static int do_boot_mode(struct cmd_tbl *cmdtp, int flag, int argc,
>  			char *const argv[])
>  {
> @@ -62,6 +72,8 @@ static int do_boot_mode(struct cmd_tbl *cmdtp, int flag, int argc,
>  
>  	if (argc < 2)
>  		return CMD_RET_USAGE;
> +	if (!strcmp(argv[1], "getprisec"))
> +		return boot_mode_getprisec();
>  	p = search_modes(argv[1]);
>  	if (!p)
>  		return CMD_RET_USAGE;
> 

Reviewed-by: Stefano Babic <sbabic at denx.de>

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================


More information about the U-Boot mailing list