blob: 306afc1d7cd33a8ea6fee0d0fbbcf16314de5cd6 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* 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
Ben Dooks5fe10ab2005-09-20 17:24:33 +010019 * 20-Sep-2005 BJD Added static to non-exported items
Ben Dookse838ffc2005-11-01 19:44:28 +000020 * 31-Oct-2005 BJD Added LCD setup for framebuffer
Linus Torvalds1da177e2005-04-16 15:20:36 -070021*/
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>
Russell Kingd052d1b2005-10-29 19:07:23 +010031#include <linux/platform_device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070032#include <linux/serial_core.h>
33#include <linux/serial.h>
34
Ben Dooks272eb572006-04-02 16:16:15 +010035#include <linux/mtd/mtd.h>
36#include <linux/mtd/nand.h>
37#include <linux/mtd/nand_ecc.h>
38#include <linux/mtd/partitions.h>
39
Linus Torvalds1da177e2005-04-16 15:20:36 -070040#include <asm/mach/arch.h>
41#include <asm/mach/map.h>
42#include <asm/mach/irq.h>
43
44#include <asm/hardware.h>
45#include <asm/hardware/iomd.h>
46#include <asm/io.h>
47#include <asm/irq.h>
48#include <asm/mach-types.h>
49
50#include <asm/arch/regs-serial.h>
51#include <asm/arch/regs-gpio.h>
Ben Dookse838ffc2005-11-01 19:44:28 +000052#include <asm/arch/regs-lcd.h>
53
Ben Dooks272eb572006-04-02 16:16:15 +010054#include <asm/arch/nand.h>
Ben Dookse838ffc2005-11-01 19:44:28 +000055#include <asm/arch/fb.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070056
57#include "clock.h"
58#include "devs.h"
59#include "cpu.h"
60#include "pm.h"
61
62static struct map_desc rx3715_iodesc[] __initdata = {
63 /* dump ISA space somewhere unused */
64
Ben Dooksff6ffa82005-11-09 14:05:31 +000065 {
66 .virtual = (u32)S3C24XX_VA_ISA_WORD,
67 .pfn = __phys_to_pfn(S3C2410_CS3),
68 .length = SZ_1M,
69 .type = MT_DEVICE,
70 }, {
71 .virtual = (u32)S3C24XX_VA_ISA_BYTE,
72 .pfn = __phys_to_pfn(S3C2410_CS3),
73 .length = SZ_1M,
74 .type = MT_DEVICE,
75 },
Linus Torvalds1da177e2005-04-16 15:20:36 -070076};
77
78
79static struct s3c24xx_uart_clksrc rx3715_serial_clocks[] = {
80 [0] = {
81 .name = "fclk",
82 .divisor = 0,
83 .min_baud = 0,
84 .max_baud = 0,
85 }
86};
87
88static struct s3c2410_uartcfg rx3715_uartcfgs[] = {
89 [0] = {
90 .hwport = 0,
91 .flags = 0,
92 .ucon = 0x3c5,
93 .ulcon = 0x03,
94 .ufcon = 0x51,
95 .clocks = rx3715_serial_clocks,
96 .clocks_size = ARRAY_SIZE(rx3715_serial_clocks),
97 },
98 [1] = {
99 .hwport = 1,
100 .flags = 0,
101 .ucon = 0x3c5,
102 .ulcon = 0x03,
103 .ufcon = 0x00,
104 .clocks = rx3715_serial_clocks,
105 .clocks_size = ARRAY_SIZE(rx3715_serial_clocks),
106 },
107 /* IR port */
108 [2] = {
109 .hwport = 2,
110 .uart_flags = UPF_CONS_FLOW,
111 .ucon = 0x3c5,
112 .ulcon = 0x43,
113 .ufcon = 0x51,
114 .clocks = rx3715_serial_clocks,
115 .clocks_size = ARRAY_SIZE(rx3715_serial_clocks),
116 }
117};
118
Ben Dookse838ffc2005-11-01 19:44:28 +0000119/* framebuffer lcd controller information */
120
121static struct s3c2410fb_mach_info rx3715_lcdcfg __initdata = {
122 .regs = {
123 .lcdcon1 = S3C2410_LCDCON1_TFT16BPP | \
124 S3C2410_LCDCON1_TFT | \
125 S3C2410_LCDCON1_CLKVAL(0x0C),
126
127 .lcdcon2 = S3C2410_LCDCON2_VBPD(5) | \
128 S3C2410_LCDCON2_LINEVAL(319) | \
129 S3C2410_LCDCON2_VFPD(6) | \
130 S3C2410_LCDCON2_VSPW(2),
131
132 .lcdcon3 = S3C2410_LCDCON3_HBPD(35) | \
133 S3C2410_LCDCON3_HOZVAL(239) | \
134 S3C2410_LCDCON3_HFPD(35),
135
136 .lcdcon4 = S3C2410_LCDCON4_MVAL(0) | \
137 S3C2410_LCDCON4_HSPW(7),
138
139 .lcdcon5 = S3C2410_LCDCON5_INVVLINE |
140 S3C2410_LCDCON5_FRM565 |
141 S3C2410_LCDCON5_HWSWP,
142 },
143
144 .lpcsel = 0xf82,
145
146 .gpccon = 0xaa955699,
147 .gpccon_mask = 0xffc003cc,
148 .gpcup = 0x0000ffff,
149 .gpcup_mask = 0xffffffff,
150
151 .gpdcon = 0xaa95aaa1,
152 .gpdcon_mask = 0xffc0fff0,
153 .gpdup = 0x0000faff,
154 .gpdup_mask = 0xffffffff,
155
156 .fixed_syncs = 1,
157 .width = 240,
158 .height = 320,
159
160 .xres = {
161 .min = 240,
162 .max = 240,
163 .defval = 240,
164 },
165
166 .yres = {
167 .max = 320,
168 .min = 320,
169 .defval = 320,
170 },
171
172 .bpp = {
173 .min = 16,
174 .max = 16,
175 .defval = 16,
176 },
177};
178
Ben Dooks272eb572006-04-02 16:16:15 +0100179static struct mtd_partition rx3715_nand_part[] = {
180 [0] = {
181 .name = "Whole Flash",
182 .offset = 0,
183 .size = MTDPART_SIZ_FULL,
184 .mask_flags = MTD_WRITEABLE,
185 }
186};
187
188static struct s3c2410_nand_set rx3715_nand_sets[] = {
189 [0] = {
190 .name = "Internal",
191 .nr_chips = 1,
192 .nr_partitions = ARRAY_SIZE(rx3715_nand_part),
193 .partitions = rx3715_nand_part,
194 },
195};
196
197static struct s3c2410_platform_nand rx3715_nand_info = {
198 .tacls = 25,
199 .twrph0 = 50,
200 .twrph1 = 15,
201 .nr_sets = ARRAY_SIZE(rx3715_nand_sets),
202 .sets = rx3715_nand_sets,
203};
204
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205static struct platform_device *rx3715_devices[] __initdata = {
206 &s3c_device_usb,
207 &s3c_device_lcd,
208 &s3c_device_wdt,
209 &s3c_device_i2c,
210 &s3c_device_iis,
Ben Dooks272eb572006-04-02 16:16:15 +0100211 &s3c_device_nand,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212};
213
214static struct s3c24xx_board rx3715_board __initdata = {
215 .devices = rx3715_devices,
216 .devices_count = ARRAY_SIZE(rx3715_devices)
217};
218
Ben Dooks5fe10ab2005-09-20 17:24:33 +0100219static void __init rx3715_map_io(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220{
Ben Dooks272eb572006-04-02 16:16:15 +0100221 s3c_device_nand.dev.platform_data = &rx3715_nand_info;
222
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223 s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc));
224 s3c24xx_init_clocks(16934000);
225 s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
226 s3c24xx_set_board(&rx3715_board);
227}
228
Ben Dooks5fe10ab2005-09-20 17:24:33 +0100229static void __init rx3715_init_irq(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700230{
231 s3c24xx_init_irq();
232}
233
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234static void __init rx3715_init_machine(void)
235{
236 s3c2410_pm_init();
Ben Dookse838ffc2005-11-01 19:44:28 +0000237 s3c24xx_fb_set_platdata(&rx3715_lcdcfg);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238}
Ben Dookse838ffc2005-11-01 19:44:28 +0000239
Linus Torvalds1da177e2005-04-16 15:20:36 -0700240
241MACHINE_START(RX3715, "IPAQ-RX3715")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100242 /* Maintainer: Ben Dooks <ben@fluff.org> */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100243 .phys_io = S3C2410_PA_UART,
244 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
245 .boot_params = S3C2410_SDRAM_PA + 0x100,
246 .map_io = rx3715_map_io,
247 .init_irq = rx3715_init_irq,
248 .init_machine = rx3715_init_machine,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249 .timer = &s3c24xx_timer,
250MACHINE_END