aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/renesas
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2007-02-13 01:42:28 -0500
committerPaul Mundt <lethal@linux-sh.org>2007-02-13 01:42:28 -0500
commit3b4d9539628502768fe7f8fd4b48f2fbf2426255 (patch)
tree2bc27b9b57ed3f768a40cedc7c44b95da4025526 /arch/sh/boards/renesas
parentc7666e72cff1a2793055486340ac5f5137494c08 (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/renesas')
-rw-r--r--arch/sh/boards/renesas/r7780rp/Makefile1
-rw-r--r--arch/sh/boards/renesas/r7780rp/led.c43
-rw-r--r--arch/sh/boards/renesas/r7780rp/setup.c25
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/Makefile1
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/led.c44
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/setup.c19
6 files changed, 37 insertions, 96 deletions
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
5obj-y := setup.o io.o irq.o 5obj-y := setup.o io.o irq.o
6 6
7obj-$(CONFIG_HEARTBEAT) += led.o
8obj-$(CONFIG_PUSH_SWITCH) += psw.o 7obj-$(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 */
14void 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
20extern void heartbeat_r7780rp(void);
21extern void init_r7780rp_IRQ(void); 20extern void init_r7780rp_IRQ(void);
22 21
23static struct resource m66596_usb_host_resources[] = { 22static 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
74static unsigned char heartbeat_bit_pos[] = { 2, 1, 0, 3, 6, 5, 4, 7 };
75
76static 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
84static 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
75static struct platform_device *r7780rp_devices[] __initdata = { 94static 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
80static int __init r7780rp_devices_setup(void) 100static 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};
192ALIAS_MV(r7780rp) 209ALIAS_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
5obj-y := setup.o io.o irq.o 5obj-y := setup.o io.o irq.o
6obj-$(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 */
16void 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
72static struct resource heartbeat_resources[] = {
73 [0] = {
74 .start = PA_OUTPORT,
75 .end = PA_OUTPORT + 8 - 1,
76 .flags = IORESOURCE_MEM,
77 },
78};
79
80static struct platform_device heartbeat_device = {
81 .name = "heartbeat",
82 .id = -1,
83 .num_resources = ARRAY_SIZE(heartbeat_resources),
84 .resource = heartbeat_resources,
85};
86
72static struct platform_device *rts7751r2d_devices[] __initdata = { 87static struct platform_device *rts7751r2d_devices[] __initdata = {
73 &uart_device, 88 &uart_device,
89 &heartbeat_device,
74}; 90};
75 91
76static int __init rts7751r2d_devices_setup(void) 92static 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