Add CCN support to FVP platform port
authorSoby Mathew <soby.mathew@arm.com>
Thu, 24 Mar 2016 10:12:42 +0000 (10:12 +0000)
committerSoby Mathew <soby.mathew@arm.com>
Wed, 25 May 2016 09:25:16 +0000 (10:25 +0100)
This patch adds support to select CCN driver for FVP during build.
A new build option `FVP_INTERCONNECT_DRIVER` is added to allow
selection between the CCI and CCN driver. Currently only the CCN-502
variant is supported on FVP.

The common ARM CCN platform helper file now verifies the cluster
count declared by platform is equal to the number of root node
masters exported by the ARM Standard platform.

Change-Id: I71d7b4785f8925ed499c153b2e9b9925fcefd57a

docs/user-guide.md
plat/arm/board/fvp/fvp_common.c
plat/arm/board/fvp/fvp_def.h
plat/arm/board/fvp/include/plat_macros.S
plat/arm/board/fvp/include/platform_def.h
plat/arm/board/fvp/platform.mk
plat/arm/common/arm_ccn.c

index cd9c8c33e1af5e9281274a734168c3c723e76d64..ce0390d8e8ccf47549032f8b24667016995e14a6 100644 (file)
@@ -496,6 +496,14 @@ map is explained in the [Firmware Design].
      for functions that wait for an arbitrary time length (udelay and mdelay).
      The default value is 0.
 
+*    `FVP_INTERCONNECT_DRIVER`: Selects the interconnect driver to be built. The
+     default interconnect driver depends on the value of `FVP_CLUSTER_COUNT` as
+     explained in the options below:
+     -    `FVP_CCI`           : The CCI driver is selected. This is the default
+                                if 0 < `FVP_CLUSTER_COUNT` <= 2.
+     -    `FVP_CCN`           : The CCN driver is selected. This is the default
+                                if `FVP_CLUSTER_COUNT` > 2.
+
 ### Debugging options
 
 To compile a debug version and make the build more verbose use
index 78782d4308932b6ed27c66d8e9eaba251c1cc17e..eb67dab2b3dd580390d246d35b7dfe281851661f 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <arm_config.h>
 #include <arm_def.h>
+#include <ccn.h>
 #include <debug.h>
 #include <gicv2.h>
 #include <mmio.h>
@@ -213,8 +214,16 @@ void fvp_config_setup(void)
 
 void fvp_interconnect_init(void)
 {
-       if (arm_config.flags & ARM_CONFIG_HAS_INTERCONNECT)
+       if (arm_config.flags & ARM_CONFIG_HAS_INTERCONNECT) {
+#if FVP_INTERCONNECT_DRIVER == FVP_CCN
+               if (ccn_get_part0_id(PLAT_ARM_CCN_BASE) != CCN_502_PART0_ID) {
+                       ERROR("Unrecognized CCN variant detected. Only CCN-502"
+                                       " is supported");
+                       panic();
+               }
+#endif
                plat_arm_interconnect_init();
+       }
 }
 
 void fvp_interconnect_enable(void)
index b0f07ef515a18bef8dad8a168dfdece26fbf1b9f..40d20fce78861e962098aa55b8fd2593d0426ec8 100644 (file)
 
 #define FVP_PRIMARY_CPU                        0x0
 
+/* Defines for the Interconnect build selection */
+#define FVP_CCI                        1
+#define FVP_CCN                        2
+
 /*******************************************************************************
  * FVP memory map related constants
  ******************************************************************************/
 #define DEVICE0_BASE                   0x20000000
 #define DEVICE0_SIZE                   0x0c200000
 
+/*
+ *  In case of FVP models with CCN, the CCN register space overlaps into
+ *  the NSRAM area.
+ */
+#if FVP_INTERCONNECT_DRIVER == FVP_CCN
+#define DEVICE1_BASE                   0x2e000000
+#define DEVICE1_SIZE                   0x1A00000
+#else
 #define DEVICE1_BASE                   0x2f000000
 #define DEVICE1_SIZE                   0x200000
-
+#define NSRAM_BASE                     0x2e000000
+#define NSRAM_SIZE                     0x10000
+#endif
 /* Devices in the second GB */
 #define DEVICE2_BASE                   0x7fe00000
 #define DEVICE2_SIZE                   0x00200000
 
-#define NSRAM_BASE                     0x2e000000
-#define NSRAM_SIZE                     0x10000
-
 #define PCIE_EXP_BASE                  0x40000000
 #define TZRNG_BASE                     0x7fe60000
 
index e43c7acfcbc905be522e7192924261339257ebf4..657a39b9cce4c32b2c8a3bc03c275719aec064b5 100644 (file)
@@ -64,7 +64,9 @@ use_ve_mmap:
        mov_imm x16, VE_GICD_BASE
 print_gic_regs:
        arm_print_gic_regs
+#if FVP_INTERCONNECT_DRIVER == FVP_CCI
        print_cci_regs
+#endif
        .endm
 
 #endif /* __PLAT_MACROS_S__ */
index ca8e35e324a2f6e659644eb4d3e4929a7c5a4f8b..1e906d82b41f7c66062f7e523faae4ec38d35746 100644 (file)
 #define PLAT_ARM_CCI_CLUSTER0_SL_IFACE_IX      3
 #define PLAT_ARM_CCI_CLUSTER1_SL_IFACE_IX      4
 
+/* CCN related constants. Only CCN 502 is currently supported */
+#define PLAT_ARM_CCN_BASE              0x2e000000
+#define PLAT_ARM_CLUSTER_TO_CCN_ID_MAP 1, 5, 7, 11
+
 /* System timer related constants */
 #define PLAT_ARM_NSTIMER_FRAME_ID              1
 
index c0fe662e08d3b03f0bea47c705182512b563ed72..6456cdeaab8ad4ba2fea5ad8a36ce688a6a90740 100644 (file)
@@ -39,11 +39,22 @@ $(eval $(call add_define,FVP_USE_SP804_TIMER))
 # The FVP platform depends on this macro to build with correct GIC driver.
 $(eval $(call add_define,FVP_USE_GIC_DRIVER))
 
-# If FVP_CLUSTER_COUNT has been defined, pass it into the build system.
-ifdef FVP_CLUSTER_COUNT
+# Define default FVP_CLUSTER_COUNT to 2 and pass it into the build system.
+FVP_CLUSTER_COUNT      := 2
 $(eval $(call add_define,FVP_CLUSTER_COUNT))
+
+# Sanity check the cluster count and if FVP_CLUSTER_COUNT <= 2,
+# choose the CCI driver , else the CCN driver
+ifeq ($(FVP_CLUSTER_COUNT), 0)
+$(error "Incorrect cluster count specified for FVP port")
+else ifeq ($(FVP_CLUSTER_COUNT),$(filter $(FVP_CLUSTER_COUNT),1 2))
+FVP_INTERCONNECT_DRIVER := FVP_CCI
+else
+FVP_INTERCONNECT_DRIVER := FVP_CCN
 endif
 
+$(eval $(call add_define,FVP_INTERCONNECT_DRIVER))
+
 # Choose the GIC sources depending upon the how the FVP will be invoked
 ifeq (${FVP_USE_GIC_DRIVER}, FVP_GICV3)
 FVP_GIC_SOURCES                :=      drivers/arm/gic/common/gic_common.c     \
@@ -67,8 +78,15 @@ else
 $(error "Incorrect GIC driver chosen on FVP port")
 endif
 
+ifeq (${FVP_INTERCONNECT_DRIVER}, FVP_CCI)
 FVP_INTERCONNECT_SOURCES       :=      drivers/arm/cci/cci.c           \
                                        plat/arm/common/arm_cci.c
+else ifeq (${FVP_INTERCONNECT_DRIVER}, FVP_CCN)
+FVP_INTERCONNECT_SOURCES       :=      drivers/arm/ccn/ccn.c           \
+                                       plat/arm/common/arm_ccn.c
+else
+$(error "Incorrect CCN driver chosen on FVP port")
+endif
 
 FVP_SECURITY_SOURCES   :=      drivers/arm/tzc/tzc400.c                \
                                plat/arm/board/fvp/fvp_security.c       \
index 5cb443aa59c65eab644333be4c2030e3245c7323..fe10d7b52f758435937c90da3906e18569dd34dd 100644 (file)
@@ -43,6 +43,9 @@ static const ccn_desc_t arm_ccn_desc = {
        .master_to_rn_id_map = master_to_rn_id_map
 };
 
+CASSERT(PLAT_ARM_CLUSTER_COUNT == ARRAY_SIZE(master_to_rn_id_map),
+               assert_invalid_cluster_count_for_ccn_variant);
+
 /******************************************************************************
  * The following functions are defined as weak to allow a platform to override
  * the way ARM CCN driver is initialised and used.