blob: b7c7880141ffe9fec1583cfcaf575164f64b55c8 [file] [log] [blame]
Nishanth Menonf97ad372016-10-14 01:13:49 +00001/*
2 * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Nishanth Menonf97ad372016-10-14 01:13:49 +00007#include <platform_def.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00008
9#include <common/bl_common.h>
10#include <common/interrupt_props.h>
11#include <drivers/arm/gicv3.h>
12#include <lib/utils.h>
13#include <plat/common/platform.h>
14
15#include <k3_gicv3.h>
Nishanth Menonf97ad372016-10-14 01:13:49 +000016
17/* The GICv3 driver only needs to be initialized in EL3 */
18uintptr_t rdistif_base_addrs[PLATFORM_CORE_COUNT];
19
20static const interrupt_prop_t k3_interrupt_props[] = {
21 PLAT_ARM_G1S_IRQ_PROPS(INTR_GROUP1S),
22 PLAT_ARM_G0_IRQ_PROPS(INTR_GROUP0)
23};
24
25static unsigned int k3_mpidr_to_core_pos(unsigned long mpidr)
26{
27 return (unsigned int)plat_core_pos_by_mpidr(mpidr);
28}
29
30gicv3_driver_data_t k3_gic_data = {
31 .rdistif_num = PLATFORM_CORE_COUNT,
32 .rdistif_base_addrs = rdistif_base_addrs,
33 .interrupt_props = k3_interrupt_props,
34 .interrupt_props_num = ARRAY_SIZE(k3_interrupt_props),
35 .mpidr_to_core_pos = k3_mpidr_to_core_pos,
36};
37
38void k3_gic_driver_init(uintptr_t gicd_base, uintptr_t gicr_base)
39{
40 /*
41 * The GICv3 driver is initialized in EL3 and does not need
42 * to be initialized again in SEL1. This is because the S-EL1
43 * can use GIC system registers to manage interrupts and does
44 * not need GIC interface base addresses to be configured.
45 */
46 k3_gic_data.gicd_base = gicd_base;
47 k3_gic_data.gicr_base = gicr_base;
48 gicv3_driver_init(&k3_gic_data);
49}
50
51void k3_gic_init(void)
52{
53 gicv3_distif_init();
54 gicv3_rdistif_init(plat_my_core_pos());
55 gicv3_cpuif_enable(plat_my_core_pos());
56}
57
58void k3_gic_cpuif_enable(void)
59{
60 gicv3_cpuif_enable(plat_my_core_pos());
61}
62
63void k3_gic_cpuif_disable(void)
64{
65 gicv3_cpuif_disable(plat_my_core_pos());
66}
67
68void k3_gic_pcpu_init(void)
69{
70 gicv3_rdistif_init(plat_my_core_pos());
71}