blob: 4eedd481dd007bba3b25bfd733fca34cbe895730 [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
Ralf Baechlebdc92d742013-05-21 16:59:19 +020015#include <asm/idle.h>
Yoichi Yuasa167da462007-12-12 22:23:13 +090016#include <asm/processor.h>
17
Yoichi Yuasacc50b672007-03-06 21:34:44 +090018#include <cobalt.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
Yoichi Yuasa3282bd32007-10-02 23:17:38 +090020#define RESET_PORT ((void __iomem *)CKSEG1ADDR(0x1c000000))
21#define RESET 0x0f
22
Yoichi Yuasae86169f2007-10-01 19:45:05 +090023DEFINE_LED_TRIGGER(power_off_led_trigger);
24
25static int __init ledtrig_power_off_init(void)
26{
27 led_trigger_register_simple("power-off", &power_off_led_trigger);
28 return 0;
29}
30device_initcall(ledtrig_power_off_init);
31
Linus Torvalds1da177e2005-04-16 15:20:36 -070032void cobalt_machine_halt(void)
33{
Ralf Baechlec4ed38a2005-02-21 16:18:36 +000034 /*
Yoichi Yuasae86169f2007-10-01 19:45:05 +090035 * turn on power off LED on RaQ
Ralf Baechlec4ed38a2005-02-21 16:18:36 +000036 */
Yoichi Yuasae86169f2007-10-01 19:45:05 +090037 led_trigger_event(power_off_led_trigger, LED_FULL);
38
Yoichi Yuasa71466dd2007-12-12 22:20:19 +090039 local_irq_disable();
Yoichi Yuasa167da462007-12-12 22:23:13 +090040 while (1) {
41 if (cpu_wait)
42 cpu_wait();
43 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070044}
45
Ralf Baechlec4ed38a2005-02-21 16:18:36 +000046void cobalt_machine_restart(char *command)
47{
Yoichi Yuasa3282bd32007-10-02 23:17:38 +090048 writeb(RESET, RESET_PORT);
Ralf Baechlec4ed38a2005-02-21 16:18:36 +000049
50 /* we should never get here */
51 cobalt_machine_halt();
52}