[U-Boot] [PATCH] sysreset: Add support for Microblaze soft reset jump
Michal Simek
michal.simek at xilinx.com
Fri Jul 13 15:15:36 UTC 2018
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 at xilinx.com>
---
drivers/sysreset/Kconfig | 6 ++++++
drivers/sysreset/Makefile | 1 +
drivers/sysreset/sysreset_microblaze.c | 30 ++++++++++++++++++++++++++++++
3 files changed, 37 insertions(+)
create mode 100644 drivers/sysreset/sysreset_microblaze.c
diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig
index 1e228b97443a..f282d77bf9f5 100644
--- a/drivers/sysreset/Kconfig
+++ b/drivers/sysreset/Kconfig
@@ -21,6 +21,12 @@ config SYSRESET_GPIO
help
Restart support via GPIO pin connected reset logic.
+config SYSRESET_MICROBLAZE
+ bool "Enable support for Microblaze soft reset"
+ depends on MICROBLAZE
+ help
+ This is soft reset on Microblaze which does jump to 0x0 address.
+
config SYSRESET_PSCI
bool "Enable support for PSCI System Reset"
depends on ARM_PSCI_FW
diff --git a/drivers/sysreset/Makefile b/drivers/sysreset/Makefile
index ca533cfefaad..223a0716f0a3 100644
--- a/drivers/sysreset/Makefile
+++ b/drivers/sysreset/Makefile
@@ -4,6 +4,7 @@
obj-$(CONFIG_SYSRESET) += sysreset-uclass.o
obj-$(CONFIG_SYSRESET_GPIO) += sysreset_gpio.o
+obj-$(CONFIG_SYSRESET_MICROBLAZE) += sysreset_microblaze.o
obj-$(CONFIG_SYSRESET_PSCI) += sysreset_psci.o
obj-$(CONFIG_SYSRESET_SYSCON) += sysreset_syscon.o
obj-$(CONFIG_SYSRESET_WATCHDOG) += sysreset_watchdog.o
diff --git a/drivers/sysreset/sysreset_microblaze.c b/drivers/sysreset/sysreset_microblaze.c
new file mode 100644
index 000000000000..514c95817f2f
--- /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 = µblaze_sysreset,
+};
--
1.9.1
More information about the U-Boot
mailing list