plat_debug.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <arch_helpers.h>
  7. #include <common/debug.h>
  8. #include <lib/mmio.h>
  9. #include <plat_debug.h>
  10. #include <platform_def.h>
  11. #include <spm.h>
  12. void circular_buffer_setup(void)
  13. {
  14. /* Clear DBG_CONTROL.lastpc_disable to enable circular buffer */
  15. sync_writel(CA15M_DBG_CONTROL,
  16. mmio_read_32(CA15M_DBG_CONTROL) & ~(BIT_CA15M_LASTPC_DIS));
  17. }
  18. void circular_buffer_unlock(void)
  19. {
  20. unsigned int i;
  21. /* Disable big vproc external off (set CPU_EXT_BUCK_ISO to 0x0) */
  22. sync_writel(VPROC_EXT_CTL, mmio_read_32(VPROC_EXT_CTL) & ~(0x1 << 1));
  23. /* Release vproc apb mask (set 0x0C53_2008[1] to 0x0) */
  24. sync_writel(CA15M_PWR_RST_CTL, mmio_read_32(CA15M_PWR_RST_CTL) & ~(0x1 << 1));
  25. for (i = 1; i <= 4; ++i)
  26. sync_writel(MP1_CPUTOP_PWR_CON + i * 4,
  27. (mmio_read_32(MP1_CPUTOP_PWR_CON + i * 4) & ~(0x4))|(0x4));
  28. /* Set DFD.en */
  29. sync_writel(DFD_INTERNAL_CTL, 0x1);
  30. }
  31. void circular_buffer_lock(void)
  32. {
  33. /* Clear DFD.en */
  34. sync_writel(DFD_INTERNAL_CTL, 0x0);
  35. }
  36. void clear_all_on_mux(void)
  37. {
  38. sync_writel(MCU_ALL_PWR_ON_CTRL,
  39. mmio_read_32(MCU_ALL_PWR_ON_CTRL) & ~(1 << 2));
  40. sync_writel(MCU_ALL_PWR_ON_CTRL,
  41. mmio_read_32(MCU_ALL_PWR_ON_CTRL) & ~(1 << 1));
  42. }
  43. void l2c_parity_check_setup(void)
  44. {
  45. /* Enable DBG_CONTROL.l2parity_en */
  46. sync_writel(CA15M_DBG_CONTROL,
  47. mmio_read_32(CA15M_DBG_CONTROL) | BIT_CA15M_L2PARITY_EN);
  48. }