Varun Wadekar | 1fd7049 | 2018-10-19 11:44:31 -0700 | [diff] [blame] | 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 | *****************************************************************************/ |
Varun Wadekar | 9f4a7d3 | 2018-10-19 11:42:28 -0700 | [diff] [blame] | 18 | void tegra_gic_setup(const interrupt_prop_t *interrupt_props, |
| 19 | unsigned int interrupt_props_num) |
Varun Wadekar | 1fd7049 | 2018-10-19 11:44:31 -0700 | [diff] [blame] | 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; |
Varun Wadekar | 9f4a7d3 | 2018-10-19 11:42:28 -0700 | [diff] [blame] | 31 | tegra_gic_data.interrupt_props = interrupt_props; |
| 32 | tegra_gic_data.interrupt_props_num = interrupt_props_num; |
Varun Wadekar | 1fd7049 | 2018-10-19 11:44:31 -0700 | [diff] [blame] | 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 | } |