Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 Marvell International Ltd. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * https://spdx.org/licenses |
| 6 | */ |
| 7 | |
| 8 | #include <gicv2.h> |
| 9 | #include <plat_marvell.h> |
| 10 | #include <platform.h> |
| 11 | #include <platform_def.h> |
| 12 | |
| 13 | /* |
| 14 | * The following functions are defined as weak to allow a platform to override |
| 15 | * the way the GICv2 driver is initialised and used. |
| 16 | */ |
| 17 | #pragma weak plat_marvell_gic_driver_init |
| 18 | #pragma weak plat_marvell_gic_init |
| 19 | |
| 20 | /* |
| 21 | * On a GICv2 system, the Group 1 secure interrupts are treated as Group 0 |
| 22 | * interrupts. |
| 23 | */ |
| 24 | static const interrupt_prop_t marvell_interrupt_props[] = { |
| 25 | PLAT_MARVELL_G1S_IRQ_PROPS(GICV2_INTR_GROUP0), |
| 26 | PLAT_MARVELL_G0_IRQ_PROPS(GICV2_INTR_GROUP0) |
| 27 | }; |
| 28 | |
| 29 | static unsigned int target_mask_array[PLATFORM_CORE_COUNT]; |
| 30 | |
| 31 | /* |
| 32 | * Ideally `marvell_gic_data` structure definition should be a `const` but it is |
| 33 | * kept as modifiable for overwriting with different GICD and GICC base when |
| 34 | * running on FVP with VE memory map. |
| 35 | */ |
| 36 | static gicv2_driver_data_t marvell_gic_data = { |
| 37 | .gicd_base = PLAT_MARVELL_GICD_BASE, |
| 38 | .gicc_base = PLAT_MARVELL_GICC_BASE, |
| 39 | .interrupt_props = marvell_interrupt_props, |
| 40 | .interrupt_props_num = ARRAY_SIZE(marvell_interrupt_props), |
| 41 | .target_masks = target_mask_array, |
| 42 | .target_masks_num = ARRAY_SIZE(target_mask_array), |
| 43 | }; |
| 44 | |
| 45 | /* |
| 46 | * ARM common helper to initialize the GICv2 only driver. |
| 47 | */ |
| 48 | void plat_marvell_gic_driver_init(void) |
| 49 | { |
| 50 | gicv2_driver_init(&marvell_gic_data); |
| 51 | } |
| 52 | |
| 53 | void plat_marvell_gic_init(void) |
| 54 | { |
| 55 | gicv2_distif_init(); |
| 56 | gicv2_pcpu_distif_init(); |
| 57 | gicv2_set_pe_target_mask(plat_my_core_pos()); |
| 58 | gicv2_cpuif_enable(); |
| 59 | } |