From: Dmitry Osipenko <digetx@gmail.com>
To: "Russell King" <linux@armlinux.org.uk>,
"Thierry Reding" <thierry.reding@gmail.com>,
"Jonathan Hunter" <jonathanh@nvidia.com>,
"Robert Yang" <decatf@gmail.com>,
"Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 8/8] ARM: tegra: Add firmware calls required for suspend-resume
Date: Mon, 18 Feb 2019 03:17:26 +0300 [thread overview]
Message-ID: <20190218001726.16785-9-digetx@gmail.com> (raw)
In-Reply-To: <20190218001726.16785-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 | 14 ++++++++++++++
arch/arm/mach-tegra/reset-handler.S | 26 ++++++++++++++++++++++++++
2 files changed, 40 insertions(+)
diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c
index 66c8cd63dd86..97bdfffc244e 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>
@@ -207,6 +208,8 @@ void tegra_idle_lp2_last(void)
if (trusted_foundations_registered())
outer_disable();
+ call_firmware_op(prepare_idle, TF_PM_MODE_LP2);
+
cpu_suspend(PHYS_OFFSET - PAGE_OFFSET, &tegra_sleep_cpu);
/*
@@ -368,6 +371,17 @@ static int tegra_suspend_enter(suspend_state_t state)
if (trusted_foundations_registered())
outer_disable();
+ switch (mode) {
+ case TEGRA_SUSPEND_LP1:
+ call_firmware_op(prepare_idle, TF_PM_MODE_LP1);
+ break;
+ case TEGRA_SUSPEND_LP2:
+ call_firmware_op(prepare_idle, TF_PM_MODE_LP2);
+ break;
+ default:
+ break;
+ }
+
cpu_suspend(PHYS_OFFSET - PAGE_OFFSET, tegra_sleep_func);
/*
diff --git a/arch/arm/mach-tegra/reset-handler.S b/arch/arm/mach-tegra/reset-handler.S
index c827b185d281..24fb375e11a9 100644
--- a/arch/arm/mach-tegra/reset-handler.S
+++ b/arch/arm/mach-tegra/reset-handler.S
@@ -20,6 +20,7 @@
#include <soc/tegra/flowctrl.h>
#include <soc/tegra/fuse.h>
+#include <asm/assembler.h>
#include <asm/asm-offsets.h>
#include <asm/cache.h>
@@ -76,6 +77,7 @@ ENTRY(tegra_resume)
orr r1, r1, #1
str r1, [r0]
#endif
+ bl tegra_resume_trusted_foundations
#ifdef CONFIG_CACHE_L2X0
/* L2 cache resume & re-enable */
@@ -88,6 +90,30 @@ end_ca9_scu_l2_resume:
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.20.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-02-18 0:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-18 0:17 [PATCH v4 0/8] Support Trusted Foundations firmware on Tegra30 Dmitry Osipenko
2019-02-18 0:17 ` [PATCH v4 1/8] ARM: trusted_foundations: Implement L2 cache initialization callback Dmitry Osipenko
2019-02-18 0:17 ` [PATCH v4 2/8] ARM: trusted_foundations: Make prepare_idle call to take mode argument Dmitry Osipenko
2019-02-18 0:17 ` [PATCH v4 3/8] ARM: trusted_foundations: Provide information about whether firmware is registered Dmitry Osipenko
2019-02-18 0:17 ` [PATCH v4 4/8] ARM: tegra: Set up L2 cache using Trusted Foundations firmware Dmitry Osipenko
2019-02-18 0:17 ` [PATCH v4 5/8] ARM: tegra: Don't apply CPU erratas in insecure mode Dmitry Osipenko
2019-02-18 0:17 ` [PATCH v4 6/8] ARM: tegra: Always boot CPU in ARM-mode Dmitry Osipenko
2019-02-18 0:17 ` [PATCH v4 7/8] ARM: tegra: Support L2 cache maintenance done via firmware Dmitry Osipenko
2019-02-18 0:17 ` Dmitry Osipenko [this message]
2019-02-18 8:51 ` [PATCH v4 0/8] Support Trusted Foundations firmware on Tegra30 Thierry Reding
2019-02-20 13:30 ` Dmitry Osipenko
2019-02-20 16:36 ` Michał Mirosław
2019-02-20 17:01 ` 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=20190218001726.16785-9-digetx@gmail.com \
--to=digetx@gmail.com \
--cc=decatf@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mirq-linux@rere.qmqm.pl \
--cc=thierry.reding@gmail.com \
/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).