First Support on Ginger and OMAP TI
[linux-ginger.git] / arch / mips / emma / markeins / led.c
blob49755896857fdd0d4382820d258d5a7220ec3e7a
1 /*
2 * Copyright (C) NEC Electronics Corporation 2004-2006
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #include <linux/kernel.h>
19 #include <linux/types.h>
20 #include <linux/string.h>
21 #include <asm/emma/emma2rh.h>
23 const unsigned long clear = 0x20202020;
25 #define LED_BASE 0xb1400038
27 void markeins_led_clear(void)
29 emma2rh_out32(LED_BASE, clear);
30 emma2rh_out32(LED_BASE + 4, clear);
33 void markeins_led(const char *str)
35 int i;
36 int len = strlen(str);
38 markeins_led_clear();
39 if (len > 8)
40 len = 8;
42 if (emma2rh_in32(0xb0000800) & (0x1 << 18))
43 for (i = 0; i < len; i++)
44 emma2rh_out8(LED_BASE + i, str[i]);
45 else
46 for (i = 0; i < len; i++)
47 emma2rh_out8(LED_BASE + (i & 4) + (3 - (i & 3)),
48 str[i]);
51 void markeins_led_hex(u32 val)
53 char str[10];
55 sprintf(str, "%08x", val);
56 markeins_led(str);