summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/pm.c
diff options
context:
space:
mode:
authorChris Johnson <cwj@nvidia.com>2011-11-18 16:14:07 -0800
committerVarun Wadekar <vwadekar@nvidia.com>2011-12-08 17:59:13 +0530
commit644d1fbf85ef31720cfefbe1f332767fe572e93a (patch)
treee79dae0187c03fef575bee42306e63ced5d668d7 /arch/arm/mach-tegra/pm.c
parentd4808f8257f2868ac5dc29da2a266e975156c583 (diff)
arm: tegra: add Trusted Foundations hooks and driver
Add CONFIG_TRUSTED_FOUNDATIONS build option and calls to issue SMCs to the TL secure monitor (used when needing to update state not writable by non-secure code). Make security/tf_driver an optional part of the build, which is part of the TL framework to interact with secure services. Bug 883391 Change-Id: I9c6c14ff457fb3a0c612d558fe731a17c2480750 Signed-off-by: Chris Johnson <cwj@nvidia.com> Reviewed-on: http://git-master/r/65616 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/pm.c')
-rw-r--r--arch/arm/mach-tegra/pm.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c
index 8028c7814ddc..ca3baada0aab 100644
--- a/arch/arm/mach-tegra/pm.c
+++ b/arch/arm/mach-tegra/pm.c
@@ -66,7 +66,6 @@
#include "reset.h"
#include "sleep.h"
#include "timer.h"
-#include "reset.h"
struct suspend_context {
/*
@@ -525,6 +524,36 @@ bool tegra_set_cpu_in_lp2(int cpu)
return last_cpu;
}
+static void tegra_sleep_core(enum tegra_suspend_mode mode,
+ unsigned long v2p)
+{
+#ifdef CONFIG_TRUSTED_FOUNDATIONS
+ if (mode == TEGRA_SUSPEND_LP0) {
+ tegra_generic_smc(0xFFFFFFFC, 0xFFFFFFE3,
+ virt_to_phys(tegra_resume));
+ } else {
+ tegra_generic_smc(0xFFFFFFFC, 0xFFFFFFE6,
+ (TEGRA_RESET_HANDLER_BASE +
+ tegra_cpu_reset_handler_offset));
+ }
+#endif
+#ifdef CONFIG_ARCH_TEGRA_2x_SOC
+ tegra2_sleep_core(v2p);
+#else
+ tegra3_sleep_core(v2p);
+#endif
+}
+
+static inline void tegra_sleep_cpu(unsigned long v2p)
+{
+#ifdef CONFIG_TRUSTED_FOUNDATIONS
+ tegra_generic_smc(0xFFFFFFFC, 0xFFFFFFE4,
+ (TEGRA_RESET_HANDLER_BASE +
+ tegra_cpu_reset_handler_offset));
+#endif
+ tegra_sleep_cpu_save(v2p);
+}
+
unsigned int tegra_idle_lp2_last(unsigned int sleep_time, unsigned int flags)
{
u32 mode; /* hardware + software power mode flags */
@@ -569,7 +598,6 @@ unsigned int tegra_idle_lp2_last(unsigned int sleep_time, unsigned int flags)
#ifdef CONFIG_CACHE_L2X0
tegra_init_cache(false);
- l2x0_enable();
#endif
tegra_cluster_switch_time(flags, tegra_cluster_switch_time_id_switch);
restore_cpu_complex(mode);
@@ -810,7 +838,7 @@ int tegra_suspend_dram(enum tegra_suspend_mode mode, unsigned int flags)
if (mode == TEGRA_SUSPEND_LP2)
tegra_sleep_cpu(PLAT_PHYS_OFFSET - PAGE_OFFSET);
else
- tegra_sleep_core(PLAT_PHYS_OFFSET - PAGE_OFFSET);
+ tegra_sleep_core(mode, PLAT_PHYS_OFFSET - PAGE_OFFSET);
tegra_init_cache(true);