blob: ae0a81179d0a2d4b77925c1c01556f11028fb8c2 [file] [log] [blame]
Trac Hoangc30a59c2020-08-20 20:41:04 +05301// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright 2020 Broadcom
4 */
5
Trac Hoangc30a59c2020-08-20 20:41:04 +05306#include <command.h>
7#include <broadcom/chimp.h>
8
9static int do_chimp_fastboot_secure(struct cmd_tbl *cmdtp, int flag, int argc,
10 char *const argv[])
11{
12 u32 health = 0;
13
14 if (chimp_health_status_optee(&health)) {
15 pr_err("Chimp health command fail\n");
16 return CMD_RET_FAILURE;
17 }
18
19 if (health == BCM_CHIMP_RUNNIG_GOOD) {
20 printf("skip fastboot...\n");
21 return CMD_RET_SUCCESS;
22 }
23
24 if (chimp_fastboot_optee()) {
25 pr_err("Failed to load secure ChiMP image\n");
26 return CMD_RET_FAILURE;
27 }
28
29 return CMD_RET_SUCCESS;
30}
31
32U_BOOT_CMD
33 (chimp_ld_secure, 1, 0, do_chimp_fastboot_secure,
34 "Invoke chimp fw load via optee",
35 "chimp_ld_secure\n"
36);