Chris Zankel | 7e270ec | 2016-08-10 18:36:48 +0300 | [diff] [blame] | 1 | /* |
| 2 | * Cadence Tensilica xtfpga system reset driver. |
| 3 | * |
| 4 | * (C) Copyright 2016 Cadence Design Systems Inc. |
| 5 | * |
| 6 | * SPDX-License-Identifier: GPL-2.0+ |
| 7 | */ |
| 8 | |
| 9 | #include <common.h> |
| 10 | #include <dm.h> |
| 11 | #include <errno.h> |
| 12 | #include <sysreset.h> |
| 13 | #include <asm/io.h> |
| 14 | |
| 15 | static int xtfpga_reset_request(struct udevice *dev, enum sysreset_t type) |
| 16 | { |
| 17 | switch (type) { |
| 18 | case SYSRESET_COLD: |
| 19 | writel(CONFIG_SYS_FPGAREG_RESET_CODE, |
| 20 | CONFIG_SYS_FPGAREG_RESET); |
| 21 | break; |
| 22 | default: |
| 23 | return -EPROTONOSUPPORT; |
| 24 | } |
| 25 | |
| 26 | return -EINPROGRESS; |
| 27 | } |
| 28 | |
| 29 | static struct sysreset_ops xtfpga_sysreset_ops = { |
| 30 | .request = xtfpga_reset_request, |
| 31 | }; |
| 32 | |
| 33 | U_BOOT_DRIVER(xtfpga_sysreset) = { |
| 34 | .name = "xtfpga_sysreset", |
| 35 | .id = UCLASS_SYSRESET, |
| 36 | .ops = &xtfpga_sysreset_ops, |
| 37 | }; |