blob: b81d82f046bd377c9c46977edc673a12d47369cb [file] [log] [blame]
Michal Simekd1c6d422018-07-13 17:00:13 +02001// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2018 Xilinx, Inc. - Michal Simek
4 */
5
Michal Simekd1c6d422018-07-13 17:00:13 +02006#include <dm.h>
7#include <errno.h>
8#include <sysreset.h>
9#include <linux/err.h>
Ovidiu Panait9f97ced2021-11-30 18:33:57 +020010#include <linux/stringify.h>
Michal Simekd1c6d422018-07-13 17:00:13 +020011
12static int microblaze_sysreset_request(struct udevice *dev,
13 enum sysreset_t type)
14{
15 puts("Microblaze soft reset sysreset\n");
Ovidiu Panait9f97ced2021-11-30 18:33:57 +020016 __asm__ __volatile__ (
17 "mts rmsr, r0;" \
18 "brai " __stringify(CONFIG_XILINX_MICROBLAZE0_VECTOR_BASE_ADDR));
Michal Simekd1c6d422018-07-13 17:00:13 +020019
20 return -EINPROGRESS;
21}
22
23static struct sysreset_ops microblaze_sysreset = {
24 .request = microblaze_sysreset_request,
25};
26
27U_BOOT_DRIVER(sysreset_microblaze) = {
28 .id = UCLASS_SYSRESET,
29 .name = "mb_soft_reset",
30 .ops = &microblaze_sysreset,
31};