Remove platform dependency in CCI-400 driver
* Create cci_init() function in CCI-400 driver to allow platform
to provide arguments needed by the driver (i.e. base address
and cluster indices for the ACE slave interfaces).
* Rename cci_(en|dis)able_coherency to
cci_(en|dis)able_cluster_coherency to make it clear that
the driver only enables/disables the coherency of CPU
clusters and not other devices connected to the CCI-400.
* Update FVP port to use new cci_init() function and remove
unnecessary CCI defintions from platform_def.h. Also rename
fvp_cci_setup() to fvp_cci_enable() to more clearly
differentiate between CCI initialization and enabling.
THIS CHANGE REQUIRES PLATFORM PORTS THAT USE THE CCI-400 DRIVER
TO BE UPDATED
Fixes ARM-software/tf-issues#168
Change-Id: I1946a51409b91217b92285b6375082619f607fec
diff --git a/plat/fvp/aarch64/fvp_common.c b/plat/fvp/aarch64/fvp_common.c
index 5041511..89fd8b3 100644
--- a/plat/fvp/aarch64/fvp_common.c
+++ b/plat/fvp/aarch64/fvp_common.c
@@ -31,7 +31,6 @@
#include <arch.h>
#include <arch_helpers.h>
#include <arm_gic.h>
-#include <assert.h>
#include <bl_common.h>
#include <cci400.h>
#include <debug.h>
@@ -243,15 +242,26 @@
return counter_base_frequency;
}
-void fvp_cci_setup(void)
+void fvp_cci_init(void)
{
/*
- * Enable CCI-400 for this cluster. No need
+ * Initialize CCI-400 driver
+ */
+ if (plat_config.flags & CONFIG_HAS_CCI)
+ cci_init(CCI400_BASE,
+ CCI400_SL_IFACE3_CLUSTER_IX,
+ CCI400_SL_IFACE4_CLUSTER_IX);
+}
+
+void fvp_cci_enable(void)
+{
+ /*
+ * Enable CCI-400 coherency for this cluster. No need
* for locks as no other cpu is active at the
* moment
*/
if (plat_config.flags & CONFIG_HAS_CCI)
- cci_enable_coherency(read_mpidr());
+ cci_enable_cluster_coherency(read_mpidr());
}
void fvp_gic_init(void)
diff --git a/plat/fvp/bl1_fvp_setup.c b/plat/fvp/bl1_fvp_setup.c
index 0cdb97a..b1205d4 100644
--- a/plat/fvp/bl1_fvp_setup.c
+++ b/plat/fvp/bl1_fvp_setup.c
@@ -110,7 +110,8 @@
******************************************************************************/
void bl1_plat_arch_setup(void)
{
- fvp_cci_setup();
+ fvp_cci_init();
+ fvp_cci_enable();
fvp_configure_mmu_el3(bl1_tzram_layout.total_base,
bl1_tzram_layout.total_size,
diff --git a/plat/fvp/bl31_fvp_setup.c b/plat/fvp/bl31_fvp_setup.c
index 0693a12..69efc9c 100644
--- a/plat/fvp/bl31_fvp_setup.c
+++ b/plat/fvp/bl31_fvp_setup.c
@@ -230,9 +230,9 @@
******************************************************************************/
void bl31_plat_arch_setup(void)
{
+ fvp_cci_init();
#if RESET_TO_BL31
- fvp_cci_setup();
-
+ fvp_cci_enable();
#endif
fvp_configure_mmu_el3(BL31_RO_BASE,
(BL31_COHERENT_RAM_LIMIT - BL31_RO_BASE),
diff --git a/plat/fvp/fvp_def.h b/plat/fvp/fvp_def.h
index b371ea9..dee2a19 100644
--- a/plat/fvp/fvp_def.h
+++ b/plat/fvp/fvp_def.h
@@ -184,11 +184,8 @@
* CCI-400 related constants
******************************************************************************/
#define CCI400_BASE 0x2c090000
-#define CCI400_SL_IFACE_CLUSTER0 3
-#define CCI400_SL_IFACE_CLUSTER1 4
-#define CCI400_SL_IFACE_INDEX(mpidr) (mpidr & MPIDR_CLUSTER_MASK ? \
- CCI400_SL_IFACE_CLUSTER1 : \
- CCI400_SL_IFACE_CLUSTER0)
+#define CCI400_SL_IFACE3_CLUSTER_IX 0
+#define CCI400_SL_IFACE4_CLUSTER_IX 1
/*******************************************************************************
* GIC-400 & interrupt handling related constants
diff --git a/plat/fvp/fvp_pm.c b/plat/fvp/fvp_pm.c
index 82a663b..b7e49a2 100644
--- a/plat/fvp/fvp_pm.c
+++ b/plat/fvp/fvp_pm.c
@@ -140,7 +140,7 @@
* turned off
*/
if (get_plat_config()->flags & CONFIG_HAS_CCI)
- cci_disable_coherency(mpidr);
+ cci_disable_cluster_coherency(mpidr);
/*
* Program the power controller to turn the
@@ -215,7 +215,7 @@
* turned off
*/
if (get_plat_config()->flags & CONFIG_HAS_CCI)
- cci_disable_coherency(mpidr);
+ cci_disable_cluster_coherency(mpidr);
/*
* Program the power controller to turn the
@@ -302,7 +302,7 @@
*/
fvp_pwrc_write_pponr(mpidr);
- fvp_cci_setup();
+ fvp_cci_enable();
}
break;
diff --git a/plat/fvp/fvp_private.h b/plat/fvp/fvp_private.h
index 054baa8..2dcb327 100644
--- a/plat/fvp/fvp_private.h
+++ b/plat/fvp/fvp_private.h
@@ -77,7 +77,8 @@
unsigned long);
int fvp_config_setup(void);
-void fvp_cci_setup(void);
+void fvp_cci_init(void);
+void fvp_cci_enable(void);
void fvp_gic_init(void);
diff --git a/plat/fvp/include/plat_macros.S b/plat/fvp/include/plat_macros.S
index 727b958..5d11d36 100644
--- a/plat/fvp/include/plat_macros.S
+++ b/plat/fvp/include/plat_macros.S
@@ -30,7 +30,7 @@
#include <cci400.h>
#include <gic_v2.h>
#include <plat_config.h>
-#include "platform_def.h"
+#include "../fvp_def.h"
.section .rodata.gic_reg_name, "aS"
gic_regs:
diff --git a/plat/fvp/include/platform_def.h b/plat/fvp/include/platform_def.h
index 734f28c..c87ba54 100644
--- a/plat/fvp/include/platform_def.h
+++ b/plat/fvp/include/platform_def.h
@@ -157,17 +157,6 @@
#define IRQ_SEC_PHY_TIMER 29
/*******************************************************************************
- * CCI-400 related constants
- ******************************************************************************/
-#define CCI400_BASE 0x2c090000
-#define CCI400_SL_IFACE_CLUSTER0 3
-#define CCI400_SL_IFACE_CLUSTER1 4
-#define CCI400_SL_IFACE_INDEX(mpidr) (mpidr & MPIDR_CLUSTER_MASK ? \
- CCI400_SL_IFACE_CLUSTER1 : \
- CCI400_SL_IFACE_CLUSTER0)
-
-
-/*******************************************************************************
* Declarations and constants to access the mailboxes safely. Each mailbox is
* aligned on the biggest cache line size in the platform. This is known only
* to the platform as it might have a combination of integrated and external