reset.c 1.0 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7 8 9 10
/*
 * Cobalt Reset operations
 *
 * 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.
 *
 * Copyright (C) 1995, 1996, 1997 by Ralf Baechle
 * Copyright (C) 2001 by Liam Davies (ldavies@agile.tv)
 */
11
#include <linux/init.h>
12
#include <linux/io.h>
13
#include <linux/leds.h>
14

15 16
#include <asm/processor.h>

17
#include <cobalt.h>
L
Linus Torvalds 已提交
18

19 20 21
#define RESET_PORT	((void __iomem *)CKSEG1ADDR(0x1c000000))
#define RESET		0x0f

22 23 24 25 26 27 28 29 30
DEFINE_LED_TRIGGER(power_off_led_trigger);

static int __init ledtrig_power_off_init(void)
{
	led_trigger_register_simple("power-off", &power_off_led_trigger);
	return 0;
}
device_initcall(ledtrig_power_off_init);

R
Ralf Baechle 已提交
31
void cobalt_machine_halt(void)
L
Linus Torvalds 已提交
32 33
{
	/*
34
	 * turn on power off LED on RaQ
L
Linus Torvalds 已提交
35
	 */
36
	led_trigger_event(power_off_led_trigger, LED_FULL);
R
Ralf Baechle 已提交
37

38
	local_irq_disable();
39 40 41 42
	while (1) {
		if (cpu_wait)
			cpu_wait();
	}
L
Linus Torvalds 已提交
43 44
}

R
Ralf Baechle 已提交
45 46
void cobalt_machine_restart(char *command)
{
47
	writeb(RESET, RESET_PORT);
R
Ralf Baechle 已提交
48 49 50 51

	/* we should never get here */
	cobalt_machine_halt();
}