Merge master.kernel.org:/home/rmk/linux-2.6-serial
[sfrench/cifs-2.6.git] / arch / arm / mach-s3c2410 / mach-rx3715.c
1 /* linux/arch/arm/mach-s3c2410/mach-rx3715.c
2  *
3  * Copyright (c) 2003,2004 Simtec Electronics
4  *      Ben Dooks <ben@simtec.co.uk>
5  *
6  * http://www.handhelds.org/projects/rx3715.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-Sep-2004 BJD  Copied from mach-h1940.c
14  *      25-Oct-2004 BJD  Updates for 2.6.10-rc1
15  *      10-Jan-2005 BJD  Removed include of s3c2410.h s3c2440.h
16  *      14-Jan-2005 BJD  Added new clock init
17  *      10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
18  *      14-Mar-2005 BJD  Fixed __iomem warnings
19  *      20-Sep-2005 BJD  Added static to non-exported items
20  *      31-Oct-2005 BJD  Added LCD setup for framebuffer
21 */
22
23 #include <linux/kernel.h>
24 #include <linux/types.h>
25 #include <linux/interrupt.h>
26 #include <linux/list.h>
27 #include <linux/timer.h>
28 #include <linux/init.h>
29 #include <linux/tty.h>
30 #include <linux/console.h>
31 #include <linux/platform_device.h>
32 #include <linux/serial_core.h>
33 #include <linux/serial.h>
34
35 #include <asm/mach/arch.h>
36 #include <asm/mach/map.h>
37 #include <asm/mach/irq.h>
38
39 #include <asm/hardware.h>
40 #include <asm/hardware/iomd.h>
41 #include <asm/io.h>
42 #include <asm/irq.h>
43 #include <asm/mach-types.h>
44
45 #include <asm/arch/regs-serial.h>
46 #include <asm/arch/regs-gpio.h>
47 #include <asm/arch/regs-lcd.h>
48
49 #include <asm/arch/fb.h>
50
51 #include "clock.h"
52 #include "devs.h"
53 #include "cpu.h"
54 #include "pm.h"
55
56 static struct map_desc rx3715_iodesc[] __initdata = {
57         /* dump ISA space somewhere unused */
58
59         { (u32)S3C24XX_VA_ISA_WORD, S3C2410_CS3, SZ_16M, MT_DEVICE },
60         { (u32)S3C24XX_VA_ISA_BYTE, S3C2410_CS3, SZ_16M, MT_DEVICE },
61 };
62
63
64 static struct s3c24xx_uart_clksrc rx3715_serial_clocks[] = {
65         [0] = {
66                 .name           = "fclk",
67                 .divisor        = 0,
68                 .min_baud       = 0,
69                 .max_baud       = 0,
70         }
71 };
72
73 static struct s3c2410_uartcfg rx3715_uartcfgs[] = {
74         [0] = {
75                 .hwport      = 0,
76                 .flags       = 0,
77                 .ucon        = 0x3c5,
78                 .ulcon       = 0x03,
79                 .ufcon       = 0x51,
80                 .clocks      = rx3715_serial_clocks,
81                 .clocks_size = ARRAY_SIZE(rx3715_serial_clocks),
82         },
83         [1] = {
84                 .hwport      = 1,
85                 .flags       = 0,
86                 .ucon        = 0x3c5,
87                 .ulcon       = 0x03,
88                 .ufcon       = 0x00,
89                 .clocks      = rx3715_serial_clocks,
90                 .clocks_size = ARRAY_SIZE(rx3715_serial_clocks),
91         },
92         /* IR port */
93         [2] = {
94                 .hwport      = 2,
95                 .uart_flags  = UPF_CONS_FLOW,
96                 .ucon        = 0x3c5,
97                 .ulcon       = 0x43,
98                 .ufcon       = 0x51,
99                 .clocks      = rx3715_serial_clocks,
100                 .clocks_size = ARRAY_SIZE(rx3715_serial_clocks),
101         }
102 };
103
104 /* framebuffer lcd controller information */
105
106 static struct s3c2410fb_mach_info rx3715_lcdcfg __initdata = {
107         .regs   = {
108                 .lcdcon1 =      S3C2410_LCDCON1_TFT16BPP | \
109                                 S3C2410_LCDCON1_TFT | \
110                                 S3C2410_LCDCON1_CLKVAL(0x0C),
111
112                 .lcdcon2 =      S3C2410_LCDCON2_VBPD(5) | \
113                                 S3C2410_LCDCON2_LINEVAL(319) | \
114                                 S3C2410_LCDCON2_VFPD(6) | \
115                                 S3C2410_LCDCON2_VSPW(2),
116
117                 .lcdcon3 =      S3C2410_LCDCON3_HBPD(35) | \
118                                 S3C2410_LCDCON3_HOZVAL(239) | \
119                                 S3C2410_LCDCON3_HFPD(35),
120
121                 .lcdcon4 =      S3C2410_LCDCON4_MVAL(0) | \
122                                 S3C2410_LCDCON4_HSPW(7),
123
124                 .lcdcon5 =      S3C2410_LCDCON5_INVVLINE |
125                                 S3C2410_LCDCON5_FRM565 |
126                                 S3C2410_LCDCON5_HWSWP,
127         },
128
129         .lpcsel =       0xf82,
130
131         .gpccon =       0xaa955699,
132         .gpccon_mask =  0xffc003cc,
133         .gpcup =        0x0000ffff,
134         .gpcup_mask =   0xffffffff,
135
136         .gpdcon =       0xaa95aaa1,
137         .gpdcon_mask =  0xffc0fff0,
138         .gpdup =        0x0000faff,
139         .gpdup_mask =   0xffffffff,
140
141         .fixed_syncs =  1,
142         .width  =       240,
143         .height =       320,
144
145         .xres   = {
146                 .min =          240,
147                 .max =          240,
148                 .defval =       240,
149         },
150
151         .yres   = {
152                 .max =          320,
153                 .min =          320,
154                 .defval =       320,
155         },
156
157         .bpp    = {
158                 .min =          16,
159                 .max =          16,
160                 .defval =       16,
161         },
162 };
163
164 static struct platform_device *rx3715_devices[] __initdata = {
165         &s3c_device_usb,
166         &s3c_device_lcd,
167         &s3c_device_wdt,
168         &s3c_device_i2c,
169         &s3c_device_iis,
170 };
171
172 static struct s3c24xx_board rx3715_board __initdata = {
173         .devices       = rx3715_devices,
174         .devices_count = ARRAY_SIZE(rx3715_devices)
175 };
176
177 static void __init rx3715_map_io(void)
178 {
179         s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc));
180         s3c24xx_init_clocks(16934000);
181         s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
182         s3c24xx_set_board(&rx3715_board);
183 }
184
185 static void __init rx3715_init_irq(void)
186 {
187         s3c24xx_init_irq();
188 }
189
190 static void __init rx3715_init_machine(void)
191 {
192         s3c2410_pm_init();
193         s3c24xx_fb_set_platdata(&rx3715_lcdcfg);
194 }
195
196
197 MACHINE_START(RX3715, "IPAQ-RX3715")
198         /* Maintainer: Ben Dooks <ben@fluff.org> */
199         .phys_ram       = S3C2410_SDRAM_PA,
200         .phys_io        = S3C2410_PA_UART,
201         .io_pg_offst    = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
202         .boot_params    = S3C2410_SDRAM_PA + 0x100,
203         .map_io         = rx3715_map_io,
204         .init_irq       = rx3715_init_irq,
205         .init_machine   = rx3715_init_machine,
206         .timer          = &s3c24xx_timer,
207 MACHINE_END