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