Yann Gautier | 9d135e4 | 2018-07-16 19:36:06 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
Yann Gautier | 9d135e4 | 2018-07-16 19:36:06 +0200 | [diff] [blame] | 7 | #include <platform_def.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 8 | |
| 9 | #include <common/bl_common.h> |
| 10 | #include <drivers/arm/gicv2.h> |
| 11 | #include <lib/utils.h> |
| 12 | #include <plat/common/platform.h> |
Yann Gautier | 9d135e4 | 2018-07-16 19:36:06 +0200 | [diff] [blame] | 13 | |
| 14 | #include <stm32mp1_private.h> |
| 15 | |
| 16 | /****************************************************************************** |
| 17 | * On a GICv2 system, the Group 1 secure interrupts are treated as Group 0 |
| 18 | * interrupts. |
| 19 | *****************************************************************************/ |
| 20 | static const interrupt_prop_t stm32mp1_interrupt_props[] = { |
| 21 | PLATFORM_G1S_PROPS(GICV2_INTR_GROUP0), |
| 22 | PLATFORM_G0_PROPS(GICV2_INTR_GROUP0) |
| 23 | }; |
| 24 | |
| 25 | static unsigned int target_mask_array[PLATFORM_CORE_COUNT]; |
| 26 | |
| 27 | static const gicv2_driver_data_t platform_gic_data = { |
| 28 | .gicd_base = STM32MP1_GICD_BASE, |
| 29 | .gicc_base = STM32MP1_GICC_BASE, |
| 30 | .interrupt_props = stm32mp1_interrupt_props, |
| 31 | .interrupt_props_num = ARRAY_SIZE(stm32mp1_interrupt_props), |
| 32 | .target_masks = target_mask_array, |
| 33 | .target_masks_num = ARRAY_SIZE(target_mask_array), |
| 34 | }; |
| 35 | |
| 36 | void stm32mp1_gic_init(void) |
| 37 | { |
| 38 | gicv2_driver_init(&platform_gic_data); |
| 39 | gicv2_distif_init(); |
| 40 | |
| 41 | stm32mp1_gic_pcpu_init(); |
| 42 | } |
| 43 | |
| 44 | void stm32mp1_gic_pcpu_init(void) |
| 45 | { |
| 46 | gicv2_pcpu_distif_init(); |
| 47 | gicv2_set_pe_target_mask(plat_my_core_pos()); |
| 48 | gicv2_cpuif_enable(); |
| 49 | } |