All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/3] add custome commands for broadcom NS3 soc
@ 2020-05-17  8:37 Rayagonda Kokatanur
  2020-05-17  8:37 ` [PATCH v1 1/3] cmd: bcm: add nitro boot command Rayagonda Kokatanur
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Rayagonda Kokatanur @ 2020-05-17  8:37 UTC (permalink / raw)
  To: u-boot

This is sixth patch set series prepared on top of fifth
patch set ("add elog support for broadcom NS3 soc").

This patch set adds commands specific to broadcom NS3 soc.

Bharat Kumar Reddy Gooty (1):
  cmd: bcm: add command for chimp hand shake

Trac Hoang (1):
  cmd: bcm: add nitro boot command

Vikas Gupta (1):
  cmd: bcm: add nitro image load commands

 cmd/bcm/Makefile           |  3 ++
 cmd/bcm/chimp_boot.c       | 36 ++++++++++++++
 cmd/bcm/chimp_handshake.c  | 32 ++++++++++++
 cmd/bcm/nitro_image_load.c | 99 ++++++++++++++++++++++++++++++++++++++
 include/brcm/chimp.h       |  8 +++
 5 files changed, 178 insertions(+)
 create mode 100644 cmd/bcm/chimp_boot.c
 create mode 100644 cmd/bcm/chimp_handshake.c
 create mode 100644 cmd/bcm/nitro_image_load.c

-- 
2.17.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v1 1/3] cmd: bcm: add nitro boot command
  2020-05-17  8:37 [PATCH v1 0/3] add custome commands for broadcom NS3 soc Rayagonda Kokatanur
@ 2020-05-17  8:37 ` Rayagonda Kokatanur
  2020-05-25 17:03   ` Simon Glass
  2020-05-17  8:37 ` [PATCH v1 2/3] cmd: bcm: add nitro image load commands Rayagonda Kokatanur
  2020-05-17  8:37 ` [PATCH v1 3/3] cmd: bcm: add command for chimp hand shake Rayagonda Kokatanur
  2 siblings, 1 reply; 7+ messages in thread
From: Rayagonda Kokatanur @ 2020-05-17  8:37 UTC (permalink / raw)
  To: u-boot

From: Trac Hoang <trac.hoang@broadcom.com>

Add command to boot nitro.

Signed-off-by: Trac Hoang <trac.hoang@broadcom.com>
Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
---
 cmd/bcm/Makefile     |  1 +
 cmd/bcm/chimp_boot.c | 36 ++++++++++++++++++++++++++++++++++++
 include/brcm/chimp.h |  2 ++
 3 files changed, 39 insertions(+)
 create mode 100644 cmd/bcm/chimp_boot.c

diff --git a/cmd/bcm/Makefile b/cmd/bcm/Makefile
index 96dc8f7ad7..dc274f6b96 100644
--- a/cmd/bcm/Makefile
+++ b/cmd/bcm/Makefile
@@ -2,3 +2,4 @@
 # Copyright 2020 Broadcom
 
 obj-$(CONFIG_CMD_BCM_LOGSETUP) += logsetup.o
+obj-y += chimp_boot.o
diff --git a/cmd/bcm/chimp_boot.c b/cmd/bcm/chimp_boot.c
new file mode 100644
index 0000000000..dcab9a5bcb
--- /dev/null
+++ b/cmd/bcm/chimp_boot.c
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2020 Broadcom
+ */
+
+#include <command.h>
+#include <common.h>
+#include <brcm/chimp.h>
+
+static int do_chimp_fastboot_secure(cmd_tbl_t *cmdtp, int flag, int argc,
+				    char *const argv[])
+{
+	u32 health = 0;
+
+	if (chimp_health_status_optee(&health) != BCM_CHIMP_SUCCESS) {
+		pr_err("Chimp health command fail\n");
+		return CMD_RET_FAILURE;
+	}
+
+	if (health == BCM_CHIMP_RUNNIG_GOOD) {
+		printf("skip fastboot...\n");
+		return CMD_RET_SUCCESS;
+	}
+
+	if (chimp_fastboot_optee() != BCM_CHIMP_SUCCESS) {
+		pr_err("Failed to load secure ChiMP image\n");
+		return CMD_RET_FAILURE;
+	}
+	return CMD_RET_SUCCESS;
+}
+
+U_BOOT_CMD
+	(chimp_ld_secure, 1, 0, do_chimp_fastboot_secure,
+	 "Invoke chimp fw load via optee",
+	 "chimp_ld_secure\n"
+);
diff --git a/include/brcm/chimp.h b/include/brcm/chimp.h
index c3d4594c4b..9099a70ef5 100644
--- a/include/brcm/chimp.h
+++ b/include/brcm/chimp.h
@@ -13,6 +13,8 @@
 #define BCM_CHIMP_SUCCESS	0
 #define BCM_CHIMP_FAILURE	(!BCM_CHIMP_SUCCESS)
 
+#define BCM_CHIMP_RUNNIG_GOOD	0x8000
+
 #ifdef CONFIG_CHIMP_OPTEE
 int chimp_fastboot_optee(void);
 int chimp_health_status_optee(u32 *status);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1 2/3] cmd: bcm: add nitro image load commands
  2020-05-17  8:37 [PATCH v1 0/3] add custome commands for broadcom NS3 soc Rayagonda Kokatanur
  2020-05-17  8:37 ` [PATCH v1 1/3] cmd: bcm: add nitro boot command Rayagonda Kokatanur
@ 2020-05-17  8:37 ` Rayagonda Kokatanur
  2020-05-25 17:03   ` Simon Glass
  2020-05-17  8:37 ` [PATCH v1 3/3] cmd: bcm: add command for chimp hand shake Rayagonda Kokatanur
  2 siblings, 1 reply; 7+ messages in thread
From: Rayagonda Kokatanur @ 2020-05-17  8:37 UTC (permalink / raw)
  To: u-boot

From: Vikas Gupta <vikas.gupta@broadcom.com>

Add nitro image load commands.

Signed-off-by: Vikas Gupta <vikas.gupta@broadcom.com>
Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
---
 cmd/bcm/Makefile           |  1 +
 cmd/bcm/nitro_image_load.c | 99 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 100 insertions(+)
 create mode 100644 cmd/bcm/nitro_image_load.c

diff --git a/cmd/bcm/Makefile b/cmd/bcm/Makefile
index dc274f6b96..671c0fbd43 100644
--- a/cmd/bcm/Makefile
+++ b/cmd/bcm/Makefile
@@ -3,3 +3,4 @@
 
 obj-$(CONFIG_CMD_BCM_LOGSETUP) += logsetup.o
 obj-y += chimp_boot.o
+obj-y += nitro_image_load.o
diff --git a/cmd/bcm/nitro_image_load.c b/cmd/bcm/nitro_image_load.c
new file mode 100644
index 0000000000..e460b91338
--- /dev/null
+++ b/cmd/bcm/nitro_image_load.c
@@ -0,0 +1,99 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2020 Broadcom
+ */
+
+#include <command.h>
+#include <common.h>
+
+#define NITRO_FW_IMAGE_SIG 0xFF123456
+#define NITRO_NS3_CFG_IMAGE_SIG 0xCF54321A
+
+/*structure for Nitro bin file
+ *  signature: Nitro fw itb file
+ *  size: Nitro fw itb file
+ *  signature: Nitro NS3 config file
+ *  size: Nitro NS3 config file
+ *  Data: Nitro fw itb file
+ *  ............................
+ *  ............................
+ *  Data: Nitro NS3 config file
+ *  ............................
+ *  ............................
+ */
+
+static struct nitro_img_header {
+	u32 nitro_fw_bin_sig;
+	u32 nitro_fw_bin_size;
+	u32 nitro_fw_cfg1_sig;
+	u32 nitro_fw_cfg1_size;
+	u32 nitro_fw_cfg2_sig;
+	u32 nitro_fw_cfg2_size;
+} *img_header;
+
+static int do_spi_nitro_images_addr(cmd_tbl_t *cmdtp, int flag, int argc,
+				    char *const argv[])
+{
+	uintptr_t images_load_addr;
+	uintptr_t spi_load_addr;
+	u32 len;
+	u32 spi_data_offset = sizeof(struct nitro_img_header);
+
+	if (argc != 3)
+		return CMD_RET_USAGE;
+
+	/* convert command parameter to fastboot address (base 16), i.e. hex */
+	images_load_addr = (uintptr_t)simple_strtoul(argv[1], NULL, 16);
+	if (!images_load_addr) {
+		pr_err("Invalid load address\n");
+		return CMD_RET_USAGE;
+	}
+
+	spi_load_addr = (uintptr_t)simple_strtoul(argv[2], NULL, 16);
+	if (!spi_load_addr) {
+		pr_err("Invalid spi load address\n");
+		return CMD_RET_USAGE;
+	}
+
+	img_header = (struct nitro_img_header *)images_load_addr;
+
+	if (img_header->nitro_fw_bin_sig != NITRO_FW_IMAGE_SIG) {
+		pr_err("Invalid Nitro bin file\n");
+		return CMD_RET_FAILURE;
+	}
+
+	env_set_hex("spi_nitro_fw_itb_start_addr", (ulong)0);
+	env_set_hex("spi_nitro_fw_itb_len", (ulong)0);
+	env_set_hex("spi_nitro_fw_ns3_cfg_start_addr", (ulong)0);
+	env_set_hex("spi_nitro_fw_ns3_cfg_len", (ulong)0);
+
+	len = img_header->nitro_fw_bin_size;
+
+	env_set_hex("spi_nitro_fw_itb_start_addr", (ulong)
+		   (spi_load_addr + spi_data_offset));
+	env_set_hex("spi_nitro_fw_itb_len", (ulong)
+		    img_header->nitro_fw_bin_size);
+
+	spi_data_offset += len;
+
+	if (img_header->nitro_fw_cfg1_sig == NITRO_NS3_CFG_IMAGE_SIG) {
+		len = img_header->nitro_fw_cfg1_size;
+
+		env_set_hex("spi_nitro_fw_ns3_cfg_start_addr", (ulong)
+			   (spi_load_addr + spi_data_offset));
+		env_set_hex("spi_nitro_fw_ns3_cfg_len", (ulong)len);
+
+		spi_data_offset += len;
+	}
+
+	/* disable nitro secure boot */
+	env_set_hex("nitro_fastboot_secure", (ulong)0);
+
+	return CMD_RET_SUCCESS;
+}
+
+U_BOOT_CMD
+	(spi_nitro_images_addr, 3, 1, do_spi_nitro_images_addr,
+	 "Load the nitro bin header and sets envs ",
+	 "spi_nitro_images_addr <load_addr> <spi_base_addr>\n"
+);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1 3/3] cmd: bcm: add command for chimp hand shake
  2020-05-17  8:37 [PATCH v1 0/3] add custome commands for broadcom NS3 soc Rayagonda Kokatanur
  2020-05-17  8:37 ` [PATCH v1 1/3] cmd: bcm: add nitro boot command Rayagonda Kokatanur
  2020-05-17  8:37 ` [PATCH v1 2/3] cmd: bcm: add nitro image load commands Rayagonda Kokatanur
@ 2020-05-17  8:37 ` Rayagonda Kokatanur
  2020-05-25 17:03   ` Simon Glass
  2 siblings, 1 reply; 7+ messages in thread
From: Rayagonda Kokatanur @ 2020-05-17  8:37 UTC (permalink / raw)
  To: u-boot

From: Bharat Kumar Reddy Gooty <bharat.gooty@broadcom.com>

Add command for chimp handshake.

Signed-off-by: Bharat Kumar Reddy Gooty <bharat.gooty@broadcom.com>
Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
---
 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 <brcm/chimp.h>
+#include <common.h>
+
+/* 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);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1 1/3] cmd: bcm: add nitro boot command
  2020-05-17  8:37 ` [PATCH v1 1/3] cmd: bcm: add nitro boot command Rayagonda Kokatanur
@ 2020-05-25 17:03   ` Simon Glass
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Glass @ 2020-05-25 17:03 UTC (permalink / raw)
  To: u-boot

Hi Rayagonda,

On Sun, 17 May 2020 at 02:37, Rayagonda Kokatanur
<rayagonda.kokatanur@broadcom.com> wrote:
>
> From: Trac Hoang <trac.hoang@broadcom.com>
>
> Add command to boot nitro.
>
> Signed-off-by: Trac Hoang <trac.hoang@broadcom.com>
> Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
> ---
>  cmd/bcm/Makefile     |  1 +
>  cmd/bcm/chimp_boot.c | 36 ++++++++++++++++++++++++++++++++++++
>  include/brcm/chimp.h |  2 ++
>  3 files changed, 39 insertions(+)
>  create mode 100644 cmd/bcm/chimp_boot.c

There seems to be a general lack of documentation in your patches.

What is nitro?

What is Chimp?

>
> diff --git a/cmd/bcm/Makefile b/cmd/bcm/Makefile
> index 96dc8f7ad7..dc274f6b96 100644
> --- a/cmd/bcm/Makefile
> +++ b/cmd/bcm/Makefile
> @@ -2,3 +2,4 @@
>  # Copyright 2020 Broadcom
>
>  obj-$(CONFIG_CMD_BCM_LOGSETUP) += logsetup.o
> +obj-y += chimp_boot.o
> diff --git a/cmd/bcm/chimp_boot.c b/cmd/bcm/chimp_boot.c
> new file mode 100644
> index 0000000000..dcab9a5bcb
> --- /dev/null
> +++ b/cmd/bcm/chimp_boot.c
> @@ -0,0 +1,36 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright 2020 Broadcom
> + */
> +
> +#include <command.h>
> +#include <common.h>

common.h always goes first

> +#include <brcm/chimp.h>
> +
> +static int do_chimp_fastboot_secure(cmd_tbl_t *cmdtp, int flag, int argc,
> +                                   char *const argv[])
> +{
> +       u32 health = 0;
> +
> +       if (chimp_health_status_optee(&health) != BCM_CHIMP_SUCCESS) {
> +               pr_err("Chimp health command fail\n");
> +               return CMD_RET_FAILURE;
> +       }
> +
> +       if (health == BCM_CHIMP_RUNNIG_GOOD) {
> +               printf("skip fastboot...\n");
> +               return CMD_RET_SUCCESS;
> +       }
> +
> +       if (chimp_fastboot_optee() != BCM_CHIMP_SUCCESS) {
> +               pr_err("Failed to load secure ChiMP image\n");
> +               return CMD_RET_FAILURE;
> +       }
> +       return CMD_RET_SUCCESS;
> +}
> +
> +U_BOOT_CMD
> +       (chimp_ld_secure, 1, 0, do_chimp_fastboot_secure,
> +        "Invoke chimp fw load via optee",
> +        "chimp_ld_secure\n"
> +);
> diff --git a/include/brcm/chimp.h b/include/brcm/chimp.h
> index c3d4594c4b..9099a70ef5 100644
> --- a/include/brcm/chimp.h
> +++ b/include/brcm/chimp.h
> @@ -13,6 +13,8 @@
>  #define BCM_CHIMP_SUCCESS      0
>  #define BCM_CHIMP_FAILURE      (!BCM_CHIMP_SUCCESS)
>
> +#define BCM_CHIMP_RUNNIG_GOOD  0x8000
> +

Please add comment. What does running good mean?

>  #ifdef CONFIG_CHIMP_OPTEE
>  int chimp_fastboot_optee(void);
>  int chimp_health_status_optee(u32 *status);

Function comments.

> --
> 2.17.1
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v1 2/3] cmd: bcm: add nitro image load commands
  2020-05-17  8:37 ` [PATCH v1 2/3] cmd: bcm: add nitro image load commands Rayagonda Kokatanur
@ 2020-05-25 17:03   ` Simon Glass
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Glass @ 2020-05-25 17:03 UTC (permalink / raw)
  To: u-boot

On Sun, 17 May 2020 at 02:37, Rayagonda Kokatanur
<rayagonda.kokatanur@broadcom.com> wrote:
>
> From: Vikas Gupta <vikas.gupta@broadcom.com>
>
> Add nitro image load commands.
>
> Signed-off-by: Vikas Gupta <vikas.gupta@broadcom.com>
> Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
> ---
>  cmd/bcm/Makefile           |  1 +
>  cmd/bcm/nitro_image_load.c | 99 ++++++++++++++++++++++++++++++++++++++
>  2 files changed, 100 insertions(+)
>  create mode 100644 cmd/bcm/nitro_image_load.c
>

Reviewed-by: Simon Glass <sjg@chromium.org>

> diff --git a/cmd/bcm/Makefile b/cmd/bcm/Makefile
> index dc274f6b96..671c0fbd43 100644
> --- a/cmd/bcm/Makefile
> +++ b/cmd/bcm/Makefile
> @@ -3,3 +3,4 @@
>
>  obj-$(CONFIG_CMD_BCM_LOGSETUP) += logsetup.o
>  obj-y += chimp_boot.o
> +obj-y += nitro_image_load.o
> diff --git a/cmd/bcm/nitro_image_load.c b/cmd/bcm/nitro_image_load.c
> new file mode 100644
> index 0000000000..e460b91338
> --- /dev/null
> +++ b/cmd/bcm/nitro_image_load.c
> @@ -0,0 +1,99 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright 2020 Broadcom
> + */
> +
> +#include <command.h>
> +#include <common.h>

switch order

> +
> +#define NITRO_FW_IMAGE_SIG 0xFF123456
> +#define NITRO_NS3_CFG_IMAGE_SIG 0xCF54321A

lower-case hex

> +
> +/*structure for Nitro bin file
> + *  signature: Nitro fw itb file
> + *  size: Nitro fw itb file
> + *  signature: Nitro NS3 config file
> + *  size: Nitro NS3 config file
> + *  Data: Nitro fw itb file
> + *  ............................
> + *  ............................
> + *  Data: Nitro NS3 config file
> + *  ............................
> + *  ............................
> + */
> +
> +static struct nitro_img_header {
> +       u32 nitro_fw_bin_sig;
> +       u32 nitro_fw_bin_size;
> +       u32 nitro_fw_cfg1_sig;
> +       u32 nitro_fw_cfg1_size;
> +       u32 nitro_fw_cfg2_sig;
> +       u32 nitro_fw_cfg2_size;
> +} *img_header;

So do you need the nitro_fw_ prefix on these?

> +
> +static int do_spi_nitro_images_addr(cmd_tbl_t *cmdtp, int flag, int argc,
> +                                   char *const argv[])
> +{
> +       uintptr_t images_load_addr;
> +       uintptr_t spi_load_addr;
> +       u32 len;
> +       u32 spi_data_offset = sizeof(struct nitro_img_header);
> +
> +       if (argc != 3)
> +               return CMD_RET_USAGE;
> +
> +       /* convert command parameter to fastboot address (base 16), i.e. hex */
> +       images_load_addr = (uintptr_t)simple_strtoul(argv[1], NULL, 16);
> +       if (!images_load_addr) {
> +               pr_err("Invalid load address\n");
> +               return CMD_RET_USAGE;
> +       }
> +
> +       spi_load_addr = (uintptr_t)simple_strtoul(argv[2], NULL, 16);

Drop cast

> +       if (!spi_load_addr) {
> +               pr_err("Invalid spi load address\n");
> +               return CMD_RET_USAGE;
> +       }
> +
> +       img_header = (struct nitro_img_header *)images_load_addr;
> +
> +       if (img_header->nitro_fw_bin_sig != NITRO_FW_IMAGE_SIG) {
> +               pr_err("Invalid Nitro bin file\n");
> +               return CMD_RET_FAILURE;
> +       }
> +
> +       env_set_hex("spi_nitro_fw_itb_start_addr", (ulong)0);

Please drop the casts here and everywhere else.

Note that any of these can fail. Do you want to check for errors?
Could perhaps just check the final one?

> +       env_set_hex("spi_nitro_fw_itb_len", (ulong)0);
> +       env_set_hex("spi_nitro_fw_ns3_cfg_start_addr", (ulong)0);
> +       env_set_hex("spi_nitro_fw_ns3_cfg_len", (ulong)0);
> +
> +       len = img_header->nitro_fw_bin_size;
> +
> +       env_set_hex("spi_nitro_fw_itb_start_addr", (ulong)
> +                  (spi_load_addr + spi_data_offset));
> +       env_set_hex("spi_nitro_fw_itb_len", (ulong)
> +                   img_header->nitro_fw_bin_size);
> +
> +       spi_data_offset += len;
> +
> +       if (img_header->nitro_fw_cfg1_sig == NITRO_NS3_CFG_IMAGE_SIG) {
> +               len = img_header->nitro_fw_cfg1_size;
> +
> +               env_set_hex("spi_nitro_fw_ns3_cfg_start_addr", (ulong)
> +                          (spi_load_addr + spi_data_offset));
> +               env_set_hex("spi_nitro_fw_ns3_cfg_len", (ulong)len);
> +
> +               spi_data_offset += len;
> +       }
> +
> +       /* disable nitro secure boot */
> +       env_set_hex("nitro_fastboot_secure", (ulong)0);
> +
> +       return CMD_RET_SUCCESS;
> +}
> +
> +U_BOOT_CMD
> +       (spi_nitro_images_addr, 3, 1, do_spi_nitro_images_addr,
> +        "Load the nitro bin header and sets envs ",
> +        "spi_nitro_images_addr <load_addr> <spi_base_addr>\n"
> +);
> --
> 2.17.1
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v1 3/3] cmd: bcm: add command for chimp hand shake
  2020-05-17  8:37 ` [PATCH v1 3/3] cmd: bcm: add command for chimp hand shake Rayagonda Kokatanur
@ 2020-05-25 17:03   ` Simon Glass
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Glass @ 2020-05-25 17:03 UTC (permalink / raw)
  To: u-boot

On Sun, 17 May 2020 at 02:37, Rayagonda Kokatanur
<rayagonda.kokatanur@broadcom.com> wrote:
>
> From: Bharat Kumar Reddy Gooty <bharat.gooty@broadcom.com>
>
> Add command for chimp handshake.
>
> Signed-off-by: Bharat Kumar Reddy Gooty <bharat.gooty@broadcom.com>
> Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
> ---
>  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

Reviewed-by: Simon Glass <sjg@chromium.org>

I think handshake is one word these days.

Also please see below

>
> 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 <brcm/chimp.h>
> +#include <common.h>

Fix order

> +
> +/* This command should be called after loading the nitro binaries */
> +static int do_chimp_hs(cmd_tbl_t *cmdtp, int flag, int argc,

Forgot to mention, this typedef has been removed sorry, so patches
need updating for that.

> +                      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",

You can drop 'Command to' since we know it is a command

> +        "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);
> --
> 2.17.1
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-05-25 17:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-17  8:37 [PATCH v1 0/3] add custome commands for broadcom NS3 soc Rayagonda Kokatanur
2020-05-17  8:37 ` [PATCH v1 1/3] cmd: bcm: add nitro boot command Rayagonda Kokatanur
2020-05-25 17:03   ` Simon Glass
2020-05-17  8:37 ` [PATCH v1 2/3] cmd: bcm: add nitro image load commands Rayagonda Kokatanur
2020-05-25 17:03   ` Simon Glass
2020-05-17  8:37 ` [PATCH v1 3/3] cmd: bcm: add command for chimp hand shake Rayagonda Kokatanur
2020-05-25 17:03   ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.