xref: /arm-trusted-firmware/plat/ax/lmt/lmt_gic.c (revision 91f16700b400a8c0651d24a598fc48ee2997a0d7)
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /*
3  * Copyright (C) 2024, Charleye <wangkart@aliyun.com>
4  * All rights reserved.
5  */
6 
7 #include <drivers/arm/gicv2.h>
8 #include <drivers/arm/gic_common.h>
9 #include <platform_def.h>
10 
11 static const interrupt_prop_t lmt_interrupt_props[] = {
12 	PLATFORM_G1S_PROPS(GICV2_INTR_GROUP0),
13 	PLATFORM_G0_PROPS(GICV2_INTR_GROUP0)
14 };
15 
16 static const struct gicv2_driver_data plat_gicv2_driver_data = {
17 	.gicd_base = GICD_BASE,
18 	.gicc_base = GICC_BASE,
19 	.interrupt_props = lmt_interrupt_props,
20 	.interrupt_props_num = ARRAY_SIZE(lmt_interrupt_props),
21 };
22 
23 void plat_lmt_gic_init(void)
24 {
25 	/* Initialize the gic cpu and distributor interfaces */
26 	gicv2_driver_init(&plat_gicv2_driver_data);
27 	gicv2_distif_init();
28 	gicv2_pcpu_distif_init();
29 	gicv2_cpuif_enable();
30 }
31 
32 void lmt_pwr_gic_on_finish(void)
33 {
34 	/* TODO: This setup is needed only after a cold boot */
35 	gicv2_pcpu_distif_init();
36 
37 	/* Enable the gic cpu interface */
38 	gicv2_cpuif_enable();
39 }
40 
41 void lmt_pwr_gic_off(void)
42 {
43 	gicv2_cpuif_disable();
44 }
45