Tegra: enable processor retention and L2/CPUECTLR access

This patch enables the processor retention and L2/CPUECTLR read/write
access from the NS world only for Cortex-A57 CPUs on the Tegra SoCs.

Change-Id: I9941a67686ea149cb95d80716fa1d03645325445
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
This commit is contained in:
Varun Wadekar 2015-09-22 13:33:56 +05:30
parent 0c2a7c38f3
commit 0cd6138ddc
3 changed files with 29 additions and 30 deletions

View File

@ -35,6 +35,22 @@
#include <cortex_a53.h> #include <cortex_a53.h>
#include <tegra_def.h> #include <tegra_def.h>
#define MIDR_PN_CORTEX_A57 0xD07
/*******************************************************************************
* Implementation defined ACTLR_EL3 bit definitions
******************************************************************************/
#define ACTLR_EL3_L2ACTLR_BIT (1 << 6)
#define ACTLR_EL3_L2ECTLR_BIT (1 << 5)
#define ACTLR_EL3_L2CTLR_BIT (1 << 4)
#define ACTLR_EL3_CPUECTLR_BIT (1 << 1)
#define ACTLR_EL3_CPUACTLR_BIT (1 << 0)
#define ACTLR_EL3_ENABLE_ALL_ACCESS (ACTLR_EL3_L2ACTLR_BIT | \
ACTLR_EL3_L2ECTLR_BIT | \
ACTLR_EL3_L2CTLR_BIT | \
ACTLR_EL3_CPUECTLR_BIT | \
ACTLR_EL3_CPUACTLR_BIT)
/* Global functions */ /* Global functions */
.globl plat_is_my_cpu_primary .globl plat_is_my_cpu_primary
.globl plat_my_core_pos .globl plat_my_core_pos
@ -57,7 +73,18 @@
*/ */
.macro cpu_init_common .macro cpu_init_common
#if ENABLE_L2_DYNAMIC_RETENTION /* ------------------------------------------------
* We enable procesor retention and L2/CPUECTLR NS
* access for A57 CPUs only.
* ------------------------------------------------
*/
mrs x0, midr_el1
mov x1, #(MIDR_PN_MASK << MIDR_PN_SHIFT)
and x0, x0, x1
lsr x0, x0, #MIDR_PN_SHIFT
cmp x0, #MIDR_PN_CORTEX_A57
b.ne 1f
/* --------------------------- /* ---------------------------
* Enable processor retention * Enable processor retention
* --------------------------- * ---------------------------
@ -68,18 +95,14 @@
orr x0, x0, x1 orr x0, x0, x1
msr L2ECTLR_EL1, x0 msr L2ECTLR_EL1, x0
isb isb
#endif
#if ENABLE_CPU_DYNAMIC_RETENTION
mrs x0, CPUECTLR_EL1 mrs x0, CPUECTLR_EL1
mov x1, #RETENTION_ENTRY_TICKS_512 << CPUECTLR_CPU_RET_CTRL_SHIFT mov x1, #RETENTION_ENTRY_TICKS_512 << CPUECTLR_CPU_RET_CTRL_SHIFT
bic x0, x0, #CPUECTLR_CPU_RET_CTRL_MASK bic x0, x0, #CPUECTLR_CPU_RET_CTRL_MASK
orr x0, x0, x1 orr x0, x0, x1
msr CPUECTLR_EL1, x0 msr CPUECTLR_EL1, x0
isb isb
#endif
#if ENABLE_NS_L2_CPUECTRL_RW_ACCESS
/* ------------------------------------------------------- /* -------------------------------------------------------
* Enable L2 and CPU ECTLR RW access from non-secure world * Enable L2 and CPU ECTLR RW access from non-secure world
* ------------------------------------------------------- * -------------------------------------------------------
@ -88,13 +111,12 @@
msr actlr_el3, x0 msr actlr_el3, x0
msr actlr_el2, x0 msr actlr_el2, x0
isb isb
#endif
/* -------------------------------- /* --------------------------------
* Enable the cycle count register * Enable the cycle count register
* -------------------------------- * --------------------------------
*/ */
mrs x0, pmcr_el0 1: mrs x0, pmcr_el0
ubfx x0, x0, #11, #5 // read PMCR.N field ubfx x0, x0, #11, #5 // read PMCR.N field
mov x1, #1 mov x1, #1
lsl x0, x1, x0 lsl x0, x1, x0

View File

@ -47,20 +47,6 @@
******************************************************************************/ ******************************************************************************/
#define PLAT_SYS_SUSPEND_STATE_ID PSTATE_ID_SOC_POWERDN #define PLAT_SYS_SUSPEND_STATE_ID PSTATE_ID_SOC_POWERDN
/*******************************************************************************
* Implementation defined ACTLR_EL3 bit definitions
******************************************************************************/
#define ACTLR_EL3_L2ACTLR_BIT (1 << 6)
#define ACTLR_EL3_L2ECTLR_BIT (1 << 5)
#define ACTLR_EL3_L2CTLR_BIT (1 << 4)
#define ACTLR_EL3_CPUECTLR_BIT (1 << 1)
#define ACTLR_EL3_CPUACTLR_BIT (1 << 0)
#define ACTLR_EL3_ENABLE_ALL_ACCESS (ACTLR_EL3_L2ACTLR_BIT | \
ACTLR_EL3_L2ECTLR_BIT | \
ACTLR_EL3_L2CTLR_BIT | \
ACTLR_EL3_CPUECTLR_BIT | \
ACTLR_EL3_CPUACTLR_BIT)
/******************************************************************************* /*******************************************************************************
* GIC memory map * GIC memory map
******************************************************************************/ ******************************************************************************/

View File

@ -37,15 +37,6 @@ $(eval $(call add_define,TZDRAM_BASE))
ERRATA_TEGRA_INVALIDATE_BTB_AT_BOOT := 1 ERRATA_TEGRA_INVALIDATE_BTB_AT_BOOT := 1
$(eval $(call add_define,ERRATA_TEGRA_INVALIDATE_BTB_AT_BOOT)) $(eval $(call add_define,ERRATA_TEGRA_INVALIDATE_BTB_AT_BOOT))
ENABLE_NS_L2_CPUECTRL_RW_ACCESS := 1
$(eval $(call add_define,ENABLE_NS_L2_CPUECTRL_RW_ACCESS))
ENABLE_L2_DYNAMIC_RETENTION := 1
$(eval $(call add_define,ENABLE_L2_DYNAMIC_RETENTION))
ENABLE_CPU_DYNAMIC_RETENTION := 1
$(eval $(call add_define,ENABLE_CPU_DYNAMIC_RETENTION))
PLATFORM_CLUSTER_COUNT := 2 PLATFORM_CLUSTER_COUNT := 2
$(eval $(call add_define,PLATFORM_CLUSTER_COUNT)) $(eval $(call add_define,PLATFORM_CLUSTER_COUNT))