diff mbox series

[v2,3/5] cmd: broadcom: add command for chimp handshake

Message ID 20200820151108.5503-4-rayagonda.kokatanur@broadcom.com
State Accepted
Commit a09ca687e7719ef0767f3febb8980725da800eb8
Delegated to: Tom Rini
Headers show
Series add custome commands for broadcom NS3 soc | expand

Commit Message

Rayagonda Kokatanur Aug. 20, 2020, 3:11 p.m. UTC
From: Bharat Kumar Reddy Gooty <bharat.gooty@broadcom.com>

Add command for chimp handshake.
Handshake is used to know chimp is loaded and booted successfully.

Signed-off-by: Bharat Kumar Reddy Gooty <bharat.gooty@broadcom.com>
Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
Changes from V1:
 -Address review comments from Simon,
  Rearrange header files.
  Remove use of typedef.
  Command description correction.

 cmd/broadcom/Makefile          |  1 +
 cmd/broadcom/chimp_handshake.c | 33 +++++++++++++++++++++++++++++++++
 include/broadcom/chimp.h       |  6 ++++++
 3 files changed, 40 insertions(+)
 create mode 100644 cmd/broadcom/chimp_handshake.c

Comments

Tom Rini Sept. 10, 2020, 6:39 p.m. UTC | #1
On Thu, Aug 20, 2020 at 08:41:06PM +0530, Rayagonda Kokatanur wrote:

> From: Bharat Kumar Reddy Gooty <bharat.gooty@broadcom.com>
> 
> Add command for chimp handshake.
> Handshake is used to know chimp is loaded and booted successfully.
> 
> Signed-off-by: Bharat Kumar Reddy Gooty <bharat.gooty@broadcom.com>
> Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/next, thanks!
diff mbox series

Patch

diff --git a/cmd/broadcom/Makefile b/cmd/broadcom/Makefile
index 6cdece1a3a..62268d98d0 100644
--- a/cmd/broadcom/Makefile
+++ b/cmd/broadcom/Makefile
@@ -3,3 +3,4 @@ 
 
 obj-y += chimp_boot.o
 obj-y += nitro_image_load.o
+obj-y += chimp_handshake.o
diff --git a/cmd/broadcom/chimp_handshake.c b/cmd/broadcom/chimp_handshake.c
new file mode 100644
index 0000000000..a90a73a6d7
--- /dev/null
+++ b/cmd/broadcom/chimp_handshake.c
@@ -0,0 +1,33 @@ 
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2020 Broadcom
+ */
+
+#include <common.h>
+#include <command.h>
+#include <broadcom/chimp.h>
+
+/* This command should be called after loading the nitro binaries */
+static int do_chimp_hs(struct cmd_tbl *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))
+		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,
+	 "Verify the Chimp handshake",
+	 "chimp_hs\n"
+);
diff --git a/include/broadcom/chimp.h b/include/broadcom/chimp.h
index 73bb1c21e9..738f73eefd 100644
--- a/include/broadcom/chimp.h
+++ b/include/broadcom/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,
+};
+
 /**
  * chimp_fastboot_optee() - api to load bnxt firmware
  *