blob: c3d1baa5bcf1ee92d9dadfb5b033a83a011a528c [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
15#include <cobalt.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
Yoichi Yuasa3282bd32007-10-02 23:17:38 +090017#define RESET_PORT ((void __iomem *)CKSEG1ADDR(0x1c000000))
18#define RESET 0x0f
19
Yoichi Yuasae86169f2007-10-01 19:45:05 +090020DEFINE_LED_TRIGGER(power_off_led_trigger);
21
22static int __init ledtrig_power_off_init(void)
23{
24 led_trigger_register_simple("power-off", &power_off_led_trigger);
25 return 0;
26}
27device_initcall(ledtrig_power_off_init);
28
Linus Torvalds1da177e2005-04-16 15:20:36 -070029void cobalt_machine_halt(void)
30{
Ralf Baechlec4ed38a2005-02-21 16:18:36 +000031 /*
Yoichi Yuasae86169f2007-10-01 19:45:05 +090032 * turn on power off LED on RaQ
Ralf Baechlec4ed38a2005-02-21 16:18:36 +000033 */
Yoichi Yuasae86169f2007-10-01 19:45:05 +090034 led_trigger_event(power_off_led_trigger, LED_FULL);
35
Yoichi Yuasa71466dd2007-12-12 22:20:19 +090036 local_irq_disable();
37 while (1) ;
Linus Torvalds1da177e2005-04-16 15:20:36 -070038}
39
Ralf Baechlec4ed38a2005-02-21 16:18:36 +000040void cobalt_machine_restart(char *command)
41{
Yoichi Yuasa3282bd32007-10-02 23:17:38 +090042 writeb(RESET, RESET_PORT);
Ralf Baechlec4ed38a2005-02-21 16:18:36 +000043
44 /* we should never get here */
45 cobalt_machine_halt();
46}