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> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 8 | |
Varun Wadekar | 1fd7049 | 2018-10-19 11:44:31 -0700 | [diff] [blame] | 9 | #include <platform_def.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 10 | |
| 11 | #include <common/bl_common.h> |
| 12 | #include <drivers/arm/gicv2.h> |
| 13 | #include <lib/utils.h> |
| 14 | |
Varun Wadekar | 1fd7049 | 2018-10-19 11:44:31 -0700 | [diff] [blame] | 15 | #include <tegra_private.h> |
| 16 | #include <tegra_def.h> |
Varun Wadekar | 1fd7049 | 2018-10-19 11:44:31 -0700 | [diff] [blame] | 17 | |
| 18 | /****************************************************************************** |
| 19 | * Tegra common helper to setup the GICv2 driver data. |
| 20 | *****************************************************************************/ |
Varun Wadekar | 9f4a7d3 | 2018-10-19 11:42:28 -0700 | [diff] [blame] | 21 | void tegra_gic_setup(const interrupt_prop_t *interrupt_props, |
| 22 | unsigned int interrupt_props_num) |
Varun Wadekar | 1fd7049 | 2018-10-19 11:44:31 -0700 | [diff] [blame] | 23 | { |
| 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 Wadekar | 9f4a7d3 | 2018-10-19 11:42:28 -0700 | [diff] [blame] | 34 | tegra_gic_data.interrupt_props = interrupt_props; |
| 35 | tegra_gic_data.interrupt_props_num = interrupt_props_num; |
Varun Wadekar | 1fd7049 | 2018-10-19 11:44:31 -0700 | [diff] [blame] | 36 | gicv2_driver_init(&tegra_gic_data); |
| 37 | } |
| 38 | |
| 39 | /****************************************************************************** |
| 40 | * Tegra common helper to initialize the GICv2 only driver. |
| 41 | *****************************************************************************/ |
| 42 | void 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 | *****************************************************************************/ |
| 52 | void 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 | *****************************************************************************/ |
| 61 | void tegra_gic_pcpu_init(void) |
| 62 | { |
| 63 | gicv2_pcpu_distif_init(); |
| 64 | gicv2_cpuif_enable(); |
| 65 | } |