aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/mpc1211/led.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/boards/mpc1211/led.c')
-rw-r--r--arch/sh/boards/mpc1211/led.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/arch/sh/boards/mpc1211/led.c b/arch/sh/boards/mpc1211/led.c
new file mode 100644
index 000000000000..0a31beec3465
--- /dev/null
+++ b/arch/sh/boards/mpc1211/led.c
@@ -0,0 +1,64 @@
1/*
2 * linux/arch/sh/kernel/led_mpc1211.c
3 *
4 * Copyright (C) 2001 Saito.K & Jeanne
5 *
6 * This file contains Interface MPC-1211 specific LED code.
7 */
8
9#include <linux/config.h>
10
11static void mach_led(int position, int value)
12{
13 volatile unsigned char* p = (volatile unsigned char*)0xa2000000;
14
15 if (value) {
16 *p |= 1;
17 } else {
18 *p &= ~1;
19 }
20}
21
22#ifdef CONFIG_HEARTBEAT
23
24#include <linux/sched.h>
25
26/* Cycle the LED's in the clasic Knightrider/Sun pattern */
27void heartbeat_mpc1211(void)
28{
29 static unsigned int cnt = 0, period = 0;
30 volatile unsigned char* p = (volatile unsigned char*)0xa2000000;
31 static unsigned bit = 0, up = 1;
32
33 cnt += 1;
34 if (cnt < period) {
35 return;
36 }
37
38 cnt = 0;
39
40 /* Go through the points (roughly!):
41 * f(0)=10, f(1)=16, f(2)=20, f(5)=35,f(inf)->110
42 */
43 period = 110 - ( (300<<FSHIFT)/
44 ((avenrun[0]/5) + (3<<FSHIFT)) );
45
46 if (up) {
47 if (bit == 7) {
48 bit--;
49 up=0;
50 } else {
51 bit ++;
52 }
53 } else {
54 if (bit == 0) {
55 bit++;
56 up=1;
57 } else {
58 bit--;
59 }
60 }
61 *p = 1<<bit;
62
63}
64#endif /* CONFIG_HEARTBEAT */