[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / arch / sh / boards / harp / led.c
blob76ca4ccac703c8698a3c3f5900b51b7066844a7f
1 /*
2 * linux/arch/sh/stboards/led.c
4 * Copyright (C) 2000 Stuart Menefy <stuart.menefy@st.com>
6 * May be copied or modified under the terms of the GNU General Public
7 * License. See linux/COPYING for more information.
9 * This file contains ST40STB1 HARP and compatible code.
12 #include <linux/config.h>
13 #include <asm/io.h>
14 #include <asm/harp/harp.h>
16 /* Harp: Flash LD10 (front pannel) connected to EPLD (IC8) */
17 /* Overdrive: Flash LD1 (front panel) connected to EPLD (IC4) */
18 /* Works for HARP and overdrive */
19 static void mach_led(int position, int value)
21 if (value) {
22 ctrl_outl(EPLD_LED_ON, EPLD_LED);
23 } else {
24 ctrl_outl(EPLD_LED_OFF, EPLD_LED);
28 #ifdef CONFIG_HEARTBEAT
30 #include <linux/sched.h>
32 /* acts like an actual heart beat -- ie thump-thump-pause... */
33 void heartbeat_harp(void)
35 static unsigned cnt = 0, period = 0, dist = 0;
37 if (cnt == 0 || cnt == dist)
38 mach_led( -1, 1);
39 else if (cnt == 7 || cnt == dist+7)
40 mach_led( -1, 0);
42 if (++cnt > period) {
43 cnt = 0;
44 /* The hyperbolic function below modifies the heartbeat period
45 * length in dependency of the current (5min) load. It goes
46 * through the points f(0)=126, f(1)=86, f(5)=51,
47 * f(inf)->30. */
48 period = ((672<<FSHIFT)/(5*avenrun[0]+(7<<FSHIFT))) + 30;
49 dist = period / 4;
52 #endif