misc.c 1.6 KB

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