Michal Simek | d1c6d42 | 2018-07-13 17:00:13 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * Copyright (C) 2018 Xilinx, Inc. - Michal Simek |
| 4 | */ |
| 5 | |
| 6 | #include <common.h> |
| 7 | #include <dm.h> |
| 8 | #include <errno.h> |
| 9 | #include <sysreset.h> |
| 10 | #include <linux/err.h> |
Ovidiu Panait | 9f97ced | 2021-11-30 18:33:57 +0200 | [diff] [blame] | 11 | #include <linux/stringify.h> |
Michal Simek | d1c6d42 | 2018-07-13 17:00:13 +0200 | [diff] [blame] | 12 | |
| 13 | static int microblaze_sysreset_request(struct udevice *dev, |
| 14 | enum sysreset_t type) |
| 15 | { |
| 16 | puts("Microblaze soft reset sysreset\n"); |
Ovidiu Panait | 9f97ced | 2021-11-30 18:33:57 +0200 | [diff] [blame] | 17 | __asm__ __volatile__ ( |
| 18 | "mts rmsr, r0;" \ |
| 19 | "brai " __stringify(CONFIG_XILINX_MICROBLAZE0_VECTOR_BASE_ADDR)); |
Michal Simek | d1c6d42 | 2018-07-13 17:00:13 +0200 | [diff] [blame] | 20 | |
| 21 | return -EINPROGRESS; |
| 22 | } |
| 23 | |
| 24 | static struct sysreset_ops microblaze_sysreset = { |
| 25 | .request = microblaze_sysreset_request, |
| 26 | }; |
| 27 | |
| 28 | U_BOOT_DRIVER(sysreset_microblaze) = { |
| 29 | .id = UCLASS_SYSRESET, |
| 30 | .name = "mb_soft_reset", |
| 31 | .ops = µblaze_sysreset, |
| 32 | }; |