From: b.galvani@gmail.com (Beniamino Galvani)
To: linus-amlogic@lists.infradead.org
Subject: [PATCH v7 1/4] arm: implement generic PSCI reset call for armv8
Date: Sun, 8 May 2016 08:30:14 +0200 [thread overview]
Message-ID: <1462689017-3160-2-git-send-email-b.galvani@gmail.com> (raw)
In-Reply-To: <1462689017-3160-1-git-send-email-b.galvani@gmail.com>
Add a psci_system_reset() which calls the SYSTEM_RESET function of
PSCI 0.2 and can be used by boards that support it to implement
reset_cpu().
Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
---
arch/arm/cpu/armv8/fwcall.c | 16 ++++++++++++++++
arch/arm/include/asm/psci.h | 17 ++++++++++++++++-
arch/arm/include/asm/system.h | 2 ++
3 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/arch/arm/cpu/armv8/fwcall.c b/arch/arm/cpu/armv8/fwcall.c
index 9efcc5a..079e250 100644
--- a/arch/arm/cpu/armv8/fwcall.c
+++ b/arch/arm/cpu/armv8/fwcall.c
@@ -8,6 +8,7 @@
#include <config.h>
#include <version.h>
#include <asm/macro.h>
+#include <asm/psci.h>
#include <asm/system.h>
/*
@@ -73,3 +74,18 @@ void smc_call(struct pt_regs *args)
"x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
"x16", "x17");
}
+
+void __noreturn psci_system_reset(bool conduit_smc)
+{
+ struct pt_regs regs;
+
+ regs.regs[0] = ARM_PSCI_0_2_FN_SYSTEM_RESET;
+
+ if (conduit_smc)
+ smc_call(®s);
+ else
+ hvc_call(®s);
+
+ while (1)
+ ;
+}
diff --git a/arch/arm/include/asm/psci.h b/arch/arm/include/asm/psci.h
index 128a606..3704f07 100644
--- a/arch/arm/include/asm/psci.h
+++ b/arch/arm/include/asm/psci.h
@@ -18,7 +18,7 @@
#ifndef __ARM_PSCI_H__
#define __ARM_PSCI_H__
-/* PSCI interface */
+/* PSCI 0.1 interface */
#define ARM_PSCI_FN_BASE 0x95c1ba5e
#define ARM_PSCI_FN(n) (ARM_PSCI_FN_BASE + (n))
@@ -32,6 +32,21 @@
#define ARM_PSCI_RET_INVAL (-2)
#define ARM_PSCI_RET_DENIED (-3)
+/* PSCI 0.2 interface */
+#define ARM_PSCI_0_2_FN_BASE 0x84000000
+#define ARM_PSCI_0_2_FN(n) (ARM_PSCI_0_2_FN_BASE + (n))
+
+#define ARM_PSCI_0_2_FN_PSCI_VERSION ARM_PSCI_0_2_FN(0)
+#define ARM_PSCI_0_2_FN_CPU_SUSPEND ARM_PSCI_0_2_FN(1)
+#define ARM_PSCI_0_2_FN_CPU_OFF ARM_PSCI_0_2_FN(2)
+#define ARM_PSCI_0_2_FN_CPU_ON ARM_PSCI_0_2_FN(3)
+#define ARM_PSCI_0_2_FN_AFFINITY_INFO ARM_PSCI_0_2_FN(4)
+#define ARM_PSCI_0_2_FN_MIGRATE ARM_PSCI_0_2_FN(5)
+#define ARM_PSCI_0_2_FN_MIGRATE_INFO_TYPE ARM_PSCI_0_2_FN(6)
+#define ARM_PSCI_0_2_FN_MIGRATE_INFO_UP_CPU ARM_PSCI_0_2_FN(7)
+#define ARM_PSCI_0_2_FN_SYSTEM_OFF ARM_PSCI_0_2_FN(8)
+#define ARM_PSCI_0_2_FN_SYSTEM_RESET ARM_PSCI_0_2_FN(9)
+
#ifndef __ASSEMBLY__
int psci_update_dt(void *fdt);
void psci_board_init(void);
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 9ae890a..2bdc0be 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -128,6 +128,8 @@ void hvc_call(struct pt_regs *args);
*/
void smc_call(struct pt_regs *args);
+void __noreturn psci_system_reset(bool smc);
+
#endif /* __ASSEMBLY__ */
#else /* CONFIG_ARM64 */
--
2.7.3
next prev parent reply other threads:[~2016-05-08 6:30 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-08 6:30 [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support Beniamino Galvani
2016-05-08 6:30 ` Beniamino Galvani [this message]
2016-05-19 3:59 ` [PATCH v7 1/4] arm: implement generic PSCI reset call for armv8 Simon Glass
2016-05-30 17:57 ` [U-Boot,v7,1/4] " Tom Rini
2016-05-30 17:57 ` Tom Rini
2016-05-08 6:30 ` [PATCH v7 2/4] net: designware: fix descriptor layout and warnings on 64-bit archs Beniamino Galvani
2016-05-19 3:59 ` Simon Glass
2016-05-30 17:57 ` [U-Boot, v7, " Tom Rini
2016-05-08 6:30 ` [PATCH v7 3/4] arm: add initial support for Amlogic Meson and ODROID-C2 Beniamino Galvani
2016-05-19 3:59 ` Simon Glass
2016-05-20 14:44 ` Carlo Caione
2016-05-30 17:57 ` [U-Boot, v7, " Tom Rini
2016-05-08 6:30 ` [PATCH v7 4/4] arm: meson: implement calls to secure monitor Beniamino Galvani
2016-05-30 17:57 ` [U-Boot,v7,4/4] " Tom Rini
2016-05-29 16:38 ` [PATCH v7 0/4] Amlogic Meson GXBaby and ODROID-C2 support Carlo Caione
2016-05-29 17:09 ` Tom Rini
2016-07-11 3:57 ` [U-Boot] " Andreas Färber
2016-07-11 4:23 ` Peter Robinson
2016-07-11 4:41 ` Andreas Färber
2016-07-11 19:48 ` Beniamino Galvani
2016-07-11 20:15 ` Andreas Färber
2016-07-11 20:36 ` Carlo Caione
2016-07-11 21:38 ` Andreas Färber
2016-07-11 22:52 ` Carlo Caione
2016-07-11 22:54 ` Andreas Färber
2016-07-11 23:04 ` Carlo Caione
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=1462689017-3160-2-git-send-email-b.galvani@gmail.com \
--to=b.galvani@gmail.com \
--cc=linus-amlogic@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).