ls_gicv3.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright 2021 NXP
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. #include <drivers/arm/gicv3.h>
  8. #include <plat_gic.h>
  9. #include <plat/common/platform.h>
  10. /*
  11. * NXP common helper to initialize the GICv3 only driver.
  12. */
  13. void plat_ls_gic_driver_init(uintptr_t nxp_gicd_addr,
  14. uintptr_t nxp_gicr_addr,
  15. uint8_t plat_core_count,
  16. interrupt_prop_t *ls_interrupt_props,
  17. uint8_t ls_interrupt_prop_count,
  18. uintptr_t *target_mask_array,
  19. mpidr_hash_fn mpidr_to_core_pos)
  20. {
  21. static struct gicv3_driver_data ls_gic_data;
  22. ls_gic_data.gicd_base = nxp_gicd_addr;
  23. ls_gic_data.gicr_base = nxp_gicr_addr;
  24. ls_gic_data.interrupt_props = ls_interrupt_props;
  25. ls_gic_data.interrupt_props_num = ls_interrupt_prop_count;
  26. ls_gic_data.rdistif_num = plat_core_count;
  27. ls_gic_data.rdistif_base_addrs = target_mask_array;
  28. ls_gic_data.mpidr_to_core_pos = mpidr_to_core_pos;
  29. gicv3_driver_init(&ls_gic_data);
  30. }
  31. void plat_ls_gic_init(void)
  32. {
  33. gicv3_distif_init();
  34. gicv3_rdistif_init(plat_my_core_pos());
  35. gicv3_cpuif_enable(plat_my_core_pos());
  36. }
  37. /*
  38. * NXP common helper to enable the GICv3 CPU interface
  39. */
  40. void plat_ls_gic_cpuif_enable(void)
  41. {
  42. gicv3_cpuif_enable(plat_my_core_pos());
  43. }
  44. /*
  45. * NXP common helper to disable the GICv3 CPU interface
  46. */
  47. void plat_ls_gic_cpuif_disable(void)
  48. {
  49. gicv3_cpuif_disable(plat_my_core_pos());
  50. }
  51. /*
  52. * NXP common helper to initialize the per cpu distributor interface in GICv3
  53. */
  54. void plat_gic_pcpu_init(void)
  55. {
  56. gicv3_rdistif_init(plat_my_core_pos());
  57. gicv3_cpuif_enable(plat_my_core_pos());
  58. }
  59. /*
  60. * Stubs for Redistributor power management. Although GICv3 doesn't have
  61. * Redistributor interface, these are provided for the sake of uniform GIC API
  62. */
  63. void plat_ls_gic_redistif_on(void)
  64. {
  65. }
  66. void plat_ls_gic_redistif_off(void)
  67. {
  68. }