summaryrefslogtreecommitdiff
path: root/drivers/sysreset/sysreset_microblaze.c
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2018-07-13 17:00:13 +0200
committerMichal Simek <michal.simek@xilinx.com>2018-07-19 10:49:55 +0200
commitcae39ae365ed98b7cd0805fcb57ca4ee280b5ebe (patch)
tree417bc42b9fac7a09e97fa30439da142fadf28e94 /drivers/sysreset/sysreset_microblaze.c
parent0d832b322109e76953bc58e4d2723d2c73dfb604 (diff)
sysreset: Add support for Microblaze soft reset jump
Microblaze is storing reset vector at address 0x0. It means soft reset can be done by just jumping to this address. This code was in platform code but sysreset interface is providing enough capabilities to have more options how to reset the system. It can go from gpio reset through watchdog reset till soft reset. The driver has not compatible string because this is cpu specific and DM core is not able to detect compatible string in DT root that's why this driver will be instantiated from platform code by calling device_bind_driver(gd->dm_root, "mb_soft_reset", "reset_soft", NULL); It should be bind as the last reset method to ensure that hw reset is called before this. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'drivers/sysreset/sysreset_microblaze.c')
-rw-r--r--drivers/sysreset/sysreset_microblaze.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/sysreset/sysreset_microblaze.c b/drivers/sysreset/sysreset_microblaze.c
new file mode 100644
index 00000000000..514c95817f2
--- /dev/null
+++ b/drivers/sysreset/sysreset_microblaze.c
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 Xilinx, Inc. - Michal Simek
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <errno.h>
+#include <sysreset.h>
+#include <linux/err.h>
+
+static int microblaze_sysreset_request(struct udevice *dev,
+ enum sysreset_t type)
+{
+ puts("Microblaze soft reset sysreset\n");
+ __asm__ __volatile__ (" mts rmsr, r0;" \
+ "bra r0");
+
+ return -EINPROGRESS;
+}
+
+static struct sysreset_ops microblaze_sysreset = {
+ .request = microblaze_sysreset_request,
+};
+
+U_BOOT_DRIVER(sysreset_microblaze) = {
+ .id = UCLASS_SYSRESET,
+ .name = "mb_soft_reset",
+ .ops = &microblaze_sysreset,
+};