aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-orion5x
diff options
context:
space:
mode:
authorSimon Guinot <sguinot@lacie.com>2010-02-09 15:21:50 -0500
committerNicolas Pitre <nico@fluxnic.net>2010-02-09 20:49:01 -0500
commit7a15726cb4aca67150b93a5ce5413efe6e87c95d (patch)
treef53a38d3ba57561b0630803f3b216bf5cc5155c1 /arch/arm/mach-orion5x
parentd74b96a73a99853708d6b278c2ce683657fa1ec5 (diff)
[ARM] Orion5x: enable SATA LED blinking for d2net
Signed-off-by: Simon Guinot <sguinot@lacie.com> Signed-off-by: Nicolas Pitre <nico@marvell.com>
Diffstat (limited to 'arch/arm/mach-orion5x')
-rw-r--r--arch/arm/mach-orion5x/d2net-setup.c41
1 files changed, 17 insertions, 24 deletions
diff --git a/arch/arm/mach-orion5x/d2net-setup.c b/arch/arm/mach-orion5x/d2net-setup.c
index 0420e45f66b..7130904ad99 100644
--- a/arch/arm/mach-orion5x/d2net-setup.c
+++ b/arch/arm/mach-orion5x/d2net-setup.c
@@ -149,10 +149,7 @@ static void __init d2net_sata_power_init(void)
149 149
150/* 150/*
151 * The blue front LED is wired to the CPLD and can blink in relation with the 151 * The blue front LED is wired to the CPLD and can blink in relation with the
152 * SATA activity. This feature is disabled to make this LED compatible with 152 * SATA activity.
153 * the leds-gpio driver: MPP14 and MPP15 are configured to act like output
154 * GPIO's and have to stay in an active state. This is needed to set the blue
155 * LED in a "fix on" state regardless of the SATA activity.
156 * 153 *
157 * The following array detail the different LED registers and the combination 154 * The following array detail the different LED registers and the combination
158 * of their possible values: 155 * of their possible values:
@@ -171,12 +168,11 @@ static void __init d2net_sata_power_init(void)
171#define D2NET_GPIO_RED_LED 6 168#define D2NET_GPIO_RED_LED 6
172#define D2NET_GPIO_BLUE_LED_BLINK_CTRL 16 169#define D2NET_GPIO_BLUE_LED_BLINK_CTRL 16
173#define D2NET_GPIO_BLUE_LED_OFF 23 170#define D2NET_GPIO_BLUE_LED_OFF 23
174#define D2NET_GPIO_SATA0_ACT 14
175#define D2NET_GPIO_SATA1_ACT 15
176 171
177static struct gpio_led d2net_leds[] = { 172static struct gpio_led d2net_leds[] = {
178 { 173 {
179 .name = "d2net:blue:power", 174 .name = "d2net:blue:sata",
175 .default_trigger = "default-on",
180 .gpio = D2NET_GPIO_BLUE_LED_OFF, 176 .gpio = D2NET_GPIO_BLUE_LED_OFF,
181 .active_low = 1, 177 .active_low = 1,
182 }, 178 },
@@ -201,25 +197,22 @@ static struct platform_device d2net_gpio_leds = {
201 197
202static void __init d2net_gpio_leds_init(void) 198static void __init d2net_gpio_leds_init(void)
203{ 199{
200 int err;
201
204 /* Configure GPIO over MPP max number. */ 202 /* Configure GPIO over MPP max number. */
205 orion_gpio_set_valid(D2NET_GPIO_BLUE_LED_OFF, 1); 203 orion_gpio_set_valid(D2NET_GPIO_BLUE_LED_OFF, 1);
206 204
207 if (gpio_request(D2NET_GPIO_SATA0_ACT, "LED SATA0 activity") != 0) 205 /* Configure register blink_ctrl to allow SATA activity LED blinking. */
208 return; 206 err = gpio_request(D2NET_GPIO_BLUE_LED_BLINK_CTRL, "blue LED blink");
209 if (gpio_direction_output(D2NET_GPIO_SATA0_ACT, 1) != 0) 207 if (err == 0) {
210 goto err_free_1; 208 err = gpio_direction_output(D2NET_GPIO_BLUE_LED_BLINK_CTRL, 1);
211 if (gpio_request(D2NET_GPIO_SATA1_ACT, "LED SATA1 activity") != 0) 209 if (err)
212 goto err_free_1; 210 gpio_free(D2NET_GPIO_BLUE_LED_BLINK_CTRL);
213 if (gpio_direction_output(D2NET_GPIO_SATA1_ACT, 1) != 0) 211 }
214 goto err_free_2; 212 if (err)
215 platform_device_register(&d2net_gpio_leds); 213 pr_err("d2net: failed to configure blue LED blink GPIO\n");
216 return;
217 214
218err_free_2: 215 platform_device_register(&d2net_gpio_leds);
219 gpio_free(D2NET_GPIO_SATA1_ACT);
220err_free_1:
221 gpio_free(D2NET_GPIO_SATA0_ACT);
222 return;
223} 216}
224 217
225/**************************************************************************** 218/****************************************************************************
@@ -289,8 +282,8 @@ static struct orion5x_mpp_mode d2net_mpp_modes[] __initdata = {
289 { 11, MPP_UNUSED }, 282 { 11, MPP_UNUSED },
290 { 12, MPP_GPIO }, /* SATA 1 power */ 283 { 12, MPP_GPIO }, /* SATA 1 power */
291 { 13, MPP_UNUSED }, 284 { 13, MPP_UNUSED },
292 { 14, MPP_GPIO }, /* SATA 0 active */ 285 { 14, MPP_SATA_LED }, /* SATA 0 active */
293 { 15, MPP_GPIO }, /* SATA 1 active */ 286 { 15, MPP_SATA_LED }, /* SATA 1 active */
294 { 16, MPP_GPIO }, /* Blue front LED blink control */ 287 { 16, MPP_GPIO }, /* Blue front LED blink control */
295 { 17, MPP_UNUSED }, 288 { 17, MPP_UNUSED },
296 { 18, MPP_GPIO }, /* Front button (0 = Released, 1 = Pushed ) */ 289 { 18, MPP_GPIO }, /* Front button (0 = Released, 1 = Pushed ) */