Merge with /pub/scm/linux/kernel/git/sfrench/cifs-2.6.git/
[sfrench/cifs-2.6.git] / arch / arm / mach-s3c2410 / mach-h1940.c
1 /* linux/arch/arm/mach-s3c2410/mach-h1940.c
2  *
3  * Copyright (c) 2003-2005 Simtec Electronics
4  *   Ben Dooks <ben@simtec.co.uk>
5  *
6  * http://www.handhelds.org/projects/h1940.html
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  *
12  * Modifications:
13  *     16-May-2003 BJD  Created initial version
14  *     16-Aug-2003 BJD  Fixed header files and copyright, added URL
15  *     05-Sep-2003 BJD  Moved to v2.6 kernel
16  *     06-Jan-2003 BJD  Updates for <arch/map.h>
17  *     18-Jan-2003 BJD  Added serial port configuration
18  *     17-Feb-2003 BJD  Copied to mach-ipaq.c
19  *     21-Aug-2004 BJD  Added struct s3c2410_board
20  *     04-Sep-2004 BJD  Changed uart init, renamed ipaq_ -> h1940_
21  *     18-Oct-2004 BJD  Updated new board structure name
22  *     04-Nov-2004 BJD  Change for new serial clock
23  *     04-Jan-2005 BJD  Updated uart init call
24  *     10-Jan-2005 BJD  Removed include of s3c2410.h
25  *     14-Jan-2005 BJD  Added clock init
26  *     10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
27  *     20-Sep-2005 BJD  Added static to non-exported items
28 */
29
30 #include <linux/kernel.h>
31 #include <linux/types.h>
32 #include <linux/interrupt.h>
33 #include <linux/list.h>
34 #include <linux/timer.h>
35 #include <linux/init.h>
36
37 #include <asm/mach/arch.h>
38 #include <asm/mach/map.h>
39 #include <asm/mach/irq.h>
40
41 #include <asm/hardware.h>
42 #include <asm/hardware/iomd.h>
43 #include <asm/io.h>
44 #include <asm/irq.h>
45 #include <asm/mach-types.h>
46
47 //#include <asm/debug-ll.h>
48 #include <asm/arch/regs-serial.h>
49 #include <asm/arch/regs-lcd.h>
50
51 #include <asm/arch/fb.h>
52
53 #include <linux/serial_core.h>
54
55 #include "clock.h"
56 #include "devs.h"
57 #include "cpu.h"
58
59 static struct map_desc h1940_iodesc[] __initdata = {
60         /* nothing here yet */
61 };
62
63 #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
64 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
65 #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
66
67 static struct s3c2410_uartcfg h1940_uartcfgs[] = {
68         [0] = {
69                 .hwport      = 0,
70                 .flags       = 0,
71                 .ucon        = 0x3c5,
72                 .ulcon       = 0x03,
73                 .ufcon       = 0x51,
74         },
75         [1] = {
76                 .hwport      = 1,
77                 .flags       = 0,
78                 .ucon        = 0x245,
79                 .ulcon       = 0x03,
80                 .ufcon       = 0x00,
81         },
82         /* IR port */
83         [2] = {
84                 .hwport      = 2,
85                 .flags       = 0,
86                 .uart_flags  = UPF_CONS_FLOW,
87                 .ucon        = 0x3c5,
88                 .ulcon       = 0x43,
89                 .ufcon       = 0x51,
90         }
91 };
92
93
94
95 /**
96  * Set lcd on or off
97  **/
98 static struct s3c2410fb_mach_info h1940_lcdcfg __initdata = {
99         .fixed_syncs=           1,
100         .regs={
101                 .lcdcon1=       S3C2410_LCDCON1_TFT16BPP | \
102                                 S3C2410_LCDCON1_TFT | \
103                                 S3C2410_LCDCON1_CLKVAL(0x0C),
104
105                 .lcdcon2=       S3C2410_LCDCON2_VBPD(7) | \
106                                 S3C2410_LCDCON2_LINEVAL(319) | \
107                                 S3C2410_LCDCON2_VFPD(6) | \
108                                 S3C2410_LCDCON2_VSPW(0),
109
110                 .lcdcon3=       S3C2410_LCDCON3_HBPD(19) | \
111                                 S3C2410_LCDCON3_HOZVAL(239) | \
112                                 S3C2410_LCDCON3_HFPD(7),
113
114                 .lcdcon4=       S3C2410_LCDCON4_MVAL(0) | \
115                                 S3C2410_LCDCON4_HSPW(3),
116
117                 .lcdcon5=       S3C2410_LCDCON5_FRM565 | \
118                                 S3C2410_LCDCON5_INVVLINE | \
119                                 S3C2410_LCDCON5_HWSWP,
120         },
121         .lpcsel=        0x02,
122         .gpccon=        0xaa940659,
123         .gpccon_mask=   0xffffffff,
124         .gpcup=         0x0000ffff,
125         .gpcup_mask=    0xffffffff,
126         .gpdcon=        0xaa84aaa0,
127         .gpdcon_mask=   0xffffffff,
128         .gpdup=         0x0000faff,
129         .gpdup_mask=    0xffffffff,
130
131         .width=         240,
132         .height=        320,
133         .xres=          {240,240,240},
134         .yres=          {320,320,320},
135         .bpp=           {16,16,16},
136 };
137
138 static struct platform_device *h1940_devices[] __initdata = {
139         &s3c_device_usb,
140         &s3c_device_lcd,
141         &s3c_device_wdt,
142         &s3c_device_i2c,
143         &s3c_device_iis,
144 };
145
146 static struct s3c24xx_board h1940_board __initdata = {
147         .devices       = h1940_devices,
148         .devices_count = ARRAY_SIZE(h1940_devices)
149 };
150
151 static void __init h1940_map_io(void)
152 {
153         s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc));
154         s3c24xx_init_clocks(0);
155         s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs));
156         s3c24xx_set_board(&h1940_board);
157 }
158
159 static void __init h1940_init_irq(void)
160 {
161         s3c24xx_init_irq();
162
163 }
164
165 static void __init h1940_init(void)
166 {
167         set_s3c2410fb_info(&h1940_lcdcfg);
168 }
169
170 MACHINE_START(H1940, "IPAQ-H1940")
171         /* Maintainer: Ben Dooks <ben@fluff.org> */
172         .phys_ram       = S3C2410_SDRAM_PA,
173         .phys_io        = S3C2410_PA_UART,
174         .io_pg_offst    = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
175         .boot_params    = S3C2410_SDRAM_PA + 0x100,
176         .map_io         = h1940_map_io,
177         .init_irq       = h1940_init_irq,
178         .init_machine   = h1940_init,
179         .timer          = &s3c24xx_timer,
180 MACHINE_END