blob: 6d6995afeb439013d19833cc1f360c986a270b32 [file] [log] [blame]
Ben Dooksa21765a2007-02-11 18:31:01 +01001/* linux/arch/arm/mach-s3c2410/mach-amlm5900.c
David Andersda56c942006-09-21 22:57:12 +01002 *
3 * linux/arch/arm/mach-s3c2410/mach-amlm5900.c
4 *
5 * Copyright (c) 2006 American Microsystems Limited
6 * David Anders <danders@amltd.com>
7
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 *
23 * @History:
24 * derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by
25 * Ben Dooks <ben@simtec.co.uk>
26 *
27 ***********************************************************************/
28
29#include <linux/kernel.h>
30#include <linux/types.h>
31#include <linux/interrupt.h>
32#include <linux/list.h>
33#include <linux/timer.h>
34#include <linux/init.h>
35#include <linux/device.h>
36#include <linux/platform_device.h>
37#include <linux/proc_fs.h>
Ben Dooks1b8fc182007-02-11 18:56:03 +010038#include <linux/serial_core.h>
Russell Kingfced80c2008-09-06 12:10:45 +010039#include <linux/io.h>
David Andersda56c942006-09-21 22:57:12 +010040
41#include <asm/mach/arch.h>
42#include <asm/mach/map.h>
43#include <asm/mach/irq.h>
44#include <asm/mach/flash.h>
45
Russell Kinga09e64f2008-08-05 16:14:15 +010046#include <mach/hardware.h>
David Andersda56c942006-09-21 22:57:12 +010047#include <asm/irq.h>
48#include <asm/mach-types.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010049#include <mach/fb.h>
David Andersda56c942006-09-21 22:57:12 +010050
Ben Dooksa2b7ba92008-10-07 22:26:09 +010051#include <plat/regs-serial.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010052#include <mach/regs-lcd.h>
53#include <mach/regs-gpio.h>
David Andersda56c942006-09-21 22:57:12 +010054
Ben Dooks3e1b7762008-10-31 16:14:40 +000055#include <plat/iic.h>
Ben Dooksa2b7ba92008-10-07 22:26:09 +010056#include <plat/devs.h>
57#include <plat/cpu.h>
David Andersda56c942006-09-21 22:57:12 +010058
59#ifdef CONFIG_MTD_PARTITIONS
60
61#include <linux/mtd/mtd.h>
62#include <linux/mtd/partitions.h>
63#include <linux/mtd/map.h>
64#include <linux/mtd/physmap.h>
65
66static struct resource amlm5900_nor_resource = {
67 .start = 0x00000000,
68 .end = 0x01000000 - 1,
69 .flags = IORESOURCE_MEM,
70};
71
72
73
74static struct mtd_partition amlm5900_mtd_partitions[] = {
75 {
76 .name = "System",
77 .size = 0x240000,
78 .offset = 0,
79 .mask_flags = MTD_WRITEABLE, /* force read-only */
80 }, {
81 .name = "Kernel",
82 .size = 0x100000,
83 .offset = MTDPART_OFS_APPEND,
84 }, {
85 .name = "Ramdisk",
86 .size = 0x300000,
87 .offset = MTDPART_OFS_APPEND,
88 }, {
89 .name = "JFFS2",
90 .size = 0x9A0000,
91 .offset = MTDPART_OFS_APPEND,
92 }, {
93 .name = "Settings",
94 .size = MTDPART_SIZ_FULL,
95 .offset = MTDPART_OFS_APPEND,
96 }
97};
98
99static struct physmap_flash_data amlm5900_flash_data = {
100 .width = 2,
101 .parts = amlm5900_mtd_partitions,
102 .nr_parts = ARRAY_SIZE(amlm5900_mtd_partitions),
103};
104
105static struct platform_device amlm5900_device_nor = {
106 .name = "physmap-flash",
107 .id = 0,
108 .dev = {
109 .platform_data = &amlm5900_flash_data,
110 },
111 .num_resources = 1,
112 .resource = &amlm5900_nor_resource,
113};
114#endif
115
116static struct map_desc amlm5900_iodesc[] __initdata = {
David Andersda56c942006-09-21 22:57:12 +0100117};
118
119#define UCON S3C2410_UCON_DEFAULT
120#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
121#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
122
123static struct s3c2410_uartcfg amlm5900_uartcfgs[] = {
124 [0] = {
125 .hwport = 0,
126 .flags = 0,
127 .ucon = UCON,
128 .ulcon = ULCON,
129 .ufcon = UFCON,
130 },
131 [1] = {
132 .hwport = 1,
133 .flags = 0,
134 .ucon = UCON,
135 .ulcon = ULCON,
136 .ufcon = UFCON,
137 },
138 [2] = {
139 .hwport = 2,
140 .flags = 0,
141 .ucon = UCON,
142 .ulcon = ULCON,
143 .ufcon = UFCON,
144 }
145};
146
147
148static struct platform_device *amlm5900_devices[] __initdata = {
149#ifdef CONFIG_FB_S3C2410
150 &s3c_device_lcd,
151#endif
152 &s3c_device_adc,
153 &s3c_device_wdt,
Ben Dooks3e1b7762008-10-31 16:14:40 +0000154 &s3c_device_i2c0,
David Andersda56c942006-09-21 22:57:12 +0100155 &s3c_device_usb,
156 &s3c_device_rtc,
157 &s3c_device_usbgadget,
158 &s3c_device_sdi,
159#ifdef CONFIG_MTD_PARTITIONS
160 &amlm5900_device_nor,
161#endif
162};
163
Ben Dookse0787612007-05-28 18:57:31 +0100164static void __init amlm5900_map_io(void)
David Andersda56c942006-09-21 22:57:12 +0100165{
166 s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc));
167 s3c24xx_init_clocks(0);
168 s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs));
David Andersda56c942006-09-21 22:57:12 +0100169}
170
171#ifdef CONFIG_FB_S3C2410
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700172static struct s3c2410fb_display __initdata amlm5900_lcd_info = {
David Andersda56c942006-09-21 22:57:12 +0100173 .width = 160,
174 .height = 160,
175
Krzysztof Helt1f411532007-10-16 01:28:57 -0700176 .type = S3C2410_LCDCON1_STN4,
177
Krzysztof Helt69816692007-10-16 01:29:06 -0700178 .pixclock = 680000, /* HCLK = 100MHz */
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700179 .xres = 160,
180 .yres = 160,
181 .bpp = 4,
Krzysztof Helt1f411532007-10-16 01:28:57 -0700182 .left_margin = 1 << (4 + 3),
183 .right_margin = 8 << 3,
Krzysztof Helt93d11f52007-10-16 01:29:00 -0700184 .hsync_len = 48,
Krzysztof Helt5f20f692007-10-16 01:28:59 -0700185 .upper_margin = 0,
186 .lower_margin = 0,
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700187
Krzysztof Heltf28ef572007-10-16 01:28:58 -0700188 .lcdcon5 = 0x00000001,
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700189};
190
191static struct s3c2410fb_mach_info __initdata amlm5900_fb_info = {
192
193 .displays = &amlm5900_lcd_info,
194 .num_displays = 1,
195 .default_display = 0,
196
David Andersda56c942006-09-21 22:57:12 +0100197 .gpccon = 0xaaaaaaaa,
198 .gpccon_mask = 0xffffffff,
199 .gpcup = 0x0000ffff,
200 .gpcup_mask = 0xffffffff,
201
202 .gpdcon = 0xaaaaaaaa,
203 .gpdcon_mask = 0xffffffff,
204 .gpdup = 0x0000ffff,
205 .gpdup_mask = 0xffffffff,
David Andersda56c942006-09-21 22:57:12 +0100206};
207#endif
208
David Anders26f90812006-09-26 17:46:00 +0100209static irqreturn_t
Linus Torvalds0cd61b62006-10-06 10:53:39 -0700210amlm5900_wake_interrupt(int irq, void *ignored)
David Anders26f90812006-09-26 17:46:00 +0100211{
212 return IRQ_HANDLED;
213}
214
215static void amlm5900_init_pm(void)
216{
217 int ret = 0;
218
219 ret = request_irq(IRQ_EINT9, &amlm5900_wake_interrupt,
220 IRQF_TRIGGER_RISING | IRQF_SHARED,
221 "amlm5900_wakeup", &amlm5900_wake_interrupt);
222 if (ret != 0) {
223 printk(KERN_ERR "AML-M5900: no wakeup irq, %d?\n", ret);
224 } else {
225 enable_irq_wake(IRQ_EINT9);
226 /* configure the suspend/resume status pin */
227 s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_OUTP);
228 s3c2410_gpio_pullup(S3C2410_GPF2, 0);
229 }
230}
David Andersda56c942006-09-21 22:57:12 +0100231static void __init amlm5900_init(void)
232{
David Anders26f90812006-09-26 17:46:00 +0100233 amlm5900_init_pm();
David Andersda56c942006-09-21 22:57:12 +0100234#ifdef CONFIG_FB_S3C2410
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700235 s3c24xx_fb_set_platdata(&amlm5900_fb_info);
David Andersda56c942006-09-21 22:57:12 +0100236#endif
Ben Dooks3e1b7762008-10-31 16:14:40 +0000237 s3c_i2c0_set_platdata(NULL);
Ben Dooks57e51712007-04-20 11:19:16 +0100238 platform_add_devices(amlm5900_devices, ARRAY_SIZE(amlm5900_devices));
David Andersda56c942006-09-21 22:57:12 +0100239}
240
241MACHINE_START(AML_M5900, "AML_M5900")
242 .phys_io = S3C2410_PA_UART,
243 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
244 .boot_params = S3C2410_SDRAM_PA + 0x100,
245 .map_io = amlm5900_map_io,
246 .init_irq = s3c24xx_init_irq,
247 .init_machine = amlm5900_init,
248 .timer = &s3c24xx_timer,
249MACHINE_END