summaryrefslogtreecommitdiff
path: root/board/kontron/sl28/psci.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-04-27 09:19:41 -0400
committerTom Rini <trini@konsulko.com>2022-04-27 09:19:41 -0400
commit8b2b125e95c44bb007b4573945f4aedb8a56222c (patch)
tree0eed8a3f6e53131583134e00258984f144845f31 /board/kontron/sl28/psci.c
parent24df831cd4ab70fe526e561b07ca37c8b8aa544c (diff)
parent182d45ddff8944e291c805d94a01d7dd29d0d3b6 (diff)
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-mpc85xx
fsl-qoriq: Fixes and updates on fsl-layerscape mpc85xx: fixes and code cleanup
Diffstat (limited to 'board/kontron/sl28/psci.c')
-rw-r--r--board/kontron/sl28/psci.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/board/kontron/sl28/psci.c b/board/kontron/sl28/psci.c
new file mode 100644
index 00000000000..19f0ef3b6df
--- /dev/null
+++ b/board/kontron/sl28/psci.c
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include <asm/secure.h>
+#include <asm/psci.h>
+#include <asm/types.h>
+#include <asm/io.h>
+#include <asm/system.h>
+
+#define GPIO2_GPDIR 0x2310000
+#define GPIO2_GPDAT 0x2310008
+#define RSTCR 0x1e60000
+#define RESET_REQ BIT(1)
+
+u32 __secure psci_version(void)
+{
+ return ARM_PSCI_VER_0_2;
+}
+
+void __secure psci_system_reset(void)
+{
+ writel(RESET_REQ, RSTCR);
+
+ while (1)
+ wfi();
+}
+
+void __secure psci_system_off(void)
+{
+ int i;
+
+ writel(0x02000000, GPIO2_GPDIR);
+ writel(0, GPIO2_GPDAT);
+
+ /* make sure the management controller has sampled the input */
+ for (i = 0; i < (1 << 11); i++)
+ asm("nop");
+
+ writel(RESET_REQ, RSTCR);
+
+ while (1)
+ wfi();
+}