8b3cc4c788708f24307179b19db175567261fa44
[pandora-kernel.git] / arch / sh64 / mach-cayman / led.c
1 /*
2  * arch/sh64/kernel/led_cayman.c
3  *
4  * Copyright (C) 2002 Stuart Menefy <stuart.menefy@st.com>
5  *
6  * May be copied or modified under the terms of the GNU General Public
7  * License.  See linux/COPYING for more information.
8  *
9  * Flash the LEDs
10  */
11 #include <asm/io.h>
12
13 /*
14 ** It is supposed these functions to be used for a low level
15 ** debugging (via Cayman LEDs), hence to be available as soon
16 ** as possible.
17 ** Unfortunately Cayman LEDs relies on Cayman EPLD to be mapped
18 ** (this happen when IRQ are initialized... quite late).
19 ** These triky dependencies should be removed. Temporary, it
20 ** may be enough to NOP until EPLD is mapped.
21 */
22
23 extern unsigned long epld_virt;
24
25 #define LED_ADDR      (epld_virt + 0x008)
26 #define HDSP2534_ADDR (epld_virt + 0x100)
27
28 void mach_led(int position, int value)
29 {
30         if (!epld_virt)
31                 return;
32
33         if (value)
34                 ctrl_outl(0, LED_ADDR);
35         else
36                 ctrl_outl(1, LED_ADDR);
37
38 }
39
40 void mach_alphanum(int position, unsigned char value)
41 {
42         if (!epld_virt)
43                 return;
44
45         ctrl_outb(value, HDSP2534_ADDR + 0xe0 + (position << 2));
46 }
47
48 void mach_alphanum_brightness(int setting)
49 {
50         ctrl_outb(setting & 7, HDSP2534_ADDR + 0xc0);
51 }