summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-highbank/reset.c
blob: d73a0a76a5fe7654d1124a420e242e546d8e20b9 (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
38
39
40
41
/*
 * Copyright (C) 2013 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com>
 *
 * GPLv2 only
 */

#include <common.h>
#include <io.h>
#include <poweroff.h>
#include <restart.h>
#include <init.h>

#include <mach/devices.h>
#include <mach/sysregs.h>

static void __noreturn highbank_restart_soc(struct restart_handler *rst)
{
	hingbank_set_pwr_hard_reset();
	asm("	wfi");

	hang();
}

static void __noreturn highbank_poweroff(struct poweroff_handler *handler)
{
	shutdown_barebox();

	hingbank_set_pwr_shutdown();
	asm("	wfi");

	while(1);
}

static int highbank_init(void)
{
	restart_handler_register_fn(highbank_restart_soc);
	poweroff_handler_register_fn(highbank_poweroff);

	return 0;
}
coredevice_initcall(highbank_init);