diff options
Diffstat (limited to 'arch/mips/cobalt')
-rw-r--r-- | arch/mips/cobalt/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/cobalt/led.c | 56 | ||||
-rw-r--r-- | arch/mips/cobalt/reset.c | 22 |
3 files changed, 71 insertions, 9 deletions
diff --git a/arch/mips/cobalt/Makefile b/arch/mips/cobalt/Makefile index a043f93f7d08..6b83f4ddc8fc 100644 --- a/arch/mips/cobalt/Makefile +++ b/arch/mips/cobalt/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for the Cobalt micro systems family specific parts of the kernel | 2 | # Makefile for the Cobalt micro systems family specific parts of the kernel |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := buttons.o irq.o reset.o rtc.o serial.o setup.o | 5 | obj-y := buttons.o irq.o led.o reset.o rtc.o serial.o setup.o |
6 | 6 | ||
7 | obj-$(CONFIG_PCI) += pci.o | 7 | obj-$(CONFIG_PCI) += pci.o |
8 | obj-$(CONFIG_EARLY_PRINTK) += console.o | 8 | obj-$(CONFIG_EARLY_PRINTK) += console.o |
diff --git a/arch/mips/cobalt/led.c b/arch/mips/cobalt/led.c new file mode 100644 index 000000000000..8150af3abb8e --- /dev/null +++ b/arch/mips/cobalt/led.c | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * Registration of Cobalt LED platform device. | ||
3 | * | ||
4 | * Copyright (C) 2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | #include <linux/errno.h> | ||
21 | #include <linux/init.h> | ||
22 | #include <linux/ioport.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | |||
25 | static struct resource cobalt_led_resource __initdata = { | ||
26 | .start = 0x1c000000, | ||
27 | .end = 0x1c000000, | ||
28 | .flags = IORESOURCE_MEM, | ||
29 | }; | ||
30 | |||
31 | static __init int cobalt_led_add(void) | ||
32 | { | ||
33 | struct platform_device *pdev; | ||
34 | int retval; | ||
35 | |||
36 | pdev = platform_device_alloc("cobalt-raq-leds", -1); | ||
37 | |||
38 | if (!pdev) | ||
39 | return -ENOMEM; | ||
40 | |||
41 | retval = platform_device_add_resources(pdev, &cobalt_led_resource, 1); | ||
42 | if (retval) | ||
43 | goto err_free_device; | ||
44 | |||
45 | retval = platform_device_add(pdev); | ||
46 | if (retval) | ||
47 | goto err_free_device; | ||
48 | |||
49 | return 0; | ||
50 | |||
51 | err_free_device: | ||
52 | platform_device_put(pdev); | ||
53 | |||
54 | return retval; | ||
55 | } | ||
56 | device_initcall(cobalt_led_add); | ||
diff --git a/arch/mips/cobalt/reset.c b/arch/mips/cobalt/reset.c index 43cca21fdbc0..f503a0d04b3b 100644 --- a/arch/mips/cobalt/reset.c +++ b/arch/mips/cobalt/reset.c | |||
@@ -8,31 +8,37 @@ | |||
8 | * Copyright (C) 1995, 1996, 1997 by Ralf Baechle | 8 | * Copyright (C) 1995, 1996, 1997 by Ralf Baechle |
9 | * Copyright (C) 2001 by Liam Davies (ldavies@agile.tv) | 9 | * Copyright (C) 2001 by Liam Davies (ldavies@agile.tv) |
10 | */ | 10 | */ |
11 | #include <linux/init.h> | ||
11 | #include <linux/jiffies.h> | 12 | #include <linux/jiffies.h> |
12 | 13 | #include <linux/leds.h> | |
13 | #include <asm/io.h> | ||
14 | #include <asm/reboot.h> | ||
15 | 14 | ||
16 | #include <cobalt.h> | 15 | #include <cobalt.h> |
17 | 16 | ||
17 | DEFINE_LED_TRIGGER(power_off_led_trigger); | ||
18 | |||
19 | static int __init ledtrig_power_off_init(void) | ||
20 | { | ||
21 | led_trigger_register_simple("power-off", &power_off_led_trigger); | ||
22 | return 0; | ||
23 | } | ||
24 | device_initcall(ledtrig_power_off_init); | ||
25 | |||
18 | void cobalt_machine_halt(void) | 26 | void cobalt_machine_halt(void) |
19 | { | 27 | { |
20 | int state, last, diff; | 28 | int state, last, diff; |
21 | unsigned long mark; | 29 | unsigned long mark; |
22 | 30 | ||
23 | /* | 31 | /* |
24 | * turn off bar on Qube, flash power off LED on RaQ (0.5Hz) | 32 | * turn on power off LED on RaQ |
25 | * | 33 | * |
26 | * restart if ENTER and SELECT are pressed | 34 | * restart if ENTER and SELECT are pressed |
27 | */ | 35 | */ |
28 | 36 | ||
29 | last = COBALT_KEY_PORT; | 37 | last = COBALT_KEY_PORT; |
30 | 38 | ||
31 | for (state = 0;;) { | 39 | led_trigger_event(power_off_led_trigger, LED_FULL); |
32 | |||
33 | state ^= COBALT_LED_POWER_OFF; | ||
34 | COBALT_LED_PORT = state; | ||
35 | 40 | ||
41 | for (state = 0;;) { | ||
36 | diff = COBALT_KEY_PORT ^ last; | 42 | diff = COBALT_KEY_PORT ^ last; |
37 | last ^= diff; | 43 | last ^= diff; |
38 | 44 | ||