aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/mpc1211
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2007-02-13 15:42:28 +0900
committerPaul Mundt <lethal@linux-sh.org>2007-02-13 15:42:28 +0900
commit3b4d9539628502768fe7f8fd4b48f2fbf2426255 (patch)
tree2bc27b9b57ed3f768a40cedc7c44b95da4025526 /arch/sh/boards/mpc1211
parentsh: define dma noncoherent API functions. (diff)
downloadlinux-dev-3b4d9539628502768fe7f8fd4b48f2fbf2426255.tar.xz
linux-dev-3b4d9539628502768fe7f8fd4b48f2fbf2426255.zip
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/mpc1211')
-rw-r--r--arch/sh/boards/mpc1211/Makefile2
-rw-r--r--arch/sh/boards/mpc1211/led.c63
-rw-r--r--arch/sh/boards/mpc1211/setup.c31
3 files changed, 28 insertions, 68 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 @@
# Makefile for the Interface (CTP/PCI/MPC-SH02) specific parts of the kernel
#
-obj-y := setup.o rtc.o led.o
+obj-y := setup.o rtc.o
obj-$(CONFIG_PCI) += pci.o
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 @@
-/*
- * linux/arch/sh/boards/mpc1211/led.c
- *
- * Copyright (C) 2001 Saito.K & Jeanne
- *
- * This file contains Interface MPC-1211 specific LED code.
- */
-
-
-static void mach_led(int position, int value)
-{
- volatile unsigned char* p = (volatile unsigned char*)0xa2000000;
-
- if (value) {
- *p |= 1;
- } else {
- *p &= ~1;
- }
-}
-
-#ifdef CONFIG_HEARTBEAT
-
-#include <linux/sched.h>
-
-/* Cycle the LED's in the clasic Knightrider/Sun pattern */
-void heartbeat_mpc1211(void)
-{
- static unsigned int cnt = 0, period = 0;
- volatile unsigned char* p = (volatile unsigned char*)0xa2000000;
- static unsigned bit = 0, up = 1;
-
- cnt += 1;
- if (cnt < period) {
- return;
- }
-
- cnt = 0;
-
- /* Go through the points (roughly!):
- * f(0)=10, f(1)=16, f(2)=20, f(5)=35,f(inf)->110
- */
- period = 110 - ( (300<<FSHIFT)/
- ((avenrun[0]/5) + (3<<FSHIFT)) );
-
- if (up) {
- if (bit == 7) {
- bit--;
- up=0;
- } else {
- bit ++;
- }
- } else {
- if (bit == 0) {
- bit++;
- up=1;
- } else {
- bit--;
- }
- }
- *p = 1<<bit;
-
-}
-#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 @@
#include <linux/hdreg.h>
#include <linux/ide.h>
#include <linux/interrupt.h>
+#include <linux/platform_device.h>
#include <asm/io.h>
#include <asm/machvec.h>
#include <asm/mpc1211/mpc1211.h>
@@ -281,6 +282,32 @@ static int put_smb_blk(unsigned char *p, int address, int command, int no)
return 0;
}
+static struct resource heartbeat_resources[] = {
+ [0] = {
+ .start = 0xa2000000,
+ .end = 0xa2000000 + 8 - 1,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct platform_device heartbeat_device = {
+ .name = "heartbeat",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(heartbeat_resources),
+ .resource = heartbeat_resources,
+};
+
+static struct platform_device *mpc1211_devices[] __initdata = {
+ &heartbeat_device,
+};
+
+static int __init mpc1211_devices_setup(void)
+{
+ return platform_add_devices(mpc1211_devices,
+ ARRAY_SIZE(mpc1211_devices));
+}
+__initcall(mpc1211_devices_setup);
+
/* arch/sh/boards/mpc1211/rtc.c */
void mpc1211_time_init(void);
@@ -317,9 +344,5 @@ struct sh_machine_vector mv_mpc1211 __initmv = {
.mv_nr_irqs = 48,
.mv_irq_demux = mpc1211_irq_demux,
.mv_init_irq = init_mpc1211_IRQ,
-
-#ifdef CONFIG_HEARTBEAT
- .mv_heartbeat = heartbeat_mpc1211,
-#endif
};
ALIAS_MV(mpc1211)