tegra_gicv2.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
  3. * Copyright (c) 2020, NVIDIA Corporation. All rights reserved.
  4. *
  5. * SPDX-License-Identifier: BSD-3-Clause
  6. */
  7. #include <assert.h>
  8. #include <platform_def.h>
  9. #include <common/bl_common.h>
  10. #include <drivers/arm/gicv2.h>
  11. #include <lib/utils.h>
  12. #include <plat/common/platform.h>
  13. #include <tegra_private.h>
  14. #include <tegra_def.h>
  15. static unsigned int tegra_target_masks[PLATFORM_CORE_COUNT];
  16. /******************************************************************************
  17. * Tegra common helper to setup the GICv2 driver data.
  18. *****************************************************************************/
  19. void tegra_gic_setup(const interrupt_prop_t *interrupt_props,
  20. unsigned int interrupt_props_num)
  21. {
  22. /*
  23. * Tegra GIC configuration settings
  24. */
  25. static gicv2_driver_data_t tegra_gic_data;
  26. /*
  27. * Register Tegra GICv2 driver
  28. */
  29. tegra_gic_data.gicd_base = TEGRA_GICD_BASE;
  30. tegra_gic_data.gicc_base = TEGRA_GICC_BASE;
  31. tegra_gic_data.interrupt_props = interrupt_props;
  32. tegra_gic_data.interrupt_props_num = interrupt_props_num;
  33. tegra_gic_data.target_masks = tegra_target_masks;
  34. tegra_gic_data.target_masks_num = ARRAY_SIZE(tegra_target_masks);
  35. gicv2_driver_init(&tegra_gic_data);
  36. }
  37. /******************************************************************************
  38. * Tegra common helper to initialize the GICv2 only driver.
  39. *****************************************************************************/
  40. void tegra_gic_init(void)
  41. {
  42. gicv2_distif_init();
  43. gicv2_pcpu_distif_init();
  44. gicv2_set_pe_target_mask(plat_my_core_pos());
  45. gicv2_cpuif_enable();
  46. }
  47. /******************************************************************************
  48. * Tegra common helper to disable the GICv2 CPU interface
  49. *****************************************************************************/
  50. void tegra_gic_cpuif_deactivate(void)
  51. {
  52. gicv2_cpuif_disable();
  53. }
  54. /******************************************************************************
  55. * Tegra common helper to initialize the per cpu distributor interface
  56. * in GICv2
  57. *****************************************************************************/
  58. void tegra_gic_pcpu_init(void)
  59. {
  60. gicv2_pcpu_distif_init();
  61. gicv2_set_pe_target_mask(plat_my_core_pos());
  62. gicv2_cpuif_enable();
  63. }