1 /*
2 * Copyright (c) 2021, Stephan Gerhold <stephan@gerhold.net>
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7 #include <common/debug.h>
8 #include <drivers/arm/gicv2.h>
9 #include <lib/mmio.h>
10
11 #include "msm8916_gicv2.h"
12 #include <msm8916_mmap.h>
13
14 #define IRQ_SEC_SGI_0 8
15 #define IRQ_SEC_SGI_1 9
16 #define IRQ_SEC_SGI_2 10
17 #define IRQ_SEC_SGI_3 11
18 #define IRQ_SEC_SGI_4 12
19 #define IRQ_SEC_SGI_5 13
20 #define IRQ_SEC_SGI_6 14
21 #define IRQ_SEC_SGI_7 15
22
23 #define IRQ_SEC_PHY_TIMER (16 + 2) /* PPI #2 */
24
25 static const interrupt_prop_t msm8916_interrupt_props[] = {
26 INTR_PROP_DESC(IRQ_SEC_SGI_0, GIC_HIGHEST_SEC_PRIORITY,
27 GICV2_INTR_GROUP0, GIC_INTR_CFG_LEVEL),
28 INTR_PROP_DESC(IRQ_SEC_SGI_1, GIC_HIGHEST_SEC_PRIORITY,
29 GICV2_INTR_GROUP0, GIC_INTR_CFG_LEVEL),
30 INTR_PROP_DESC(IRQ_SEC_SGI_2, GIC_HIGHEST_SEC_PRIORITY,
31 GICV2_INTR_GROUP0, GIC_INTR_CFG_LEVEL),
32 INTR_PROP_DESC(IRQ_SEC_SGI_3, GIC_HIGHEST_SEC_PRIORITY,
33 GICV2_INTR_GROUP0, GIC_INTR_CFG_LEVEL),
34 INTR_PROP_DESC(IRQ_SEC_SGI_4, GIC_HIGHEST_SEC_PRIORITY,
35 GICV2_INTR_GROUP0, GIC_INTR_CFG_LEVEL),
36 INTR_PROP_DESC(IRQ_SEC_SGI_5, GIC_HIGHEST_SEC_PRIORITY,
37 GICV2_INTR_GROUP0, GIC_INTR_CFG_LEVEL),
38 INTR_PROP_DESC(IRQ_SEC_SGI_6, GIC_HIGHEST_SEC_PRIORITY,
39 GICV2_INTR_GROUP0, GIC_INTR_CFG_LEVEL),
40 INTR_PROP_DESC(IRQ_SEC_SGI_7, GIC_HIGHEST_SEC_PRIORITY,
41 GICV2_INTR_GROUP0, GIC_INTR_CFG_LEVEL),
42 INTR_PROP_DESC(IRQ_SEC_PHY_TIMER, GIC_HIGHEST_SEC_PRIORITY,
43 GICV2_INTR_GROUP0, GIC_INTR_CFG_LEVEL),
44 };
45
46 static const gicv2_driver_data_t msm8916_gic_data = {
47 .gicd_base = APCS_QGIC2_GICD,
48 .gicc_base = APCS_QGIC2_GICC,
49 .interrupt_props = msm8916_interrupt_props,
50 .interrupt_props_num = ARRAY_SIZE(msm8916_interrupt_props),
51 };
52
msm8916_gicv2_init(void)53 void msm8916_gicv2_init(void)
54 {
55 gicv2_driver_init(&msm8916_gic_data);
56 gicv2_distif_init();
57 gicv2_pcpu_distif_init();
58 gicv2_cpuif_enable();
59 }
60