Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw
[pandora-kernel.git] / arch / arm / mach-orion5x / ts409-setup.c
index 6053e76..d85588a 100644 (file)
@@ -3,6 +3,9 @@
  *
  * Maintainer: Sylver Bruneau <sylver.bruneau@gmail.com>
  *
+ * Copyright (C) 2008  Sylver Bruneau <sylver.bruneau@gmail.com>
+ * Copyright (C) 2008  Martin Michlmayr <tbm@cyrius.com>
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version
@@ -16,6 +19,7 @@
 #include <linux/irq.h>
 #include <linux/mtd/physmap.h>
 #include <linux/mv643xx_eth.h>
+#include <linux/leds.h>
 #include <linux/gpio_keys.h>
 #include <linux/input.h>
 #include <linux/i2c.h>
@@ -162,16 +166,59 @@ static struct i2c_board_info __initdata qnap_ts409_i2c_rtc = {
        I2C_BOARD_INFO("s35390a", 0x30),
 };
 
+/*****************************************************************************
+ * LEDs attached to GPIO
+ ****************************************************************************/
+
+static struct gpio_led ts409_led_pins[] = {
+       {
+               .name           = "ts409:red:sata1",
+               .gpio           = 4,
+               .active_low     = 1,
+       }, {
+               .name           = "ts409:red:sata2",
+               .gpio           = 5,
+               .active_low     = 1,
+       }, {
+               .name           = "ts409:red:sata3",
+               .gpio           = 6,
+               .active_low     = 1,
+       }, {
+               .name           = "ts409:red:sata4",
+               .gpio           = 7,
+               .active_low     = 1,
+       },
+};
+
+static struct gpio_led_platform_data ts409_led_data = {
+       .leds           = ts409_led_pins,
+       .num_leds       = ARRAY_SIZE(ts409_led_pins),
+};
+
+static struct platform_device ts409_leds = {
+       .name   = "leds-gpio",
+       .id     = -1,
+       .dev    = {
+               .platform_data  = &ts409_led_data,
+       },
+};
+
 /****************************************************************************
  * GPIO Attached Keys
  *     Power button is attached to the PIC microcontroller
  ****************************************************************************/
 
+#define QNAP_TS409_GPIO_KEY_RESET      14
 #define QNAP_TS409_GPIO_KEY_MEDIA      15
 
 static struct gpio_keys_button qnap_ts409_buttons[] = {
        {
                .code           = KEY_RESTART,
+               .gpio           = QNAP_TS409_GPIO_KEY_RESET,
+               .desc           = "Reset Button",
+               .active_low     = 1,
+       }, {
+               .code           = KEY_COPY,
                .gpio           = QNAP_TS409_GPIO_KEY_MEDIA,
                .desc           = "USB Copy Button",
                .active_low     = 1,
@@ -231,6 +278,10 @@ static void __init qnap_ts409_init(void)
        /*
         * Configure peripherals.
         */
+       orion5x_setup_dev_boot_win(QNAP_TS409_NOR_BOOT_BASE,
+                                  QNAP_TS409_NOR_BOOT_SIZE);
+       platform_device_register(&qnap_ts409_nor_flash);
+
        orion5x_ehci0_init();
        qnap_tsx09_find_mac_addr(QNAP_TS409_NOR_BOOT_BASE +
                                 qnap_ts409_partitions[5].offset,
@@ -238,10 +289,7 @@ static void __init qnap_ts409_init(void)
        orion5x_eth_init(&qnap_tsx09_eth_data);
        orion5x_i2c_init();
        orion5x_uart0_init();
-
-       orion5x_setup_dev_boot_win(QNAP_TS409_NOR_BOOT_BASE,
-                                  QNAP_TS409_NOR_BOOT_SIZE);
-       platform_device_register(&qnap_ts409_nor_flash);
+       orion5x_uart1_init();
 
        platform_device_register(&qnap_ts409_button_device);
 
@@ -255,6 +303,7 @@ static void __init qnap_ts409_init(void)
        if (qnap_ts409_i2c_rtc.irq == 0)
                pr_warning("qnap_ts409_init: failed to get RTC IRQ\n");
        i2c_register_board_info(0, &qnap_ts409_i2c_rtc, 1);
+       platform_device_register(&ts409_leds);
 
        /* register tsx09 specific power-off method */
        pm_power_off = qnap_tsx09_power_off;