Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 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 Yuasa | e86169f | 2007-10-01 19:45:05 +0900 | [diff] [blame] | 11 | #include <linux/init.h> |
Yoichi Yuasa | 3282bd3 | 2007-10-02 23:17:38 +0900 | [diff] [blame] | 12 | #include <linux/io.h> |
Yoichi Yuasa | e86169f | 2007-10-01 19:45:05 +0900 | [diff] [blame] | 13 | #include <linux/leds.h> |
Yoichi Yuasa | cc50b67 | 2007-03-06 21:34:44 +0900 | [diff] [blame] | 14 | |
Ralf Baechle | bdc92d74 | 2013-05-21 16:59:19 +0200 | [diff] [blame] | 15 | #include <asm/idle.h> |
Yoichi Yuasa | 167da46 | 2007-12-12 22:23:13 +0900 | [diff] [blame] | 16 | #include <asm/processor.h> |
| 17 | |
Yoichi Yuasa | cc50b67 | 2007-03-06 21:34:44 +0900 | [diff] [blame] | 18 | #include <cobalt.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | |
Yoichi Yuasa | 3282bd3 | 2007-10-02 23:17:38 +0900 | [diff] [blame] | 20 | #define RESET_PORT ((void __iomem *)CKSEG1ADDR(0x1c000000)) |
| 21 | #define RESET 0x0f |
| 22 | |
Yoichi Yuasa | e86169f | 2007-10-01 19:45:05 +0900 | [diff] [blame] | 23 | DEFINE_LED_TRIGGER(power_off_led_trigger); |
| 24 | |
| 25 | static int __init ledtrig_power_off_init(void) |
| 26 | { |
| 27 | led_trigger_register_simple("power-off", &power_off_led_trigger); |
| 28 | return 0; |
| 29 | } |
| 30 | device_initcall(ledtrig_power_off_init); |
| 31 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | void cobalt_machine_halt(void) |
| 33 | { |
Ralf Baechle | c4ed38a | 2005-02-21 16:18:36 +0000 | [diff] [blame] | 34 | /* |
Yoichi Yuasa | e86169f | 2007-10-01 19:45:05 +0900 | [diff] [blame] | 35 | * turn on power off LED on RaQ |
Ralf Baechle | c4ed38a | 2005-02-21 16:18:36 +0000 | [diff] [blame] | 36 | */ |
Yoichi Yuasa | e86169f | 2007-10-01 19:45:05 +0900 | [diff] [blame] | 37 | led_trigger_event(power_off_led_trigger, LED_FULL); |
| 38 | |
Yoichi Yuasa | 71466dd | 2007-12-12 22:20:19 +0900 | [diff] [blame] | 39 | local_irq_disable(); |
Yoichi Yuasa | 167da46 | 2007-12-12 22:23:13 +0900 | [diff] [blame] | 40 | while (1) { |
| 41 | if (cpu_wait) |
| 42 | cpu_wait(); |
| 43 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | } |
| 45 | |
Ralf Baechle | c4ed38a | 2005-02-21 16:18:36 +0000 | [diff] [blame] | 46 | void cobalt_machine_restart(char *command) |
| 47 | { |
Yoichi Yuasa | 3282bd3 | 2007-10-02 23:17:38 +0900 | [diff] [blame] | 48 | writeb(RESET, RESET_PORT); |
Ralf Baechle | c4ed38a | 2005-02-21 16:18:36 +0000 | [diff] [blame] | 49 | |
| 50 | /* we should never get here */ |
| 51 | cobalt_machine_halt(); |
| 52 | } |