diff options
| -rw-r--r-- | arch/arm/mach-orion5x/dns323-setup.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c index b31ca4cef365..8f159db4d08a 100644 --- a/arch/arm/mach-orion5x/dns323-setup.c +++ b/arch/arm/mach-orion5x/dns323-setup.c | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
| 14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
| 15 | #include <linux/delay.h> | ||
| 15 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
| 16 | #include <linux/pci.h> | 17 | #include <linux/pci.h> |
| 17 | #include <linux/irq.h> | 18 | #include <linux/irq.h> |
| @@ -32,6 +33,7 @@ | |||
| 32 | 33 | ||
| 33 | #define DNS323_GPIO_LED_RIGHT_AMBER 1 | 34 | #define DNS323_GPIO_LED_RIGHT_AMBER 1 |
| 34 | #define DNS323_GPIO_LED_LEFT_AMBER 2 | 35 | #define DNS323_GPIO_LED_LEFT_AMBER 2 |
| 36 | #define DNS323_GPIO_SYSTEM_UP 3 | ||
| 35 | #define DNS323_GPIO_LED_POWER 5 | 37 | #define DNS323_GPIO_LED_POWER 5 |
| 36 | #define DNS323_GPIO_OVERTEMP 6 | 38 | #define DNS323_GPIO_OVERTEMP 6 |
| 37 | #define DNS323_GPIO_RTC 7 | 39 | #define DNS323_GPIO_RTC 7 |
| @@ -239,7 +241,7 @@ static struct gpio_led dns323_leds[] = { | |||
| 239 | { | 241 | { |
| 240 | .name = "power:blue", | 242 | .name = "power:blue", |
| 241 | .gpio = DNS323_GPIO_LED_POWER, | 243 | .gpio = DNS323_GPIO_LED_POWER, |
| 242 | .active_low = 1, | 244 | .default_state = LEDS_GPIO_DEFSTATE_ON, |
| 243 | }, { | 245 | }, { |
| 244 | .name = "right:amber", | 246 | .name = "right:amber", |
| 245 | .gpio = DNS323_GPIO_LED_RIGHT_AMBER, | 247 | .gpio = DNS323_GPIO_LED_RIGHT_AMBER, |
| @@ -334,7 +336,7 @@ static struct orion5x_mpp_mode dns323_mv88f5182_mpp_modes[] __initdata = { | |||
| 334 | { 0, MPP_UNUSED }, | 336 | { 0, MPP_UNUSED }, |
| 335 | { 1, MPP_GPIO }, /* right amber LED (sata ch0) */ | 337 | { 1, MPP_GPIO }, /* right amber LED (sata ch0) */ |
| 336 | { 2, MPP_GPIO }, /* left amber LED (sata ch1) */ | 338 | { 2, MPP_GPIO }, /* left amber LED (sata ch1) */ |
| 337 | { 3, MPP_UNUSED }, | 339 | { 3, MPP_GPIO }, /* system up flag */ |
| 338 | { 4, MPP_GPIO }, /* power button LED */ | 340 | { 4, MPP_GPIO }, /* power button LED */ |
| 339 | { 5, MPP_GPIO }, /* power button LED */ | 341 | { 5, MPP_GPIO }, /* power button LED */ |
| 340 | { 6, MPP_GPIO }, /* GMT G751-2f overtemp */ | 342 | { 6, MPP_GPIO }, /* GMT G751-2f overtemp */ |
| @@ -372,13 +374,23 @@ static struct i2c_board_info __initdata dns323_i2c_devices[] = { | |||
| 372 | }, | 374 | }, |
| 373 | }; | 375 | }; |
| 374 | 376 | ||
| 375 | /* DNS-323 specific power off method */ | 377 | /* DNS-323 rev. A specific power off method */ |
| 376 | static void dns323_power_off(void) | 378 | static void dns323a_power_off(void) |
| 377 | { | 379 | { |
| 378 | pr_info("%s: triggering power-off...\n", __func__); | 380 | pr_info("%s: triggering power-off...\n", __func__); |
| 379 | gpio_set_value(DNS323_GPIO_POWER_OFF, 1); | 381 | gpio_set_value(DNS323_GPIO_POWER_OFF, 1); |
| 380 | } | 382 | } |
| 381 | 383 | ||
| 384 | /* DNS-323 rev B specific power off method */ | ||
| 385 | static void dns323b_power_off(void) | ||
| 386 | { | ||
| 387 | pr_info("%s: triggering power-off...\n", __func__); | ||
| 388 | /* Pin has to be changed to 1 and back to 0 to do actual power off. */ | ||
| 389 | gpio_set_value(DNS323_GPIO_POWER_OFF, 1); | ||
| 390 | mdelay(100); | ||
| 391 | gpio_set_value(DNS323_GPIO_POWER_OFF, 0); | ||
| 392 | } | ||
| 393 | |||
| 382 | static void __init dns323_init(void) | 394 | static void __init dns323_init(void) |
| 383 | { | 395 | { |
| 384 | /* Setup basic Orion functions. Need to be called early. */ | 396 | /* Setup basic Orion functions. Need to be called early. */ |
| @@ -424,11 +436,20 @@ static void __init dns323_init(void) | |||
| 424 | if (dns323_dev_id() == MV88F5182_DEV_ID) | 436 | if (dns323_dev_id() == MV88F5182_DEV_ID) |
| 425 | orion5x_sata_init(&dns323_sata_data); | 437 | orion5x_sata_init(&dns323_sata_data); |
| 426 | 438 | ||
| 427 | /* register dns323 specific power-off method */ | 439 | /* The 5182 has flag to indicate the system is up. Without this flag |
| 440 | * set, power LED will flash and cannot be controlled via leds-gpio. | ||
| 441 | */ | ||
| 442 | if (dns323_dev_id() == MV88F5182_DEV_ID) | ||
| 443 | gpio_set_value(DNS323_GPIO_SYSTEM_UP, 1); | ||
| 444 | |||
| 445 | /* Register dns323 specific power-off method */ | ||
| 428 | if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 || | 446 | if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 || |
| 429 | gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0) | 447 | gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0) |
| 430 | pr_err("DNS323: failed to setup power-off GPIO\n"); | 448 | pr_err("DNS323: failed to setup power-off GPIO\n"); |
| 431 | pm_power_off = dns323_power_off; | 449 | if (dns323_dev_id() == MV88F5182_DEV_ID) |
| 450 | pm_power_off = dns323b_power_off; | ||
| 451 | else | ||
| 452 | pm_power_off = dns323a_power_off; | ||
| 432 | } | 453 | } |
| 433 | 454 | ||
| 434 | /* Warning: D-Link uses a wrong mach-type (=526) in their bootloader */ | 455 | /* Warning: D-Link uses a wrong mach-type (=526) in their bootloader */ |
