summaryrefslogtreecommitdiff
path: root/drivers/sysreset/sysreset_xtfpga.c
blob: 54fd5a0163b5ce973857066dc8b2a65dc976bd47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * Cadence Tensilica xtfpga system reset driver.
 *
 * (C) Copyright 2016 Cadence Design Systems Inc.
 *
 * SPDX-License-Identifier:     GPL-2.0+
 */

#include <common.h>
#include <dm.h>
#include <errno.h>
#include <sysreset.h>
#include <asm/io.h>

static int xtfpga_reset_request(struct udevice *dev, enum sysreset_t type)
{
	switch (type) {
	case SYSRESET_COLD:
		writel(CONFIG_SYS_FPGAREG_RESET_CODE,
		       CONFIG_SYS_FPGAREG_RESET);
		break;
	default:
		return -EPROTONOSUPPORT;
	}

	return -EINPROGRESS;
}

static struct sysreset_ops xtfpga_sysreset_ops = {
	.request	= xtfpga_reset_request,
};

U_BOOT_DRIVER(xtfpga_sysreset) = {
	.name	= "xtfpga_sysreset",
	.id	= UCLASS_SYSRESET,
	.ops	= &xtfpga_sysreset_ops,
};