Merge pull request #1570 from Andre-ARM/allwinner/pmic-fixes
Allwinner PMIC fixes
diff --git a/bl31/bl31_main.c b/bl31/bl31_main.c
index 5479a49..4b7f63c 100644
--- a/bl31/bl31_main.c
+++ b/bl31/bl31_main.c
@@ -108,10 +108,8 @@
int32_t rc = (*bl32_init)();
- if (rc != 0) {
- WARN("BL31: BL32 initialization failed (rc = %d)\n",
- rc);
- }
+ if (rc == 0)
+ WARN("BL31: BL32 initialization failed\n");
}
/*
* We are ready to enter the next EL. Prepare entry into the image
diff --git a/plat/arm/common/arm_bl1_setup.c b/plat/arm/common/arm_bl1_setup.c
index d9104ee..ea3703b 100644
--- a/plat/arm/common/arm_bl1_setup.c
+++ b/plat/arm/common/arm_bl1_setup.c
@@ -111,8 +111,11 @@
*****************************************************************************/
void arm_bl1_plat_arch_setup(void)
{
-#if USE_COHERENT_MEM
- /* ARM platforms dont use coherent memory in BL1 */
+#if USE_COHERENT_MEM && !ARM_CRYPTOCELL_INTEG
+ /*
+ * Ensure ARM platforms don't use coherent memory in BL1 unless
+ * cryptocell integration is enabled.
+ */
assert((BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE) == 0U);
#endif
@@ -122,7 +125,10 @@
#if USE_ROMLIB
ARM_MAP_ROMLIB_CODE,
ARM_MAP_ROMLIB_DATA,
- #endif
+#endif
+#if ARM_CRYPTOCELL_INTEG
+ ARM_MAP_BL_COHERENT_RAM,
+#endif
{0}
};
diff --git a/plat/arm/common/arm_bl2_setup.c b/plat/arm/common/arm_bl2_setup.c
index a8ea075..edad800 100644
--- a/plat/arm/common/arm_bl2_setup.c
+++ b/plat/arm/common/arm_bl2_setup.c
@@ -237,9 +237,11 @@
******************************************************************************/
void arm_bl2_plat_arch_setup(void)
{
-
-#if USE_COHERENT_MEM
- /* Ensure ARM platforms dont use coherent memory in BL2 */
+#if USE_COHERENT_MEM && !ARM_CRYPTOCELL_INTEG
+ /*
+ * Ensure ARM platforms don't use coherent memory in BL2 unless
+ * cryptocell integration is enabled.
+ */
assert((BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE) == 0U);
#endif
@@ -250,6 +252,9 @@
ARM_MAP_ROMLIB_CODE,
ARM_MAP_ROMLIB_DATA,
#endif
+#if ARM_CRYPTOCELL_INTEG
+ ARM_MAP_BL_COHERENT_RAM,
+#endif
{0}
};
diff --git a/plat/arm/common/arm_common.mk b/plat/arm/common/arm_common.mk
index d8eda35..5c2d1e8 100644
--- a/plat/arm/common/arm_common.mk
+++ b/plat/arm/common/arm_common.mk
@@ -138,6 +138,14 @@
$(eval $(call assert_boolean,ARM_CRYPTOCELL_INTEG))
$(eval $(call add_define,ARM_CRYPTOCELL_INTEG))
+# CryptoCell integration relies on coherent buffers for passing data from
+# the AP CPU to the CryptoCell
+ifeq (${ARM_CRYPTOCELL_INTEG},1)
+ ifeq (${USE_COHERENT_MEM},0)
+ $(error "ARM_CRYPTOCELL_INTEG needs USE_COHERENT_MEM to be set.")
+ endif
+endif
+
PLAT_INCLUDES += -Iinclude/common/tbbr \
-Iinclude/plat/arm/common
diff --git a/services/spd/trusty/trusty.c b/services/spd/trusty/trusty.c
index cc808e2..3335836 100644
--- a/services/spd/trusty/trusty.c
+++ b/services/spd/trusty/trusty.c
@@ -322,7 +322,7 @@
fpregs_context_restore(get_fpregs_ctx(cm_get_context(NON_SECURE)));
cm_set_next_eret_context(NON_SECURE);
- return 0;
+ return 1;
}
static void trusty_cpu_suspend(uint32_t off)