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 | |
| 6 | #include <common.h> |
| 7 | #include <command.h> |
| 8 | #include <broadcom/chimp.h> |
| 9 | |
| 10 | static int do_chimp_fastboot_secure(struct cmd_tbl *cmdtp, int flag, int argc, |
| 11 | char *const argv[]) |
| 12 | { |
| 13 | u32 health = 0; |
| 14 | |
| 15 | if (chimp_health_status_optee(&health)) { |
| 16 | pr_err("Chimp health command fail\n"); |
| 17 | return CMD_RET_FAILURE; |
| 18 | } |
| 19 | |
| 20 | if (health == BCM_CHIMP_RUNNIG_GOOD) { |
| 21 | printf("skip fastboot...\n"); |
| 22 | return CMD_RET_SUCCESS; |
| 23 | } |
| 24 | |
| 25 | if (chimp_fastboot_optee()) { |
| 26 | pr_err("Failed to load secure ChiMP image\n"); |
| 27 | return CMD_RET_FAILURE; |
| 28 | } |
| 29 | |
| 30 | return CMD_RET_SUCCESS; |
| 31 | } |
| 32 | |
| 33 | U_BOOT_CMD |
| 34 | (chimp_ld_secure, 1, 0, do_chimp_fastboot_secure, |
| 35 | "Invoke chimp fw load via optee", |
| 36 | "chimp_ld_secure\n" |
| 37 | ); |