blob: 293df8d4f3673eb67b6831b24b1008b63cd78e1a [file] [log] [blame]
Varun Wadekar1fd70492018-10-19 11:44:31 -07001/*
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>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00008
Varun Wadekar1fd70492018-10-19 11:44:31 -07009#include <platform_def.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000010
11#include <common/bl_common.h>
12#include <drivers/arm/gicv2.h>
13#include <lib/utils.h>
14
Varun Wadekar1fd70492018-10-19 11:44:31 -070015#include <tegra_private.h>
16#include <tegra_def.h>
Varun Wadekar1fd70492018-10-19 11:44:31 -070017
18/******************************************************************************
19 * Tegra common helper to setup the GICv2 driver data.
20 *****************************************************************************/
Varun Wadekar9f4a7d32018-10-19 11:42:28 -070021void tegra_gic_setup(const interrupt_prop_t *interrupt_props,
22 unsigned int interrupt_props_num)
Varun Wadekar1fd70492018-10-19 11:44:31 -070023{
24 /*
25 * Tegra GIC configuration settings
26 */
27 static gicv2_driver_data_t tegra_gic_data;
28
29 /*
30 * Register Tegra GICv2 driver
31 */
32 tegra_gic_data.gicd_base = TEGRA_GICD_BASE;
33 tegra_gic_data.gicc_base = TEGRA_GICC_BASE;
Varun Wadekar9f4a7d32018-10-19 11:42:28 -070034 tegra_gic_data.interrupt_props = interrupt_props;
35 tegra_gic_data.interrupt_props_num = interrupt_props_num;
Varun Wadekar1fd70492018-10-19 11:44:31 -070036 gicv2_driver_init(&tegra_gic_data);
37}
38
39/******************************************************************************
40 * Tegra common helper to initialize the GICv2 only driver.
41 *****************************************************************************/
42void tegra_gic_init(void)
43{
44 gicv2_distif_init();
45 gicv2_pcpu_distif_init();
46 gicv2_cpuif_enable();
47}
48
49/******************************************************************************
50 * Tegra common helper to disable the GICv2 CPU interface
51 *****************************************************************************/
52void tegra_gic_cpuif_deactivate(void)
53{
54 gicv2_cpuif_disable();
55}
56
57/******************************************************************************
58 * Tegra common helper to initialize the per cpu distributor interface
59 * in GICv2
60 *****************************************************************************/
61void tegra_gic_pcpu_init(void)
62{
63 gicv2_pcpu_distif_init();
64 gicv2_cpuif_enable();
65}