pmu.c 1004 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright 2021 NXP
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. #include <arch.h>
  8. #include <arch_helpers.h>
  9. #include <common/debug.h>
  10. #include <dcfg.h>
  11. #include <lib/mmio.h>
  12. #include <pmu.h>
  13. void enable_timer_base_to_cluster(uintptr_t nxp_pmu_addr)
  14. {
  15. uint32_t *cltbenr = NULL;
  16. uint32_t cltbenr_val = 0U;
  17. cltbenr = (uint32_t *)(nxp_pmu_addr
  18. + CLUST_TIMER_BASE_ENBL_OFFSET);
  19. cltbenr_val = mmio_read_32((uintptr_t)cltbenr);
  20. cltbenr_val = cltbenr_val
  21. | (1 << MPIDR_AFFLVL1_VAL(read_mpidr_el1()));
  22. mmio_write_32((uintptr_t)cltbenr, cltbenr_val);
  23. VERBOSE("Enable cluster time base\n");
  24. }
  25. /*
  26. * Enable core timebase. In certain Layerscape SoCs, the clock for each core's
  27. * has an enable bit in the PMU Physical Core Time Base Enable
  28. * Register (PCTBENR), which allows the watchdog to operate.
  29. */
  30. void enable_core_tb(uintptr_t nxp_pmu_addr)
  31. {
  32. uint32_t *pctbenr = (uint32_t *) (nxp_pmu_addr +
  33. CORE_TIMEBASE_ENBL_OFFSET);
  34. mmio_write_32((uintptr_t)pctbenr, 0xff);
  35. }