xref: /rk3399_ARM-atf/plat/nvidia/tegra/common/tegra_gicv2.c (revision 80c50eeaf9cf5aa0c749175f9dcca9774ad041b1)
1 /*
2  * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <assert.h>
8 #include <bl_common.h>
9 #include <gicv2.h>
10 #include <platform_def.h>
11 #include <tegra_private.h>
12 #include <tegra_def.h>
13 #include <utils.h>
14 
15 /******************************************************************************
16  * Tegra common helper to setup the GICv2 driver data.
17  *****************************************************************************/
18 void tegra_gic_setup(const interrupt_prop_t *interrupt_props,
19 		     unsigned int interrupt_props_num)
20 {
21 	/*
22 	 * Tegra GIC configuration settings
23 	 */
24 	static gicv2_driver_data_t tegra_gic_data;
25 
26 	/*
27 	 * Register Tegra GICv2 driver
28 	 */
29 	tegra_gic_data.gicd_base = TEGRA_GICD_BASE;
30 	tegra_gic_data.gicc_base = TEGRA_GICC_BASE;
31 	tegra_gic_data.interrupt_props = interrupt_props;
32 	tegra_gic_data.interrupt_props_num = interrupt_props_num;
33 	gicv2_driver_init(&tegra_gic_data);
34 }
35 
36 /******************************************************************************
37  * Tegra common helper to initialize the GICv2 only driver.
38  *****************************************************************************/
39 void tegra_gic_init(void)
40 {
41 	gicv2_distif_init();
42 	gicv2_pcpu_distif_init();
43 	gicv2_cpuif_enable();
44 }
45 
46 /******************************************************************************
47  * Tegra common helper to disable the GICv2 CPU interface
48  *****************************************************************************/
49 void tegra_gic_cpuif_deactivate(void)
50 {
51 	gicv2_cpuif_disable();
52 }
53 
54 /******************************************************************************
55  * Tegra common helper to initialize the per cpu distributor interface
56  * in GICv2
57  *****************************************************************************/
58 void tegra_gic_pcpu_init(void)
59 {
60 	gicv2_pcpu_distif_init();
61 	gicv2_cpuif_enable();
62 }
63