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