misc.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // SPDX-License-Identifier: GPL-2.0+
  2. #include <common.h>
  3. #include <asm/arch/sci/sci.h>
  4. #include <asm/mach-imx/sys_proto.h>
  5. #include <imx_sip.h>
  6. int sc_pm_setup_uart(sc_rsrc_t uart_rsrc, sc_pm_clock_rate_t clk_rate)
  7. {
  8. sc_pm_clock_rate_t rate = clk_rate;
  9. int ret;
  10. /* Power up UARTn */
  11. ret = sc_pm_set_resource_power_mode(-1, uart_rsrc, SC_PM_PW_MODE_ON);
  12. if (ret)
  13. return ret;
  14. /* Set UARTn clock root to 'rate' MHz */
  15. ret = sc_pm_set_clock_rate(-1, uart_rsrc, SC_PM_CLK_PER, &rate);
  16. if (ret)
  17. return ret;
  18. /* Enable UARTn clock root */
  19. ret = sc_pm_clock_enable(-1, uart_rsrc, SC_PM_CLK_PER, true, false);
  20. if (ret)
  21. return ret;
  22. return 0;
  23. }
  24. void build_info(void)
  25. {
  26. u32 seco_build = 0, seco_commit = 0;
  27. u32 sc_build = 0, sc_commit = 0;
  28. ulong atf_commit = 0;
  29. /* Get SCFW build and commit id */
  30. sc_misc_build_info(-1, &sc_build, &sc_commit);
  31. if (!sc_build) {
  32. printf("SCFW does not support build info\n");
  33. sc_commit = 0; /* Display 0 if build info not supported */
  34. }
  35. /* Get SECO FW build and commit id */
  36. sc_seco_build_info(-1, &seco_build, &seco_commit);
  37. if (!seco_build) {
  38. debug("SECO FW does not support build info\n");
  39. /* Display 0 when the build info is not supported */
  40. seco_commit = 0;
  41. }
  42. /* Get ARM Trusted Firmware commit id */
  43. atf_commit = call_imx_sip(IMX_SIP_BUILDINFO,
  44. IMX_SIP_BUILDINFO_GET_COMMITHASH, 0, 0, 0);
  45. if (atf_commit == 0xffffffff) {
  46. debug("ATF does not support build info\n");
  47. atf_commit = 0x30; /* Display 0 */
  48. }
  49. printf("Build: SCFW %08x, SECO-FW %08x, ATF %s\n",
  50. sc_commit, seco_commit, (char *)&atf_commit);
  51. }