ACPI: Fix CONFIG_ACPI_DOCK=n compiler warning
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-s3c2410 / mach-amlm5900.c
blobdabc141243f397b234c00b19293fccdd05a5d027
1 /* linux/arch/arm/mach-s3c2410/mach-amlm5900.c
3 * linux/arch/arm/mach-s3c2410/mach-amlm5900.c
5 * Copyright (c) 2006 American Microsystems Limited
6 * David Anders <danders@amltd.com>
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.
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.
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
23 * @History:
24 * derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by
25 * Ben Dooks <ben@simtec.co.uk>
27 ***********************************************************************/
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/gpio.h>
36 #include <linux/device.h>
37 #include <linux/platform_device.h>
38 #include <linux/proc_fs.h>
39 #include <linux/serial_core.h>
40 #include <linux/io.h>
42 #include <asm/mach/arch.h>
43 #include <asm/mach/map.h>
44 #include <asm/mach/irq.h>
45 #include <asm/mach/flash.h>
47 #include <mach/hardware.h>
48 #include <asm/irq.h>
49 #include <asm/mach-types.h>
50 #include <mach/fb.h>
52 #include <plat/regs-serial.h>
53 #include <mach/regs-lcd.h>
54 #include <mach/regs-gpio.h>
56 #include <plat/iic.h>
57 #include <plat/devs.h>
58 #include <plat/cpu.h>
59 #include <plat/gpio-cfg.h>
61 #include <linux/mtd/mtd.h>
62 #include <linux/mtd/partitions.h>
63 #include <linux/mtd/map.h>
64 #include <linux/mtd/physmap.h>
66 static struct resource amlm5900_nor_resource = {
67 .start = 0x00000000,
68 .end = 0x01000000 - 1,
69 .flags = IORESOURCE_MEM,
74 static struct mtd_partition amlm5900_mtd_partitions[] = {
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,
99 static struct physmap_flash_data amlm5900_flash_data = {
100 .width = 2,
101 .parts = amlm5900_mtd_partitions,
102 .nr_parts = ARRAY_SIZE(amlm5900_mtd_partitions),
105 static struct platform_device amlm5900_device_nor = {
106 .name = "physmap-flash",
107 .id = 0,
108 .dev = {
109 .platform_data = &amlm5900_flash_data,
111 .num_resources = 1,
112 .resource = &amlm5900_nor_resource,
115 static struct map_desc amlm5900_iodesc[] __initdata = {
118 #define UCON S3C2410_UCON_DEFAULT
119 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
120 #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
122 static struct s3c2410_uartcfg amlm5900_uartcfgs[] = {
123 [0] = {
124 .hwport = 0,
125 .flags = 0,
126 .ucon = UCON,
127 .ulcon = ULCON,
128 .ufcon = UFCON,
130 [1] = {
131 .hwport = 1,
132 .flags = 0,
133 .ucon = UCON,
134 .ulcon = ULCON,
135 .ufcon = UFCON,
137 [2] = {
138 .hwport = 2,
139 .flags = 0,
140 .ucon = UCON,
141 .ulcon = ULCON,
142 .ufcon = UFCON,
147 static struct platform_device *amlm5900_devices[] __initdata = {
148 #ifdef CONFIG_FB_S3C2410
149 &s3c_device_lcd,
150 #endif
151 &s3c_device_adc,
152 &s3c_device_wdt,
153 &s3c_device_i2c0,
154 &s3c_device_ohci,
155 &s3c_device_rtc,
156 &s3c_device_usbgadget,
157 &s3c_device_sdi,
158 &amlm5900_device_nor,
161 static void __init amlm5900_map_io(void)
163 s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc));
164 s3c24xx_init_clocks(0);
165 s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs));
168 #ifdef CONFIG_FB_S3C2410
169 static struct s3c2410fb_display __initdata amlm5900_lcd_info = {
170 .width = 160,
171 .height = 160,
173 .type = S3C2410_LCDCON1_STN4,
175 .pixclock = 680000, /* HCLK = 100MHz */
176 .xres = 160,
177 .yres = 160,
178 .bpp = 4,
179 .left_margin = 1 << (4 + 3),
180 .right_margin = 8 << 3,
181 .hsync_len = 48,
182 .upper_margin = 0,
183 .lower_margin = 0,
185 .lcdcon5 = 0x00000001,
188 static struct s3c2410fb_mach_info __initdata amlm5900_fb_info = {
190 .displays = &amlm5900_lcd_info,
191 .num_displays = 1,
192 .default_display = 0,
194 .gpccon = 0xaaaaaaaa,
195 .gpccon_mask = 0xffffffff,
196 .gpcup = 0x0000ffff,
197 .gpcup_mask = 0xffffffff,
199 .gpdcon = 0xaaaaaaaa,
200 .gpdcon_mask = 0xffffffff,
201 .gpdup = 0x0000ffff,
202 .gpdup_mask = 0xffffffff,
204 #endif
206 static irqreturn_t
207 amlm5900_wake_interrupt(int irq, void *ignored)
209 return IRQ_HANDLED;
212 static void amlm5900_init_pm(void)
214 int ret = 0;
216 ret = request_irq(IRQ_EINT9, &amlm5900_wake_interrupt,
217 IRQF_TRIGGER_RISING | IRQF_SHARED,
218 "amlm5900_wakeup", &amlm5900_wake_interrupt);
219 if (ret != 0) {
220 printk(KERN_ERR "AML-M5900: no wakeup irq, %d?\n", ret);
221 } else {
222 enable_irq_wake(IRQ_EINT9);
223 /* configure the suspend/resume status pin */
224 s3c_gpio_cfgpin(S3C2410_GPF(2), S3C2410_GPIO_OUTPUT);
225 s3c_gpio_setpull(S3C2410_GPF(2), S3C_GPIO_PULL_UP);
228 static void __init amlm5900_init(void)
230 amlm5900_init_pm();
231 #ifdef CONFIG_FB_S3C2410
232 s3c24xx_fb_set_platdata(&amlm5900_fb_info);
233 #endif
234 s3c_i2c0_set_platdata(NULL);
235 platform_add_devices(amlm5900_devices, ARRAY_SIZE(amlm5900_devices));
238 MACHINE_START(AML_M5900, "AML_M5900")
239 .boot_params = S3C2410_SDRAM_PA + 0x100,
240 .map_io = amlm5900_map_io,
241 .init_irq = s3c24xx_init_irq,
242 .init_machine = amlm5900_init,
243 .timer = &s3c24xx_timer,
244 MACHINE_END