ARM: imx: move mx1 support to mach-imx
[deliverable/linux.git] / arch / arm / mach-s3c2410 / mach-amlm5900.c
CommitLineData
a21765a7 1/* linux/arch/arm/mach-s3c2410/mach-amlm5900.c
da56c949
DA
2 *
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>
ec976d6e 35#include <linux/gpio.h>
da56c949
DA
36#include <linux/device.h>
37#include <linux/platform_device.h>
38#include <linux/proc_fs.h>
1b8fc188 39#include <linux/serial_core.h>
fced80c7 40#include <linux/io.h>
da56c949
DA
41
42#include <asm/mach/arch.h>
43#include <asm/mach/map.h>
44#include <asm/mach/irq.h>
45#include <asm/mach/flash.h>
46
a09e64fb 47#include <mach/hardware.h>
da56c949
DA
48#include <asm/irq.h>
49#include <asm/mach-types.h>
a09e64fb 50#include <mach/fb.h>
da56c949 51
a2b7ba9c 52#include <plat/regs-serial.h>
a09e64fb
RK
53#include <mach/regs-lcd.h>
54#include <mach/regs-gpio.h>
da56c949 55
3e1b776c 56#include <plat/iic.h>
a2b7ba9c
BD
57#include <plat/devs.h>
58#include <plat/cpu.h>
40b956f0 59#include <plat/gpio-cfg.h>
da56c949
DA
60
61#ifdef CONFIG_MTD_PARTITIONS
62
63#include <linux/mtd/mtd.h>
64#include <linux/mtd/partitions.h>
65#include <linux/mtd/map.h>
66#include <linux/mtd/physmap.h>
67
68static struct resource amlm5900_nor_resource = {
69 .start = 0x00000000,
70 .end = 0x01000000 - 1,
71 .flags = IORESOURCE_MEM,
72};
73
74
75
76static struct mtd_partition amlm5900_mtd_partitions[] = {
77 {
78 .name = "System",
79 .size = 0x240000,
80 .offset = 0,
81 .mask_flags = MTD_WRITEABLE, /* force read-only */
82 }, {
83 .name = "Kernel",
84 .size = 0x100000,
85 .offset = MTDPART_OFS_APPEND,
86 }, {
87 .name = "Ramdisk",
88 .size = 0x300000,
89 .offset = MTDPART_OFS_APPEND,
90 }, {
91 .name = "JFFS2",
92 .size = 0x9A0000,
93 .offset = MTDPART_OFS_APPEND,
94 }, {
95 .name = "Settings",
96 .size = MTDPART_SIZ_FULL,
97 .offset = MTDPART_OFS_APPEND,
98 }
99};
100
101static struct physmap_flash_data amlm5900_flash_data = {
102 .width = 2,
103 .parts = amlm5900_mtd_partitions,
104 .nr_parts = ARRAY_SIZE(amlm5900_mtd_partitions),
105};
106
107static struct platform_device amlm5900_device_nor = {
108 .name = "physmap-flash",
109 .id = 0,
110 .dev = {
111 .platform_data = &amlm5900_flash_data,
112 },
113 .num_resources = 1,
114 .resource = &amlm5900_nor_resource,
115};
116#endif
117
118static struct map_desc amlm5900_iodesc[] __initdata = {
da56c949
DA
119};
120
121#define UCON S3C2410_UCON_DEFAULT
122#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
123#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
124
125static struct s3c2410_uartcfg amlm5900_uartcfgs[] = {
126 [0] = {
127 .hwport = 0,
128 .flags = 0,
129 .ucon = UCON,
130 .ulcon = ULCON,
131 .ufcon = UFCON,
132 },
133 [1] = {
134 .hwport = 1,
135 .flags = 0,
136 .ucon = UCON,
137 .ulcon = ULCON,
138 .ufcon = UFCON,
139 },
140 [2] = {
141 .hwport = 2,
142 .flags = 0,
143 .ucon = UCON,
144 .ulcon = ULCON,
145 .ufcon = UFCON,
146 }
147};
148
149
150static struct platform_device *amlm5900_devices[] __initdata = {
151#ifdef CONFIG_FB_S3C2410
152 &s3c_device_lcd,
153#endif
154 &s3c_device_adc,
155 &s3c_device_wdt,
3e1b776c 156 &s3c_device_i2c0,
b813248c 157 &s3c_device_ohci,
da56c949
DA
158 &s3c_device_rtc,
159 &s3c_device_usbgadget,
160 &s3c_device_sdi,
161#ifdef CONFIG_MTD_PARTITIONS
162 &amlm5900_device_nor,
163#endif
164};
165
e078761a 166static void __init amlm5900_map_io(void)
da56c949
DA
167{
168 s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc));
169 s3c24xx_init_clocks(0);
170 s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs));
da56c949
DA
171}
172
173#ifdef CONFIG_FB_S3C2410
09fe75f6 174static struct s3c2410fb_display __initdata amlm5900_lcd_info = {
da56c949
DA
175 .width = 160,
176 .height = 160,
177
1f411537
KH
178 .type = S3C2410_LCDCON1_STN4,
179
69816699 180 .pixclock = 680000, /* HCLK = 100MHz */
09fe75f6
KH
181 .xres = 160,
182 .yres = 160,
183 .bpp = 4,
1f411537
KH
184 .left_margin = 1 << (4 + 3),
185 .right_margin = 8 << 3,
93d11f5a 186 .hsync_len = 48,
5f20f69b
KH
187 .upper_margin = 0,
188 .lower_margin = 0,
09fe75f6 189
f28ef573 190 .lcdcon5 = 0x00000001,
09fe75f6
KH
191};
192
193static struct s3c2410fb_mach_info __initdata amlm5900_fb_info = {
194
195 .displays = &amlm5900_lcd_info,
196 .num_displays = 1,
197 .default_display = 0,
198
da56c949
DA
199 .gpccon = 0xaaaaaaaa,
200 .gpccon_mask = 0xffffffff,
201 .gpcup = 0x0000ffff,
202 .gpcup_mask = 0xffffffff,
203
204 .gpdcon = 0xaaaaaaaa,
205 .gpdcon_mask = 0xffffffff,
206 .gpdup = 0x0000ffff,
207 .gpdup_mask = 0xffffffff,
da56c949
DA
208};
209#endif
210
26f90818 211static irqreturn_t
0cd61b68 212amlm5900_wake_interrupt(int irq, void *ignored)
da56c949 213{
26f90818
DA
214 return IRQ_HANDLED;
215}
da56c949 216
26f90818
DA
217static void amlm5900_init_pm(void)
218{
219 int ret = 0;
220
221 ret = request_irq(IRQ_EINT9, &amlm5900_wake_interrupt,
222 IRQF_TRIGGER_RISING | IRQF_SHARED,
223 "amlm5900_wakeup", &amlm5900_wake_interrupt);
224 if (ret != 0) {
225 printk(KERN_ERR "AML-M5900: no wakeup irq, %d?\n", ret);
226 } else {
227 enable_irq_wake(IRQ_EINT9);
228 /* configure the suspend/resume status pin */
40b956f0 229 s3c_gpio_cfgpin(S3C2410_GPF(2), S3C2410_GPIO_OUTPUT);
fb378747 230 s3c_gpio_setpull(S3C2410_GPF(2), S3C_GPIO_PULL_UP);
26f90818
DA
231 }
232}
233static void __init amlm5900_init(void)
234{
235 amlm5900_init_pm();
da56c949 236#ifdef CONFIG_FB_S3C2410
09fe75f6 237 s3c24xx_fb_set_platdata(&amlm5900_fb_info);
da56c949 238#endif
3e1b776c 239 s3c_i2c0_set_platdata(NULL);
57e5171c 240 platform_add_devices(amlm5900_devices, ARRAY_SIZE(amlm5900_devices));
da56c949
DA
241}
242
243MACHINE_START(AML_M5900, "AML_M5900")
244 .phys_io = S3C2410_PA_UART,
245 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
246 .boot_params = S3C2410_SDRAM_PA + 0x100,
247 .map_io = amlm5900_map_io,
248 .init_irq = s3c24xx_init_irq,
249 .init_machine = amlm5900_init,
250 .timer = &s3c24xx_timer,
251MACHINE_END
This page took 0.425965 seconds and 5 git commands to generate.