Commit 348619f2 authored by Varun Wadekar's avatar Varun Wadekar
Browse files

Tegra186: implement CPU_OFF handler



This patch implements the CPU_OFF handler for powering down
a CPU using the MCE driver.

Change-Id: I8d455005d0b547cc61cc7778bfe9eb84b7e5480c
Signed-off-by: default avatarVarun Wadekar <vwadekar@nvidia.com>
parent 5d74d68e
...@@ -30,6 +30,10 @@ ...@@ -30,6 +30,10 @@
#include <arch.h> #include <arch.h>
#include <arch_helpers.h> #include <arch_helpers.h>
#include <assert.h>
#include <bl_common.h>
#include <context.h>
#include <context_mgmt.h>
#include <debug.h> #include <debug.h>
#include <mce.h> #include <mce.h>
#include <psci.h> #include <psci.h>
...@@ -88,11 +92,22 @@ int tegra_soc_prepare_cpu_on_finish(unsigned long mpidr) ...@@ -88,11 +92,22 @@ int tegra_soc_prepare_cpu_on_finish(unsigned long mpidr)
int tegra_soc_prepare_cpu_off(unsigned long mpidr) int tegra_soc_prepare_cpu_off(unsigned long mpidr)
{ {
cpu_context_t *ctx = cm_get_context(NON_SECURE);
gp_regs_t *gp_regs = get_gpregs_ctx(ctx);
assert(ctx);
assert(gp_regs);
/* Turn off wake_mask */ /* Turn off wake_mask */
mce_command_handler(MCE_CMD_UPDATE_CSTATE_INFO, 0, 0, 1); write_ctx_reg(gp_regs, CTX_GPREG_X4, 0);
write_ctx_reg(gp_regs, CTX_GPREG_X5, 0);
write_ctx_reg(gp_regs, CTX_GPREG_X6, 1);
mce_command_handler(MCE_CMD_UPDATE_CSTATE_INFO, TEGRA_ARI_CLUSTER_CC7,
0, TEGRA_ARI_SYSTEM_SC7);
/* Turn off CPU */ /* Turn off CPU */
return mce_command_handler(MCE_CMD_ENTER_CSTATE, ~0, 0, 0); return mce_command_handler(MCE_CMD_ENTER_CSTATE, TEGRA_ARI_CORE_C7,
~0, 0);
} }
__dead2 void tegra_soc_prepare_system_off(void) __dead2 void tegra_soc_prepare_system_off(void)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment