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 | |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 8 | #include <drivers/arm/cci.h> |
| 9 | |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 10 | #include <plat_marvell.h> |
| 11 | |
| 12 | static const int cci_map[] = { |
| 13 | PLAT_MARVELL_CCI_CLUSTER0_SL_IFACE_IX, |
| 14 | PLAT_MARVELL_CCI_CLUSTER1_SL_IFACE_IX |
| 15 | }; |
| 16 | |
| 17 | /**************************************************************************** |
| 18 | * The following functions are defined as weak to allow a platform to override |
| 19 | * the way ARM CCI driver is initialised and used. |
| 20 | **************************************************************************** |
| 21 | */ |
| 22 | #pragma weak plat_marvell_interconnect_init |
| 23 | #pragma weak plat_marvell_interconnect_enter_coherency |
| 24 | #pragma weak plat_marvell_interconnect_exit_coherency |
| 25 | |
| 26 | |
| 27 | /**************************************************************************** |
| 28 | * Helper function to initialize ARM CCI driver. |
| 29 | **************************************************************************** |
| 30 | */ |
| 31 | void plat_marvell_interconnect_init(void) |
| 32 | { |
| 33 | cci_init(PLAT_MARVELL_CCI_BASE, cci_map, ARRAY_SIZE(cci_map)); |
| 34 | } |
| 35 | |
| 36 | /**************************************************************************** |
| 37 | * Helper function to place current master into coherency |
| 38 | **************************************************************************** |
| 39 | */ |
| 40 | void plat_marvell_interconnect_enter_coherency(void) |
| 41 | { |
| 42 | cci_enable_snoop_dvm_reqs(MPIDR_AFFLVL1_VAL(read_mpidr_el1())); |
| 43 | } |
| 44 | |
| 45 | /**************************************************************************** |
| 46 | * Helper function to remove current master from coherency |
| 47 | **************************************************************************** |
| 48 | */ |
| 49 | void plat_marvell_interconnect_exit_coherency(void) |
| 50 | { |
| 51 | cci_disable_snoop_dvm_reqs(MPIDR_AFFLVL1_VAL(read_mpidr_el1())); |
| 52 | } |