1 /* Machine specific code for the Acer n30 PDA.
3 * Copyright (c) 2003-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
6 * Copyright (c) 2005-2008 Christer Weinigel <christer@weinigel.se>
8 * There is a wiki with more information about the n30 port at
9 * http://handhelds.org/moin/moin.cgi/AcerN30Documentation .
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
16 #include <linux/kernel.h>
17 #include <linux/types.h>
19 #include <linux/delay.h>
20 #include <linux/gpio_keys.h>
21 #include <linux/init.h>
22 #include <linux/input.h>
23 #include <linux/interrupt.h>
24 #include <linux/platform_device.h>
25 #include <linux/serial_core.h>
26 #include <linux/timer.h>
28 #include <asm/hardware.h>
31 #include <asm/mach-types.h>
33 #include <asm/arch/regs-gpio.h>
35 #include <asm/mach/arch.h>
36 #include <asm/mach/irq.h>
37 #include <asm/mach/map.h>
39 #include <asm/plat-s3c/iic.h>
40 #include <asm/plat-s3c/regs-serial.h>
42 #include <asm/plat-s3c24xx/clock.h>
43 #include <asm/plat-s3c24xx/cpu.h>
44 #include <asm/plat-s3c24xx/devs.h>
45 #include <asm/plat-s3c24xx/s3c2410.h>
46 #include <asm/plat-s3c24xx/udc.h>
48 static struct map_desc n30_iodesc[] __initdata = {
49 /* nothing here yet */
52 static struct s3c2410_uartcfg n30_uartcfgs[] = {
53 /* Normal serial port */
65 .uart_flags = UPF_CONS_FLOW,
70 /* The BlueTooth controller is connected to port 2 */
80 static void n30_udc_pullup(enum s3c2410_udc_cmd_e cmd)
84 case S3C2410_UDC_P_ENABLE :
85 s3c2410_gpio_setpin(S3C2410_GPB3, 1);
87 case S3C2410_UDC_P_DISABLE :
88 s3c2410_gpio_setpin(S3C2410_GPB3, 0);
90 case S3C2410_UDC_P_RESET :
97 static struct s3c2410_udc_mach_info n30_udc_cfg __initdata = {
98 .udc_command = n30_udc_pullup,
99 .vbus_pin = S3C2410_GPG1,
100 .vbus_pin_inverted = 0,
103 static struct gpio_keys_button n30_buttons[] = {
105 .gpio = S3C2410_GPF0,
111 .gpio = S3C2410_GPG9,
113 .desc = "Thumbwheel Up",
117 .gpio = S3C2410_GPG8,
119 .desc = "Thumbwheel Down",
123 .gpio = S3C2410_GPG7,
125 .desc = "Thumbwheel Press",
129 .gpio = S3C2410_GPF7,
130 .code = KEY_HOMEPAGE,
135 .gpio = S3C2410_GPF6,
136 .code = KEY_CALENDAR,
141 .gpio = S3C2410_GPF5,
142 .code = KEY_ADDRESSBOOK,
147 .gpio = S3C2410_GPF4,
154 static struct gpio_keys_platform_data n30_button_data = {
155 .buttons = n30_buttons,
156 .nbuttons = ARRAY_SIZE(n30_buttons),
159 static struct platform_device n30_button_device = {
163 .platform_data = &n30_button_data,
167 static struct platform_device *n30_devices[] __initdata = {
173 &s3c_device_usbgadget,
177 static struct s3c2410_platform_i2c n30_i2ccfg = {
184 static void __init n30_map_io(void)
186 s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc));
187 s3c24xx_init_clocks(0);
188 s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
191 static void __init n30_init_irq(void)
196 /* GPB3 is the line that controls the pull-up for the USB D+ line */
198 static void __init n30_init(void)
200 s3c_device_i2c.dev.platform_data = &n30_i2ccfg;
201 s3c24xx_udc_set_platdata(&n30_udc_cfg);
203 /* Turn off suspend on both USB ports, and switch the
204 * selectable USB port to USB device mode. */
206 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
207 S3C2410_MISCCR_USBSUSPND0 |
208 S3C2410_MISCCR_USBSUSPND1, 0x0);
210 platform_add_devices(n30_devices, ARRAY_SIZE(n30_devices));
213 MACHINE_START(N30, "Acer-N30")
214 /* Maintainer: Christer Weinigel <christer@weinigel.se>,
215 Ben Dooks <ben-linux@fluff.org>
217 .phys_io = S3C2410_PA_UART,
218 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
219 .boot_params = S3C2410_SDRAM_PA + 0x100,
220 .timer = &s3c24xx_timer,
221 .init_machine = n30_init,
222 .init_irq = n30_init_irq,
223 .map_io = n30_map_io,