summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91/at91sam9x5.c
blob: 0b0fbc6ff3692de5a615ad312ed1afe773c9461c (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
// SPDX-License-Identifier: GPL-2.0-only

#include <common.h>
#include <init.h>
#include <restart.h>
#include <mach/at91/at91sam9x5.h>
#include <mach/at91/board.h>
#include <mach/at91/at91_rstc.h>

static void at91sam9x5_restart(struct restart_handler *rst)
{
	at91sam9g45_reset(IOMEM(AT91SAM9X5_BASE_DDRSDRC0),
			  IOMEM(AT91SAM9X5_BASE_RSTC + AT91_RSTC_CR));
}

static struct restart_handler restart;

static int at91sam9x5_initialize(void)
{
	if (IS_ENABLED(CONFIG_OFDEVICE) && !of_machine_is_compatible("atmel,at91sam9x5"))
		return 0;

	restart.name = "soc";
	restart.priority = 110;
	restart.restart = at91sam9x5_restart;

	return restart_handler_register(&restart);
}
coredevice_initcall(at91sam9x5_initialize);