diff options
author | Paul Mundt <lethal@linux-sh.org> | 2007-02-13 01:42:28 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2007-02-13 01:42:28 -0500 |
commit | 3b4d9539628502768fe7f8fd4b48f2fbf2426255 (patch) | |
tree | 2bc27b9b57ed3f768a40cedc7c44b95da4025526 /arch/sh/boards/se | |
parent | c7666e72cff1a2793055486340ac5f5137494c08 (diff) |
sh: heartbeat consolidation for banked LEDs.
This consolidates the various board heartbeat LED implementations,
used for strobing the load average across a LED bank. Those boards
not implementing a full bank can hook in via the LED class.
We leave the compat hook in the machvec for now until those non-banked
boards are able to migrate to the drivers/leds.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards/se')
-rw-r--r-- | arch/sh/boards/se/7206/Makefile | 2 | ||||
-rw-r--r-- | arch/sh/boards/se/7206/led.c | 57 | ||||
-rw-r--r-- | arch/sh/boards/se/7206/setup.c | 34 | ||||
-rw-r--r-- | arch/sh/boards/se/7300/Makefile | 2 | ||||
-rw-r--r-- | arch/sh/boards/se/7300/led.c | 54 | ||||
-rw-r--r-- | arch/sh/boards/se/7300/setup.c | 36 | ||||
-rw-r--r-- | arch/sh/boards/se/73180/Makefile | 2 | ||||
-rw-r--r-- | arch/sh/boards/se/73180/led.c | 53 | ||||
-rw-r--r-- | arch/sh/boards/se/73180/setup.c | 31 | ||||
-rw-r--r-- | arch/sh/boards/se/7343/Makefile | 2 | ||||
-rw-r--r-- | arch/sh/boards/se/7343/led.c | 44 | ||||
-rw-r--r-- | arch/sh/boards/se/7343/setup.c | 26 | ||||
-rw-r--r-- | arch/sh/boards/se/770x/Makefile | 1 | ||||
-rw-r--r-- | arch/sh/boards/se/770x/led.c | 52 | ||||
-rw-r--r-- | arch/sh/boards/se/770x/setup.c | 35 | ||||
-rw-r--r-- | arch/sh/boards/se/7751/Makefile | 1 | ||||
-rw-r--r-- | arch/sh/boards/se/7751/led.c | 51 | ||||
-rw-r--r-- | arch/sh/boards/se/7751/setup.c | 36 |
18 files changed, 166 insertions, 353 deletions
diff --git a/arch/sh/boards/se/7206/Makefile b/arch/sh/boards/se/7206/Makefile index 63950f4f2453..63e7ed699f39 100644 --- a/arch/sh/boards/se/7206/Makefile +++ b/arch/sh/boards/se/7206/Makefile | |||
@@ -3,5 +3,3 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := setup.o io.o irq.o | 5 | obj-y := setup.o io.o irq.o |
6 | obj-$(CONFIG_HEARTBEAT) += led.o | ||
7 | |||
diff --git a/arch/sh/boards/se/7206/led.c b/arch/sh/boards/se/7206/led.c deleted file mode 100644 index ef794601ab86..000000000000 --- a/arch/sh/boards/se/7206/led.c +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/kernel/led_se.c | ||
3 | * | ||
4 | * Copyright (C) 2000 Stuart Menefy <stuart.menefy@st.com> | ||
5 | * | ||
6 | * May be copied or modified under the terms of the GNU General Public | ||
7 | * License. See linux/COPYING for more information. | ||
8 | * | ||
9 | * This file contains Solution Engine specific LED code. | ||
10 | */ | ||
11 | |||
12 | #include <linux/config.h> | ||
13 | #include <asm/se7206.h> | ||
14 | |||
15 | #ifdef CONFIG_HEARTBEAT | ||
16 | |||
17 | #include <linux/sched.h> | ||
18 | |||
19 | /* Cycle the LED's in the clasic Knightrider/Sun pattern */ | ||
20 | void heartbeat_se(void) | ||
21 | { | ||
22 | static unsigned int cnt = 0, period = 0; | ||
23 | volatile unsigned short* p = (volatile unsigned short*)PA_LED; | ||
24 | static unsigned bit = 0, up = 1; | ||
25 | |||
26 | cnt += 1; | ||
27 | if (cnt < period) { | ||
28 | return; | ||
29 | } | ||
30 | |||
31 | cnt = 0; | ||
32 | |||
33 | /* Go through the points (roughly!): | ||
34 | * f(0)=10, f(1)=16, f(2)=20, f(5)=35,f(inf)->110 | ||
35 | */ | ||
36 | period = 110 - ( (300<<FSHIFT)/ | ||
37 | ((avenrun[0]/5) + (3<<FSHIFT)) ); | ||
38 | |||
39 | if (up) { | ||
40 | if (bit == 7) { | ||
41 | bit--; | ||
42 | up=0; | ||
43 | } else { | ||
44 | bit ++; | ||
45 | } | ||
46 | } else { | ||
47 | if (bit == 0) { | ||
48 | bit++; | ||
49 | up=1; | ||
50 | } else { | ||
51 | bit--; | ||
52 | } | ||
53 | } | ||
54 | *p = 1<<(bit+8); | ||
55 | |||
56 | } | ||
57 | #endif /* CONFIG_HEARTBEAT */ | ||
diff --git a/arch/sh/boards/se/7206/setup.c b/arch/sh/boards/se/7206/setup.c index 0f42e91a3238..ca714879f559 100644 --- a/arch/sh/boards/se/7206/setup.c +++ b/arch/sh/boards/se/7206/setup.c | |||
@@ -3,6 +3,7 @@ | |||
3 | * linux/arch/sh/boards/se/7206/setup.c | 3 | * linux/arch/sh/boards/se/7206/setup.c |
4 | * | 4 | * |
5 | * Copyright (C) 2006 Yoshinori Sato | 5 | * Copyright (C) 2006 Yoshinori Sato |
6 | * Copyright (C) 2007 Paul Mundt | ||
6 | * | 7 | * |
7 | * Hitachi 7206 SolutionEngine Support. | 8 | * Hitachi 7206 SolutionEngine Support. |
8 | * | 9 | * |
@@ -34,15 +35,37 @@ static struct platform_device smc91x_device = { | |||
34 | .resource = smc91x_resources, | 35 | .resource = smc91x_resources, |
35 | }; | 36 | }; |
36 | 37 | ||
38 | static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 }; | ||
39 | |||
40 | static struct resource heartbeat_resources[] = { | ||
41 | [0] = { | ||
42 | .start = PA_LED, | ||
43 | .end = PA_LED + ARRAY_SIZE(heartbeat_bit_pos) - 1, | ||
44 | .flags = IORESOURCE_MEM, | ||
45 | }, | ||
46 | }; | ||
47 | |||
48 | static struct platform_device heartbeat_device = { | ||
49 | .name = "heartbeat", | ||
50 | .id = -1, | ||
51 | .dev = { | ||
52 | .platform_data = heartbeat_bit_pos, | ||
53 | }, | ||
54 | .num_resources = ARRAY_SIZE(heartbeat_resources), | ||
55 | .resource = heartbeat_resources, | ||
56 | }; | ||
57 | |||
58 | static struct platform_device *se7206_devices[] __initdata = { | ||
59 | &smc91x_device, | ||
60 | &heartbeat_device, | ||
61 | }; | ||
62 | |||
37 | static int __init se7206_devices_setup(void) | 63 | static int __init se7206_devices_setup(void) |
38 | { | 64 | { |
39 | return platform_device_register(&smc91x_device); | 65 | return platform_add_devices(se7206_devices, ARRAY_SIZE(se7206_devices)); |
40 | } | 66 | } |
41 | |||
42 | __initcall(se7206_devices_setup); | 67 | __initcall(se7206_devices_setup); |
43 | 68 | ||
44 | void heartbeat_se(void); | ||
45 | |||
46 | /* | 69 | /* |
47 | * The Machine Vector | 70 | * The Machine Vector |
48 | */ | 71 | */ |
@@ -72,8 +95,5 @@ struct sh_machine_vector mv_se __initmv = { | |||
72 | .mv_outsl = se7206_outsl, | 95 | .mv_outsl = se7206_outsl, |
73 | 96 | ||
74 | .mv_init_irq = init_se7206_IRQ, | 97 | .mv_init_irq = init_se7206_IRQ, |
75 | #ifdef CONFIG_HEARTBEAT | ||
76 | .mv_heartbeat = heartbeat_se, | ||
77 | #endif | ||
78 | }; | 98 | }; |
79 | ALIAS_MV(se) | 99 | ALIAS_MV(se) |
diff --git a/arch/sh/boards/se/7300/Makefile b/arch/sh/boards/se/7300/Makefile index 0fbd4f47815c..46247368f14b 100644 --- a/arch/sh/boards/se/7300/Makefile +++ b/arch/sh/boards/se/7300/Makefile | |||
@@ -3,5 +3,3 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := setup.o io.o irq.o | 5 | obj-y := setup.o io.o irq.o |
6 | |||
7 | obj-$(CONFIG_HEARTBEAT) += led.o | ||
diff --git a/arch/sh/boards/se/7300/led.c b/arch/sh/boards/se/7300/led.c deleted file mode 100644 index 4d03bb7774be..000000000000 --- a/arch/sh/boards/se/7300/led.c +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/se/7300/led.c | ||
3 | * | ||
4 | * Derived from linux/arch/sh/boards/se/770x/led.c | ||
5 | * | ||
6 | * Copyright (C) 2000 Stuart Menefy <stuart.menefy@st.com> | ||
7 | * | ||
8 | * May be copied or modified under the terms of the GNU General Public | ||
9 | * License. See linux/COPYING for more information. | ||
10 | * | ||
11 | * This file contains Solution Engine specific LED code. | ||
12 | */ | ||
13 | |||
14 | #include <linux/sched.h> | ||
15 | #include <asm/se7300.h> | ||
16 | |||
17 | /* Cycle the LED's in the clasic Knightrider/Sun pattern */ | ||
18 | void heartbeat_7300se(void) | ||
19 | { | ||
20 | static unsigned int cnt = 0, period = 0; | ||
21 | volatile unsigned short *p = (volatile unsigned short *) PA_LED; | ||
22 | static unsigned bit = 0, up = 1; | ||
23 | |||
24 | cnt += 1; | ||
25 | if (cnt < period) { | ||
26 | return; | ||
27 | } | ||
28 | |||
29 | cnt = 0; | ||
30 | |||
31 | /* Go through the points (roughly!): | ||
32 | * f(0)=10, f(1)=16, f(2)=20, f(5)=35,f(inf)->110 | ||
33 | */ | ||
34 | period = 110 - ((300 << FSHIFT) / ((avenrun[0] / 5) + (3 << FSHIFT))); | ||
35 | |||
36 | if (up) { | ||
37 | if (bit == 7) { | ||
38 | bit--; | ||
39 | up = 0; | ||
40 | } else { | ||
41 | bit++; | ||
42 | } | ||
43 | } else { | ||
44 | if (bit == 0) { | ||
45 | bit++; | ||
46 | up = 1; | ||
47 | } else { | ||
48 | bit--; | ||
49 | } | ||
50 | } | ||
51 | *p = 1 << (bit + 8); | ||
52 | |||
53 | } | ||
54 | |||
diff --git a/arch/sh/boards/se/7300/setup.c b/arch/sh/boards/se/7300/setup.c index 6f082a722d42..f1960956bad0 100644 --- a/arch/sh/boards/se/7300/setup.c +++ b/arch/sh/boards/se/7300/setup.c | |||
@@ -6,14 +6,43 @@ | |||
6 | * SH-Mobile SolutionEngine 7300 Support. | 6 | * SH-Mobile SolutionEngine 7300 Support. |
7 | * | 7 | * |
8 | */ | 8 | */ |
9 | |||
10 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/platform_device.h> | ||
11 | #include <asm/machvec.h> | 11 | #include <asm/machvec.h> |
12 | #include <asm/se7300.h> | 12 | #include <asm/se7300.h> |
13 | 13 | ||
14 | void heartbeat_7300se(void); | ||
15 | void init_7300se_IRQ(void); | 14 | void init_7300se_IRQ(void); |
16 | 15 | ||
16 | static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 }; | ||
17 | |||
18 | static struct resource heartbeat_resources[] = { | ||
19 | [0] = { | ||
20 | .start = PA_LED, | ||
21 | .end = PA_LED + ARRAY_SIZE(heartbeat_bit_pos) - 1, | ||
22 | .flags = IORESOURCE_MEM, | ||
23 | }, | ||
24 | }; | ||
25 | |||
26 | static struct platform_device heartbeat_device = { | ||
27 | .name = "heartbeat", | ||
28 | .id = -1, | ||
29 | .dev = { | ||
30 | .platform_data = heartbeat_bit_pos, | ||
31 | }, | ||
32 | .num_resources = ARRAY_SIZE(heartbeat_resources), | ||
33 | .resource = heartbeat_resources, | ||
34 | }; | ||
35 | |||
36 | static struct platform_device *se7300_devices[] __initdata = { | ||
37 | &heartbeat_device, | ||
38 | }; | ||
39 | |||
40 | static int __init se7300_devices_setup(void) | ||
41 | { | ||
42 | return platform_add_devices(se7300_devices, ARRAY_SIZE(se7300_devices)); | ||
43 | } | ||
44 | __initcall(se7300_devices_setup); | ||
45 | |||
17 | /* | 46 | /* |
18 | * The Machine Vector | 47 | * The Machine Vector |
19 | */ | 48 | */ |
@@ -42,8 +71,5 @@ struct sh_machine_vector mv_7300se __initmv = { | |||
42 | .mv_outsl = sh7300se_outsl, | 71 | .mv_outsl = sh7300se_outsl, |
43 | 72 | ||
44 | .mv_init_irq = init_7300se_IRQ, | 73 | .mv_init_irq = init_7300se_IRQ, |
45 | #ifdef CONFIG_HEARTBEAT | ||
46 | .mv_heartbeat = heartbeat_7300se, | ||
47 | #endif | ||
48 | }; | 74 | }; |
49 | ALIAS_MV(7300se) | 75 | ALIAS_MV(7300se) |
diff --git a/arch/sh/boards/se/73180/Makefile b/arch/sh/boards/se/73180/Makefile index 8f63886a0f3f..e7c09967c529 100644 --- a/arch/sh/boards/se/73180/Makefile +++ b/arch/sh/boards/se/73180/Makefile | |||
@@ -3,5 +3,3 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := setup.o io.o irq.o | 5 | obj-y := setup.o io.o irq.o |
6 | |||
7 | obj-$(CONFIG_HEARTBEAT) += led.o | ||
diff --git a/arch/sh/boards/se/73180/led.c b/arch/sh/boards/se/73180/led.c deleted file mode 100644 index 4b72e9a3ead9..000000000000 --- a/arch/sh/boards/se/73180/led.c +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | /* | ||
2 | * arch/sh/boards/se/73180/led.c | ||
3 | * | ||
4 | * Derived from arch/sh/boards/se/770x/led.c | ||
5 | * | ||
6 | * Copyright (C) 2000 Stuart Menefy <stuart.menefy@st.com> | ||
7 | * | ||
8 | * May be copied or modified under the terms of the GNU General Public | ||
9 | * License. See linux/COPYING for more information. | ||
10 | * | ||
11 | * This file contains Solution Engine specific LED code. | ||
12 | */ | ||
13 | |||
14 | #include <linux/sched.h> | ||
15 | #include <asm/mach/se73180.h> | ||
16 | |||
17 | /* Cycle the LED's in the clasic Knightrider/Sun pattern */ | ||
18 | void heartbeat_73180se(void) | ||
19 | { | ||
20 | static unsigned int cnt = 0, period = 0; | ||
21 | volatile unsigned short *p = (volatile unsigned short *) PA_LED; | ||
22 | static unsigned bit = 0, up = 1; | ||
23 | |||
24 | cnt += 1; | ||
25 | if (cnt < period) { | ||
26 | return; | ||
27 | } | ||
28 | |||
29 | cnt = 0; | ||
30 | |||
31 | /* Go through the points (roughly!): | ||
32 | * f(0)=10, f(1)=16, f(2)=20, f(5)=35,f(inf)->110 | ||
33 | */ | ||
34 | period = 110 - ((300 << FSHIFT) / ((avenrun[0] / 5) + (3 << FSHIFT))); | ||
35 | |||
36 | if (up) { | ||
37 | if (bit == 7) { | ||
38 | bit--; | ||
39 | up = 0; | ||
40 | } else { | ||
41 | bit++; | ||
42 | } | ||
43 | } else { | ||
44 | if (bit == 0) { | ||
45 | bit++; | ||
46 | up = 1; | ||
47 | } else { | ||
48 | bit--; | ||
49 | } | ||
50 | } | ||
51 | *p = 1 << (bit + LED_SHIFT); | ||
52 | |||
53 | } | ||
diff --git a/arch/sh/boards/se/73180/setup.c b/arch/sh/boards/se/73180/setup.c index b38ef50a160a..911ce1cdbd7f 100644 --- a/arch/sh/boards/se/73180/setup.c +++ b/arch/sh/boards/se/73180/setup.c | |||
@@ -10,13 +10,39 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/platform_device.h> | ||
13 | #include <asm/machvec.h> | 14 | #include <asm/machvec.h> |
14 | #include <asm/se73180.h> | 15 | #include <asm/se73180.h> |
15 | #include <asm/irq.h> | 16 | #include <asm/irq.h> |
16 | 17 | ||
17 | void heartbeat_73180se(void); | ||
18 | void init_73180se_IRQ(void); | 18 | void init_73180se_IRQ(void); |
19 | 19 | ||
20 | static struct resource heartbeat_resources[] = { | ||
21 | [0] = { | ||
22 | .start = PA_LED, | ||
23 | .end = PA_LED + 8 - 1, | ||
24 | .flags = IORESOURCE_MEM, | ||
25 | }, | ||
26 | }; | ||
27 | |||
28 | static struct platform_device heartbeat_device = { | ||
29 | .name = "heartbeat", | ||
30 | .id = -1, | ||
31 | .num_resources = ARRAY_SIZE(heartbeat_resources), | ||
32 | .resource = heartbeat_resources, | ||
33 | }; | ||
34 | |||
35 | static struct platform_device *se73180_devices[] __initdata = { | ||
36 | &heartbeat_device, | ||
37 | }; | ||
38 | |||
39 | static int __init se73180_devices_setup(void) | ||
40 | { | ||
41 | return platform_add_devices(sh7343se_platform_devices, | ||
42 | ARRAY_SIZE(sh7343se_platform_devices)); | ||
43 | } | ||
44 | __initcall(se73180_devices_setup); | ||
45 | |||
20 | /* | 46 | /* |
21 | * The Machine Vector | 47 | * The Machine Vector |
22 | */ | 48 | */ |
@@ -46,8 +72,5 @@ struct sh_machine_vector mv_73180se __initmv = { | |||
46 | 72 | ||
47 | .mv_init_irq = init_73180se_IRQ, | 73 | .mv_init_irq = init_73180se_IRQ, |
48 | .mv_irq_demux = shmse_irq_demux, | 74 | .mv_irq_demux = shmse_irq_demux, |
49 | #ifdef CONFIG_HEARTBEAT | ||
50 | .mv_heartbeat = heartbeat_73180se, | ||
51 | #endif | ||
52 | }; | 75 | }; |
53 | ALIAS_MV(73180se) | 76 | ALIAS_MV(73180se) |
diff --git a/arch/sh/boards/se/7343/Makefile b/arch/sh/boards/se/7343/Makefile index 4291069c0b4f..3024796c6203 100644 --- a/arch/sh/boards/se/7343/Makefile +++ b/arch/sh/boards/se/7343/Makefile | |||
@@ -3,5 +3,3 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := setup.o io.o irq.o | 5 | obj-y := setup.o io.o irq.o |
6 | |||
7 | obj-$(CONFIG_HEARTBEAT) += led.o | ||
diff --git a/arch/sh/boards/se/7343/led.c b/arch/sh/boards/se/7343/led.c deleted file mode 100644 index 6b39e191c420..000000000000 --- a/arch/sh/boards/se/7343/led.c +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | /* | ||
2 | * arch/sh/boards/se/7343/led.c | ||
3 | * | ||
4 | */ | ||
5 | #include <linux/sched.h> | ||
6 | #include <asm/mach/se7343.h> | ||
7 | |||
8 | /* Cycle the LED's in the clasic Knightrider/Sun pattern */ | ||
9 | void heartbeat_7343se(void) | ||
10 | { | ||
11 | static unsigned int cnt = 0, period = 0; | ||
12 | volatile unsigned short *p = (volatile unsigned short *) PA_LED; | ||
13 | static unsigned bit = 0, up = 1; | ||
14 | |||
15 | cnt += 1; | ||
16 | if (cnt < period) { | ||
17 | return; | ||
18 | } | ||
19 | |||
20 | cnt = 0; | ||
21 | |||
22 | /* Go through the points (roughly!): | ||
23 | * f(0)=10, f(1)=16, f(2)=20, f(5)=35,f(inf)->110 | ||
24 | */ | ||
25 | period = 110 - ((300 << FSHIFT) / ((avenrun[0] / 5) + (3 << FSHIFT))); | ||
26 | |||
27 | if (up) { | ||
28 | if (bit == 7) { | ||
29 | bit--; | ||
30 | up = 0; | ||
31 | } else { | ||
32 | bit++; | ||
33 | } | ||
34 | } else { | ||
35 | if (bit == 0) { | ||
36 | bit++; | ||
37 | up = 1; | ||
38 | } else { | ||
39 | bit--; | ||
40 | } | ||
41 | } | ||
42 | *p = 1 << (bit + LED_SHIFT); | ||
43 | |||
44 | } | ||
diff --git a/arch/sh/boards/se/7343/setup.c b/arch/sh/boards/se/7343/setup.c index c7d17fe7764e..3fdb16f2cef1 100644 --- a/arch/sh/boards/se/7343/setup.c +++ b/arch/sh/boards/se/7343/setup.c | |||
@@ -4,7 +4,6 @@ | |||
4 | #include <asm/mach/se7343.h> | 4 | #include <asm/mach/se7343.h> |
5 | #include <asm/irq.h> | 5 | #include <asm/irq.h> |
6 | 6 | ||
7 | void heartbeat_7343se(void); | ||
8 | void init_7343se_IRQ(void); | 7 | void init_7343se_IRQ(void); |
9 | 8 | ||
10 | static struct resource smc91x_resources[] = { | 9 | static struct resource smc91x_resources[] = { |
@@ -31,14 +30,30 @@ static struct platform_device smc91x_device = { | |||
31 | .resource = smc91x_resources, | 30 | .resource = smc91x_resources, |
32 | }; | 31 | }; |
33 | 32 | ||
34 | static struct platform_device *smc91x_platform_devices[] __initdata = { | 33 | static struct resource heartbeat_resources[] = { |
34 | [0] = { | ||
35 | .start = PA_LED, | ||
36 | .end = PA_LED + 8 - 1, | ||
37 | .flags = IORESOURCE_MEM, | ||
38 | }, | ||
39 | }; | ||
40 | |||
41 | static struct platform_device heartbeat_device = { | ||
42 | .name = "heartbeat", | ||
43 | .id = -1, | ||
44 | .num_resources = ARRAY_SIZE(heartbeat_resources), | ||
45 | .resource = heartbeat_resources, | ||
46 | }; | ||
47 | |||
48 | static struct platform_device *sh7343se_platform_devices[] __initdata = { | ||
35 | &smc91x_device, | 49 | &smc91x_device, |
50 | &heartbeat_device, | ||
36 | }; | 51 | }; |
37 | 52 | ||
38 | static int __init sh7343se_devices_setup(void) | 53 | static int __init sh7343se_devices_setup(void) |
39 | { | 54 | { |
40 | return platform_add_devices(smc91x_platform_devices, | 55 | return platform_add_devices(sh7343se_platform_devices, |
41 | ARRAY_SIZE(smc91x_platform_devices)); | 56 | ARRAY_SIZE(sh7343se_platform_devices)); |
42 | } | 57 | } |
43 | 58 | ||
44 | static void __init sh7343se_setup(char **cmdline_p) | 59 | static void __init sh7343se_setup(char **cmdline_p) |
@@ -76,8 +91,5 @@ struct sh_machine_vector mv_7343se __initmv = { | |||
76 | 91 | ||
77 | .mv_init_irq = init_7343se_IRQ, | 92 | .mv_init_irq = init_7343se_IRQ, |
78 | .mv_irq_demux = shmse_irq_demux, | 93 | .mv_irq_demux = shmse_irq_demux, |
79 | #ifdef CONFIG_HEARTBEAT | ||
80 | .mv_heartbeat = heartbeat_7343se, | ||
81 | #endif | ||
82 | }; | 94 | }; |
83 | ALIAS_MV(7343se) | 95 | ALIAS_MV(7343se) |
diff --git a/arch/sh/boards/se/770x/Makefile b/arch/sh/boards/se/770x/Makefile index 9a5035f80ec0..8e624b06d5ea 100644 --- a/arch/sh/boards/se/770x/Makefile +++ b/arch/sh/boards/se/770x/Makefile | |||
@@ -3,4 +3,3 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := setup.o io.o irq.o | 5 | obj-y := setup.o io.o irq.o |
6 | obj-$(CONFIG_HEARTBEAT) += led.o | ||
diff --git a/arch/sh/boards/se/770x/led.c b/arch/sh/boards/se/770x/led.c deleted file mode 100644 index d93dd831b2ad..000000000000 --- a/arch/sh/boards/se/770x/led.c +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/se/770x/led.c | ||
3 | * | ||
4 | * Copyright (C) 2000 Stuart Menefy <stuart.menefy@st.com> | ||
5 | * | ||
6 | * May be copied or modified under the terms of the GNU General Public | ||
7 | * License. See linux/COPYING for more information. | ||
8 | * | ||
9 | * This file contains Solution Engine specific LED code. | ||
10 | */ | ||
11 | |||
12 | #include <linux/sched.h> | ||
13 | #include <asm/se.h> | ||
14 | |||
15 | /* Cycle the LED's in the clasic Knightrider/Sun pattern */ | ||
16 | void heartbeat_se(void) | ||
17 | { | ||
18 | static unsigned int cnt = 0, period = 0; | ||
19 | volatile unsigned short* p = (volatile unsigned short*)PA_LED; | ||
20 | static unsigned bit = 0, up = 1; | ||
21 | |||
22 | cnt += 1; | ||
23 | if (cnt < period) { | ||
24 | return; | ||
25 | } | ||
26 | |||
27 | cnt = 0; | ||
28 | |||
29 | /* Go through the points (roughly!): | ||
30 | * f(0)=10, f(1)=16, f(2)=20, f(5)=35,f(inf)->110 | ||
31 | */ | ||
32 | period = 110 - ( (300<<FSHIFT)/ | ||
33 | ((avenrun[0]/5) + (3<<FSHIFT)) ); | ||
34 | |||
35 | if (up) { | ||
36 | if (bit == 7) { | ||
37 | bit--; | ||
38 | up=0; | ||
39 | } else { | ||
40 | bit ++; | ||
41 | } | ||
42 | } else { | ||
43 | if (bit == 0) { | ||
44 | bit++; | ||
45 | up=1; | ||
46 | } else { | ||
47 | bit--; | ||
48 | } | ||
49 | } | ||
50 | *p = 1<<(bit+8); | ||
51 | |||
52 | } | ||
diff --git a/arch/sh/boards/se/770x/setup.c b/arch/sh/boards/se/770x/setup.c index 84f2e4857c63..45cbc36b9fb7 100644 --- a/arch/sh/boards/se/770x/setup.c +++ b/arch/sh/boards/se/770x/setup.c | |||
@@ -7,12 +7,12 @@ | |||
7 | * | 7 | * |
8 | */ | 8 | */ |
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/platform_device.h> | ||
10 | #include <asm/machvec.h> | 11 | #include <asm/machvec.h> |
11 | #include <asm/se.h> | 12 | #include <asm/se.h> |
12 | #include <asm/io.h> | 13 | #include <asm/io.h> |
13 | #include <asm/smc37c93x.h> | 14 | #include <asm/smc37c93x.h> |
14 | 15 | ||
15 | void heartbeat_se(void); | ||
16 | void init_se_IRQ(void); | 16 | void init_se_IRQ(void); |
17 | 17 | ||
18 | /* | 18 | /* |
@@ -63,6 +63,36 @@ static void __init smsc_setup(char **cmdline_p) | |||
63 | outb_p(CONFIG_EXIT, CONFIG_PORT); | 63 | outb_p(CONFIG_EXIT, CONFIG_PORT); |
64 | } | 64 | } |
65 | 65 | ||
66 | static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 }; | ||
67 | |||
68 | static struct resource heartbeat_resources[] = { | ||
69 | [0] = { | ||
70 | .start = PA_LED, | ||
71 | .end = PA_LED + ARRAY_SIZE(heartbeat_bit_pos) - 1, | ||
72 | .flags = IORESOURCE_MEM, | ||
73 | }, | ||
74 | }; | ||
75 | |||
76 | static struct platform_device heartbeat_device = { | ||
77 | .name = "heartbeat", | ||
78 | .id = -1, | ||
79 | .dev = { | ||
80 | .platform_data = heartbeat_bit_pos, | ||
81 | }, | ||
82 | .num_resources = ARRAY_SIZE(heartbeat_resources), | ||
83 | .resource = heartbeat_resources, | ||
84 | }; | ||
85 | |||
86 | static struct platform_device *se_devices[] __initdata = { | ||
87 | &heartbeat_device, | ||
88 | }; | ||
89 | |||
90 | static int __init se_devices_setup(void) | ||
91 | { | ||
92 | return platform_add_devices(se_devices, ARRAY_SIZE(se_devices)); | ||
93 | } | ||
94 | __initcall(se_devices_setup); | ||
95 | |||
66 | /* | 96 | /* |
67 | * The Machine Vector | 97 | * The Machine Vector |
68 | */ | 98 | */ |
@@ -101,8 +131,5 @@ struct sh_machine_vector mv_se __initmv = { | |||
101 | .mv_outsl = se_outsl, | 131 | .mv_outsl = se_outsl, |
102 | 132 | ||
103 | .mv_init_irq = init_se_IRQ, | 133 | .mv_init_irq = init_se_IRQ, |
104 | #ifdef CONFIG_HEARTBEAT | ||
105 | .mv_heartbeat = heartbeat_se, | ||
106 | #endif | ||
107 | }; | 134 | }; |
108 | ALIAS_MV(se) | 135 | ALIAS_MV(se) |
diff --git a/arch/sh/boards/se/7751/Makefile b/arch/sh/boards/se/7751/Makefile index 188900c48321..dbc29f3a9de5 100644 --- a/arch/sh/boards/se/7751/Makefile +++ b/arch/sh/boards/se/7751/Makefile | |||
@@ -5,4 +5,3 @@ | |||
5 | obj-y := setup.o io.o irq.o | 5 | obj-y := setup.o io.o irq.o |
6 | 6 | ||
7 | obj-$(CONFIG_PCI) += pci.o | 7 | obj-$(CONFIG_PCI) += pci.o |
8 | obj-$(CONFIG_HEARTBEAT) += led.o | ||
diff --git a/arch/sh/boards/se/7751/led.c b/arch/sh/boards/se/7751/led.c deleted file mode 100644 index de4194d97c88..000000000000 --- a/arch/sh/boards/se/7751/led.c +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/se/7751/led.c | ||
3 | * | ||
4 | * Copyright (C) 2000 Stuart Menefy <stuart.menefy@st.com> | ||
5 | * | ||
6 | * May be copied or modified under the terms of the GNU General Public | ||
7 | * License. See linux/COPYING for more information. | ||
8 | * | ||
9 | * This file contains Solution Engine specific LED code. | ||
10 | */ | ||
11 | #include <linux/sched.h> | ||
12 | #include <asm/se7751.h> | ||
13 | |||
14 | /* Cycle the LED's in the clasic Knightrider/Sun pattern */ | ||
15 | void heartbeat_7751se(void) | ||
16 | { | ||
17 | static unsigned int cnt = 0, period = 0; | ||
18 | volatile unsigned short* p = (volatile unsigned short*)PA_LED; | ||
19 | static unsigned bit = 0, up = 1; | ||
20 | |||
21 | cnt += 1; | ||
22 | if (cnt < period) { | ||
23 | return; | ||
24 | } | ||
25 | |||
26 | cnt = 0; | ||
27 | |||
28 | /* Go through the points (roughly!): | ||
29 | * f(0)=10, f(1)=16, f(2)=20, f(5)=35,f(inf)->110 | ||
30 | */ | ||
31 | period = 110 - ( (300<<FSHIFT)/ | ||
32 | ((avenrun[0]/5) + (3<<FSHIFT)) ); | ||
33 | |||
34 | if (up) { | ||
35 | if (bit == 7) { | ||
36 | bit--; | ||
37 | up=0; | ||
38 | } else { | ||
39 | bit ++; | ||
40 | } | ||
41 | } else { | ||
42 | if (bit == 0) { | ||
43 | bit++; | ||
44 | up=1; | ||
45 | } else { | ||
46 | bit--; | ||
47 | } | ||
48 | } | ||
49 | *p = 1<<(bit+8); | ||
50 | |||
51 | } | ||
diff --git a/arch/sh/boards/se/7751/setup.c b/arch/sh/boards/se/7751/setup.c index f7e1dd39c836..e3feae6ec0bf 100644 --- a/arch/sh/boards/se/7751/setup.c +++ b/arch/sh/boards/se/7751/setup.c | |||
@@ -9,11 +9,11 @@ | |||
9 | * Ian da Silva and Jeremy Siegel, 2001. | 9 | * Ian da Silva and Jeremy Siegel, 2001. |
10 | */ | 10 | */ |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/platform_device.h> | ||
12 | #include <asm/machvec.h> | 13 | #include <asm/machvec.h> |
13 | #include <asm/se7751.h> | 14 | #include <asm/se7751.h> |
14 | #include <asm/io.h> | 15 | #include <asm/io.h> |
15 | 16 | ||
16 | void heartbeat_7751se(void); | ||
17 | void init_7751se_IRQ(void); | 17 | void init_7751se_IRQ(void); |
18 | 18 | ||
19 | #ifdef CONFIG_SH_KGDB | 19 | #ifdef CONFIG_SH_KGDB |
@@ -161,11 +161,40 @@ static int kgdb_uart_setup(void) | |||
161 | } | 161 | } |
162 | #endif /* CONFIG_SH_KGDB */ | 162 | #endif /* CONFIG_SH_KGDB */ |
163 | 163 | ||
164 | static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 }; | ||
165 | |||
166 | static struct resource heartbeat_resources[] = { | ||
167 | [0] = { | ||
168 | .start = PA_LED, | ||
169 | .end = PA_LED + ARRAY_SIZE(heartbeat_bit_pos) - 1, | ||
170 | .flags = IORESOURCE_MEM, | ||
171 | }, | ||
172 | }; | ||
173 | |||
174 | static struct platform_device heartbeat_device = { | ||
175 | .name = "heartbeat", | ||
176 | .id = -1, | ||
177 | .dev = { | ||
178 | .platform_data = heartbeat_bit_pos, | ||
179 | }, | ||
180 | .num_resources = ARRAY_SIZE(heartbeat_resources), | ||
181 | .resource = heartbeat_resources, | ||
182 | }; | ||
183 | |||
184 | static struct platform_device *se7751_devices[] __initdata = { | ||
185 | &smc91x_device, | ||
186 | &heartbeat_device, | ||
187 | }; | ||
188 | |||
189 | static int __init se7751_devices_setup(void) | ||
190 | { | ||
191 | return platform_add_devices(se7751_devices, ARRAY_SIZE(se7751_devices)); | ||
192 | } | ||
193 | __initcall(se7751_devices_setup); | ||
164 | 194 | ||
165 | /* | 195 | /* |
166 | * The Machine Vector | 196 | * The Machine Vector |
167 | */ | 197 | */ |
168 | |||
169 | struct sh_machine_vector mv_7751se __initmv = { | 198 | struct sh_machine_vector mv_7751se __initmv = { |
170 | .mv_name = "7751 SolutionEngine", | 199 | .mv_name = "7751 SolutionEngine", |
171 | .mv_setup = sh7751se_setup, | 200 | .mv_setup = sh7751se_setup, |
@@ -189,8 +218,5 @@ struct sh_machine_vector mv_7751se __initmv = { | |||
189 | .mv_outsl = sh7751se_outsl, | 218 | .mv_outsl = sh7751se_outsl, |
190 | 219 | ||
191 | .mv_init_irq = init_7751se_IRQ, | 220 | .mv_init_irq = init_7751se_IRQ, |
192 | #ifdef CONFIG_HEARTBEAT | ||
193 | .mv_heartbeat = heartbeat_7751se, | ||
194 | #endif | ||
195 | }; | 221 | }; |
196 | ALIAS_MV(7751se) | 222 | ALIAS_MV(7751se) |