Skip to contentSkip to conversation

add custome commands for broadcom NS3 soc

PATCH New Rayagonda Kokatanur 3 participants 14 messages Aug 20, 2020 – Sep 10, 2020

lore
Share & tools
lore
#0 lore raw

v2 cover add custome commands for broadcom NS3 soc

This patch set adds commands specific to broadcom NS3 soc.

Changes from V1:
-Address review comments from Simon,
Update commit message.
Rearrange header files.
Add comments to macros.
Use lower case hex.
Rename struct name from nitro_img_header to img_header. Drop unnecessary type cast.
Check returun value for env_set_hex().
Remove use of typedef.
Command description correction.

Bharat Kumar Reddy Gooty (1):
cmd: broadcom: add command for chimp handshake

Rayagonda Kokatanur (1):
MAINTAINERS: update maintainers file for new files

Trac Hoang (1):
cmd: broadcom: add bnxt boot command

Vikas Gupta (1):
cmd: broadcom: add cmd to update bnxt image env variables

Vladimir Olovyannikov (1):
board: ns3: kconfig: extend board kconfig with specific commands

 MAINTAINERS                     |   4 +
 board/broadcom/bcmns3/Kconfig   |   7 ++
 cmd/Makefile                    |   2 +
 cmd/broadcom/Makefile           |   6 ++
 cmd/broadcom/chimp_boot.c       |  37 ++++++++++
 cmd/broadcom/chimp_handshake.c  |  33 +++++++++
 cmd/broadcom/nitro_image_load.c | 125 ++++++++++++++++++++++++++++++++
 include/broadcom/chimp.h        |  12 +++
 8 files changed, 226 insertions(+)
 create mode 100644 cmd/broadcom/Makefile
 create mode 100644 cmd/broadcom/chimp_boot.c
 create mode 100644 cmd/broadcom/chimp_handshake.c
 create mode 100644 cmd/broadcom/nitro_image_load.c
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/5 cmd: broadcom: add bnxt boot command

From: Trac Hoang <[email protected]>

Chimp is a core in Broadcom netxtream controller (bnxt). Add command to load binary to chimp and boot bnxt.

---
Changes from V1:
-Address review comments from Simon,
Update commit message.
Rearrange header files.
Add comments to macros.

 cmd/broadcom/Makefile     |  4 ++++
 cmd/broadcom/chimp_boot.c | 37 +++++++++++++++++++++++++++++++++++++
 include/broadcom/chimp.h  |  6 ++++++
 3 files changed, 47 insertions(+)
 create mode 100644 cmd/broadcom/Makefile
 create mode 100644 cmd/broadcom/chimp_boot.c
cmd/broadcom/Makefile new file +4 -0
new file mode 100644
index 0000000000..22ccf2f334
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2020 Broadcom
+
+obj-y += chimp_boot.o
cmd/broadcom/chimp_boot.c new file +37 -0
new file mode 100644
index 0000000000..16f2b612c4
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2020 Broadcom
+ */
+
+#include <common.h>
+#include <command.h>
+#include <broadcom/chimp.h>
+
+static int do_chimp_fastboot_secure(struct cmd_tbl *cmdtp, int flag, int argc,
+				    char *const argv[])
+{
+	u32 health = 0;
+
+	if (chimp_health_status_optee(&health)) {
+		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()) {
+		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"
+);
include/broadcom/chimp.h +6 -0
index 7f64152913..73bb1c21e9 100644
@@ -9,6 +9,12 @@
 
 #include <linux/compiler.h>
 
+/*
+ * Chimp binary has health status like initialization complete,
+ * crash or running fine
+ */
+#define BCM_CHIMP_RUNNIG_GOOD	0x8000
+
 /**
  * chimp_fastboot_optee() - api to load bnxt firmware
  *
Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 1/5 cmd: broadcom: add bnxt boot command

Quoted 15 lines · Rayagonda Kokatanur

From: Trac Hoang <[email protected]>

Chimp is a core in Broadcom netxtream controller (bnxt). Add command to load binary to chimp and boot bnxt.

---
Changes from V1:
-Address review comments from Simon,
Update commit message.
Rearrange header files.
Add comments to macros.

Quoted 7 lines
 cmd/broadcom/Makefile     |  4 ++++
 cmd/broadcom/chimp_boot.c | 37 +++++++++++++++++++++++++++++++++++++
 include/broadcom/chimp.h  |  6 ++++++
 3 files changed, 47 insertions(+)
 create mode 100644 cmd/broadcom/Makefile
 create mode 100644 cmd/broadcom/chimp_boot.c
#3 lore raw

PATCH v2 1/5 cmd: broadcom: add bnxt boot command

In reply to Rayagonda Kokatanur
Quoted 8 lines · Rayagonda Kokatanur

From: Trac Hoang <[email protected]>

Chimp is a core in Broadcom netxtream controller (bnxt). Add command to load binary to chimp and boot bnxt.

Applied to u-boot/next, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200910/7887b426/attachment.sig>
#4 lore raw

PATCH v2 1/5 cmd: broadcom: add bnxt boot command

In reply to Rayagonda Kokatanur
Quoted 8 lines · Rayagonda Kokatanur

From: Trac Hoang <[email protected]>

Chimp is a core in Broadcom netxtream controller (bnxt). Add command to load binary to chimp and boot bnxt.

Applied to u-boot/next, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200910/7709d52b/attachment.sig>
#5 lore raw

PATCH v2 2/5 cmd: broadcom: add cmd to update bnxt image env variables

In reply to Rayagonda Kokatanur

From: Vikas Gupta <[email protected]>

Add command to update the environmental variables which are used to read the data from QSPI offsets and load the binaries to bnxt.

---
Changes from V1:
-Address review comments from Simon,
Rearrange header files.
Use lower case hex.
Rename struct name from nitro_img_header to img_header. Drop unnecessary type cast.
Check returun value for env_set_hex().

 cmd/broadcom/Makefile           |   1 +
 cmd/broadcom/nitro_image_load.c | 125 ++++++++++++++++++++++++++++++++
 2 files changed, 126 insertions(+)
 create mode 100644 cmd/broadcom/nitro_image_load.c
cmd/broadcom/Makefile +1 -0
index 22ccf2f334..6cdece1a3a 100644
@@ -2,3 +2,4 @@
 # Copyright 2020 Broadcom
 
 obj-y += chimp_boot.o
+obj-y += nitro_image_load.o
cmd/broadcom/nitro_image_load.c new file +125 -0

125 lines not on this page · raw message

Signature · 1 line
2.17.1
#6 lore raw

PATCH v2 2/5 cmd: broadcom: add cmd to update bnxt image env variables

Quoted 9 lines · Rayagonda Kokatanur

From: Vikas Gupta <[email protected]>

Add command to update the environmental variables which are used to read the data from QSPI offsets and load the binaries to bnxt.

Applied to u-boot/next, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200910/8747a3e0/attachment.sig>
#7 lore raw

PATCH v2 3/5 cmd: broadcom: add command for chimp handshake

In reply to Rayagonda Kokatanur

From: Bharat Kumar Reddy Gooty <[email protected]>

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

---
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
cmd/broadcom/Makefile +1 -0
index 6cdece1a3a..62268d98d0 100644
@@ -3,3 +3,4 @@
 
 obj-y += chimp_boot.o
 obj-y += nitro_image_load.o
+obj-y += chimp_handshake.o
cmd/broadcom/chimp_handshake.c new file +33 -0
new file mode 100644
index 0000000000..a90a73a6d7
@@ -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"
+);
include/broadcom/chimp.h +6 -0
index 73bb1c21e9..738f73eefd 100644
@@ -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
  *
Signature · 1 line
2.17.1
#8 lore raw

PATCH v2 3/5 cmd: broadcom: add command for chimp handshake

Quoted 8 lines · Rayagonda Kokatanur

From: Bharat Kumar Reddy Gooty <[email protected]>

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

Applied to u-boot/next, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200910/056aeb86/attachment.sig>
#9 lore raw

PATCH v2 4/5 board: ns3: kconfig: extend board kconfig with specific commands

In reply to Rayagonda Kokatanur

From: Vladimir Olovyannikov <[email protected]>

Extend Kconfig for the board with board-specific commands selection.

---
 board/broadcom/bcmns3/Kconfig | 7 +++++++
 cmd/Makefile                  | 2 ++
 2 files changed, 9 insertions(+)
board/broadcom/bcmns3/Kconfig +7 -0
index 8ce21f980d..cb73f98eae 100644
@@ -12,4 +12,11 @@ config SYS_SOC
 config SYS_CONFIG_NAME
 	default "bcm_ns3"
 
+config CMD_BCM_EXT_UTILS
+	bool "Enable Broadcom-specific U-Boot commands"
+	default y
+	help
+	  Enable Broadcom specific U-Boot commands such as error log setup
+	  command or any other commands specific to NS3 platform.
+
 endif
cmd/Makefile +2 -0
index 3a9c9747c9..c7a08ed109 100644
@@ -197,6 +197,8 @@ obj-$(CONFIG_$(SPL_)CMD_TLV_EEPROM) += tlv_eeprom.o
 # core command
 obj-y += nvedit.o
 
+obj-$(CONFIG_CMD_BCM_EXT_UTILS) += broadcom/
+
 obj-$(CONFIG_TI_COMMON_CMD_OPTIONS) += ti/
 
 filechk_data_gz = (echo "static const char data_gz[] ="; cat $< | scripts/bin2c; echo ";")
Signature · 1 line
2.17.1
#10 lore raw

PATCH v2 4/5 board: ns3: kconfig: extend board kconfig with specific commands

Quoted 7 lines · Rayagonda Kokatanur

From: Vladimir Olovyannikov <[email protected]>

Extend Kconfig for the board with board-specific commands selection.

Applied to u-boot/next, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200910/5999d5e8/attachment.sig>
#11 lore raw

PATCH v2 5/5 MAINTAINERS: update maintainers file for new files

In reply to Rayagonda Kokatanur

Update MAINTAINERS file for new files.

---
 MAINTAINERS | 4 ++++
 1 file changed, 4 insertions(+)
MAINTAINERS +4 -0
index 17ac45587b..2b00674d65 100644
@@ -1005,6 +1005,10 @@ F:	arch/arm/dts/ns3-board.dts
 F:	arch/arm/dts/ns3.dtsi
 F:	arch/arm/cpu/armv8/bcmns3
 F:	arch/arm/include/asm/arch-bcmns3/
+F:	cmd/broadcom/Makefile
+F:	cmd/broadcom/chimp_boot.c
+F:	cmd/broadcom/nitro_image_load.c
+F:	cmd/broadcom/chimp_handshake.c
 
 TDA19988 HDMI ENCODER
 M:	Liviu Dudau <[email protected]>
Signature · 1 line
2.17.1
#13 lore raw

PATCH v2 5/5 MAINTAINERS: update maintainers file for new files

In reply to Rayagonda Kokatanur
Quoted 4 lines · Rayagonda Kokatanur

Update MAINTAINERS file for new files.

Applied to u-boot/next, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200910/dc7e1914/attachment.sig>