From: digetx@gmail.com (Dmitry Osipenko)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 8/8] ARM: tegra: Add firmware calls required for suspend-resume
Date: Thu, 30 Aug 2018 21:04:21 +0300 [thread overview]
Message-ID: <20180830180421.6415-9-digetx@gmail.com> (raw)
In-Reply-To: <20180830180421.6415-1-digetx@gmail.com>
In order to resume CPU from suspend via trusted Foundations firmware,
the LP1/LP2 boot vectors shall be specified using the firmware calls.
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
arch/arm/mach-tegra/pm.c | 7 ++++++
arch/arm/mach-tegra/reset-handler.S | 33 +++++++++++++++++++++++++++--
2 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c
index 66c8cd63dd86..12341ffabb99 100644
--- a/arch/arm/mach-tegra/pm.c
+++ b/arch/arm/mach-tegra/pm.c
@@ -33,6 +33,7 @@
#include <soc/tegra/pmc.h>
#include <asm/cacheflush.h>
+#include <asm/firmware.h>
#include <asm/idmap.h>
#include <asm/proc-fns.h>
#include <asm/smp_plat.h>
@@ -150,6 +151,10 @@ bool tegra_set_cpu_in_lp2(void)
tegra20_cpu_set_resettable_soon();
spin_unlock(&tegra_lp2_lock);
+
+ if (last_cpu)
+ call_firmware_op(prepare_idle, TF_PM_MODE_LP2);
+
return last_cpu;
}
@@ -316,6 +321,8 @@ static void tegra_suspend_enter_lp1(void)
tegra_lp1_iram.start_addr, iram_save_size);
*((u32 *)tegra_cpu_lp1_mask) = 1;
+
+ call_firmware_op(prepare_idle, TF_PM_MODE_LP1);
}
static void tegra_suspend_exit_lp1(void)
diff --git a/arch/arm/mach-tegra/reset-handler.S b/arch/arm/mach-tegra/reset-handler.S
index 4973ea053bd7..0e208b2e246e 100644
--- a/arch/arm/mach-tegra/reset-handler.S
+++ b/arch/arm/mach-tegra/reset-handler.S
@@ -69,7 +69,7 @@ ENTRY(tegra_resume)
mov32 r9, 0xc09
cmp r8, r9
- bne end_ca9_scu_resume
+ bne end_ca9_scu_l2_resume
#ifdef CONFIG_HAVE_ARM_SCU
/* enable SCU */
mov32 r0, TEGRA_ARM_PERIF_BASE
@@ -77,14 +77,43 @@ ENTRY(tegra_resume)
orr r1, r1, #1
str r1, [r0]
#endif
+ bl tegra_resume_trusted_foundations
-end_ca9_scu_resume:
+#ifdef CONFIG_CACHE_L2X0
+ /* L2 cache resume & re-enable */
+ bleq l2c310_early_resume @ No, resume cache early
+#endif
+end_ca9_scu_l2_resume:
mov32 r9, 0xc0f
cmp r8, r9
bleq tegra_init_l2_for_a15
b cpu_resume
ENDPROC(tegra_resume)
+
+/*
+ * tegra_resume_trusted_foundations
+ *
+ * Trusted Foundations firmware initialization.
+ *
+ * Doesn't return if firmware presents.
+ * Corrupted registers: r1, r2
+ */
+ENTRY(tegra_resume_trusted_foundations)
+ /* Check whether Trusted Foundations firmware presents. */
+ mov32 r2, TEGRA_IRAM_BASE + TEGRA_IRAM_RESET_HANDLER_OFFSET
+ ldr r1, =__tegra_cpu_reset_handler_data_offset + \
+ RESET_DATA(TF_PRESENT)
+ ldr r1, [r2, r1]
+ cmp r1, #0
+ reteq lr
+
+ .arch_extension sec
+ /* First call after suspend wakes firmware. No arguments required. */
+ smc #0
+
+ b cpu_resume
+ENDPROC(tegra_resume_trusted_foundations)
#endif
.align L1_CACHE_SHIFT
--
2.18.0
next prev parent reply other threads:[~2018-08-30 18:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-30 18:04 [PATCH v3 0/8] Support Trusted Foundations firmware on Tegra30 Dmitry Osipenko
2018-08-30 18:04 ` [PATCH v3 1/8] ARM: trusted_foundations: Implement L2 cache initialization callback Dmitry Osipenko
2018-08-30 18:04 ` [PATCH v3 2/8] ARM: trusted_foundations: Make prepare_idle call to take mode argument Dmitry Osipenko
2018-08-30 18:04 ` [PATCH v3 3/8] ARM: trusted_foundations: Provide information about whether firmware is registered Dmitry Osipenko
2018-08-30 18:04 ` [PATCH v3 4/8] ARM: tegra: Setup L2 cache using Trusted Foundations firmware Dmitry Osipenko
2018-08-30 18:04 ` [PATCH v3 5/8] ARM: tegra: Don't apply CPU erratas in insecure mode Dmitry Osipenko
2018-08-30 18:04 ` [PATCH v3 6/8] ARM: tegra: Always boot CPU in ARM-mode Dmitry Osipenko
2018-08-30 18:04 ` [PATCH v3 7/8] ARM: tegra: Support L2 cache maintenance done via firmware Dmitry Osipenko
2018-08-30 18:04 ` Dmitry Osipenko [this message]
2018-10-15 12:34 ` [PATCH v3 0/8] Support Trusted Foundations firmware on Tegra30 Dmitry Osipenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180830180421.6415-9-digetx@gmail.com \
--to=digetx@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).