diff options
author | David Howells <dhowells@redhat.com> | 2008-02-08 07:19:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:22:30 -0500 |
commit | b920de1b77b72ca9432ac3f97edb26541e65e5dd (patch) | |
tree | 40fa9be1470e929c47927dea7eddf184c0204229 /arch/mn10300/unit-asb2305/leds.c | |
parent | ef3d534754f31fed9c3b976fee1ece1b3bc38282 (diff) |
mn10300: add the MN10300/AM33 architecture to the kernel
Add architecture support for the MN10300/AM33 CPUs produced by MEI to the
kernel.
This patch also adds board support for the ASB2303 with the ASB2308 daughter
board, and the ASB2305. The only processor supported is the MN103E010, which
is an AM33v2 core plus on-chip devices.
[akpm@linux-foundation.org: nuke cvs control strings]
Signed-off-by: Masakazu Urade <urade.masakazu@jp.panasonic.com>
Signed-off-by: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/mn10300/unit-asb2305/leds.c')
-rw-r--r-- | arch/mn10300/unit-asb2305/leds.c | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/arch/mn10300/unit-asb2305/leds.c b/arch/mn10300/unit-asb2305/leds.c new file mode 100644 index 000000000000..e99dcc9cee1a --- /dev/null +++ b/arch/mn10300/unit-asb2305/leds.c | |||
@@ -0,0 +1,124 @@ | |||
1 | /* ASB2305 Peripheral 7-segment LEDs x4 support | ||
2 | * | ||
3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
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. | ||
10 | */ | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/param.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <asm/io.h> | ||
15 | #include <asm/processor.h> | ||
16 | #include <asm/cpu/intctl-regs.h> | ||
17 | #include <asm/cpu/rtc-regs.h> | ||
18 | #include <asm/unit/leds.h> | ||
19 | |||
20 | static const u8 asb2305_led_hex_tbl[16] = { | ||
21 | 0x80, 0xf2, 0x48, 0x60, 0x32, 0x24, 0x04, 0xf0, | ||
22 | 0x00, 0x20, 0x10, 0x06, 0x8c, 0x42, 0x0c, 0x1c | ||
23 | }; | ||
24 | |||
25 | static const u32 asb2305_led_chase_tbl[6] = { | ||
26 | ~0x02020202, /* top - segA */ | ||
27 | ~0x04040404, /* right top - segB */ | ||
28 | ~0x08080808, /* right bottom - segC */ | ||
29 | ~0x10101010, /* bottom - segD */ | ||
30 | ~0x20202020, /* left bottom - segE */ | ||
31 | ~0x40404040, /* left top - segF */ | ||
32 | }; | ||
33 | |||
34 | static unsigned asb2305_led_chase; | ||
35 | |||
36 | void peripheral_leds7x4_display_dec(unsigned int val, unsigned int points) | ||
37 | { | ||
38 | u32 leds; | ||
39 | |||
40 | leds = asb2305_led_hex_tbl[(val/1000) % 10]; | ||
41 | leds <<= 8; | ||
42 | leds |= asb2305_led_hex_tbl[(val/100) % 10]; | ||
43 | leds <<= 8; | ||
44 | leds |= asb2305_led_hex_tbl[(val/10) % 10]; | ||
45 | leds <<= 8; | ||
46 | leds |= asb2305_led_hex_tbl[val % 10]; | ||
47 | leds |= points^0x01010101; | ||
48 | |||
49 | ASB2305_7SEGLEDS = leds; | ||
50 | } | ||
51 | |||
52 | void peripheral_leds7x4_display_hex(unsigned int val, unsigned int points) | ||
53 | { | ||
54 | u32 leds; | ||
55 | |||
56 | leds = asb2305_led_hex_tbl[(val/1000) % 10]; | ||
57 | leds <<= 8; | ||
58 | leds |= asb2305_led_hex_tbl[(val/100) % 10]; | ||
59 | leds <<= 8; | ||
60 | leds |= asb2305_led_hex_tbl[(val/10) % 10]; | ||
61 | leds <<= 8; | ||
62 | leds |= asb2305_led_hex_tbl[val % 10]; | ||
63 | leds |= points^0x01010101; | ||
64 | |||
65 | ASB2305_7SEGLEDS = leds; | ||
66 | } | ||
67 | |||
68 | void peripheral_leds_display_exception(enum exception_code code) | ||
69 | { | ||
70 | u32 leds; | ||
71 | |||
72 | leds = asb2305_led_hex_tbl[(code/0x100) % 0x10]; | ||
73 | leds <<= 8; | ||
74 | leds |= asb2305_led_hex_tbl[(code/0x10) % 0x10]; | ||
75 | leds <<= 8; | ||
76 | leds |= asb2305_led_hex_tbl[code % 0x10]; | ||
77 | leds |= 0x6d010101; | ||
78 | |||
79 | ASB2305_7SEGLEDS = leds; | ||
80 | } | ||
81 | |||
82 | void peripheral_leds7x4_display_minssecs(unsigned int time, unsigned int points) | ||
83 | { | ||
84 | u32 leds; | ||
85 | |||
86 | leds = asb2305_led_hex_tbl[(time/600) % 6]; | ||
87 | leds <<= 8; | ||
88 | leds |= asb2305_led_hex_tbl[(time/60) % 10]; | ||
89 | leds <<= 8; | ||
90 | leds |= asb2305_led_hex_tbl[(time/10) % 6]; | ||
91 | leds <<= 8; | ||
92 | leds |= asb2305_led_hex_tbl[time % 10]; | ||
93 | leds |= points^0x01010101; | ||
94 | |||
95 | ASB2305_7SEGLEDS = leds; | ||
96 | } | ||
97 | |||
98 | void peripheral_leds7x4_display_rtc(void) | ||
99 | { | ||
100 | unsigned int clock; | ||
101 | u8 mins, secs; | ||
102 | |||
103 | mins = RTMCR; | ||
104 | secs = RTSCR; | ||
105 | |||
106 | clock = ((mins & 0xf0) >> 4); | ||
107 | clock *= 10; | ||
108 | clock += (mins & 0x0f); | ||
109 | clock *= 6; | ||
110 | |||
111 | clock += ((secs & 0xf0) >> 4); | ||
112 | clock *= 10; | ||
113 | clock += (secs & 0x0f); | ||
114 | |||
115 | peripheral_leds7x4_display_minssecs(clock, 0); | ||
116 | } | ||
117 | |||
118 | void peripheral_leds_led_chase(void) | ||
119 | { | ||
120 | ASB2305_7SEGLEDS = asb2305_led_chase_tbl[asb2305_led_chase]; | ||
121 | asb2305_led_chase++; | ||
122 | if (asb2305_led_chase >= 6) | ||
123 | asb2305_led_chase = 0; | ||
124 | } | ||