aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/se
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/boards/se')
-rw-r--r--arch/sh/boards/se/7206/Makefile2
-rw-r--r--arch/sh/boards/se/7206/led.c57
-rw-r--r--arch/sh/boards/se/7206/setup.c34
-rw-r--r--arch/sh/boards/se/7300/Makefile2
-rw-r--r--arch/sh/boards/se/7300/led.c54
-rw-r--r--arch/sh/boards/se/7300/setup.c36
-rw-r--r--arch/sh/boards/se/73180/Makefile2
-rw-r--r--arch/sh/boards/se/73180/led.c53
-rw-r--r--arch/sh/boards/se/73180/setup.c31
-rw-r--r--arch/sh/boards/se/7343/Makefile2
-rw-r--r--arch/sh/boards/se/7343/led.c44
-rw-r--r--arch/sh/boards/se/7343/setup.c26
-rw-r--r--arch/sh/boards/se/770x/Makefile1
-rw-r--r--arch/sh/boards/se/770x/irq.c108
-rw-r--r--arch/sh/boards/se/770x/led.c52
-rw-r--r--arch/sh/boards/se/770x/setup.c43
-rw-r--r--arch/sh/boards/se/7751/Makefile1
-rw-r--r--arch/sh/boards/se/7751/led.c51
-rw-r--r--arch/sh/boards/se/7751/setup.c36
19 files changed, 241 insertions, 394 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
5obj-y := setup.o io.o irq.o 5obj-y := setup.o io.o irq.o
6obj-$(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 */
20void 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
38static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
39
40static 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
48static 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
58static struct platform_device *se7206_devices[] __initdata = {
59 &smc91x_device,
60 &heartbeat_device,
61};
62
37static int __init se7206_devices_setup(void) 63static 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
44void 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};
79ALIAS_MV(se) 99ALIAS_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
5obj-y := setup.o io.o irq.o 5obj-y := setup.o io.o irq.o
6
7obj-$(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 */
18void 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
14void heartbeat_7300se(void);
15void init_7300se_IRQ(void); 14void init_7300se_IRQ(void);
16 15
16static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
17
18static 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
26static 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
36static struct platform_device *se7300_devices[] __initdata = {
37 &heartbeat_device,
38};
39
40static 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};
49ALIAS_MV(7300se) 75ALIAS_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
5obj-y := setup.o io.o irq.o 5obj-y := setup.o io.o irq.o
6
7obj-$(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 */
18void 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
17void heartbeat_73180se(void);
18void init_73180se_IRQ(void); 18void init_73180se_IRQ(void);
19 19
20static struct resource heartbeat_resources[] = {
21 [0] = {
22 .start = PA_LED,
23 .end = PA_LED + 8 - 1,
24 .flags = IORESOURCE_MEM,
25 },
26};
27
28static struct platform_device heartbeat_device = {
29 .name = "heartbeat",
30 .id = -1,
31 .num_resources = ARRAY_SIZE(heartbeat_resources),
32 .resource = heartbeat_resources,
33};
34
35static struct platform_device *se73180_devices[] __initdata = {
36 &heartbeat_device,
37};
38
39static 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};
53ALIAS_MV(73180se) 76ALIAS_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
5obj-y := setup.o io.o irq.o 5obj-y := setup.o io.o irq.o
6
7obj-$(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 */
9void 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
7void heartbeat_7343se(void);
8void init_7343se_IRQ(void); 7void init_7343se_IRQ(void);
9 8
10static struct resource smc91x_resources[] = { 9static 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
34static struct platform_device *smc91x_platform_devices[] __initdata = { 33static struct resource heartbeat_resources[] = {
34 [0] = {
35 .start = PA_LED,
36 .end = PA_LED + 8 - 1,
37 .flags = IORESOURCE_MEM,
38 },
39};
40
41static struct platform_device heartbeat_device = {
42 .name = "heartbeat",
43 .id = -1,
44 .num_resources = ARRAY_SIZE(heartbeat_resources),
45 .resource = heartbeat_resources,
46};
47
48static struct platform_device *sh7343se_platform_devices[] __initdata = {
35 &smc91x_device, 49 &smc91x_device,
50 &heartbeat_device,
36}; 51};
37 52
38static int __init sh7343se_devices_setup(void) 53static 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
44static void __init sh7343se_setup(char **cmdline_p) 59static 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};
83ALIAS_MV(7343se) 95ALIAS_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
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/se/770x/irq.c b/arch/sh/boards/se/770x/irq.c
index fcd7cd7fa05f..307ca5da6232 100644
--- a/arch/sh/boards/se/770x/irq.c
+++ b/arch/sh/boards/se/770x/irq.c
@@ -2,56 +2,96 @@
2 * linux/arch/sh/boards/se/770x/irq.c 2 * linux/arch/sh/boards/se/770x/irq.c
3 * 3 *
4 * Copyright (C) 2000 Kazumoto Kojima 4 * Copyright (C) 2000 Kazumoto Kojima
5 * Copyright (C) 2006 Nobuhiro Iwamatsu
5 * 6 *
6 * Hitachi SolutionEngine Support. 7 * Hitachi SolutionEngine Support.
7 * 8 *
8 */ 9 */
9 10
10#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/interrupt.h>
11#include <linux/irq.h> 13#include <linux/irq.h>
12#include <asm/irq.h> 14#include <asm/irq.h>
13#include <asm/io.h> 15#include <asm/io.h>
14#include <asm/se.h> 16#include <asm/se.h>
15 17
18/*
19 * If the problem of make_ipr_irq is solved,
20 * this code will become unnecessary. :-)
21 */
22static void se770x_disable_ipr_irq(unsigned int irq)
23{
24 struct ipr_data *p = get_irq_chip_data(irq);
25
26 ctrl_outw(ctrl_inw(p->addr) & (0xffff ^ (0xf << p->shift)), p->addr);
27}
28
29static void se770x_enable_ipr_irq(unsigned int irq)
30{
31 struct ipr_data *p = get_irq_chip_data(irq);
32
33 ctrl_outw(ctrl_inw(p->addr) | (p->priority << p->shift), p->addr);
34}
35
36static struct irq_chip se770x_irq_chip = {
37 .name = "MS770xSE-FPGA",
38 .mask = se770x_disable_ipr_irq,
39 .unmask = se770x_enable_ipr_irq,
40 .mask_ack = se770x_disable_ipr_irq,
41};
42
43void make_se770x_irq(struct ipr_data *table, unsigned int nr_irqs)
44{
45 int i;
46
47 for (i = 0; i < nr_irqs; i++) {
48 unsigned int irq = table[i].irq;
49 disable_irq_nosync(irq);
50 set_irq_chip_and_handler_name(irq, &se770x_irq_chip,
51 handle_level_irq, "level");
52 set_irq_chip_data(irq, &table[i]);
53 se770x_enable_ipr_irq(irq);
54 }
55}
56
16static struct ipr_data se770x_ipr_map[] = { 57static struct ipr_data se770x_ipr_map[] = {
17#if defined(CONFIG_CPU_SUBTYPE_SH7705) 58#if defined(CONFIG_CPU_SUBTYPE_SH7705)
18 /* This is default value */ 59 /* This is default value */
19 { 0xf-0x2, BCR_ILCRA, 2, 0x2 }, 60 { 0xf-0x2, 0, 8, 0x2 , BCR_ILCRA},
20 { 0xf-0xa, BCR_ILCRA, 1, 0xa }, 61 { 0xf-0xa, 0, 4, 0xa , BCR_ILCRA},
21 { 0xf-0x5, BCR_ILCRB, 0, 0x5 }, 62 { 0xf-0x5, 0, 0, 0x5 , BCR_ILCRB},
22 { 0xf-0x8, BCR_ILCRC, 1, 0x8 }, 63 { 0xf-0x8, 0, 4, 0x8 , BCR_ILCRC},
23 { 0xf-0xc, BCR_ILCRC, 0, 0xc }, 64 { 0xf-0xc, 0, 0, 0xc , BCR_ILCRC},
24 { 0xf-0xe, BCR_ILCRD, 3, 0xe }, 65 { 0xf-0xe, 0, 12, 0xe , BCR_ILCRD},
25 { 0xf-0x3, BCR_ILCRD, 1, 0x3 }, /* LAN */ 66 { 0xf-0x3, 0, 4, 0x3 , BCR_ILCRD}, /* LAN */
26 { 0xf-0xd, BCR_ILCRE, 2, 0xd }, 67 { 0xf-0xd, 0, 8, 0xd , BCR_ILCRE},
27 { 0xf-0x9, BCR_ILCRE, 1, 0x9 }, 68 { 0xf-0x9, 0, 4, 0x9 , BCR_ILCRE},
28 { 0xf-0x1, BCR_ILCRE, 0, 0x1 }, 69 { 0xf-0x1, 0, 0, 0x1 , BCR_ILCRE},
29 { 0xf-0xf, BCR_ILCRF, 3, 0xf }, 70 { 0xf-0xf, 0, 12, 0xf , BCR_ILCRF},
30 { 0xf-0xb, BCR_ILCRF, 1, 0xb }, 71 { 0xf-0xb, 0, 4, 0xb , BCR_ILCRF},
31 { 0xf-0x7, BCR_ILCRG, 3, 0x7 }, 72 { 0xf-0x7, 0, 12, 0x7 , BCR_ILCRG},
32 { 0xf-0x6, BCR_ILCRG, 2, 0x6 }, 73 { 0xf-0x6, 0, 8, 0x6 , BCR_ILCRG},
33 { 0xf-0x4, BCR_ILCRG, 1, 0x4 }, 74 { 0xf-0x4, 0, 4, 0x4 , BCR_ILCRG},
34#else 75#else
35 { 14, BCR_ILCRA, 2, 0x0f-14 }, 76 { 14, 0, 8, 0x0f-14 ,BCR_ILCRA},
36 { 12, BCR_ILCRA, 1, 0x0f-12 }, 77 { 12, 0, 4, 0x0f-12 ,BCR_ILCRA},
37 { 8, BCR_ILCRB, 1, 0x0f- 8 }, 78 { 8, 0, 4, 0x0f- 8 ,BCR_ILCRB},
38 { 6, BCR_ILCRC, 3, 0x0f- 6 }, 79 { 6, 0, 12, 0x0f- 6 ,BCR_ILCRC},
39 { 5, BCR_ILCRC, 2, 0x0f- 5 }, 80 { 5, 0, 8, 0x0f- 5 ,BCR_ILCRC},
40 { 4, BCR_ILCRC, 1, 0x0f- 4 }, 81 { 4, 0, 4, 0x0f- 4 ,BCR_ILCRC},
41 { 3, BCR_ILCRC, 0, 0x0f- 3 }, 82 { 3, 0, 0, 0x0f- 3 ,BCR_ILCRC},
42 { 1, BCR_ILCRD, 3, 0x0f- 1 }, 83 { 1, 0, 12, 0x0f- 1 ,BCR_ILCRD},
43 84 /* ST NIC */
44 { 10, BCR_ILCRD, 1, 0x0f-10 }, /* LAN */ 85 { 10, 0, 4, 0x0f-10 ,BCR_ILCRD}, /* LAN */
45 86 /* MRSHPC IRQs setting */
46 { 0, BCR_ILCRE, 3, 0x0f- 0 }, /* PCIRQ3 */ 87 { 0, 0, 12, 0x0f- 0 ,BCR_ILCRE}, /* PCIRQ3 */
47 { 11, BCR_ILCRE, 2, 0x0f-11 }, /* PCIRQ2 */ 88 { 11, 0, 8, 0x0f-11 ,BCR_ILCRE}, /* PCIRQ2 */
48 { 9, BCR_ILCRE, 1, 0x0f- 9 }, /* PCIRQ1 */ 89 { 9, 0, 4, 0x0f- 9 ,BCR_ILCRE}, /* PCIRQ1 */
49 { 7, BCR_ILCRE, 0, 0x0f- 7 }, /* PCIRQ0 */ 90 { 7, 0, 0, 0x0f- 7 ,BCR_ILCRE}, /* PCIRQ0 */
50
51 /* #2, #13 are allocated for SLOT IRQ #1 and #2 (for now) */ 91 /* #2, #13 are allocated for SLOT IRQ #1 and #2 (for now) */
52 /* NOTE: #2 and #13 are not used on PC */ 92 /* NOTE: #2 and #13 are not used on PC */
53 { 13, BCR_ILCRG, 1, 0x0f-13 }, /* SLOTIRQ2 */ 93 { 13, 0, 4, 0x0f-13 ,BCR_ILCRG}, /* SLOTIRQ2 */
54 { 2, BCR_ILCRG, 0, 0x0f- 2 }, /* SLOTIRQ1 */ 94 { 2, 0, 0, 0x0f- 2 ,BCR_ILCRG}, /* SLOTIRQ1 */
55#endif 95#endif
56}; 96};
57 97
@@ -81,5 +121,5 @@ void __init init_se_IRQ(void)
81 ctrl_outw(0, BCR_ILCRF); 121 ctrl_outw(0, BCR_ILCRF);
82 ctrl_outw(0, BCR_ILCRG); 122 ctrl_outw(0, BCR_ILCRG);
83#endif 123#endif
84 make_ipr_irq(se770x_ipr_map, ARRAY_SIZE(se770x_ipr_map)); 124 make_se770x_irq(se770x_ipr_map, ARRAY_SIZE(se770x_ipr_map));
85} 125}
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 */
16void 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 a1d51d5fa925..45cbc36b9fb7 100644
--- a/arch/sh/boards/se/770x/setup.c
+++ b/arch/sh/boards/se/770x/setup.c
@@ -1,5 +1,4 @@
1/* $Id: setup.c,v 1.1.2.4 2002/03/02 21:57:07 lethal Exp $ 1/*
2 *
3 * linux/arch/sh/boards/se/770x/setup.c 2 * linux/arch/sh/boards/se/770x/setup.c
4 * 3 *
5 * Copyright (C) 2000 Kazumoto Kojima 4 * Copyright (C) 2000 Kazumoto Kojima
@@ -8,12 +7,12 @@
8 * 7 *
9 */ 8 */
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/se.h> 12#include <asm/se.h>
13#include <asm/io.h> 13#include <asm/io.h>
14#include <asm/smc37c93x.h> 14#include <asm/smc37c93x.h>
15 15
16void heartbeat_se(void);
17void init_se_IRQ(void); 16void init_se_IRQ(void);
18 17
19/* 18/*
@@ -36,11 +35,6 @@ static void __init smsc_setup(char **cmdline_p)
36 smsc_config(ACTIVATE_INDEX, 0x01); 35 smsc_config(ACTIVATE_INDEX, 0x01);
37 smsc_config(IRQ_SELECT_INDEX, 6); /* IRQ6 */ 36 smsc_config(IRQ_SELECT_INDEX, 6); /* IRQ6 */
38 37
39 /* IDE1 */
40 smsc_config(CURRENT_LDN_INDEX, LDN_IDE1);
41 smsc_config(ACTIVATE_INDEX, 0x01);
42 smsc_config(IRQ_SELECT_INDEX, 14); /* IRQ14 */
43
44 /* AUXIO (GPIO): to use IDE1 */ 38 /* AUXIO (GPIO): to use IDE1 */
45 smsc_config(CURRENT_LDN_INDEX, LDN_AUXIO); 39 smsc_config(CURRENT_LDN_INDEX, LDN_AUXIO);
46 smsc_config(GPIO46_INDEX, 0x00); /* nIOROP */ 40 smsc_config(GPIO46_INDEX, 0x00); /* nIOROP */
@@ -69,6 +63,36 @@ static void __init smsc_setup(char **cmdline_p)
69 outb_p(CONFIG_EXIT, CONFIG_PORT); 63 outb_p(CONFIG_EXIT, CONFIG_PORT);
70} 64}
71 65
66static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
67
68static 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
76static 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
86static struct platform_device *se_devices[] __initdata = {
87 &heartbeat_device,
88};
89
90static 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
72/* 96/*
73 * The Machine Vector 97 * The Machine Vector
74 */ 98 */
@@ -107,8 +131,5 @@ struct sh_machine_vector mv_se __initmv = {
107 .mv_outsl = se_outsl, 131 .mv_outsl = se_outsl,
108 132
109 .mv_init_irq = init_se_IRQ, 133 .mv_init_irq = init_se_IRQ,
110#ifdef CONFIG_HEARTBEAT
111 .mv_heartbeat = heartbeat_se,
112#endif
113}; 134};
114ALIAS_MV(se) 135ALIAS_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 @@
5obj-y := setup.o io.o irq.o 5obj-y := setup.o io.o irq.o
6 6
7obj-$(CONFIG_PCI) += pci.o 7obj-$(CONFIG_PCI) += pci.o
8obj-$(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 */
15void 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
16void heartbeat_7751se(void);
17void init_7751se_IRQ(void); 17void 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
164static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
165
166static 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
174static 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
184static struct platform_device *se7751_devices[] __initdata = {
185 &smc91x_device,
186 &heartbeat_device,
187};
188
189static 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
169struct sh_machine_vector mv_7751se __initmv = { 198struct 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};
196ALIAS_MV(7751se) 222ALIAS_MV(7751se)