1 --- a/arch/arm/mach-at91/at91rm9200_devices.c
2 +++ b/arch/arm/mach-at91/at91rm9200_devices.c
4 static void __init at91_add_device_watchdog(void) {}
7 +/* --------------------------------------------------------------------
9 + * -------------------------------------------------------------------- */
11 +#if defined(CONFIG_LEDS)
15 +void __init at91_init_leds(u8 cpu_led, u8 timer_led)
17 + /* Enable GPIO to access the LEDs */
18 + at91_set_gpio_output(cpu_led, 1);
19 + at91_set_gpio_output(timer_led, 1);
21 + at91_leds_cpu = cpu_led;
22 + at91_leds_timer = timer_led;
25 +void __init at91_init_leds(u8 cpu_led, u8 timer_led) {}
28 /* --------------------------------------------------------------------
29 * SSC -- Synchronous Serial Controller
30 --- a/arch/arm/mach-at91/Makefile
31 +++ b/arch/arm/mach-at91/Makefile
33 obj-$(CONFIG_MACH_AT91EB01) += board-eb01.o
37 +ifeq ($(CONFIG_MACH_VLINK),y)
38 +led-$(CONFIG_MACH_VLINK) += vlink_leds.o
43 obj-$(CONFIG_FB_S1D13XXX) += ics1523.o
47 +++ b/arch/arm/mach-at91/vlink_leds.c
50 + * LED driver for Atmel AT91-based boards.
52 + * Copyright (C) SAN People (Pty) Ltd
53 + * Modified for FDL VersaLink Copyright (C) Guthrie Consulting
55 + * This program is free software; you can redistribute it and/or
56 + * modify it under the terms of the GNU General Public License
57 + * as published by the Free Software Foundation; either version
58 + * 2 of the License, or (at your option) any later version.
61 +#include <linux/kernel.h>
62 +#include <linux/module.h>
63 +#include <linux/init.h>
65 +#include <asm/mach-types.h>
66 +#include <asm/leds.h>
67 +#include <asm/arch/board.h>
68 +#include <asm/arch/gpio.h>
71 +static inline void at91_led_on(unsigned int led)
73 + at91_set_gpio_value(led, 0);
76 +static inline void at91_led_off(unsigned int led)
78 + at91_set_gpio_value(led, 1);
81 +static inline void at91_led_toggle(unsigned int led)
83 + unsigned long is_off = at91_get_gpio_value(led);
86 + at91_led_off(at91_leds_cpu);
89 + at91_led_on(at91_leds_cpu);
96 + * Handle LED events.
100 + * VersaLink has a single bi-coloured LED which changes colour when the
101 + * polarity is reversed
103 +static void at91_leds_event(led_event_t evt)
105 + unsigned long flags;
107 + local_irq_save(flags);
110 + case led_start: /* System startup */
111 + at91_led_toggle(at91_leds_timer);
114 + case led_stop: /* System stop / suspend */
115 + at91_led_toggle(at91_leds_timer);
118 +#ifdef CONFIG_LEDS_TIMER
119 + case led_timer: /* Every 50 timer ticks */
120 + at91_led_toggle(at91_leds_timer);
124 +#ifdef CONFIG_LEDS_CPU
125 + case led_idle_start: /* Entering idle state */
126 + at91_led_toggle(at91_leds_timer);
129 + case led_idle_end: /* Exit idle state */
130 + at91_led_toggle(at91_leds_timer);
138 + local_irq_restore(flags);
142 +static int __init leds_init(void)
144 + if (!at91_leds_timer || !at91_leds_cpu)
147 + leds_event = at91_leds_event;
149 + leds_event(led_start);
153 +__initcall(leds_init);
154 --- a/include/asm-arm/arch-at91/board.h
155 +++ b/include/asm-arm/arch-at91/board.h
158 extern void __init at91_add_device_isi(void);
161 +extern u8 at91_leds_cpu;
162 +extern u8 at91_leds_timer;
163 +extern void __init at91_init_leds(u8 cpu_led, u8 timer_led);
165 /* Touchscreen Controller */
166 extern void __init at91_add_device_tsadcc(void);