chimp_boot.c 746 B

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