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 | |
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')
30 files changed, 257 insertions, 570 deletions
diff --git a/arch/sh/boards/mpc1211/Makefile b/arch/sh/boards/mpc1211/Makefile index 1644ebed78cb..8cd31b5d200b 100644 --- a/arch/sh/boards/mpc1211/Makefile +++ b/arch/sh/boards/mpc1211/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for the Interface (CTP/PCI/MPC-SH02) specific parts of the kernel | 2 | # Makefile for the Interface (CTP/PCI/MPC-SH02) specific parts of the kernel |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := setup.o rtc.o led.o | 5 | obj-y := setup.o rtc.o |
6 | 6 | ||
7 | obj-$(CONFIG_PCI) += pci.o | 7 | obj-$(CONFIG_PCI) += pci.o |
8 | 8 | ||
diff --git a/arch/sh/boards/mpc1211/led.c b/arch/sh/boards/mpc1211/led.c deleted file mode 100644 index 8df1591823d6..000000000000 --- a/arch/sh/boards/mpc1211/led.c +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/mpc1211/led.c | ||
3 | * | ||
4 | * Copyright (C) 2001 Saito.K & Jeanne | ||
5 | * | ||
6 | * This file contains Interface MPC-1211 specific LED code. | ||
7 | */ | ||
8 | |||
9 | |||
10 | static void mach_led(int position, int value) | ||
11 | { | ||
12 | volatile unsigned char* p = (volatile unsigned char*)0xa2000000; | ||
13 | |||
14 | if (value) { | ||
15 | *p |= 1; | ||
16 | } else { | ||
17 | *p &= ~1; | ||
18 | } | ||
19 | } | ||
20 | |||
21 | #ifdef CONFIG_HEARTBEAT | ||
22 | |||
23 | #include <linux/sched.h> | ||
24 | |||
25 | /* Cycle the LED's in the clasic Knightrider/Sun pattern */ | ||
26 | void heartbeat_mpc1211(void) | ||
27 | { | ||
28 | static unsigned int cnt = 0, period = 0; | ||
29 | volatile unsigned char* p = (volatile unsigned char*)0xa2000000; | ||
30 | static unsigned bit = 0, up = 1; | ||
31 | |||
32 | cnt += 1; | ||
33 | if (cnt < period) { | ||
34 | return; | ||
35 | } | ||
36 | |||
37 | cnt = 0; | ||
38 | |||
39 | /* Go through the points (roughly!): | ||
40 | * f(0)=10, f(1)=16, f(2)=20, f(5)=35,f(inf)->110 | ||
41 | */ | ||
42 | period = 110 - ( (300<<FSHIFT)/ | ||
43 | ((avenrun[0]/5) + (3<<FSHIFT)) ); | ||
44 | |||
45 | if (up) { | ||
46 | if (bit == 7) { | ||
47 | bit--; | ||
48 | up=0; | ||
49 | } else { | ||
50 | bit ++; | ||
51 | } | ||
52 | } else { | ||
53 | if (bit == 0) { | ||
54 | bit++; | ||
55 | up=1; | ||
56 | } else { | ||
57 | bit--; | ||
58 | } | ||
59 | } | ||
60 | *p = 1<<bit; | ||
61 | |||
62 | } | ||
63 | #endif /* CONFIG_HEARTBEAT */ | ||
diff --git a/arch/sh/boards/mpc1211/setup.c b/arch/sh/boards/mpc1211/setup.c index 7c3d1d304157..1a0604b23ce0 100644 --- a/arch/sh/boards/mpc1211/setup.c +++ b/arch/sh/boards/mpc1211/setup.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/hdreg.h> | 10 | #include <linux/hdreg.h> |
11 | #include <linux/ide.h> | 11 | #include <linux/ide.h> |
12 | #include <linux/interrupt.h> | 12 | #include <linux/interrupt.h> |
13 | #include <linux/platform_device.h> | ||
13 | #include <asm/io.h> | 14 | #include <asm/io.h> |
14 | #include <asm/machvec.h> | 15 | #include <asm/machvec.h> |
15 | #include <asm/mpc1211/mpc1211.h> | 16 | #include <asm/mpc1211/mpc1211.h> |
@@ -281,6 +282,32 @@ static int put_smb_blk(unsigned char *p, int address, int command, int no) | |||
281 | return 0; | 282 | return 0; |
282 | } | 283 | } |
283 | 284 | ||
285 | static struct resource heartbeat_resources[] = { | ||
286 | [0] = { | ||
287 | .start = 0xa2000000, | ||
288 | .end = 0xa2000000 + 8 - 1, | ||
289 | .flags = IORESOURCE_MEM, | ||
290 | }, | ||
291 | }; | ||
292 | |||
293 | static struct platform_device heartbeat_device = { | ||
294 | .name = "heartbeat", | ||
295 | .id = -1, | ||
296 | .num_resources = ARRAY_SIZE(heartbeat_resources), | ||
297 | .resource = heartbeat_resources, | ||
298 | }; | ||
299 | |||
300 | static struct platform_device *mpc1211_devices[] __initdata = { | ||
301 | &heartbeat_device, | ||
302 | }; | ||
303 | |||
304 | static int __init mpc1211_devices_setup(void) | ||
305 | { | ||
306 | return platform_add_devices(mpc1211_devices, | ||
307 | ARRAY_SIZE(mpc1211_devices)); | ||
308 | } | ||
309 | __initcall(mpc1211_devices_setup); | ||
310 | |||
284 | /* arch/sh/boards/mpc1211/rtc.c */ | 311 | /* arch/sh/boards/mpc1211/rtc.c */ |
285 | void mpc1211_time_init(void); | 312 | void mpc1211_time_init(void); |
286 | 313 | ||
@@ -317,9 +344,5 @@ struct sh_machine_vector mv_mpc1211 __initmv = { | |||
317 | .mv_nr_irqs = 48, | 344 | .mv_nr_irqs = 48, |
318 | .mv_irq_demux = mpc1211_irq_demux, | 345 | .mv_irq_demux = mpc1211_irq_demux, |
319 | .mv_init_irq = init_mpc1211_IRQ, | 346 | .mv_init_irq = init_mpc1211_IRQ, |
320 | |||
321 | #ifdef CONFIG_HEARTBEAT | ||
322 | .mv_heartbeat = heartbeat_mpc1211, | ||
323 | #endif | ||
324 | }; | 347 | }; |
325 | ALIAS_MV(mpc1211) | 348 | ALIAS_MV(mpc1211) |
diff --git a/arch/sh/boards/renesas/r7780rp/Makefile b/arch/sh/boards/renesas/r7780rp/Makefile index 574b0316ed56..3c93012e91a3 100644 --- a/arch/sh/boards/renesas/r7780rp/Makefile +++ b/arch/sh/boards/renesas/r7780rp/Makefile | |||
@@ -4,5 +4,4 @@ | |||
4 | 4 | ||
5 | obj-y := setup.o io.o irq.o | 5 | obj-y := setup.o io.o irq.o |
6 | 6 | ||
7 | obj-$(CONFIG_HEARTBEAT) += led.o | ||
8 | obj-$(CONFIG_PUSH_SWITCH) += psw.o | 7 | obj-$(CONFIG_PUSH_SWITCH) += psw.o |
diff --git a/arch/sh/boards/renesas/r7780rp/led.c b/arch/sh/boards/renesas/r7780rp/led.c deleted file mode 100644 index 6a00a257afd2..000000000000 --- a/arch/sh/boards/renesas/r7780rp/led.c +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) Atom Create Engineering Co., Ltd. | ||
3 | * | ||
4 | * May be copied or modified under the terms of GNU General Public | ||
5 | * License. See linux/COPYING for more information. | ||
6 | * | ||
7 | * This file contains Renesas Solutions HIGHLANDER R7780RP-1 specific LED code. | ||
8 | */ | ||
9 | #include <linux/sched.h> | ||
10 | #include <asm/io.h> | ||
11 | #include <asm/r7780rp/r7780rp.h> | ||
12 | |||
13 | /* Cycle the LED's in the clasic Knightriger/Sun pattern */ | ||
14 | void heartbeat_r7780rp(void) | ||
15 | { | ||
16 | static unsigned int cnt = 0, period = 0; | ||
17 | volatile unsigned short *p = (volatile unsigned short *)PA_OBLED; | ||
18 | static unsigned bit = 0, up = 1; | ||
19 | unsigned bit_pos[] = {2, 1, 0, 3, 6, 5, 4, 7}; | ||
20 | |||
21 | cnt += 1; | ||
22 | if (cnt < period) | ||
23 | return; | ||
24 | |||
25 | cnt = 0; | ||
26 | |||
27 | /* Go through the points (roughly!): | ||
28 | * f(0)=10, f(1)=16, f(2)=20, f(5)=35, f(int)->110 | ||
29 | */ | ||
30 | period = 110 - ((300 << FSHIFT)/((avenrun[0]/5) + (3<<FSHIFT))); | ||
31 | |||
32 | *p = 1 << bit_pos[bit]; | ||
33 | if (up) | ||
34 | if (bit == 7) { | ||
35 | bit--; | ||
36 | up = 0; | ||
37 | } else | ||
38 | bit++; | ||
39 | else if (bit == 0) | ||
40 | up = 1; | ||
41 | else | ||
42 | bit--; | ||
43 | } | ||
diff --git a/arch/sh/boards/renesas/r7780rp/setup.c b/arch/sh/boards/renesas/r7780rp/setup.c index b48f19f512ca..c40f85cc3e5e 100644 --- a/arch/sh/boards/renesas/r7780rp/setup.c +++ b/arch/sh/boards/renesas/r7780rp/setup.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <asm/clock.h> | 17 | #include <asm/clock.h> |
18 | #include <asm/io.h> | 18 | #include <asm/io.h> |
19 | 19 | ||
20 | extern void heartbeat_r7780rp(void); | ||
21 | extern void init_r7780rp_IRQ(void); | 20 | extern void init_r7780rp_IRQ(void); |
22 | 21 | ||
23 | static struct resource m66596_usb_host_resources[] = { | 22 | static struct resource m66596_usb_host_resources[] = { |
@@ -72,9 +71,30 @@ static struct platform_device cf_ide_device = { | |||
72 | .resource = cf_ide_resources, | 71 | .resource = cf_ide_resources, |
73 | }; | 72 | }; |
74 | 73 | ||
74 | static unsigned char heartbeat_bit_pos[] = { 2, 1, 0, 3, 6, 5, 4, 7 }; | ||
75 | |||
76 | static struct resource heartbeat_resources[] = { | ||
77 | [0] = { | ||
78 | .start = PA_OBLED, | ||
79 | .end = PA_OBLED + ARRAY_SIZE(heartbeat_bit_pos) - 1, | ||
80 | .flags = IORESOURCE_MEM, | ||
81 | }, | ||
82 | }; | ||
83 | |||
84 | static struct platform_device heartbeat_device = { | ||
85 | .name = "heartbeat", | ||
86 | .id = -1, | ||
87 | .dev = { | ||
88 | .platform_data = heartbeat_bit_pos, | ||
89 | }, | ||
90 | .num_resources = ARRAY_SIZE(heartbeat_resources), | ||
91 | .resource = heartbeat_resources, | ||
92 | }; | ||
93 | |||
75 | static struct platform_device *r7780rp_devices[] __initdata = { | 94 | static struct platform_device *r7780rp_devices[] __initdata = { |
76 | &m66596_usb_host_device, | 95 | &m66596_usb_host_device, |
77 | &cf_ide_device, | 96 | &cf_ide_device, |
97 | &heartbeat_device, | ||
78 | }; | 98 | }; |
79 | 99 | ||
80 | static int __init r7780rp_devices_setup(void) | 100 | static int __init r7780rp_devices_setup(void) |
@@ -185,8 +205,5 @@ struct sh_machine_vector mv_r7780rp __initmv = { | |||
185 | 205 | ||
186 | .mv_ioport_map = r7780rp_ioport_map, | 206 | .mv_ioport_map = r7780rp_ioport_map, |
187 | .mv_init_irq = init_r7780rp_IRQ, | 207 | .mv_init_irq = init_r7780rp_IRQ, |
188 | #ifdef CONFIG_HEARTBEAT | ||
189 | .mv_heartbeat = heartbeat_r7780rp, | ||
190 | #endif | ||
191 | }; | 208 | }; |
192 | ALIAS_MV(r7780rp) | 209 | ALIAS_MV(r7780rp) |
diff --git a/arch/sh/boards/renesas/rts7751r2d/Makefile b/arch/sh/boards/renesas/rts7751r2d/Makefile index 686fc9ea5989..833de1eac0e8 100644 --- a/arch/sh/boards/renesas/rts7751r2d/Makefile +++ b/arch/sh/boards/renesas/rts7751r2d/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/renesas/rts7751r2d/led.c b/arch/sh/boards/renesas/rts7751r2d/led.c deleted file mode 100644 index 509f548bdce0..000000000000 --- a/arch/sh/boards/renesas/rts7751r2d/led.c +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/renesas/rts7751r2d/led.c | ||
3 | * | ||
4 | * Copyright (C) Atom Create Engineering Co., Ltd. | ||
5 | * | ||
6 | * May be copied or modified under the terms of GNU General Public | ||
7 | * License. See linux/COPYING for more information. | ||
8 | * | ||
9 | * This file contains Renesas Technology Sales RTS7751R2D specific LED code. | ||
10 | */ | ||
11 | #include <linux/io.h> | ||
12 | #include <linux/sched.h> | ||
13 | #include <asm/rts7751r2d.h> | ||
14 | |||
15 | /* Cycle the LED's in the clasic Knightriger/Sun pattern */ | ||
16 | void heartbeat_rts7751r2d(void) | ||
17 | { | ||
18 | static unsigned int cnt = 0, period = 0; | ||
19 | volatile unsigned short *p = (volatile unsigned short *)PA_OUTPORT; | ||
20 | static unsigned bit = 0, up = 1; | ||
21 | |||
22 | cnt += 1; | ||
23 | if (cnt < period) | ||
24 | return; | ||
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(int)->110 | ||
30 | */ | ||
31 | period = 110 - ((300 << FSHIFT)/((avenrun[0]/5) + (3<<FSHIFT))); | ||
32 | |||
33 | *p = 1 << bit; | ||
34 | if (up) | ||
35 | if (bit == 7) { | ||
36 | bit--; | ||
37 | up = 0; | ||
38 | } else | ||
39 | bit++; | ||
40 | else if (bit == 0) | ||
41 | up = 1; | ||
42 | else | ||
43 | bit--; | ||
44 | } | ||
diff --git a/arch/sh/boards/renesas/rts7751r2d/setup.c b/arch/sh/boards/renesas/rts7751r2d/setup.c index 5c042d35ec91..d97be1202245 100644 --- a/arch/sh/boards/renesas/rts7751r2d/setup.c +++ b/arch/sh/boards/renesas/rts7751r2d/setup.c | |||
@@ -69,8 +69,24 @@ static struct platform_device uart_device = { | |||
69 | }, | 69 | }, |
70 | }; | 70 | }; |
71 | 71 | ||
72 | static struct resource heartbeat_resources[] = { | ||
73 | [0] = { | ||
74 | .start = PA_OUTPORT, | ||
75 | .end = PA_OUTPORT + 8 - 1, | ||
76 | .flags = IORESOURCE_MEM, | ||
77 | }, | ||
78 | }; | ||
79 | |||
80 | static struct platform_device heartbeat_device = { | ||
81 | .name = "heartbeat", | ||
82 | .id = -1, | ||
83 | .num_resources = ARRAY_SIZE(heartbeat_resources), | ||
84 | .resource = heartbeat_resources, | ||
85 | }; | ||
86 | |||
72 | static struct platform_device *rts7751r2d_devices[] __initdata = { | 87 | static struct platform_device *rts7751r2d_devices[] __initdata = { |
73 | &uart_device, | 88 | &uart_device, |
89 | &heartbeat_device, | ||
74 | }; | 90 | }; |
75 | 91 | ||
76 | static int __init rts7751r2d_devices_setup(void) | 92 | static int __init rts7751r2d_devices_setup(void) |
@@ -129,9 +145,6 @@ struct sh_machine_vector mv_rts7751r2d __initmv = { | |||
129 | .mv_outsl = rts7751r2d_outsl, | 145 | .mv_outsl = rts7751r2d_outsl, |
130 | 146 | ||
131 | .mv_init_irq = init_rts7751r2d_IRQ, | 147 | .mv_init_irq = init_rts7751r2d_IRQ, |
132 | #ifdef CONFIG_HEARTBEAT | ||
133 | .mv_heartbeat = heartbeat_rts7751r2d, | ||
134 | #endif | ||
135 | .mv_irq_demux = rts7751r2d_irq_demux, | 148 | .mv_irq_demux = rts7751r2d_irq_demux, |
136 | 149 | ||
137 | #ifdef CONFIG_USB_SM501 | 150 | #ifdef CONFIG_USB_SM501 |
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) |
diff --git a/arch/sh/boards/sh03/Makefile b/arch/sh/boards/sh03/Makefile index 321be50e36a5..400306a796ec 100644 --- a/arch/sh/boards/sh03/Makefile +++ b/arch/sh/boards/sh03/Makefile | |||
@@ -3,4 +3,3 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := setup.o rtc.o | 5 | obj-y := setup.o rtc.o |
6 | obj-$(CONFIG_HEARTBEAT) += led.o | ||
diff --git a/arch/sh/boards/sh03/led.c b/arch/sh/boards/sh03/led.c deleted file mode 100644 index d38562ad6be8..000000000000 --- a/arch/sh/boards/sh03/led.c +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/sh03/led.c | ||
3 | * | ||
4 | * Copyright (C) 2004 Saito.K Interface Corporation. | ||
5 | * | ||
6 | * This file contains Interface CTP/PCI-SH03 specific LED code. | ||
7 | */ | ||
8 | |||
9 | #include <linux/sched.h> | ||
10 | |||
11 | /* Cycle the LED's in the clasic Knightrider/Sun pattern */ | ||
12 | void heartbeat_sh03(void) | ||
13 | { | ||
14 | static unsigned int cnt = 0, period = 0; | ||
15 | volatile unsigned char* p = (volatile unsigned char*)0xa0800000; | ||
16 | static unsigned bit = 0, up = 1; | ||
17 | |||
18 | cnt += 1; | ||
19 | if (cnt < period) { | ||
20 | return; | ||
21 | } | ||
22 | |||
23 | cnt = 0; | ||
24 | |||
25 | /* Go through the points (roughly!): | ||
26 | * f(0)=10, f(1)=16, f(2)=20, f(5)=35,f(inf)->110 | ||
27 | */ | ||
28 | period = 110 - ( (300<<FSHIFT)/ | ||
29 | ((avenrun[0]/5) + (3<<FSHIFT)) ); | ||
30 | |||
31 | if (up) { | ||
32 | if (bit == 7) { | ||
33 | bit--; | ||
34 | up=0; | ||
35 | } else { | ||
36 | bit ++; | ||
37 | } | ||
38 | } else { | ||
39 | if (bit == 0) { | ||
40 | bit++; | ||
41 | up=1; | ||
42 | } else { | ||
43 | bit--; | ||
44 | } | ||
45 | } | ||
46 | *p = 1<<bit; | ||
47 | |||
48 | } | ||
diff --git a/arch/sh/boards/sh03/setup.c b/arch/sh/boards/sh03/setup.c index 5ad1e19771be..c069c444b4ec 100644 --- a/arch/sh/boards/sh03/setup.c +++ b/arch/sh/boards/sh03/setup.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/init.h> | 8 | #include <linux/init.h> |
9 | #include <linux/irq.h> | 9 | #include <linux/irq.h> |
10 | #include <linux/pci.h> | 10 | #include <linux/pci.h> |
11 | #include <linux/platform_device.h> | ||
11 | #include <asm/io.h> | 12 | #include <asm/io.h> |
12 | #include <asm/rtc.h> | 13 | #include <asm/rtc.h> |
13 | #include <asm/sh03/io.h> | 14 | #include <asm/sh03/io.h> |
@@ -48,15 +49,36 @@ static void __init sh03_setup(char **cmdline_p) | |||
48 | board_time_init = sh03_time_init; | 49 | board_time_init = sh03_time_init; |
49 | } | 50 | } |
50 | 51 | ||
52 | static struct resource heartbeat_resources[] = { | ||
53 | [0] = { | ||
54 | .start = 0xa0800000, | ||
55 | .end = 0xa0800000 + 8 - 1, | ||
56 | .flags = IORESOURCE_MEM, | ||
57 | }, | ||
58 | }; | ||
59 | |||
60 | static struct platform_device heartbeat_device = { | ||
61 | .name = "heartbeat", | ||
62 | .id = -1, | ||
63 | .num_resources = ARRAY_SIZE(heartbeat_resources), | ||
64 | .resource = heartbeat_resources, | ||
65 | }; | ||
66 | |||
67 | static struct platform_device *sh03_devices[] __initdata = { | ||
68 | &heartbeat_device, | ||
69 | }; | ||
70 | |||
71 | static int __init sh03_devices_setup(void) | ||
72 | { | ||
73 | return platform_add_devices(sh03_devices, ARRAY_SIZE(sh03_devices)); | ||
74 | } | ||
75 | __initcall(sh03_devices_setup); | ||
76 | |||
51 | struct sh_machine_vector mv_sh03 __initmv = { | 77 | struct sh_machine_vector mv_sh03 __initmv = { |
52 | .mv_name = "Interface (CTP/PCI-SH03)", | 78 | .mv_name = "Interface (CTP/PCI-SH03)", |
53 | .mv_setup = sh03_setup, | 79 | .mv_setup = sh03_setup, |
54 | .mv_nr_irqs = 48, | 80 | .mv_nr_irqs = 48, |
55 | .mv_ioport_map = sh03_ioport_map, | 81 | .mv_ioport_map = sh03_ioport_map, |
56 | .mv_init_irq = init_sh03_IRQ, | 82 | .mv_init_irq = init_sh03_IRQ, |
57 | |||
58 | #ifdef CONFIG_HEARTBEAT | ||
59 | .mv_heartbeat = heartbeat_sh03, | ||
60 | #endif | ||
61 | }; | 83 | }; |
62 | ALIAS_MV(sh03) | 84 | ALIAS_MV(sh03) |