]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-s3c2410/mach-h1940.c
Merge branch 'omap2-upstream' into devel
[linux-2.6-omap-h63xx.git] / arch / arm / mach-s3c2410 / mach-h1940.c
index 5af26e177966d42a603a4c618ae88fa82e91f00f..7c1145e87c121d0b4f492b3c4b8cea05ab4f4eb7 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/list.h>
 #include <linux/timer.h>
 #include <linux/init.h>
+#include <linux/sysdev.h>
 #include <linux/serial_core.h>
 #include <linux/platform_device.h>
 
 #include <asm/mach/irq.h>
 
 #include <asm/hardware.h>
-#include <asm/hardware/iomd.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-
-#include <asm/arch/regs-serial.h>
+#include <asm/plat-s3c/regs-serial.h>
 #include <asm/arch/regs-lcd.h>
+#include <asm/arch/regs-gpio.h>
+#include <asm/arch/regs-clock.h>
 
 #include <asm/arch/h1940.h>
 #include <asm/arch/h1940-latch.h>
 #include <asm/arch/fb.h>
+#include <asm/plat-s3c24xx/udc.h>
 
 #include <asm/plat-s3c24xx/clock.h>
 #include <asm/plat-s3c24xx/devs.h>
@@ -102,33 +104,60 @@ void h1940_latch_control(unsigned int clear, unsigned int set)
 
 EXPORT_SYMBOL_GPL(h1940_latch_control);
 
+static void h1940_udc_pullup(enum s3c2410_udc_cmd_e cmd)
+{
+       printk(KERN_DEBUG "udc: pullup(%d)\n",cmd);
+
+       switch (cmd)
+       {
+               case S3C2410_UDC_P_ENABLE :
+                       h1940_latch_control(0, H1940_LATCH_USB_DP);
+                       break;
+               case S3C2410_UDC_P_DISABLE :
+                       h1940_latch_control(H1940_LATCH_USB_DP, 0);
+                       break;
+               case S3C2410_UDC_P_RESET :
+                       break;
+               default:
+                       break;
+       }
+}
+
+static struct s3c2410_udc_mach_info h1940_udc_cfg __initdata = {
+       .udc_command            = h1940_udc_pullup,
+       .vbus_pin               = S3C2410_GPG5,
+       .vbus_pin_inverted      = 1,
+};
+
 
 /**
  * Set lcd on or off
  **/
-static struct s3c2410fb_mach_info h1940_lcdcfg __initdata = {
-       .fixed_syncs=           1,
-       .regs={
-               .lcdcon1=       S3C2410_LCDCON1_TFT16BPP | \
-                               S3C2410_LCDCON1_TFT | \
-                               S3C2410_LCDCON1_CLKVAL(0x0C),
-
-               .lcdcon2=       S3C2410_LCDCON2_VBPD(7) | \
-                               S3C2410_LCDCON2_LINEVAL(319) | \
-                               S3C2410_LCDCON2_VFPD(6) | \
-                               S3C2410_LCDCON2_VSPW(0),
-
-               .lcdcon3=       S3C2410_LCDCON3_HBPD(19) | \
-                               S3C2410_LCDCON3_HOZVAL(239) | \
-                               S3C2410_LCDCON3_HFPD(7),
-
-               .lcdcon4=       S3C2410_LCDCON4_MVAL(0) | \
-                               S3C2410_LCDCON4_HSPW(3),
-
-               .lcdcon5=       S3C2410_LCDCON5_FRM565 | \
-                               S3C2410_LCDCON5_INVVLINE | \
-                               S3C2410_LCDCON5_HWSWP,
-       },
+static struct s3c2410fb_display h1940_lcd __initdata = {
+       .lcdcon5=       S3C2410_LCDCON5_FRM565 | \
+                       S3C2410_LCDCON5_INVVLINE | \
+                       S3C2410_LCDCON5_HWSWP,
+
+       .type =         S3C2410_LCDCON1_TFT,
+       .width =        240,
+       .height =       320,
+       .pixclock =     260000,
+       .xres =         240,
+       .yres =         320,
+       .bpp =          16,
+       .left_margin =  20,
+       .right_margin = 8,
+       .hsync_len =    4,
+       .upper_margin = 8,
+       .lower_margin = 7,
+       .vsync_len =    1,
+};
+
+static struct s3c2410fb_mach_info h1940_fb_info __initdata = {
+       .displays = &h1940_lcd,
+       .num_displays = 1,
+       .default_display = 0,
+
        .lpcsel=        0x02,
        .gpccon=        0xaa940659,
        .gpccon_mask=   0xffffffff,
@@ -138,12 +167,16 @@ static struct s3c2410fb_mach_info h1940_lcdcfg __initdata = {
        .gpdcon_mask=   0xffffffff,
        .gpdup=         0x0000faff,
        .gpdup_mask=    0xffffffff,
+};
+
+static struct platform_device s3c_device_leds = {
+       .name             = "h1940-leds",
+       .id               = -1,
+};
 
-       .width=         240,
-       .height=        320,
-       .xres=          {240,240,240},
-       .yres=          {320,320,320},
-       .bpp=           {16,16,16},
+static struct platform_device s3c_device_bluetooth = {
+       .name             = "h1940-bt",
+       .id               = -1,
 };
 
 static struct platform_device *h1940_devices[] __initdata = {
@@ -152,11 +185,9 @@ static struct platform_device *h1940_devices[] __initdata = {
        &s3c_device_wdt,
        &s3c_device_i2c,
        &s3c_device_iis,
-};
-
-static struct s3c24xx_board h1940_board __initdata = {
-       .devices       = h1940_devices,
-       .devices_count = ARRAY_SIZE(h1940_devices)
+       &s3c_device_usbgadget,
+       &s3c_device_leds,
+       &s3c_device_bluetooth,
 };
 
 static void __init h1940_map_io(void)
@@ -164,11 +195,12 @@ static void __init h1940_map_io(void)
        s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc));
        s3c24xx_init_clocks(0);
        s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs));
-       s3c24xx_set_board(&h1940_board);
 
        /* setup PM */
 
+#ifdef CONFIG_PM_H1940
        memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024);
+#endif
        s3c2410_pm_init();
 }
 
@@ -179,7 +211,25 @@ static void __init h1940_init_irq(void)
 
 static void __init h1940_init(void)
 {
-       s3c24xx_fb_set_platdata(&h1940_lcdcfg);
+       u32 tmp;
+
+       s3c24xx_fb_set_platdata(&h1940_fb_info);
+       s3c24xx_udc_set_platdata(&h1940_udc_cfg);
+
+       /* Turn off suspend on both USB ports, and switch the
+        * selectable USB port to USB device mode. */
+
+       s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
+                             S3C2410_MISCCR_USBSUSPND0 |
+                             S3C2410_MISCCR_USBSUSPND1, 0x0);
+
+       tmp = (
+                0x78 << S3C2410_PLLCON_MDIVSHIFT)
+             | (0x02 << S3C2410_PLLCON_PDIVSHIFT)
+             | (0x03 << S3C2410_PLLCON_SDIVSHIFT);
+       writel(tmp, S3C2410_UPLLCON);
+
+       platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
 }
 
 MACHINE_START(H1940, "IPAQ-H1940")
@@ -189,6 +239,6 @@ MACHINE_START(H1940, "IPAQ-H1940")
        .boot_params    = S3C2410_SDRAM_PA + 0x100,
        .map_io         = h1940_map_io,
        .init_irq       = h1940_init_irq,
-       .init_machine   = h1940_init,
+       .init_machine   = h1940_init,
        .timer          = &s3c24xx_timer,
 MACHINE_END