summaryrefslogtreecommitdiff
path: root/arch/microblaze/kernel/reset.c
blob: 42031c535d48d24aca75e71bbc80992028df428b (plain) (blame)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 * Copyright (C) 2009 Michal Simek <monstr@monstr.eu>
 * Copyright (C) 2009 PetaLogix
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License. See the file "COPYING" in the main directory of this archive
 * for more details.
 */

#include <linux/init.h>
#include <linux/delay.h>
#include <linux/reboot.h>

void machine_shutdown(void)
{
	pr_notice("Machine shutdown...\n");
	while (1)
		;
}

void machine_halt(void)
{
	pr_notice("Machine halt...\n");
	while (1)
		;
}

void machine_power_off(void)
{
	pr_notice("Machine power off...\n");
	do_kernel_power_off();
	while (1)
		;
}

void machine_restart(char *cmd)
{
	do_kernel_restart(cmd);
	/* Give the restart hook 1 s to take us down */
	mdelay(1000);
	pr_emerg("Reboot failed -- System halted\n");
	while (1);
}

#ifdef CONFIG_MB_POWER_OFF_THROUGH_UNALIGNED_PC
static int unaligned_pc_sys_off(struct sys_off_data *data)
{
	__asm__(
		"bri 1\n"
	);

	return NOTIFY_DONE;
}

static int __init register_unaligned_pc_sys_off(void)
{
	struct sys_off_handler *sys_off;

	sys_off = register_sys_off_handler(SYS_OFF_MODE_POWER_OFF, SYS_OFF_PRIO_LOW,
					   unaligned_pc_sys_off, NULL);
	return PTR_ERR_OR_ZERO(sys_off);
}
device_initcall(register_unaligned_pc_sys_off);
#endif /* CONFIG_MB_POWER_OFF_THROUGH_UNALIGNED_PC */