s32g2_soc.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright 2024 NXP
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <plat/common/platform.h>
  7. #include <plat_helpers.h>
  8. const unsigned char *plat_get_power_domain_tree_desc(void)
  9. {
  10. static const unsigned char s32g_power_domain_tree_desc[] = {
  11. PLATFORM_SYSTEM_COUNT,
  12. PLATFORM_CLUSTER_COUNT,
  13. PLATFORM_CORE_COUNT / U(2),
  14. PLATFORM_CORE_COUNT / U(2),
  15. };
  16. return s32g_power_domain_tree_desc;
  17. }
  18. int plat_core_pos_by_mpidr(u_register_t mpidr)
  19. {
  20. unsigned int cluster_id, cpu_id, core_id;
  21. u_register_t mpidr_priv = mpidr;
  22. mpidr_priv &= MPIDR_AFFINITY_MASK;
  23. if ((mpidr_priv & ~(MPIDR_CLUSTER_MASK | MPIDR_CPU_MASK)) != 0) {
  24. return -1;
  25. }
  26. cluster_id = MPIDR_AFFLVL1_VAL(mpidr_priv);
  27. cpu_id = MPIDR_AFFLVL0_VAL(mpidr_priv);
  28. if ((cluster_id >= PLATFORM_CLUSTER_COUNT) ||
  29. (cpu_id >= PLATFORM_MAX_CPUS_PER_CLUSTER)) {
  30. return -1;
  31. }
  32. core_id = s32g2_core_pos_by_mpidr(mpidr_priv);
  33. if (core_id >= PLATFORM_CORE_COUNT) {
  34. return -1;
  35. }
  36. return (int)core_id;
  37. }
  38. unsigned int plat_get_syscnt_freq2(void)
  39. {
  40. return COUNTER_FREQUENCY;
  41. }