blob: 516b4428df4ecd3ac5b45a6397f8ffe4a2e070c1 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Cobalt Reset operations
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1995, 1996, 1997 by Ralf Baechle
9 * Copyright (C) 2001 by Liam Davies (ldavies@agile.tv)
10 */
Yoichi Yuasae86169f2007-10-01 19:45:05 +090011#include <linux/init.h>
Yoichi Yuasa3282bd32007-10-02 23:17:38 +090012#include <linux/io.h>
Yoichi Yuasae86169f2007-10-01 19:45:05 +090013#include <linux/leds.h>
Yoichi Yuasacc50b672007-03-06 21:34:44 +090014
Yoichi Yuasa167da462007-12-12 22:23:13 +090015#include <asm/processor.h>
16
Yoichi Yuasacc50b672007-03-06 21:34:44 +090017#include <cobalt.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
Yoichi Yuasa3282bd32007-10-02 23:17:38 +090019#define RESET_PORT ((void __iomem *)CKSEG1ADDR(0x1c000000))
20#define RESET 0x0f
21
Yoichi Yuasae86169f2007-10-01 19:45:05 +090022DEFINE_LED_TRIGGER(power_off_led_trigger);
23
24static int __init ledtrig_power_off_init(void)
25{
26 led_trigger_register_simple("power-off", &power_off_led_trigger);
27 return 0;
28}
29device_initcall(ledtrig_power_off_init);
30
Linus Torvalds1da177e2005-04-16 15:20:36 -070031void cobalt_machine_halt(void)
32{
Ralf Baechlec4ed38a2005-02-21 16:18:36 +000033 /*
Yoichi Yuasae86169f2007-10-01 19:45:05 +090034 * turn on power off LED on RaQ
Ralf Baechlec4ed38a2005-02-21 16:18:36 +000035 */
Yoichi Yuasae86169f2007-10-01 19:45:05 +090036 led_trigger_event(power_off_led_trigger, LED_FULL);
37
Yoichi Yuasa71466dd2007-12-12 22:20:19 +090038 local_irq_disable();
Yoichi Yuasa167da462007-12-12 22:23:13 +090039 while (1) {
40 if (cpu_wait)
41 cpu_wait();
42 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070043}
44
Ralf Baechlec4ed38a2005-02-21 16:18:36 +000045void cobalt_machine_restart(char *command)
46{
Yoichi Yuasa3282bd32007-10-02 23:17:38 +090047 writeb(RESET, RESET_PORT);
Ralf Baechlec4ed38a2005-02-21 16:18:36 +000048
49 /* we should never get here */
50 cobalt_machine_halt();
51}