aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-sa1100
diff options
context:
space:
mode:
authorBryan Wu <bryan.wu@canonical.com>2012-03-13 14:22:03 -0400
committerBryan Wu <bryan.wu@canonical.com>2012-07-31 23:22:14 -0400
commit18775a7bea8fbbebe8818db7a64aaeb40b40a0c5 (patch)
tree6f47d6a4147a6505da85cf4126254bdccc458842 /arch/arm/mach-sa1100
parentdafbeadf4a9e1b2765641b687e3343be76d2eacd (diff)
ARM: mach-sa1100: retire custom LED code
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
Diffstat (limited to 'arch/arm/mach-sa1100')
-rw-r--r--arch/arm/mach-sa1100/Makefile9
-rw-r--r--arch/arm/mach-sa1100/assabet.c85
-rw-r--r--arch/arm/mach-sa1100/badge4.c30
-rw-r--r--arch/arm/mach-sa1100/cerf.c42
-rw-r--r--arch/arm/mach-sa1100/hackkit.c32
-rw-r--r--arch/arm/mach-sa1100/lart.c26
-rw-r--r--arch/arm/mach-sa1100/leds-assabet.c113
-rw-r--r--arch/arm/mach-sa1100/leds-badge4.c110
-rw-r--r--arch/arm/mach-sa1100/leds-cerf.c109
-rw-r--r--arch/arm/mach-sa1100/leds-hackkit.c111
-rw-r--r--arch/arm/mach-sa1100/leds-lart.c100
-rw-r--r--arch/arm/mach-sa1100/leds.c50
-rw-r--r--arch/arm/mach-sa1100/leds.h13
13 files changed, 215 insertions, 615 deletions
diff --git a/arch/arm/mach-sa1100/Makefile b/arch/arm/mach-sa1100/Makefile
index 60b97ec01676..1aed9e70465d 100644
--- a/arch/arm/mach-sa1100/Makefile
+++ b/arch/arm/mach-sa1100/Makefile
@@ -7,21 +7,17 @@ obj-y := clock.o generic.o irq.o time.o #nmi-oopser.o
7obj-m := 7obj-m :=
8obj-n := 8obj-n :=
9obj- := 9obj- :=
10led-y := leds.o
11 10
12obj-$(CONFIG_CPU_FREQ_SA1100) += cpu-sa1100.o 11obj-$(CONFIG_CPU_FREQ_SA1100) += cpu-sa1100.o
13obj-$(CONFIG_CPU_FREQ_SA1110) += cpu-sa1110.o 12obj-$(CONFIG_CPU_FREQ_SA1110) += cpu-sa1110.o
14 13
15# Specific board support 14# Specific board support
16obj-$(CONFIG_SA1100_ASSABET) += assabet.o 15obj-$(CONFIG_SA1100_ASSABET) += assabet.o
17led-$(CONFIG_SA1100_ASSABET) += leds-assabet.o
18obj-$(CONFIG_ASSABET_NEPONSET) += neponset.o 16obj-$(CONFIG_ASSABET_NEPONSET) += neponset.o
19 17
20obj-$(CONFIG_SA1100_BADGE4) += badge4.o 18obj-$(CONFIG_SA1100_BADGE4) += badge4.o
21led-$(CONFIG_SA1100_BADGE4) += leds-badge4.o
22 19
23obj-$(CONFIG_SA1100_CERF) += cerf.o 20obj-$(CONFIG_SA1100_CERF) += cerf.o
24led-$(CONFIG_SA1100_CERF) += leds-cerf.o
25 21
26obj-$(CONFIG_SA1100_COLLIE) += collie.o 22obj-$(CONFIG_SA1100_COLLIE) += collie.o
27 23
@@ -29,13 +25,11 @@ obj-$(CONFIG_SA1100_H3100) += h3100.o h3xxx.o
29obj-$(CONFIG_SA1100_H3600) += h3600.o h3xxx.o 25obj-$(CONFIG_SA1100_H3600) += h3600.o h3xxx.o
30 26
31obj-$(CONFIG_SA1100_HACKKIT) += hackkit.o 27obj-$(CONFIG_SA1100_HACKKIT) += hackkit.o
32led-$(CONFIG_SA1100_HACKKIT) += leds-hackkit.o
33 28
34obj-$(CONFIG_SA1100_JORNADA720) += jornada720.o 29obj-$(CONFIG_SA1100_JORNADA720) += jornada720.o
35obj-$(CONFIG_SA1100_JORNADA720_SSP) += jornada720_ssp.o 30obj-$(CONFIG_SA1100_JORNADA720_SSP) += jornada720_ssp.o
36 31
37obj-$(CONFIG_SA1100_LART) += lart.o 32obj-$(CONFIG_SA1100_LART) += lart.o
38led-$(CONFIG_SA1100_LART) += leds-lart.o
39 33
40obj-$(CONFIG_SA1100_NANOENGINE) += nanoengine.o 34obj-$(CONFIG_SA1100_NANOENGINE) += nanoengine.o
41obj-$(CONFIG_PCI_NANOENGINE) += pci-nanoengine.o 35obj-$(CONFIG_PCI_NANOENGINE) += pci-nanoengine.o
@@ -46,9 +40,6 @@ obj-$(CONFIG_SA1100_SHANNON) += shannon.o
46 40
47obj-$(CONFIG_SA1100_SIMPAD) += simpad.o 41obj-$(CONFIG_SA1100_SIMPAD) += simpad.o
48 42
49# LEDs support
50obj-$(CONFIG_LEDS) += $(led-y)
51
52# Miscellaneous functions 43# Miscellaneous functions
53obj-$(CONFIG_PM) += pm.o sleep.o 44obj-$(CONFIG_PM) += pm.o sleep.o
54obj-$(CONFIG_SA1100_SSP) += ssp.o 45obj-$(CONFIG_SA1100_SSP) += ssp.o
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index d1dc7f1a239c..0359a66359bd 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -20,6 +20,8 @@
20#include <linux/mtd/partitions.h> 20#include <linux/mtd/partitions.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/mm.h> 22#include <linux/mm.h>
23#include <linux/leds.h>
24#include <linux/slab.h>
23 25
24#include <video/sa1100fb.h> 26#include <video/sa1100fb.h>
25 27
@@ -529,6 +531,89 @@ static void __init assabet_map_io(void)
529 sa1100_register_uart(2, 3); 531 sa1100_register_uart(2, 3);
530} 532}
531 533
534/* LEDs */
535#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
536struct assabet_led {
537 struct led_classdev cdev;
538 u32 mask;
539};
540
541/*
542 * The triggers lines up below will only be used if the
543 * LED triggers are compiled in.
544 */
545static const struct {
546 const char *name;
547 const char *trigger;
548} assabet_leds[] = {
549 { "assabet:red", "cpu0",},
550 { "assabet:green", "heartbeat", },
551};
552
553/*
554 * The LED control in Assabet is reversed:
555 * - setting bit means turn off LED
556 * - clearing bit means turn on LED
557 */
558static void assabet_led_set(struct led_classdev *cdev,
559 enum led_brightness b)
560{
561 struct assabet_led *led = container_of(cdev,
562 struct assabet_led, cdev);
563
564 if (b != LED_OFF)
565 ASSABET_BCR_clear(led->mask);
566 else
567 ASSABET_BCR_set(led->mask);
568}
569
570static enum led_brightness assabet_led_get(struct led_classdev *cdev)
571{
572 struct assabet_led *led = container_of(cdev,
573 struct assabet_led, cdev);
574
575 return (ASSABET_BCR & led->mask) ? LED_OFF : LED_FULL;
576}
577
578static int __init assabet_leds_init(void)
579{
580 int i;
581
582 if (!machine_is_assabet())
583 return -ENODEV;
584
585 for (i = 0; i < ARRAY_SIZE(assabet_leds); i++) {
586 struct assabet_led *led;
587
588 led = kzalloc(sizeof(*led), GFP_KERNEL);
589 if (!led)
590 break;
591
592 led->cdev.name = assabet_leds[i].name;
593 led->cdev.brightness_set = assabet_led_set;
594 led->cdev.brightness_get = assabet_led_get;
595 led->cdev.default_trigger = assabet_leds[i].trigger;
596
597 if (!i)
598 led->mask = ASSABET_BCR_LED_RED;
599 else
600 led->mask = ASSABET_BCR_LED_GREEN;
601
602 if (led_classdev_register(NULL, &led->cdev) < 0) {
603 kfree(led);
604 break;
605 }
606 }
607
608 return 0;
609}
610
611/*
612 * Since we may have triggers on any subsystem, defer registration
613 * until after subsystem_init.
614 */
615fs_initcall(assabet_leds_init);
616#endif
532 617
533MACHINE_START(ASSABET, "Intel-Assabet") 618MACHINE_START(ASSABET, "Intel-Assabet")
534 .atag_offset = 0x100, 619 .atag_offset = 0x100,
diff --git a/arch/arm/mach-sa1100/badge4.c b/arch/arm/mach-sa1100/badge4.c
index b30fb99b587c..038df4894b0f 100644
--- a/arch/arm/mach-sa1100/badge4.c
+++ b/arch/arm/mach-sa1100/badge4.c
@@ -22,6 +22,8 @@
22#include <linux/mtd/mtd.h> 22#include <linux/mtd/mtd.h>
23#include <linux/mtd/partitions.h> 23#include <linux/mtd/partitions.h>
24#include <linux/errno.h> 24#include <linux/errno.h>
25#include <linux/gpio.h>
26#include <linux/leds.h>
25 27
26#include <mach/hardware.h> 28#include <mach/hardware.h>
27#include <asm/mach-types.h> 29#include <asm/mach-types.h>
@@ -76,8 +78,36 @@ static struct platform_device sa1111_device = {
76 .resource = sa1111_resources, 78 .resource = sa1111_resources,
77}; 79};
78 80
81/* LEDs */
82struct gpio_led badge4_gpio_leds[] = {
83 {
84 .name = "badge4:red",
85 .default_trigger = "heartbeat",
86 .gpio = 7,
87 },
88 {
89 .name = "badge4:green",
90 .default_trigger = "cpu0",
91 .gpio = 9,
92 },
93};
94
95static struct gpio_led_platform_data badge4_gpio_led_info = {
96 .leds = badge4_gpio_leds,
97 .num_leds = ARRAY_SIZE(badge4_gpio_leds),
98};
99
100static struct platform_device badge4_leds = {
101 .name = "leds-gpio",
102 .id = -1,
103 .dev = {
104 .platform_data = &badge4_gpio_led_info,
105 }
106};
107
79static struct platform_device *devices[] __initdata = { 108static struct platform_device *devices[] __initdata = {
80 &sa1111_device, 109 &sa1111_device,
110 &badge4_leds,
81}; 111};
82 112
83static int __init badge4_sa1111_init(void) 113static int __init badge4_sa1111_init(void)
diff --git a/arch/arm/mach-sa1100/cerf.c b/arch/arm/mach-sa1100/cerf.c
index 09d7f4b4b354..5240f104a3cd 100644
--- a/arch/arm/mach-sa1100/cerf.c
+++ b/arch/arm/mach-sa1100/cerf.c
@@ -17,6 +17,8 @@
17#include <linux/irq.h> 17#include <linux/irq.h>
18#include <linux/mtd/mtd.h> 18#include <linux/mtd/mtd.h>
19#include <linux/mtd/partitions.h> 19#include <linux/mtd/partitions.h>
20#include <linux/gpio.h>
21#include <linux/leds.h>
20 22
21#include <mach/hardware.h> 23#include <mach/hardware.h>
22#include <asm/setup.h> 24#include <asm/setup.h>
@@ -43,8 +45,48 @@ static struct platform_device cerfuart2_device = {
43 .resource = cerfuart2_resources, 45 .resource = cerfuart2_resources,
44}; 46};
45 47
48/* LEDs */
49struct gpio_led cerf_gpio_leds[] = {
50 {
51 .name = "cerf:d0",
52 .default_trigger = "heartbeat",
53 .gpio = 0,
54 },
55 {
56 .name = "cerf:d1",
57 .default_trigger = "cpu0",
58 .gpio = 1,
59 },
60 {
61 .name = "cerf:d2",
62 .default_trigger = "default-on",
63 .gpio = 2,
64 },
65 {
66 .name = "cerf:d3",
67 .default_trigger = "default-on",
68 .gpio = 3,
69 },
70
71};
72
73static struct gpio_led_platform_data cerf_gpio_led_info = {
74 .leds = cerf_gpio_leds,
75 .num_leds = ARRAY_SIZE(cerf_gpio_leds),
76};
77
78static struct platform_device cerf_leds = {
79 .name = "leds-gpio",
80 .id = -1,
81 .dev = {
82 .platform_data = &cerf_gpio_led_info,
83 }
84};
85
86
46static struct platform_device *cerf_devices[] __initdata = { 87static struct platform_device *cerf_devices[] __initdata = {
47 &cerfuart2_device, 88 &cerfuart2_device,
89 &cerf_leds,
48}; 90};
49 91
50#ifdef CONFIG_SA1100_CERF_FLASH_32MB 92#ifdef CONFIG_SA1100_CERF_FLASH_32MB
diff --git a/arch/arm/mach-sa1100/hackkit.c b/arch/arm/mach-sa1100/hackkit.c
index 7f86bd911826..fc106aab7c7e 100644
--- a/arch/arm/mach-sa1100/hackkit.c
+++ b/arch/arm/mach-sa1100/hackkit.c
@@ -21,6 +21,10 @@
21#include <linux/serial_core.h> 21#include <linux/serial_core.h>
22#include <linux/mtd/mtd.h> 22#include <linux/mtd/mtd.h>
23#include <linux/mtd/partitions.h> 23#include <linux/mtd/partitions.h>
24#include <linux/tty.h>
25#include <linux/gpio.h>
26#include <linux/leds.h>
27#include <linux/platform_device.h>
24 28
25#include <asm/mach-types.h> 29#include <asm/mach-types.h>
26#include <asm/setup.h> 30#include <asm/setup.h>
@@ -183,9 +187,37 @@ static struct flash_platform_data hackkit_flash_data = {
183static struct resource hackkit_flash_resource = 187static struct resource hackkit_flash_resource =
184 DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M); 188 DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M);
185 189
190/* LEDs */
191struct gpio_led hackkit_gpio_leds[] = {
192 {
193 .name = "hackkit:red",
194 .default_trigger = "cpu0",
195 .gpio = 22,
196 },
197 {
198 .name = "hackkit:green",
199 .default_trigger = "heartbeat",
200 .gpio = 23,
201 },
202};
203
204static struct gpio_led_platform_data hackkit_gpio_led_info = {
205 .leds = hackkit_gpio_leds,
206 .num_leds = ARRAY_SIZE(hackkit_gpio_leds),
207};
208
209static struct platform_device hackkit_leds = {
210 .name = "leds-gpio",
211 .id = -1,
212 .dev = {
213 .platform_data = &hackkit_gpio_led_info,
214 }
215};
216
186static void __init hackkit_init(void) 217static void __init hackkit_init(void)
187{ 218{
188 sa11x0_register_mtd(&hackkit_flash_data, &hackkit_flash_resource, 1); 219 sa11x0_register_mtd(&hackkit_flash_data, &hackkit_flash_resource, 1);
220 platform_device_register(&hackkit_leds);
189} 221}
190 222
191/********************************************************************** 223/**********************************************************************
diff --git a/arch/arm/mach-sa1100/lart.c b/arch/arm/mach-sa1100/lart.c
index b775a0abec0a..b2ce04bf4c9b 100644
--- a/arch/arm/mach-sa1100/lart.c
+++ b/arch/arm/mach-sa1100/lart.c
@@ -5,6 +5,9 @@
5#include <linux/init.h> 5#include <linux/init.h>
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/tty.h> 7#include <linux/tty.h>
8#include <linux/gpio.h>
9#include <linux/leds.h>
10#include <linux/platform_device.h>
8 11
9#include <video/sa1100fb.h> 12#include <video/sa1100fb.h>
10 13
@@ -126,6 +129,27 @@ static struct map_desc lart_io_desc[] __initdata = {
126 } 129 }
127}; 130};
128 131
132/* LEDs */
133struct gpio_led lart_gpio_leds[] = {
134 {
135 .name = "lart:red",
136 .default_trigger = "cpu0",
137 .gpio = 23,
138 },
139};
140
141static struct gpio_led_platform_data lart_gpio_led_info = {
142 .leds = lart_gpio_leds,
143 .num_leds = ARRAY_SIZE(lart_gpio_leds),
144};
145
146static struct platform_device lart_leds = {
147 .name = "leds-gpio",
148 .id = -1,
149 .dev = {
150 .platform_data = &lart_gpio_led_info,
151 }
152};
129static void __init lart_map_io(void) 153static void __init lart_map_io(void)
130{ 154{
131 sa1100_map_io(); 155 sa1100_map_io();
@@ -139,6 +163,8 @@ static void __init lart_map_io(void)
139 GPDR |= GPIO_UART_TXD; 163 GPDR |= GPIO_UART_TXD;
140 GPDR &= ~GPIO_UART_RXD; 164 GPDR &= ~GPIO_UART_RXD;
141 PPAR |= PPAR_UPR; 165 PPAR |= PPAR_UPR;
166
167 platform_device_register(&lart_leds);
142} 168}
143 169
144MACHINE_START(LART, "LART") 170MACHINE_START(LART, "LART")
diff --git a/arch/arm/mach-sa1100/leds-assabet.c b/arch/arm/mach-sa1100/leds-assabet.c
deleted file mode 100644
index 3699176bca94..000000000000
--- a/arch/arm/mach-sa1100/leds-assabet.c
+++ /dev/null
@@ -1,113 +0,0 @@
1/*
2 * linux/arch/arm/mach-sa1100/leds-assabet.c
3 *
4 * Copyright (C) 2000 John Dorsey <john+@cs.cmu.edu>
5 *
6 * Original (leds-footbridge.c) by Russell King
7 *
8 * Assabet uses the LEDs as follows:
9 * - Green - toggles state every 50 timer interrupts
10 * - Red - on if system is not idle
11 */
12#include <linux/init.h>
13
14#include <mach/hardware.h>
15#include <asm/leds.h>
16#include <mach/assabet.h>
17
18#include "leds.h"
19
20
21#define LED_STATE_ENABLED 1
22#define LED_STATE_CLAIMED 2
23
24static unsigned int led_state;
25static unsigned int hw_led_state;
26
27#define ASSABET_BCR_LED_MASK (ASSABET_BCR_LED_GREEN | ASSABET_BCR_LED_RED)
28
29void assabet_leds_event(led_event_t evt)
30{
31 unsigned long flags;
32
33 local_irq_save(flags);
34
35 switch (evt) {
36 case led_start:
37 hw_led_state = ASSABET_BCR_LED_RED | ASSABET_BCR_LED_GREEN;
38 led_state = LED_STATE_ENABLED;
39 break;
40
41 case led_stop:
42 led_state &= ~LED_STATE_ENABLED;
43 hw_led_state = ASSABET_BCR_LED_RED | ASSABET_BCR_LED_GREEN;
44 ASSABET_BCR_frob(ASSABET_BCR_LED_MASK, hw_led_state);
45 break;
46
47 case led_claim:
48 led_state |= LED_STATE_CLAIMED;
49 hw_led_state = ASSABET_BCR_LED_RED | ASSABET_BCR_LED_GREEN;
50 break;
51
52 case led_release:
53 led_state &= ~LED_STATE_CLAIMED;
54 hw_led_state = ASSABET_BCR_LED_RED | ASSABET_BCR_LED_GREEN;
55 break;
56
57#ifdef CONFIG_LEDS_TIMER
58 case led_timer:
59 if (!(led_state & LED_STATE_CLAIMED))
60 hw_led_state ^= ASSABET_BCR_LED_GREEN;
61 break;
62#endif
63
64#ifdef CONFIG_LEDS_CPU
65 case led_idle_start:
66 if (!(led_state & LED_STATE_CLAIMED))
67 hw_led_state |= ASSABET_BCR_LED_RED;
68 break;
69
70 case led_idle_end:
71 if (!(led_state & LED_STATE_CLAIMED))
72 hw_led_state &= ~ASSABET_BCR_LED_RED;
73 break;
74#endif
75
76 case led_halted:
77 break;
78
79 case led_green_on:
80 if (led_state & LED_STATE_CLAIMED)
81 hw_led_state &= ~ASSABET_BCR_LED_GREEN;
82 break;
83
84 case led_green_off:
85 if (led_state & LED_STATE_CLAIMED)
86 hw_led_state |= ASSABET_BCR_LED_GREEN;
87 break;
88
89 case led_amber_on:
90 break;
91
92 case led_amber_off:
93 break;
94
95 case led_red_on:
96 if (led_state & LED_STATE_CLAIMED)
97 hw_led_state &= ~ASSABET_BCR_LED_RED;
98 break;
99
100 case led_red_off:
101 if (led_state & LED_STATE_CLAIMED)
102 hw_led_state |= ASSABET_BCR_LED_RED;
103 break;
104
105 default:
106 break;
107 }
108
109 if (led_state & LED_STATE_ENABLED)
110 ASSABET_BCR_frob(ASSABET_BCR_LED_MASK, hw_led_state);
111
112 local_irq_restore(flags);
113}
diff --git a/arch/arm/mach-sa1100/leds-badge4.c b/arch/arm/mach-sa1100/leds-badge4.c
deleted file mode 100644
index f99fac3eedb6..000000000000
--- a/arch/arm/mach-sa1100/leds-badge4.c
+++ /dev/null
@@ -1,110 +0,0 @@
1/*
2 * linux/arch/arm/mach-sa1100/leds-badge4.c
3 *
4 * Author: Christopher Hoover <ch@hpl.hp.com>
5 * Copyright (C) 2002 Hewlett-Packard Company
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12
13#include <linux/init.h>
14
15#include <mach/hardware.h>
16#include <asm/leds.h>
17
18#include "leds.h"
19
20#define LED_STATE_ENABLED 1
21#define LED_STATE_CLAIMED 2
22
23static unsigned int led_state;
24static unsigned int hw_led_state;
25
26#define LED_RED GPIO_GPIO(7)
27#define LED_GREEN GPIO_GPIO(9)
28#define LED_MASK (LED_RED|LED_GREEN)
29
30#define LED_IDLE LED_GREEN
31#define LED_TIMER LED_RED
32
33void badge4_leds_event(led_event_t evt)
34{
35 unsigned long flags;
36
37 local_irq_save(flags);
38
39 switch (evt) {
40 case led_start:
41 GPDR |= LED_MASK;
42 hw_led_state = LED_MASK;
43 led_state = LED_STATE_ENABLED;
44 break;
45
46 case led_stop:
47 led_state &= ~LED_STATE_ENABLED;
48 break;
49
50 case led_claim:
51 led_state |= LED_STATE_CLAIMED;
52 hw_led_state = LED_MASK;
53 break;
54
55 case led_release:
56 led_state &= ~LED_STATE_CLAIMED;
57 hw_led_state = LED_MASK;
58 break;
59
60#ifdef CONFIG_LEDS_TIMER
61 case led_timer:
62 if (!(led_state & LED_STATE_CLAIMED))
63 hw_led_state ^= LED_TIMER;
64 break;
65#endif
66
67#ifdef CONFIG_LEDS_CPU
68 case led_idle_start:
69 /* LED off when system is idle */
70 if (!(led_state & LED_STATE_CLAIMED))
71 hw_led_state &= ~LED_IDLE;
72 break;
73
74 case led_idle_end:
75 if (!(led_state & LED_STATE_CLAIMED))
76 hw_led_state |= LED_IDLE;
77 break;
78#endif
79
80 case led_red_on:
81 if (!(led_state & LED_STATE_CLAIMED))
82 hw_led_state &= ~LED_RED;
83 break;
84
85 case led_red_off:
86 if (!(led_state & LED_STATE_CLAIMED))
87 hw_led_state |= LED_RED;
88 break;
89
90 case led_green_on:
91 if (!(led_state & LED_STATE_CLAIMED))
92 hw_led_state &= ~LED_GREEN;
93 break;
94
95 case led_green_off:
96 if (!(led_state & LED_STATE_CLAIMED))
97 hw_led_state |= LED_GREEN;
98 break;
99
100 default:
101 break;
102 }
103
104 if (led_state & LED_STATE_ENABLED) {
105 GPSR = hw_led_state;
106 GPCR = hw_led_state ^ LED_MASK;
107 }
108
109 local_irq_restore(flags);
110}
diff --git a/arch/arm/mach-sa1100/leds-cerf.c b/arch/arm/mach-sa1100/leds-cerf.c
deleted file mode 100644
index 040540fb7d8a..000000000000
--- a/arch/arm/mach-sa1100/leds-cerf.c
+++ /dev/null
@@ -1,109 +0,0 @@
1/*
2 * linux/arch/arm/mach-sa1100/leds-cerf.c
3 *
4 * Author: ???
5 */
6#include <linux/init.h>
7
8#include <mach/hardware.h>
9#include <asm/leds.h>
10
11#include "leds.h"
12
13
14#define LED_STATE_ENABLED 1
15#define LED_STATE_CLAIMED 2
16
17static unsigned int led_state;
18static unsigned int hw_led_state;
19
20#define LED_D0 GPIO_GPIO(0)
21#define LED_D1 GPIO_GPIO(1)
22#define LED_D2 GPIO_GPIO(2)
23#define LED_D3 GPIO_GPIO(3)
24#define LED_MASK (LED_D0|LED_D1|LED_D2|LED_D3)
25
26void cerf_leds_event(led_event_t evt)
27{
28 unsigned long flags;
29
30 local_irq_save(flags);
31
32 switch (evt) {
33 case led_start:
34 hw_led_state = LED_MASK;
35 led_state = LED_STATE_ENABLED;
36 break;
37
38 case led_stop:
39 led_state &= ~LED_STATE_ENABLED;
40 break;
41
42 case led_claim:
43 led_state |= LED_STATE_CLAIMED;
44 hw_led_state = LED_MASK;
45 break;
46 case led_release:
47 led_state &= ~LED_STATE_CLAIMED;
48 hw_led_state = LED_MASK;
49 break;
50
51#ifdef CONFIG_LEDS_TIMER
52 case led_timer:
53 if (!(led_state & LED_STATE_CLAIMED))
54 hw_led_state ^= LED_D0;
55 break;
56#endif
57
58#ifdef CONFIG_LEDS_CPU
59 case led_idle_start:
60 if (!(led_state & LED_STATE_CLAIMED))
61 hw_led_state &= ~LED_D1;
62 break;
63
64 case led_idle_end:
65 if (!(led_state & LED_STATE_CLAIMED))
66 hw_led_state |= LED_D1;
67 break;
68#endif
69 case led_green_on:
70 if (!(led_state & LED_STATE_CLAIMED))
71 hw_led_state &= ~LED_D2;
72 break;
73
74 case led_green_off:
75 if (!(led_state & LED_STATE_CLAIMED))
76 hw_led_state |= LED_D2;
77 break;
78
79 case led_amber_on:
80 if (!(led_state & LED_STATE_CLAIMED))
81 hw_led_state &= ~LED_D3;
82 break;
83
84 case led_amber_off:
85 if (!(led_state & LED_STATE_CLAIMED))
86 hw_led_state |= LED_D3;
87 break;
88
89 case led_red_on:
90 if (!(led_state & LED_STATE_CLAIMED))
91 hw_led_state &= ~LED_D1;
92 break;
93
94 case led_red_off:
95 if (!(led_state & LED_STATE_CLAIMED))
96 hw_led_state |= LED_D1;
97 break;
98
99 default:
100 break;
101 }
102
103 if (led_state & LED_STATE_ENABLED) {
104 GPSR = hw_led_state;
105 GPCR = hw_led_state ^ LED_MASK;
106 }
107
108 local_irq_restore(flags);
109}
diff --git a/arch/arm/mach-sa1100/leds-hackkit.c b/arch/arm/mach-sa1100/leds-hackkit.c
deleted file mode 100644
index 6a2352436e62..000000000000
--- a/arch/arm/mach-sa1100/leds-hackkit.c
+++ /dev/null
@@ -1,111 +0,0 @@
1/*
2 * linux/arch/arm/mach-sa1100/leds-hackkit.c
3 *
4 * based on leds-lart.c
5 *
6 * (C) Erik Mouw (J.A.K.Mouw@its.tudelft.nl), April 21, 2000
7 * (C) Stefan Eletzhofer <stefan.eletzhofer@eletztrick.de>, 2002
8 *
9 * The HackKit has two leds (GPIO 22/23). The red led (gpio 22) is used
10 * as cpu led, the green one is used as timer led.
11 */
12#include <linux/init.h>
13
14#include <mach/hardware.h>
15#include <asm/leds.h>
16
17#include "leds.h"
18
19
20#define LED_STATE_ENABLED 1
21#define LED_STATE_CLAIMED 2
22
23static unsigned int led_state;
24static unsigned int hw_led_state;
25
26#define LED_GREEN GPIO_GPIO23
27#define LED_RED GPIO_GPIO22
28#define LED_MASK (LED_RED | LED_GREEN)
29
30void hackkit_leds_event(led_event_t evt)
31{
32 unsigned long flags;
33
34 local_irq_save(flags);
35
36 switch(evt) {
37 case led_start:
38 /* pin 22/23 are outputs */
39 GPDR |= LED_MASK;
40 hw_led_state = LED_MASK;
41 led_state = LED_STATE_ENABLED;
42 break;
43
44 case led_stop:
45 led_state &= ~LED_STATE_ENABLED;
46 break;
47
48 case led_claim:
49 led_state |= LED_STATE_CLAIMED;
50 hw_led_state = LED_MASK;
51 break;
52
53 case led_release:
54 led_state &= ~LED_STATE_CLAIMED;
55 hw_led_state = LED_MASK;
56 break;
57
58#ifdef CONFIG_LEDS_TIMER
59 case led_timer:
60 if (!(led_state & LED_STATE_CLAIMED))
61 hw_led_state ^= LED_GREEN;
62 break;
63#endif
64
65#ifdef CONFIG_LEDS_CPU
66 case led_idle_start:
67 /* The LART people like the LED to be off when the
68 system is idle... */
69 if (!(led_state & LED_STATE_CLAIMED))
70 hw_led_state &= ~LED_RED;
71 break;
72
73 case led_idle_end:
74 /* ... and on if the system is not idle */
75 if (!(led_state & LED_STATE_CLAIMED))
76 hw_led_state |= LED_RED;
77 break;
78#endif
79
80 case led_red_on:
81 if (led_state & LED_STATE_CLAIMED)
82 hw_led_state &= ~LED_RED;
83 break;
84
85 case led_red_off:
86 if (led_state & LED_STATE_CLAIMED)
87 hw_led_state |= LED_RED;
88 break;
89
90 case led_green_on:
91 if (led_state & LED_STATE_CLAIMED)
92 hw_led_state &= ~LED_GREEN;
93 break;
94
95 case led_green_off:
96 if (led_state & LED_STATE_CLAIMED)
97 hw_led_state |= LED_GREEN;
98 break;
99
100 default:
101 break;
102 }
103
104 /* Now set the GPIO state, or nothing will happen at all */
105 if (led_state & LED_STATE_ENABLED) {
106 GPSR = hw_led_state;
107 GPCR = hw_led_state ^ LED_MASK;
108 }
109
110 local_irq_restore(flags);
111}
diff --git a/arch/arm/mach-sa1100/leds-lart.c b/arch/arm/mach-sa1100/leds-lart.c
deleted file mode 100644
index a51830c60e53..000000000000
--- a/arch/arm/mach-sa1100/leds-lart.c
+++ /dev/null
@@ -1,100 +0,0 @@
1/*
2 * linux/arch/arm/mach-sa1100/leds-lart.c
3 *
4 * (C) Erik Mouw (J.A.K.Mouw@its.tudelft.nl), April 21, 2000
5 *
6 * LART uses the LED as follows:
7 * - GPIO23 is the LED, on if system is not idle
8 * You can use both CONFIG_LEDS_CPU and CONFIG_LEDS_TIMER at the same
9 * time, but in that case the timer events will still dictate the
10 * pace of the LED.
11 */
12#include <linux/init.h>
13
14#include <mach/hardware.h>
15#include <asm/leds.h>
16
17#include "leds.h"
18
19
20#define LED_STATE_ENABLED 1
21#define LED_STATE_CLAIMED 2
22
23static unsigned int led_state;
24static unsigned int hw_led_state;
25
26#define LED_23 GPIO_GPIO23
27#define LED_MASK (LED_23)
28
29void lart_leds_event(led_event_t evt)
30{
31 unsigned long flags;
32
33 local_irq_save(flags);
34
35 switch(evt) {
36 case led_start:
37 /* pin 23 is output pin */
38 GPDR |= LED_23;
39 hw_led_state = LED_MASK;
40 led_state = LED_STATE_ENABLED;
41 break;
42
43 case led_stop:
44 led_state &= ~LED_STATE_ENABLED;
45 break;
46
47 case led_claim:
48 led_state |= LED_STATE_CLAIMED;
49 hw_led_state = LED_MASK;
50 break;
51
52 case led_release:
53 led_state &= ~LED_STATE_CLAIMED;
54 hw_led_state = LED_MASK;
55 break;
56
57#ifdef CONFIG_LEDS_TIMER
58 case led_timer:
59 if (!(led_state & LED_STATE_CLAIMED))
60 hw_led_state ^= LED_23;
61 break;
62#endif
63
64#ifdef CONFIG_LEDS_CPU
65 case led_idle_start:
66 /* The LART people like the LED to be off when the
67 system is idle... */
68 if (!(led_state & LED_STATE_CLAIMED))
69 hw_led_state &= ~LED_23;
70 break;
71
72 case led_idle_end:
73 /* ... and on if the system is not idle */
74 if (!(led_state & LED_STATE_CLAIMED))
75 hw_led_state |= LED_23;
76 break;
77#endif
78
79 case led_red_on:
80 if (led_state & LED_STATE_CLAIMED)
81 hw_led_state &= ~LED_23;
82 break;
83
84 case led_red_off:
85 if (led_state & LED_STATE_CLAIMED)
86 hw_led_state |= LED_23;
87 break;
88
89 default:
90 break;
91 }
92
93 /* Now set the GPIO state, or nothing will happen at all */
94 if (led_state & LED_STATE_ENABLED) {
95 GPSR = hw_led_state;
96 GPCR = hw_led_state ^ LED_MASK;
97 }
98
99 local_irq_restore(flags);
100}
diff --git a/arch/arm/mach-sa1100/leds.c b/arch/arm/mach-sa1100/leds.c
deleted file mode 100644
index 5fe71a0f1053..000000000000
--- a/arch/arm/mach-sa1100/leds.c
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * linux/arch/arm/mach-sa1100/leds.c
3 *
4 * SA1100 LEDs dispatcher
5 *
6 * Copyright (C) 2001 Nicolas Pitre
7 */
8#include <linux/compiler.h>
9#include <linux/init.h>
10
11#include <asm/leds.h>
12#include <asm/mach-types.h>
13
14#include "leds.h"
15
16static int __init
17sa1100_leds_init(void)
18{
19 if (machine_is_assabet())
20 leds_event = assabet_leds_event;
21 if (machine_is_consus())
22 leds_event = consus_leds_event;
23 if (machine_is_badge4())
24 leds_event = badge4_leds_event;
25 if (machine_is_brutus())
26 leds_event = brutus_leds_event;
27 if (machine_is_cerf())
28 leds_event = cerf_leds_event;
29 if (machine_is_flexanet())
30 leds_event = flexanet_leds_event;
31 if (machine_is_graphicsclient())
32 leds_event = graphicsclient_leds_event;
33 if (machine_is_hackkit())
34 leds_event = hackkit_leds_event;
35 if (machine_is_lart())
36 leds_event = lart_leds_event;
37 if (machine_is_pfs168())
38 leds_event = pfs168_leds_event;
39 if (machine_is_graphicsmaster())
40 leds_event = graphicsmaster_leds_event;
41 if (machine_is_adsbitsy())
42 leds_event = adsbitsy_leds_event;
43 if (machine_is_pt_system3())
44 leds_event = system3_leds_event;
45
46 leds_event(led_start);
47 return 0;
48}
49
50core_initcall(sa1100_leds_init);
diff --git a/arch/arm/mach-sa1100/leds.h b/arch/arm/mach-sa1100/leds.h
deleted file mode 100644
index 776b6020f550..000000000000
--- a/arch/arm/mach-sa1100/leds.h
+++ /dev/null
@@ -1,13 +0,0 @@
1extern void assabet_leds_event(led_event_t evt);
2extern void badge4_leds_event(led_event_t evt);
3extern void consus_leds_event(led_event_t evt);
4extern void brutus_leds_event(led_event_t evt);
5extern void cerf_leds_event(led_event_t evt);
6extern void flexanet_leds_event(led_event_t evt);
7extern void graphicsclient_leds_event(led_event_t evt);
8extern void hackkit_leds_event(led_event_t evt);
9extern void lart_leds_event(led_event_t evt);
10extern void pfs168_leds_event(led_event_t evt);
11extern void graphicsmaster_leds_event(led_event_t evt);
12extern void adsbitsy_leds_event(led_event_t evt);
13extern void system3_leds_event(led_event_t evt);