Merge branch 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[pandora-kernel.git] / arch / arm / mach-s3c2410 / mach-n30.c
index ce1172e..41f299d 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/serial_core.h>
 #include <linux/timer.h>
 #include <linux/io.h>
+#include <linux/mmc/host.h>
 
 #include <mach/hardware.h>
 #include <asm/irq.h>
@@ -46,6 +47,7 @@
 #include <plat/clock.h>
 #include <plat/cpu.h>
 #include <plat/devs.h>
+#include <plat/mci.h>
 #include <plat/s3c2410.h>
 #include <plat/udc.h>
 
@@ -86,10 +88,10 @@ static void n30_udc_pullup(enum s3c2410_udc_cmd_e cmd)
 {
        switch (cmd) {
        case S3C2410_UDC_P_ENABLE :
-               s3c2410_gpio_setpin(S3C2410_GPB(3), 1);
+               gpio_set_value(S3C2410_GPB(3), 1);
                break;
        case S3C2410_UDC_P_DISABLE :
-               s3c2410_gpio_setpin(S3C2410_GPB(3), 0);
+               gpio_set_value(S3C2410_GPB(3), 0);
                break;
        case S3C2410_UDC_P_RESET :
                break;
@@ -172,8 +174,10 @@ static struct gpio_keys_button n35_buttons[] = {
        {
                .gpio           = S3C2410_GPF(0),
                .code           = KEY_POWER,
+               .type           = EV_PWR,
                .desc           = "Power",
                .active_low     = 0,
+               .wakeup         = 1,
        },
        {
                .gpio           = S3C2410_GPG(9),
@@ -264,6 +268,14 @@ static struct s3c24xx_led_platdata n30_blue_led_pdata = {
        .def_trigger    = "",
 };
 
+/* This is the blue LED on the device. Originaly used to indicate GPS activity
+ * by flashing. */
+static struct s3c24xx_led_platdata n35_blue_led_pdata = {
+       .name           = "blue_led",
+       .gpio           = S3C2410_GPD(8),
+       .def_trigger    = "",
+};
+
 /* This LED is driven by the battery microcontroller, and is blinking
  * red, blinking green or solid green when the battery is low,
  * charging or full respectively.  By driving GPD9 low, it's possible
@@ -275,6 +287,13 @@ static struct s3c24xx_led_platdata n30_warning_led_pdata = {
        .def_trigger    = "",
 };
 
+static struct s3c24xx_led_platdata n35_warning_led_pdata = {
+       .name           = "warning_led",
+       .flags          = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
+       .gpio           = S3C2410_GPD(9),
+       .def_trigger    = "",
+};
+
 static struct platform_device n30_blue_led = {
        .name           = "s3c24xx_led",
        .id             = 1,
@@ -283,6 +302,14 @@ static struct platform_device n30_blue_led = {
        },
 };
 
+static struct platform_device n35_blue_led = {
+       .name           = "s3c24xx_led",
+       .id             = 1,
+       .dev            = {
+               .platform_data  = &n35_blue_led_pdata,
+       },
+};
+
 static struct platform_device n30_warning_led = {
        .name           = "s3c24xx_led",
        .id             = 2,
@@ -291,6 +318,14 @@ static struct platform_device n30_warning_led = {
        },
 };
 
+static struct platform_device n35_warning_led = {
+       .name           = "s3c24xx_led",
+       .id             = 2,
+       .dev            = {
+               .platform_data  = &n35_warning_led_pdata,
+       },
+};
+
 static struct s3c2410fb_display n30_display __initdata = {
        .type           = S3C2410_LCDCON1_TFT,
        .width          = 240,
@@ -317,6 +352,27 @@ static struct s3c2410fb_mach_info n30_fb_info __initdata = {
        .lpcsel         = 0x06,
 };
 
+static void n30_sdi_set_power(unsigned char power_mode, unsigned short vdd)
+{
+       switch (power_mode) {
+       case MMC_POWER_ON:
+       case MMC_POWER_UP:
+               gpio_set_value(S3C2410_GPG(4), 1);
+               break;
+       case MMC_POWER_OFF:
+       default:
+               gpio_set_value(S3C2410_GPG(4), 0);
+               break;
+       }
+}
+
+static struct s3c24xx_mci_pdata n30_mci_cfg __initdata = {
+       .gpio_detect    = S3C2410_GPF(1),
+       .gpio_wprotect  = S3C2410_GPG(10),
+       .ocr_avail      = MMC_VDD_32_33,
+       .set_power      = n30_sdi_set_power,
+};
+
 static struct platform_device *n30_devices[] __initdata = {
        &s3c_device_lcd,
        &s3c_device_wdt,
@@ -325,6 +381,7 @@ static struct platform_device *n30_devices[] __initdata = {
        &s3c_device_ohci,
        &s3c_device_rtc,
        &s3c_device_usbgadget,
+       &s3c_device_sdi,
        &n30_button_device,
        &n30_blue_led,
        &n30_warning_led,
@@ -337,7 +394,10 @@ static struct platform_device *n35_devices[] __initdata = {
        &s3c_device_iis,
        &s3c_device_rtc,
        &s3c_device_usbgadget,
+       &s3c_device_sdi,
        &n35_button_device,
+       &n35_blue_led,
+       &n35_warning_led,
 };
 
 static struct s3c2410_platform_i2c __initdata n30_i2ccfg = {
@@ -492,17 +552,15 @@ static void __init n30_map_io(void)
        s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
 }
 
-static void __init n30_init_irq(void)
-{
-       s3c24xx_init_irq();
-}
-
 /* GPB3 is the line that controls the pull-up for the USB D+ line */
 
 static void __init n30_init(void)
 {
+       WARN_ON(gpio_request(S3C2410_GPG(4), "mmc power"));
+
        s3c24xx_fb_set_platdata(&n30_fb_info);
        s3c24xx_udc_set_platdata(&n30_udc_cfg);
+       s3c24xx_mci_set_platdata(&n30_mci_cfg);
        s3c_i2c0_set_platdata(&n30_i2ccfg);
 
        /* Turn off suspend on both USB ports, and switch the
@@ -538,6 +596,9 @@ static void __init n30_init(void)
 
                platform_add_devices(n35_devices, ARRAY_SIZE(n35_devices));
        }
+
+       WARN_ON(gpio_request(S3C2410_GPB(3), "udc pup"));
+       gpio_direction_output(S3C2410_GPB(3), 0);
 }
 
 MACHINE_START(N30, "Acer-N30")
@@ -549,7 +610,7 @@ MACHINE_START(N30, "Acer-N30")
        .boot_params    = S3C2410_SDRAM_PA + 0x100,
        .timer          = &s3c24xx_timer,
        .init_machine   = n30_init,
-       .init_irq       = n30_init_irq,
+       .init_irq       = s3c24xx_init_irq,
        .map_io         = n30_map_io,
 MACHINE_END
 
@@ -561,6 +622,6 @@ MACHINE_START(N35, "Acer-N35")
        .boot_params    = S3C2410_SDRAM_PA + 0x100,
        .timer          = &s3c24xx_timer,
        .init_machine   = n30_init,
-       .init_irq       = n30_init_irq,
+       .init_irq       = s3c24xx_init_irq,
        .map_io         = n30_map_io,
 MACHINE_END