blob: 59f7b76ee77a3a8d3ceea919baa658aeae6927fa [file] [log] [blame]
Antonio Nino Diaz6766bb12018-10-26 11:12:31 +01001/*
2 * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Antonio Nino Diaz6766bb12018-10-26 11:12:31 +01007#include <platform_def.h>
8
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00009#include <drivers/arm/gicv2.h>
10#include <plat/common/platform.h>
11
Antonio Nino Diaz6766bb12018-10-26 11:12:31 +010012/******************************************************************************
13 * On a GICv2 system, the Group 1 secure interrupts are treated as Group 0
14 * interrupts.
15 *****************************************************************************/
16static const interrupt_prop_t poplar_interrupt_props[] = {
17 POPLAR_G1S_IRQ_PROPS(GICV2_INTR_GROUP0),
18 POPLAR_G0_IRQ_PROPS(GICV2_INTR_GROUP0)
19};
20
21static unsigned int target_mask_array[PLATFORM_CORE_COUNT];
22
23static const gicv2_driver_data_t poplar_gic_data = {
24 .gicd_base = POPLAR_GICD_BASE,
25 .gicc_base = POPLAR_GICC_BASE,
26 .interrupt_props = poplar_interrupt_props,
27 .interrupt_props_num = ARRAY_SIZE(poplar_interrupt_props),
28 .target_masks = target_mask_array,
29 .target_masks_num = ARRAY_SIZE(target_mask_array),
30};
31
32/******************************************************************************
33 * Helper to initialize the GICv2 only driver.
34 *****************************************************************************/
35void poplar_gic_driver_init(void)
36{
37 gicv2_driver_init(&poplar_gic_data);
38}
39
40void poplar_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/******************************************************************************
49 * Helper to enable the GICv2 CPU interface
50 *****************************************************************************/
51void poplar_gic_cpuif_enable(void)
52{
53 gicv2_cpuif_enable();
54}
55
56/******************************************************************************
57 * Helper to initialize the per cpu distributor interface in GICv2
58 *****************************************************************************/
59void poplar_gic_pcpu_init(void)
60{
61 gicv2_pcpu_distif_init();
62 gicv2_set_pe_target_mask(plat_my_core_pos());
63}