1 /*
2 * Copyright 2021 NXP
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8 #include <gicv2.h>
9 #include <plat_gic.h>
10
11
12 /*
13 * NXP common helper to initialize the GICv3 only driver.
14 */
plat_ls_gic_driver_init(uintptr_t nxp_gicd_addr,uintptr_t nxp_gicc_addr,uint8_t plat_core_count,interrupt_prop_t * ls_interrupt_props,uint8_t ls_interrupt_prop_count,uint32_t * target_mask_array)15 void plat_ls_gic_driver_init(uintptr_t nxp_gicd_addr,
16 uintptr_t nxp_gicc_addr,
17 uint8_t plat_core_count,
18 interrupt_prop_t *ls_interrupt_props,
19 uint8_t ls_interrupt_prop_count,
20 uint32_t *target_mask_array)
21 {
22 static struct gicv2_driver_data ls_gic_data;
23
24 ls_gic_data.gicd_base = nxp_gicd_addr;
25 ls_gic_data.gicc_base = nxp_gicc_addr;
26 ls_gic_data.target_masks = target_mask_array;
27 ls_gic_data.target_masks_num = plat_core_count;
28 ls_gic_data.interrupt_props = ls_interrupt_props;
29 ls_gic_data.interrupt_props_num = ls_interrupt_prop_count;
30
31 gicv2_driver_init(&ls_gic_data);
32 }
33
plat_ls_gic_init(void)34 void plat_ls_gic_init(void)
35 {
36 gicv2_distif_init();
37 gicv2_pcpu_distif_init();
38 gicv2_cpuif_enable();
39 }
40
41 /******************************************************************************
42 * ARM common helper to enable the GICv2 CPU interface
43 *****************************************************************************/
plat_ls_gic_cpuif_enable(void)44 void plat_ls_gic_cpuif_enable(void)
45 {
46 gicv2_cpuif_enable();
47 }
48
49 /******************************************************************************
50 * ARM common helper to disable the GICv2 CPU interface
51 *****************************************************************************/
plat_ls_gic_cpuif_disable(void)52 void plat_ls_gic_cpuif_disable(void)
53 {
54 gicv2_cpuif_disable();
55 }
56
57 /******************************************************************************
58 * NXP common helper to initialize GICv2 per cpu
59 *****************************************************************************/
plat_gic_pcpu_init(void)60 void plat_gic_pcpu_init(void)
61 {
62 gicv2_pcpu_distif_init();
63 gicv2_cpuif_enable();
64 }
65
66 /******************************************************************************
67 * Stubs for Redistributor power management. Although GICv2 doesn't have
68 * Redistributor interface, these are provided for the sake of uniform GIC API
69 *****************************************************************************/
plat_ls_gic_redistif_on(void)70 void plat_ls_gic_redistif_on(void)
71 {
72 }
73
plat_ls_gic_redistif_off(void)74 void plat_ls_gic_redistif_off(void)
75 {
76 }
77