MIPS: EMMA: Move arch/mips/emma2rh/ into arch/mips/emma/
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / mips / emma / markeins / led.c
blobb65254c1bfe9446e169e20d7a39f14c55e8ca362
1 /*
2 * arch/mips/emma2rh/markeins/led.c
3 * This file defines the led display for Mark-eins.
5 * Copyright (C) NEC Electronics Corporation 2004-2006
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <linux/kernel.h>
22 #include <linux/types.h>
23 #include <linux/string.h>
24 #include <asm/emma2rh/emma2rh.h>
26 const unsigned long clear = 0x20202020;
28 #define LED_BASE 0xb1400038
30 void markeins_led_clear(void)
32 emma2rh_out32(LED_BASE, clear);
33 emma2rh_out32(LED_BASE + 4, clear);
36 void markeins_led(const char *str)
38 int i;
39 int len = strlen(str);
41 markeins_led_clear();
42 if (len > 8)
43 len = 8;
45 if (emma2rh_in32(0xb0000800) & (0x1 << 18))
46 for (i = 0; i < len; i++)
47 emma2rh_out8(LED_BASE + i, str[i]);
48 else
49 for (i = 0; i < len; i++)
50 emma2rh_out8(LED_BASE + (i & 4) + (3 - (i & 3)),
51 str[i]);
54 void markeins_led_hex(u32 val)
56 char str[10];
58 sprintf(str, "%08x", val);
59 markeins_led(str);