Full support for Ginger Console
[linux-ginger.git] / arch / mn10300 / unit-asb2303 / leds.c
blobc03839357a140e67ede804f1da357a5f7d0f42a0
1 /* ASB2303 peripheral 7-segment LEDs x1 support
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
11 #include <linux/kernel.h>
12 #include <linux/param.h>
13 #include <linux/init.h>
15 #include <asm/io.h>
16 #include <asm/processor.h>
17 #include <asm/intctl-regs.h>
18 #include <asm/rtc-regs.h>
19 #include <unit/leds.h>
21 #if 0
22 static const u8 asb2303_led_hex_tbl[16] = {
23 0x80, 0xf2, 0x48, 0x60, 0x32, 0x24, 0x04, 0xf0,
24 0x00, 0x20, 0x10, 0x06, 0x8c, 0x42, 0x0c, 0x1c
26 #endif
28 static const u8 asb2303_led_chase_tbl[6] = {
29 ~0x02, /* top - segA */
30 ~0x04, /* right top - segB */
31 ~0x08, /* right bottom - segC */
32 ~0x10, /* bottom - segD */
33 ~0x20, /* left bottom - segE */
34 ~0x40, /* left top - segF */
37 static unsigned asb2303_led_chase;
39 void peripheral_leds_display_exception(enum exception_code code)
41 ASB2303_GPIO0DEF = 0x5555; /* configure as an output port */
42 ASB2303_7SEGLEDS = 0x6d; /* triple horizontal bar */
45 void peripheral_leds_led_chase(void)
47 ASB2303_GPIO0DEF = 0x5555; /* configure as an output port */
48 ASB2303_7SEGLEDS = asb2303_led_chase_tbl[asb2303_led_chase];
49 asb2303_led_chase++;
50 if (asb2303_led_chase >= 6)
51 asb2303_led_chase = 0;