juno_topology.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (c) 2016-2020, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <drivers/arm/css/css_mhu_doorbell.h>
  7. #include <drivers/arm/css/scmi.h>
  8. #include <plat/arm/common/plat_arm.h>
  9. #include <plat/arm/css/common/css_pm.h>
  10. #include <plat/common/platform.h>
  11. #include <platform_def.h>
  12. #if CSS_USE_SCMI_SDS_DRIVER
  13. static scmi_channel_plat_info_t juno_scmi_plat_info = {
  14. .scmi_mbx_mem = CSS_SCMI_PAYLOAD_BASE,
  15. .db_reg_addr = PLAT_CSS_MHU_BASE + CSS_SCMI_MHU_DB_REG_OFF,
  16. .db_preserve_mask = 0xfffffffe,
  17. .db_modify_mask = 0x1,
  18. .ring_doorbell = &mhu_ring_doorbell,
  19. };
  20. scmi_channel_plat_info_t *plat_css_get_scmi_info(unsigned int channel_id)
  21. {
  22. return &juno_scmi_plat_info;
  23. }
  24. #endif
  25. /*
  26. * On Juno, the system power level is the highest power level.
  27. * The first entry in the power domain descriptor specifies the
  28. * number of system power domains i.e. 1.
  29. */
  30. #define JUNO_PWR_DOMAINS_AT_MAX_PWR_LVL ARM_SYSTEM_COUNT
  31. /*
  32. * The Juno power domain tree descriptor. The cluster power domains
  33. * are arranged so that when the PSCI generic code creates the power
  34. * domain tree, the indices of the CPU power domain nodes it allocates
  35. * match the linear indices returned by plat_core_pos_by_mpidr()
  36. * i.e. CLUSTER1 CPUs are allocated indices from 0 to 3 and the higher
  37. * indices for CLUSTER0 CPUs.
  38. */
  39. static const unsigned char juno_power_domain_tree_desc[] = {
  40. /* No of root nodes */
  41. JUNO_PWR_DOMAINS_AT_MAX_PWR_LVL,
  42. /* No of children for the root node */
  43. JUNO_CLUSTER_COUNT,
  44. /* No of children for the first cluster node */
  45. JUNO_CLUSTER1_CORE_COUNT,
  46. /* No of children for the second cluster node */
  47. JUNO_CLUSTER0_CORE_COUNT
  48. };
  49. /*******************************************************************************
  50. * This function returns the Juno topology tree information.
  51. ******************************************************************************/
  52. const unsigned char *plat_get_power_domain_tree_desc(void)
  53. {
  54. return juno_power_domain_tree_desc;
  55. }
  56. /*******************************************************************************
  57. * This function returns the core count within the cluster corresponding to
  58. * `mpidr`.
  59. ******************************************************************************/
  60. unsigned int plat_arm_get_cluster_core_count(u_register_t mpidr)
  61. {
  62. return (((mpidr & (u_register_t) 0x100) != 0U) ?
  63. JUNO_CLUSTER1_CORE_COUNT : JUNO_CLUSTER0_CORE_COUNT);
  64. }
  65. /*
  66. * The array mapping platform core position (implemented by plat_my_core_pos())
  67. * to the SCMI power domain ID implemented by SCP.
  68. */
  69. const uint32_t plat_css_core_pos_to_scmi_dmn_id_map[PLATFORM_CORE_COUNT] = {
  70. 2, 3, 4, 5, 0, 1 };