From patchwork Mon Apr 27 10:52:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rayagonda Kokatanur X-Patchwork-Id: 238650 List-Id: U-Boot discussion From: rayagonda.kokatanur at broadcom.com (Rayagonda Kokatanur) Date: Mon, 27 Apr 2020 16:22:06 +0530 Subject: [PATCH v1 48/49] cmd: bcm: add command for chimp hand shake In-Reply-To: <20200427105207.5659-1-rayagonda.kokatanur@broadcom.com> References: <20200427105207.5659-1-rayagonda.kokatanur@broadcom.com> Message-ID: <20200427105207.5659-49-rayagonda.kokatanur@broadcom.com> From: Bharat Kumar Reddy Gooty Add command for chimp handshake. Signed-off-by: Bharat Kumar Reddy Gooty Signed-off-by: Rayagonda Kokatanur --- cmd/bcm/Makefile | 1 + cmd/bcm/chimp_handshake.c | 32 ++++++++++++++++++++++++++++++++ include/brcm/chimp.h | 6 ++++++ 3 files changed, 39 insertions(+) create mode 100644 cmd/bcm/chimp_handshake.c diff --git a/cmd/bcm/Makefile b/cmd/bcm/Makefile index 671c0fbd43..49a3f38357 100644 --- a/cmd/bcm/Makefile +++ b/cmd/bcm/Makefile @@ -3,4 +3,5 @@ obj-$(CONFIG_CMD_BCM_LOGSETUP) += logsetup.o obj-y += chimp_boot.o +obj-y += chimp_handshake.o obj-y += nitro_image_load.o diff --git a/cmd/bcm/chimp_handshake.c b/cmd/bcm/chimp_handshake.c new file mode 100644 index 0000000000..7b9c766dd3 --- /dev/null +++ b/cmd/bcm/chimp_handshake.c @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2020 Broadcom + */ + +#include +#include + +/* This command should be called after loading the nitro binaries */ +static int do_chimp_hs(cmd_tbl_t *cmdtp, int flag, int argc, + char *const argv[]) +{ + int ret = CMD_RET_USAGE; + u32 hstatus; + + /* Returns 1, if handshake call is success */ + if (chimp_handshake_status_optee(0, &hstatus) == BCM_CHIMP_SUCCESS) + ret = CMD_RET_SUCCESS; + + if (hstatus == CHIMP_HANDSHAKE_SUCCESS) + printf("ChiMP Handshake successful\n"); + else + printf("ERROR: ChiMP Handshake status 0x%x\n", hstatus); + + return ret; +} + +U_BOOT_CMD + (chimp_hs, 1, 1, do_chimp_hs, + "Command to verify the Chimp hand shake", + "chimp_hs\n" +); diff --git a/include/brcm/chimp.h b/include/brcm/chimp.h index 9099a70ef5..f384603dc7 100644 --- a/include/brcm/chimp.h +++ b/include/brcm/chimp.h @@ -15,6 +15,12 @@ #define BCM_CHIMP_RUNNIG_GOOD 0x8000 +enum { + CHIMP_HANDSHAKE_SUCCESS = 0, + CHIMP_HANDSHAKE_WAIT_ERROR, + CHIMP_HANDSHAKE_WAIT_TIMEOUT, +}; + #ifdef CONFIG_CHIMP_OPTEE int chimp_fastboot_optee(void); int chimp_health_status_optee(u32 *status);