blob: 82cecf2ed69f72f9ff72a19a1480d4e2381dbb7e [file] [log] [blame]
Stephan Gerhold253fef02021-12-01 20:03:33 +01001/*
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>
Stephan Gerhold4f29e6c2023-03-25 13:28:46 +010013#include <platform_def.h>
Stephan Gerhold253fef02021-12-01 20:03:33 +010014
15#define IRQ_SEC_SGI_0 8
16#define IRQ_SEC_SGI_1 9
17#define IRQ_SEC_SGI_2 10
18#define IRQ_SEC_SGI_3 11
19#define IRQ_SEC_SGI_4 12
20#define IRQ_SEC_SGI_5 13
21#define IRQ_SEC_SGI_6 14
22#define IRQ_SEC_SGI_7 15
23
Stephan Gerhold253fef02021-12-01 20:03:33 +010024static const interrupt_prop_t msm8916_interrupt_props[] = {
25 INTR_PROP_DESC(IRQ_SEC_SGI_0, GIC_HIGHEST_SEC_PRIORITY,
26 GICV2_INTR_GROUP0, GIC_INTR_CFG_LEVEL),
27 INTR_PROP_DESC(IRQ_SEC_SGI_1, GIC_HIGHEST_SEC_PRIORITY,
28 GICV2_INTR_GROUP0, GIC_INTR_CFG_LEVEL),
29 INTR_PROP_DESC(IRQ_SEC_SGI_2, GIC_HIGHEST_SEC_PRIORITY,
30 GICV2_INTR_GROUP0, GIC_INTR_CFG_LEVEL),
31 INTR_PROP_DESC(IRQ_SEC_SGI_3, GIC_HIGHEST_SEC_PRIORITY,
32 GICV2_INTR_GROUP0, GIC_INTR_CFG_LEVEL),
33 INTR_PROP_DESC(IRQ_SEC_SGI_4, GIC_HIGHEST_SEC_PRIORITY,
34 GICV2_INTR_GROUP0, GIC_INTR_CFG_LEVEL),
35 INTR_PROP_DESC(IRQ_SEC_SGI_5, GIC_HIGHEST_SEC_PRIORITY,
36 GICV2_INTR_GROUP0, GIC_INTR_CFG_LEVEL),
37 INTR_PROP_DESC(IRQ_SEC_SGI_6, GIC_HIGHEST_SEC_PRIORITY,
38 GICV2_INTR_GROUP0, GIC_INTR_CFG_LEVEL),
39 INTR_PROP_DESC(IRQ_SEC_SGI_7, GIC_HIGHEST_SEC_PRIORITY,
40 GICV2_INTR_GROUP0, GIC_INTR_CFG_LEVEL),
41 INTR_PROP_DESC(IRQ_SEC_PHY_TIMER, GIC_HIGHEST_SEC_PRIORITY,
42 GICV2_INTR_GROUP0, GIC_INTR_CFG_LEVEL),
43};
44
45static const gicv2_driver_data_t msm8916_gic_data = {
46 .gicd_base = APCS_QGIC2_GICD,
47 .gicc_base = APCS_QGIC2_GICC,
48 .interrupt_props = msm8916_interrupt_props,
49 .interrupt_props_num = ARRAY_SIZE(msm8916_interrupt_props),
50};
51
52void msm8916_gicv2_init(void)
53{
54 gicv2_driver_init(&msm8916_gic_data);
Stephan Gerhold4bc53a12022-08-28 15:18:55 +020055}
56
57void msm8916_gicv2_configure(void)
58{
Stephan Gerhold253fef02021-12-01 20:03:33 +010059 gicv2_distif_init();
60 gicv2_pcpu_distif_init();
61 gicv2_cpuif_enable();
62}