aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-kirkwood
diff options
context:
space:
mode:
authorSimon Guinot <sguinot@lacie.com>2010-07-06 10:08:47 -0400
committerNicolas Pitre <nico@fluxnic.net>2010-07-16 22:02:00 -0400
commit2641375d6de0885dd26ee0edd0cf00282e3324d5 (patch)
tree53a99d6f4d18c6c6aa5106f8b9ed98b18c8d663c /arch/arm/mach-kirkwood
parent11efe71f6564e59ba9acfc636ac6f423e059dc69 (diff)
[ARM] Kirkwood: update LED support for Network Space v2
Signed-off-by: Simon Guinot <sguinot@lacie.com> Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Diffstat (limited to 'arch/arm/mach-kirkwood')
-rw-r--r--arch/arm/mach-kirkwood/netspace_v2-setup.c71
1 files changed, 30 insertions, 41 deletions
diff --git a/arch/arm/mach-kirkwood/netspace_v2-setup.c b/arch/arm/mach-kirkwood/netspace_v2-setup.c
index 9f20c8d3e18b..d26bf324738b 100644
--- a/arch/arm/mach-kirkwood/netspace_v2-setup.c
+++ b/arch/arm/mach-kirkwood/netspace_v2-setup.c
@@ -39,6 +39,7 @@
39#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
40#include <asm/mach/time.h> 40#include <asm/mach/time.h>
41#include <mach/kirkwood.h> 41#include <mach/kirkwood.h>
42#include <mach/leds-ns2.h>
42#include <plat/time.h> 43#include <plat/time.h>
43#include "common.h" 44#include "common.h"
44#include "mpp.h" 45#include "mpp.h"
@@ -172,36 +173,12 @@ static struct platform_device netspace_v2_gpio_buttons = {
172 * GPIO LEDs 173 * GPIO LEDs
173 ****************************************************************************/ 174 ****************************************************************************/
174 175
175/*
176 * The blue front LED is wired to a CPLD and can blink in relation with the
177 * SATA activity.
178 *
179 * The following array detail the different LED registers and the combination
180 * of their possible values:
181 *
182 * cmd_led | slow_led | /SATA active | LED state
183 * | | |
184 * 1 | 0 | x | off
185 * - | 1 | x | on
186 * 0 | 0 | 1 | on
187 * 0 | 0 | 0 | blink (rate 300ms)
188 */
189
190#define NETSPACE_V2_GPIO_RED_LED 12 176#define NETSPACE_V2_GPIO_RED_LED 12
191#define NETSPACE_V2_GPIO_BLUE_LED_SLOW 29
192#define NETSPACE_V2_GPIO_BLUE_LED_CMD 30
193
194 177
195static struct gpio_led netspace_v2_gpio_led_pins[] = { 178static struct gpio_led netspace_v2_gpio_led_pins[] = {
196 { 179 {
197 .name = "ns_v2:blue:sata", 180 .name = "ns_v2:red:fail",
198 .default_trigger = "default-on", 181 .gpio = NETSPACE_V2_GPIO_RED_LED,
199 .gpio = NETSPACE_V2_GPIO_BLUE_LED_CMD,
200 .active_low = 1,
201 },
202 {
203 .name = "ns_v2:red:fail",
204 .gpio = NETSPACE_V2_GPIO_RED_LED,
205 }, 182 },
206}; 183};
207 184
@@ -218,22 +195,33 @@ static struct platform_device netspace_v2_gpio_leds = {
218 }, 195 },
219}; 196};
220 197
221static void __init netspace_v2_gpio_leds_init(void) 198/*****************************************************************************
222{ 199 * Dual-GPIO CPLD LEDs
223 int err; 200 ****************************************************************************/
224 201
225 /* Configure register slow_led to allow SATA activity LED blinking */ 202#define NETSPACE_V2_GPIO_BLUE_LED_SLOW 29
226 err = gpio_request(NETSPACE_V2_GPIO_BLUE_LED_SLOW, "blue LED slow"); 203#define NETSPACE_V2_GPIO_BLUE_LED_CMD 30
227 if (err == 0) {
228 err = gpio_direction_output(NETSPACE_V2_GPIO_BLUE_LED_SLOW, 0);
229 if (err)
230 gpio_free(NETSPACE_V2_GPIO_BLUE_LED_SLOW);
231 }
232 if (err)
233 pr_err("netspace_v2: failed to configure blue LED slow GPIO\n");
234 204
235 platform_device_register(&netspace_v2_gpio_leds); 205static struct ns2_led netspace_v2_led_pins[] = {
236} 206 {
207 .name = "ns_v2:blue:sata",
208 .cmd = NETSPACE_V2_GPIO_BLUE_LED_CMD,
209 .slow = NETSPACE_V2_GPIO_BLUE_LED_SLOW,
210 },
211};
212
213static struct ns2_led_platform_data netspace_v2_leds_data = {
214 .num_leds = ARRAY_SIZE(netspace_v2_led_pins),
215 .leds = netspace_v2_led_pins,
216};
217
218static struct platform_device netspace_v2_leds = {
219 .name = "leds-ns2",
220 .id = -1,
221 .dev = {
222 .platform_data = &netspace_v2_leds_data,
223 },
224};
237 225
238/***************************************************************************** 226/*****************************************************************************
239 * Timer 227 * Timer
@@ -316,7 +304,8 @@ static void __init netspace_v2_init(void)
316 i2c_register_board_info(0, netspace_v2_i2c_info, 304 i2c_register_board_info(0, netspace_v2_i2c_info,
317 ARRAY_SIZE(netspace_v2_i2c_info)); 305 ARRAY_SIZE(netspace_v2_i2c_info));
318 306
319 netspace_v2_gpio_leds_init(); 307 platform_device_register(&netspace_v2_leds);
308 platform_device_register(&netspace_v2_gpio_leds);
320 platform_device_register(&netspace_v2_gpio_buttons); 309 platform_device_register(&netspace_v2_gpio_buttons);
321 310
322 if (gpio_request(NETSPACE_V2_GPIO_POWER_OFF, "power-off") == 0 && 311 if (gpio_request(NETSPACE_V2_GPIO_POWER_OFF, "power-off") == 0 &&