blob: 54fd5a0163b5ce973857066dc8b2a65dc976bd47 [file] [log] [blame]
Chris Zankel7e270ec2016-08-10 18:36:48 +03001/*
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
15static 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
29static struct sysreset_ops xtfpga_sysreset_ops = {
30 .request = xtfpga_reset_request,
31};
32
33U_BOOT_DRIVER(xtfpga_sysreset) = {
34 .name = "xtfpga_sysreset",
35 .id = UCLASS_SYSRESET,
36 .ops = &xtfpga_sysreset_ops,
37};