aboutsummaryrefslogtreecommitdiff
path: root/board/kontron
diff options
context:
space:
mode:
authorMichael Walle <michael@walle.cc>2022-04-25 09:25:08 +0530
committerPriyanka Jain <priyanka.jain@nxp.com>2022-04-26 17:13:57 +0530
commit20759b2973e77d86ffea11a7eff3fccbc0e37dd9 (patch)
tree11ead1b39b43095d2ffe1c26e5f72bf81edcda62 /board/kontron
parent49bb245f1dc447152a80b522cce7b964e0972517 (diff)
downloadu-boot-20759b2973e77d86ffea11a7eff3fccbc0e37dd9.zip
u-boot-20759b2973e77d86ffea11a7eff3fccbc0e37dd9.tar.gz
u-boot-20759b2973e77d86ffea11a7eff3fccbc0e37dd9.tar.bz2
board: sl28: add basic PSCI implementation
For now, this only provides reset and poweroff functions. Signed-off-by: Michael Walle <michael@walle.cc> [Rebased] Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
Diffstat (limited to 'board/kontron')
-rw-r--r--board/kontron/sl28/Makefile2
-rw-r--r--board/kontron/sl28/psci.c42
2 files changed, 44 insertions, 0 deletions
diff --git a/board/kontron/sl28/Makefile b/board/kontron/sl28/Makefile
index 5d220f0..084c11d 100644
--- a/board/kontron/sl28/Makefile
+++ b/board/kontron/sl28/Makefile
@@ -6,6 +6,8 @@ endif
obj-y += common.o ddr.o
+obj-$(CONFIG_ARMV8_PSCI) += psci.o
+
ifdef CONFIG_SPL_BUILD
obj-y += spl.o
obj-$(CONFIG_SPL_ATF) += spl_atf.o
diff --git a/board/kontron/sl28/psci.c b/board/kontron/sl28/psci.c
new file mode 100644
index 0000000..19f0ef3
--- /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();
+}