Trac Hoang | c30a59c | 2020-08-20 20:41:04 +0530 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright 2020 Broadcom |
| 4 | */ |
| 5 | |
Trac Hoang | c30a59c | 2020-08-20 20:41:04 +0530 | [diff] [blame] | 6 | #include <command.h> |
| 7 | #include <broadcom/chimp.h> |
| 8 | |
| 9 | static 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 | |
| 32 | U_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 | ); |