1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright 2020 Broadcom
4  */
5 
6 #include <common.h>
7 #include <command.h>
8 #include <broadcom/chimp.h>
9 
10 /* This command should be called after loading the nitro binaries */
do_chimp_hs(struct cmd_tbl * cmdtp,int flag,int argc,char * const argv[])11 static int do_chimp_hs(struct cmd_tbl *cmdtp, int flag, int argc,
12 		       char *const argv[])
13 {
14 	int ret = CMD_RET_USAGE;
15 	u32 hstatus;
16 
17 	/* Returns 1, if handshake call is success */
18 	if (chimp_handshake_status_optee(0, &hstatus))
19 		ret = CMD_RET_SUCCESS;
20 
21 	if (hstatus == CHIMP_HANDSHAKE_SUCCESS)
22 		printf("ChiMP Handshake successful\n");
23 	else
24 		printf("ERROR: ChiMP Handshake status 0x%x\n", hstatus);
25 
26 	return ret;
27 }
28 
29 U_BOOT_CMD
30 	(chimp_hs, 1, 1, do_chimp_hs,
31 	 "Verify the Chimp handshake",
32 	 "chimp_hs\n"
33 );
34