Vikram Kanigiri | fbb1301 | 2016-02-15 11:54:14 +0000 | [diff] [blame] | 1 | /* |
Daniel Boulby | 844b487 | 2018-09-18 13:36:39 +0100 | [diff] [blame] | 2 | * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved. |
Vikram Kanigiri | fbb1301 | 2016-02-15 11:54:14 +0000 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Vikram Kanigiri | fbb1301 | 2016-02-15 11:54:14 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <arch.h> |
| 8 | #include <ccn.h> |
| 9 | #include <plat_arm.h> |
| 10 | #include <platform_def.h> |
| 11 | |
| 12 | static const unsigned char master_to_rn_id_map[] = { |
| 13 | PLAT_ARM_CLUSTER_TO_CCN_ID_MAP |
| 14 | }; |
| 15 | |
| 16 | static const ccn_desc_t arm_ccn_desc = { |
| 17 | .periphbase = PLAT_ARM_CCN_BASE, |
| 18 | .num_masters = ARRAY_SIZE(master_to_rn_id_map), |
| 19 | .master_to_rn_id_map = master_to_rn_id_map |
| 20 | }; |
| 21 | |
Soby Mathew | 7356b1e | 2016-03-24 10:12:42 +0000 | [diff] [blame] | 22 | CASSERT(PLAT_ARM_CLUSTER_COUNT == ARRAY_SIZE(master_to_rn_id_map), |
| 23 | assert_invalid_cluster_count_for_ccn_variant); |
| 24 | |
Vikram Kanigiri | fbb1301 | 2016-02-15 11:54:14 +0000 | [diff] [blame] | 25 | /****************************************************************************** |
| 26 | * The following functions are defined as weak to allow a platform to override |
| 27 | * the way ARM CCN driver is initialised and used. |
| 28 | *****************************************************************************/ |
| 29 | #pragma weak plat_arm_interconnect_init |
| 30 | #pragma weak plat_arm_interconnect_enter_coherency |
| 31 | #pragma weak plat_arm_interconnect_exit_coherency |
| 32 | |
| 33 | |
| 34 | /****************************************************************************** |
| 35 | * Helper function to initialize ARM CCN driver. |
| 36 | *****************************************************************************/ |
Daniel Boulby | 844b487 | 2018-09-18 13:36:39 +0100 | [diff] [blame] | 37 | void __init plat_arm_interconnect_init(void) |
Vikram Kanigiri | fbb1301 | 2016-02-15 11:54:14 +0000 | [diff] [blame] | 38 | { |
| 39 | ccn_init(&arm_ccn_desc); |
| 40 | } |
| 41 | |
| 42 | /****************************************************************************** |
| 43 | * Helper function to place current master into coherency |
| 44 | *****************************************************************************/ |
| 45 | void plat_arm_interconnect_enter_coherency(void) |
| 46 | { |
| 47 | ccn_enter_snoop_dvm_domain(1 << MPIDR_AFFLVL1_VAL(read_mpidr_el1())); |
| 48 | } |
| 49 | |
| 50 | /****************************************************************************** |
| 51 | * Helper function to remove current master from coherency |
| 52 | *****************************************************************************/ |
| 53 | void plat_arm_interconnect_exit_coherency(void) |
| 54 | { |
| 55 | ccn_exit_snoop_dvm_domain(1 << MPIDR_AFFLVL1_VAL(read_mpidr_el1())); |
| 56 | } |