Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx
[linux-2.6.git] / arch / arm / mach-s3c2410 / mach-qt2410.c
index 50c0939..e8f49fe 100644 (file)
 #include <linux/list.h>
 #include <linux/timer.h>
 #include <linux/init.h>
+#include <linux/gpio.h>
 #include <linux/sysdev.h>
 #include <linux/platform_device.h>
 #include <linux/serial_core.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/spi_bitbang.h>
-
+#include <linux/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/nand_ecc.h>
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <asm/hardware.h>
-#include <asm/io.h>
+#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-#include <asm/arch/regs-gpio.h>
-#include <asm/arch/leds-gpio.h>
-#include <asm/plat-s3c/regs-serial.h>
-#include <asm/arch/fb.h>
-#include <asm/plat-s3c/nand.h>
-#include <asm/plat-s3c24xx/udc.h>
-#include <asm/arch/spi.h>
-#include <asm/arch/spi-gpio.h>
-
-#include <asm/plat-s3c24xx/common-smdk.h>
-#include <asm/plat-s3c24xx/devs.h>
-#include <asm/plat-s3c24xx/cpu.h>
-#include <asm/plat-s3c24xx/pm.h>
+#include <mach/regs-gpio.h>
+#include <mach/leds-gpio.h>
+#include <plat/regs-serial.h>
+#include <mach/fb.h>
+#include <plat/nand.h>
+#include <plat/udc.h>
+#include <mach/spi.h>
+#include <mach/spi-gpio.h>
+#include <plat/iic.h>
+
+#include <plat/common-smdk.h>
+#include <plat/gpio-cfg.h>
+#include <plat/devs.h>
+#include <plat/cpu.h>
+#include <plat/pm.h>
 
 static struct map_desc qt2410_iodesc[] __initdata = {
        { 0xe0000000, __phys_to_pfn(S3C2410_CS3+0x01000000), SZ_1M, MT_DEVICE }
@@ -98,18 +100,6 @@ static struct s3c2410_uartcfg smdk2410_uartcfgs[] = {
 static struct s3c2410fb_display qt2410_lcd_cfg[] __initdata = {
        {
                /* Configuration for 640x480 SHARP LQ080V3DG01 */
-               .lcdcon1 = S3C2410_LCDCON1_TFT16BPP |
-                          S3C2410_LCDCON1_TFT |
-                          S3C2410_LCDCON1_CLKVAL(0x01), /* HCLK/4 */
-
-               .lcdcon2 = S3C2410_LCDCON2_VBPD(18) |   /* 19 */
-                          S3C2410_LCDCON2_LINEVAL(479) |
-                          S3C2410_LCDCON2_VFPD(10) |   /* 11 */
-                          S3C2410_LCDCON2_VSPW(14),    /* 15 */
-
-               .lcdcon4 = S3C2410_LCDCON4_MVAL(0) |
-                          S3C2410_LCDCON4_HSPW(95),    /* 96 */
-
                .lcdcon5 = S3C2410_LCDCON5_FRM565 |
                           S3C2410_LCDCON5_INVVLINE |
                           S3C2410_LCDCON5_INVVFRAME |
@@ -120,6 +110,7 @@ static struct s3c2410fb_display qt2410_lcd_cfg[] __initdata = {
                .width          = 640,
                .height         = 480,
 
+               .pixclock       = 40000, /* HCLK/4 */
                .xres           = 640,
                .yres           = 480,
                .bpp            = 16,
@@ -132,18 +123,6 @@ static struct s3c2410fb_display qt2410_lcd_cfg[] __initdata = {
        },
        {
                /* Configuration for 480x640 toppoly TD028TTEC1 */
-               .lcdcon1 = S3C2410_LCDCON1_TFT16BPP |
-                          S3C2410_LCDCON1_TFT |
-                          S3C2410_LCDCON1_CLKVAL(0x01), /* HCLK/4 */
-
-               .lcdcon2 = S3C2410_LCDCON2_VBPD(1) |    /* 2 */
-                          S3C2410_LCDCON2_LINEVAL(639) |/* 640 */
-                          S3C2410_LCDCON2_VFPD(3) |    /* 4 */
-                          S3C2410_LCDCON2_VSPW(1),     /* 2 */
-
-               .lcdcon4 = S3C2410_LCDCON4_MVAL(0) |
-                          S3C2410_LCDCON4_HSPW(7),     /* 8 */
-
                .lcdcon5 = S3C2410_LCDCON5_FRM565 |
                           S3C2410_LCDCON5_INVVLINE |
                           S3C2410_LCDCON5_INVVFRAME |
@@ -153,6 +132,7 @@ static struct s3c2410fb_display qt2410_lcd_cfg[] __initdata = {
                .type           = S3C2410_LCDCON1_TFT,
                .width          = 480,
                .height         = 640,
+               .pixclock       = 40000, /* HCLK/4 */
                .xres           = 480,
                .yres           = 640,
                .bpp            = 16,
@@ -165,18 +145,6 @@ static struct s3c2410fb_display qt2410_lcd_cfg[] __initdata = {
        },
        {
                /* Config for 240x320 LCD */
-               .lcdcon1 = S3C2410_LCDCON1_TFT16BPP |
-                          S3C2410_LCDCON1_TFT |
-                          S3C2410_LCDCON1_CLKVAL(0x04),
-
-               .lcdcon2 = S3C2410_LCDCON2_VBPD(1) |
-                          S3C2410_LCDCON2_LINEVAL(319) |
-                          S3C2410_LCDCON2_VFPD(6) |
-                          S3C2410_LCDCON2_VSPW(3),
-
-               .lcdcon4 = S3C2410_LCDCON4_MVAL(0) |
-                          S3C2410_LCDCON4_HSPW(3),
-
                .lcdcon5 = S3C2410_LCDCON5_FRM565 |
                           S3C2410_LCDCON5_INVVLINE |
                           S3C2410_LCDCON5_INVVFRAME |
@@ -186,6 +154,7 @@ static struct s3c2410fb_display qt2410_lcd_cfg[] __initdata = {
                .type           = S3C2410_LCDCON1_TFT,
                .width          = 240,
                .height         = 320,
+               .pixclock       = 100000, /* HCLK/10 */
                .xres           = 240,
                .yres           = 320,
                .bpp            = 16,
@@ -231,7 +200,7 @@ static struct platform_device qt2410_cs89x0 = {
 /* LED */
 
 static struct s3c24xx_led_platdata qt2410_pdata_led = {
-       .gpio           = S3C2410_GPB0,
+       .gpio           = S3C2410_GPB(0),
        .flags          = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
        .name           = "led",
        .def_trigger    = "timer",
@@ -251,18 +220,18 @@ static void spi_gpio_cs(struct s3c2410_spigpio_info *spi, int cs)
 {
        switch (cs) {
        case BITBANG_CS_ACTIVE:
-               s3c2410_gpio_setpin(S3C2410_GPB5, 0);
+               gpio_set_value(S3C2410_GPB(5), 0);
                break;
        case BITBANG_CS_INACTIVE:
-               s3c2410_gpio_setpin(S3C2410_GPB5, 1);
+               gpio_set_value(S3C2410_GPB(5), 1);
                break;
        }
 }
 
 static struct s3c2410_spigpio_info spi_gpio_cfg = {
-       .pin_clk        = S3C2410_GPG7,
-       .pin_mosi       = S3C2410_GPG6,
-       .pin_miso       = S3C2410_GPG5,
+       .pin_clk        = S3C2410_GPG(7),
+       .pin_mosi       = S3C2410_GPG(6),
+       .pin_miso       = S3C2410_GPG(5),
        .chip_select    = &spi_gpio_cs,
 };
 
@@ -278,10 +247,10 @@ static struct platform_device qt2410_spi = {
 /* Board devices */
 
 static struct platform_device *qt2410_devices[] __initdata = {
-       &s3c_device_usb,
+       &s3c_device_ohci,
        &s3c_device_lcd,
        &s3c_device_wdt,
-       &s3c_device_i2c,
+       &s3c_device_i2c0,
        &s3c_device_iis,
        &s3c_device_sdi,
        &s3c_device_usbgadget,
@@ -290,7 +259,7 @@ static struct platform_device *qt2410_devices[] __initdata = {
        &qt2410_led,
 };
 
-static struct mtd_partition qt2410_nand_part[] = {
+static struct mtd_partition __initdata qt2410_nand_part[] = {
        [0] = {
                .name   = "U-Boot",
                .size   = 0x30000,
@@ -318,7 +287,7 @@ static struct mtd_partition qt2410_nand_part[] = {
        },
 };
 
-static struct s3c2410_nand_set qt2410_nand_sets[] = {
+static struct s3c2410_nand_set __initdata qt2410_nand_sets[] = {
        [0] = {
                .name           = "NAND",
                .nr_chips       = 1,
@@ -331,7 +300,7 @@ static struct s3c2410_nand_set qt2410_nand_sets[] = {
  * chips and beyond.
  */
 
-static struct s3c2410_platform_nand qt2410_nand_info = {
+static struct s3c2410_platform_nand __initdata qt2410_nand_info = {
        .tacls          = 20,
        .twrph0         = 60,
        .twrph1         = 20,
@@ -363,7 +332,7 @@ static void __init qt2410_map_io(void)
 
 static void __init qt2410_machine_init(void)
 {
-       s3c_device_nand.dev.platform_data = &qt2410_nand_info;
+       s3c_nand_set_platdata(&qt2410_nand_info);
 
        switch (tft_type) {
        case 'p': /* production */
@@ -379,20 +348,20 @@ static void __init qt2410_machine_init(void)
        }
        s3c24xx_fb_set_platdata(&qt2410_fb_info);
 
-       s3c2410_gpio_cfgpin(S3C2410_GPB0, S3C2410_GPIO_OUTPUT);
-       s3c2410_gpio_setpin(S3C2410_GPB0, 1);
+       s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPIO_OUTPUT);
+       s3c2410_gpio_setpin(S3C2410_GPB(0), 1);
 
        s3c24xx_udc_set_platdata(&qt2410_udc_cfg);
+       s3c_i2c0_set_platdata(NULL);
 
-       s3c2410_gpio_cfgpin(S3C2410_GPB5, S3C2410_GPIO_OUTPUT);
+       WARN_ON(gpio_request(S3C2410_GPB(5), "spi cs"));
+       gpio_direction_output(S3C2410_GPB(5), 1);
 
        platform_add_devices(qt2410_devices, ARRAY_SIZE(qt2410_devices));
-       s3c2410_pm_init();
+       s3c_pm_init();
 }
 
 MACHINE_START(QT2410, "QT2410")
-       .phys_io        = S3C2410_PA_UART,
-       .io_pg_offst    = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
        .boot_params    = S3C2410_SDRAM_PA + 0x100,
        .map_io         = qt2410_map_io,
        .init_irq       = s3c24xx_init_irq,