aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-kirkwood/netspace_v2-setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-kirkwood/netspace_v2-setup.c')
-rw-r--r--arch/arm/mach-kirkwood/netspace_v2-setup.c104
1 files changed, 61 insertions, 43 deletions
diff --git a/arch/arm/mach-kirkwood/netspace_v2-setup.c b/arch/arm/mach-kirkwood/netspace_v2-setup.c
index 3ae158d7268..d26bf324738 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"
@@ -126,6 +127,18 @@ static void __init netspace_v2_sata_power_init(void)
126 } 127 }
127 if (err) 128 if (err)
128 pr_err("netspace_v2: failed to setup SATA0 power\n"); 129 pr_err("netspace_v2: failed to setup SATA0 power\n");
130
131 if (machine_is_netspace_max_v2()) {
132 err = gpio_request(NETSPACE_V2_GPIO_SATA1_POWER, "SATA1 power");
133 if (err == 0) {
134 err = gpio_direction_output(
135 NETSPACE_V2_GPIO_SATA1_POWER, 1);
136 if (err)
137 gpio_free(NETSPACE_V2_GPIO_SATA1_POWER);
138 }
139 if (err)
140 pr_err("netspace_v2: failed to setup SATA1 power\n");
141 }
129} 142}
130 143
131/***************************************************************************** 144/*****************************************************************************
@@ -160,36 +173,12 @@ static struct platform_device netspace_v2_gpio_buttons = {
160 * GPIO LEDs 173 * GPIO LEDs
161 ****************************************************************************/ 174 ****************************************************************************/
162 175
163/*
164 * The blue front LED is wired to a CPLD and can blink in relation with the
165 * SATA activity.
166 *
167 * The following array detail the different LED registers and the combination
168 * of their possible values:
169 *
170 * cmd_led | slow_led | /SATA active | LED state
171 * | | |
172 * 1 | 0 | x | off
173 * - | 1 | x | on
174 * 0 | 0 | 1 | on
175 * 0 | 0 | 0 | blink (rate 300ms)
176 */
177
178#define NETSPACE_V2_GPIO_RED_LED 12 176#define NETSPACE_V2_GPIO_RED_LED 12
179#define NETSPACE_V2_GPIO_BLUE_LED_SLOW 29
180#define NETSPACE_V2_GPIO_BLUE_LED_CMD 30
181
182 177
183static struct gpio_led netspace_v2_gpio_led_pins[] = { 178static struct gpio_led netspace_v2_gpio_led_pins[] = {
184 { 179 {
185 .name = "ns_v2:blue:sata", 180 .name = "ns_v2:red:fail",
186 .default_trigger = "default-on", 181 .gpio = NETSPACE_V2_GPIO_RED_LED,
187 .gpio = NETSPACE_V2_GPIO_BLUE_LED_CMD,
188 .active_low = 1,
189 },
190 {
191 .name = "ns_v2:red:fail",
192 .gpio = NETSPACE_V2_GPIO_RED_LED,
193 }, 182 },
194}; 183};
195 184
@@ -206,22 +195,33 @@ static struct platform_device netspace_v2_gpio_leds = {
206 }, 195 },
207}; 196};
208 197
209static void __init netspace_v2_gpio_leds_init(void) 198/*****************************************************************************
210{ 199 * Dual-GPIO CPLD LEDs
211 int err; 200 ****************************************************************************/
212 201
213 /* Configure register slow_led to allow SATA activity LED blinking */ 202#define NETSPACE_V2_GPIO_BLUE_LED_SLOW 29
214 err = gpio_request(NETSPACE_V2_GPIO_BLUE_LED_SLOW, "blue LED slow"); 203#define NETSPACE_V2_GPIO_BLUE_LED_CMD 30
215 if (err == 0) {
216 err = gpio_direction_output(NETSPACE_V2_GPIO_BLUE_LED_SLOW, 0);
217 if (err)
218 gpio_free(NETSPACE_V2_GPIO_BLUE_LED_SLOW);
219 }
220 if (err)
221 pr_err("netspace_v2: failed to configure blue LED slow GPIO\n");
222 204
223 platform_device_register(&netspace_v2_gpio_leds); 205static struct ns2_led netspace_v2_led_pins[] = {
224} 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};
225 225
226/***************************************************************************** 226/*****************************************************************************
227 * Timer 227 * Timer
@@ -249,17 +249,21 @@ static unsigned int netspace_v2_mpp_config[] __initdata = {
249 MPP4_NF_IO6, 249 MPP4_NF_IO6,
250 MPP5_NF_IO7, 250 MPP5_NF_IO7,
251 MPP6_SYSRST_OUTn, 251 MPP6_SYSRST_OUTn,
252 MPP8_TW_SDA, 252 MPP7_GPO, /* Fan speed (bit 1) */
253 MPP9_TW_SCK, 253 MPP8_TW0_SDA,
254 MPP9_TW0_SCK,
254 MPP10_UART0_TXD, 255 MPP10_UART0_TXD,
255 MPP11_UART0_RXD, 256 MPP11_UART0_RXD,
256 MPP12_GPO, /* Red led */ 257 MPP12_GPO, /* Red led */
257 MPP14_GPIO, /* USB fuse */ 258 MPP14_GPIO, /* USB fuse */
258 MPP16_GPIO, /* SATA 0 power */ 259 MPP16_GPIO, /* SATA 0 power */
260 MPP17_GPIO, /* SATA 1 power */
259 MPP18_NF_IO0, 261 MPP18_NF_IO0,
260 MPP19_NF_IO1, 262 MPP19_NF_IO1,
261 MPP20_SATA1_ACTn, 263 MPP20_SATA1_ACTn,
262 MPP21_SATA0_ACTn, 264 MPP21_SATA0_ACTn,
265 MPP22_GPIO, /* Fan speed (bit 0) */
266 MPP23_GPIO, /* Fan power */
263 MPP24_GPIO, /* USB mode select */ 267 MPP24_GPIO, /* USB mode select */
264 MPP25_GPIO, /* Fan rotation fail */ 268 MPP25_GPIO, /* Fan rotation fail */
265 MPP26_GPIO, /* USB device vbus */ 269 MPP26_GPIO, /* USB device vbus */
@@ -268,6 +272,7 @@ static unsigned int netspace_v2_mpp_config[] __initdata = {
268 MPP30_GPIO, /* Blue led (command register) */ 272 MPP30_GPIO, /* Blue led (command register) */
269 MPP31_GPIO, /* Board power off */ 273 MPP31_GPIO, /* Board power off */
270 MPP32_GPIO, /* Power button (0 = Released, 1 = Pushed) */ 274 MPP32_GPIO, /* Power button (0 = Released, 1 = Pushed) */
275 MPP33_GPO, /* Fan speed (bit 2) */
271 0 276 0
272}; 277};
273 278
@@ -299,7 +304,8 @@ static void __init netspace_v2_init(void)
299 i2c_register_board_info(0, netspace_v2_i2c_info, 304 i2c_register_board_info(0, netspace_v2_i2c_info,
300 ARRAY_SIZE(netspace_v2_i2c_info)); 305 ARRAY_SIZE(netspace_v2_i2c_info));
301 306
302 netspace_v2_gpio_leds_init(); 307 platform_device_register(&netspace_v2_leds);
308 platform_device_register(&netspace_v2_gpio_leds);
303 platform_device_register(&netspace_v2_gpio_buttons); 309 platform_device_register(&netspace_v2_gpio_buttons);
304 310
305 if (gpio_request(NETSPACE_V2_GPIO_POWER_OFF, "power-off") == 0 && 311 if (gpio_request(NETSPACE_V2_GPIO_POWER_OFF, "power-off") == 0 &&
@@ -332,3 +338,15 @@ MACHINE_START(INETSPACE_V2, "LaCie Internet Space v2")
332 .timer = &netspace_v2_timer, 338 .timer = &netspace_v2_timer,
333MACHINE_END 339MACHINE_END
334#endif 340#endif
341
342#ifdef CONFIG_MACH_NETSPACE_MAX_V2
343MACHINE_START(NETSPACE_MAX_V2, "LaCie Network Space Max v2")
344 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
345 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
346 .boot_params = 0x00000100,
347 .init_machine = netspace_v2_init,
348 .map_io = kirkwood_map_io,
349 .init_irq = kirkwood_init_irq,
350 .timer = &netspace_v2_timer,
351MACHINE_END
352#endif