blob: 6aa56f217dabd080658859c94ff0c79d0440fcef [file] [log] [blame]
Vikram Kanigirifbb13012016-02-15 11:54:14 +00001/*
Daniel Boulby844b4872018-09-18 13:36:39 +01002 * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
Vikram Kanigirifbb13012016-02-15 11:54:14 +00003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Vikram Kanigirifbb13012016-02-15 11:54:14 +00005 */
6
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00007#include <platform_def.h>
8
Vikram Kanigirifbb13012016-02-15 11:54:14 +00009#include <arch.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000010#include <drivers/arm/ccn.h>
11
Vikram Kanigirifbb13012016-02-15 11:54:14 +000012#include <plat_arm.h>
Vikram Kanigirifbb13012016-02-15 11:54:14 +000013
14static const unsigned char master_to_rn_id_map[] = {
15 PLAT_ARM_CLUSTER_TO_CCN_ID_MAP
16};
17
18static const ccn_desc_t arm_ccn_desc = {
19 .periphbase = PLAT_ARM_CCN_BASE,
20 .num_masters = ARRAY_SIZE(master_to_rn_id_map),
21 .master_to_rn_id_map = master_to_rn_id_map
22};
23
Soby Mathew7356b1e2016-03-24 10:12:42 +000024CASSERT(PLAT_ARM_CLUSTER_COUNT == ARRAY_SIZE(master_to_rn_id_map),
25 assert_invalid_cluster_count_for_ccn_variant);
26
Vikram Kanigirifbb13012016-02-15 11:54:14 +000027/******************************************************************************
28 * The following functions are defined as weak to allow a platform to override
29 * the way ARM CCN driver is initialised and used.
30 *****************************************************************************/
31#pragma weak plat_arm_interconnect_init
32#pragma weak plat_arm_interconnect_enter_coherency
33#pragma weak plat_arm_interconnect_exit_coherency
34
35
36/******************************************************************************
37 * Helper function to initialize ARM CCN driver.
38 *****************************************************************************/
Daniel Boulby844b4872018-09-18 13:36:39 +010039void __init plat_arm_interconnect_init(void)
Vikram Kanigirifbb13012016-02-15 11:54:14 +000040{
41 ccn_init(&arm_ccn_desc);
42}
43
44/******************************************************************************
45 * Helper function to place current master into coherency
46 *****************************************************************************/
47void plat_arm_interconnect_enter_coherency(void)
48{
49 ccn_enter_snoop_dvm_domain(1 << MPIDR_AFFLVL1_VAL(read_mpidr_el1()));
50}
51
52/******************************************************************************
53 * Helper function to remove current master from coherency
54 *****************************************************************************/
55void plat_arm_interconnect_exit_coherency(void)
56{
57 ccn_exit_snoop_dvm_domain(1 << MPIDR_AFFLVL1_VAL(read_mpidr_el1()));
58}