1 /* Machine specific code for the Acer n30, Acer N35, Navman PiN 570,
2 * Yakumo AlphaX and Airis NC05 PDAs.
4 * Copyright (c) 2003-2005 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
7 * Copyright (c) 2005-2008 Christer Weinigel <christer@weinigel.se>
9 * There is a wiki with more information about the n30 port at
10 * http://handhelds.org/moin/moin.cgi/AcerN30Documentation .
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
17 #include <linux/kernel.h>
18 #include <linux/types.h>
20 #include <linux/delay.h>
21 #include <linux/gpio_keys.h>
22 #include <linux/init.h>
23 #include <linux/input.h>
24 #include <linux/interrupt.h>
25 #include <linux/platform_device.h>
26 #include <linux/serial_core.h>
27 #include <linux/timer.h>
29 #include <asm/hardware.h>
32 #include <asm/mach-types.h>
34 #include <asm/arch/fb.h>
35 #include <asm/arch/leds-gpio.h>
36 #include <asm/arch/regs-gpio.h>
37 #include <asm/arch/regs-lcd.h>
39 #include <asm/mach/arch.h>
40 #include <asm/mach/irq.h>
41 #include <asm/mach/map.h>
43 #include <asm/plat-s3c/iic.h>
44 #include <asm/plat-s3c/regs-serial.h>
46 #include <asm/plat-s3c24xx/clock.h>
47 #include <asm/plat-s3c24xx/cpu.h>
48 #include <asm/plat-s3c24xx/devs.h>
49 #include <asm/plat-s3c24xx/s3c2410.h>
50 #include <asm/plat-s3c24xx/udc.h>
52 static struct map_desc n30_iodesc[] __initdata = {
53 /* nothing here yet */
56 static struct s3c2410_uartcfg n30_uartcfgs[] = {
57 /* Normal serial port */
69 .uart_flags = UPF_CONS_FLOW,
74 /* On the N30 the bluetooth controller is connected here.
75 * On the N35 and variants the GPS receiver is connected here. */
85 static void n30_udc_pullup(enum s3c2410_udc_cmd_e cmd)
89 case S3C2410_UDC_P_ENABLE :
90 s3c2410_gpio_setpin(S3C2410_GPB3, 1);
92 case S3C2410_UDC_P_DISABLE :
93 s3c2410_gpio_setpin(S3C2410_GPB3, 0);
95 case S3C2410_UDC_P_RESET :
102 static struct s3c2410_udc_mach_info n30_udc_cfg __initdata = {
103 .udc_command = n30_udc_pullup,
104 .vbus_pin = S3C2410_GPG1,
105 .vbus_pin_inverted = 0,
108 static struct gpio_keys_button n30_buttons[] = {
110 .gpio = S3C2410_GPF0,
116 .gpio = S3C2410_GPG9,
118 .desc = "Thumbwheel Up",
122 .gpio = S3C2410_GPG8,
124 .desc = "Thumbwheel Down",
128 .gpio = S3C2410_GPG7,
130 .desc = "Thumbwheel Press",
134 .gpio = S3C2410_GPF7,
135 .code = KEY_HOMEPAGE,
140 .gpio = S3C2410_GPF6,
141 .code = KEY_CALENDAR,
146 .gpio = S3C2410_GPF5,
147 .code = KEY_ADDRESSBOOK,
152 .gpio = S3C2410_GPF4,
159 static struct gpio_keys_platform_data n30_button_data = {
160 .buttons = n30_buttons,
161 .nbuttons = ARRAY_SIZE(n30_buttons),
164 static struct platform_device n30_button_device = {
168 .platform_data = &n30_button_data,
172 static struct gpio_keys_button n35_buttons[] = {
174 .gpio = S3C2410_GPF0,
180 .gpio = S3C2410_GPG9,
182 .desc = "Joystick Up",
186 .gpio = S3C2410_GPG8,
188 .desc = "Joystick Down",
192 .gpio = S3C2410_GPG6,
194 .desc = "Joystick Left",
198 .gpio = S3C2410_GPG5,
200 .desc = "Joystick Right",
204 .gpio = S3C2410_GPG7,
206 .desc = "Joystick Press",
210 .gpio = S3C2410_GPF7,
211 .code = KEY_HOMEPAGE,
216 .gpio = S3C2410_GPF6,
217 .code = KEY_CALENDAR,
222 .gpio = S3C2410_GPF5,
223 .code = KEY_ADDRESSBOOK,
228 .gpio = S3C2410_GPF4,
234 .gpio = S3C2410_GPF3,
236 .desc = "GPS Antenna",
240 .gpio = S3C2410_GPG2,
241 .code = SW_HEADPHONE_INSERT,
247 static struct gpio_keys_platform_data n35_button_data = {
248 .buttons = n35_buttons,
249 .nbuttons = ARRAY_SIZE(n35_buttons),
252 static struct platform_device n35_button_device = {
257 .platform_data = &n35_button_data,
261 /* This is the bluetooth LED on the device. */
262 static struct s3c24xx_led_platdata n30_blue_led_pdata = {
264 .gpio = S3C2410_GPG6,
268 /* This LED is driven by the battery microcontroller, and is blinking
269 * red, blinking green or solid green when the battery is low,
270 * charging or full respectively. By driving GPD9 low, it's possible
271 * to force the LED to blink red, so call that warning LED. */
272 static struct s3c24xx_led_platdata n30_warning_led_pdata = {
273 .name = "warning_led",
274 .flags = S3C24XX_LEDF_ACTLOW,
275 .gpio = S3C2410_GPD9,
279 static struct platform_device n30_blue_led = {
280 .name = "s3c24xx_led",
283 .platform_data = &n30_blue_led_pdata,
287 static struct platform_device n30_warning_led = {
288 .name = "s3c24xx_led",
291 .platform_data = &n30_warning_led_pdata,
295 static struct s3c2410fb_display n30_display __initdata = {
296 .type = S3C2410_LCDCON1_TFT,
310 .lcdcon5 = S3C2410_LCDCON5_INVVLINE | S3C2410_LCDCON5_INVVFRAME,
313 static struct s3c2410fb_mach_info n30_fb_info __initdata = {
314 .displays = &n30_display,
316 .default_display = 0,
320 static struct platform_device *n30_devices[] __initdata = {
326 &s3c_device_usbgadget,
332 static struct platform_device *n35_devices[] __initdata = {
337 &s3c_device_usbgadget,
341 static struct s3c2410_platform_i2c n30_i2ccfg = {
348 static void __init n30_map_io(void)
350 s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc));
351 s3c24xx_init_clocks(0);
352 s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
355 static void __init n30_init_irq(void)
360 /* GPB3 is the line that controls the pull-up for the USB D+ line */
362 static void __init n30_init(void)
364 s3c24xx_fb_set_platdata(&n30_fb_info);
365 s3c_device_i2c.dev.platform_data = &n30_i2ccfg;
366 s3c24xx_udc_set_platdata(&n30_udc_cfg);
368 /* Turn off suspend on both USB ports, and switch the
369 * selectable USB port to USB device mode. */
371 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
372 S3C2410_MISCCR_USBSUSPND0 |
373 S3C2410_MISCCR_USBSUSPND1, 0x0);
375 if (machine_is_n30()) {
376 /* Turn off suspend on both USB ports, and switch the
377 * selectable USB port to USB device mode. */
378 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
379 S3C2410_MISCCR_USBSUSPND0 |
380 S3C2410_MISCCR_USBSUSPND1, 0x0);
382 platform_add_devices(n30_devices, ARRAY_SIZE(n30_devices));
385 if (machine_is_n35()) {
386 /* Turn off suspend and switch the selectable USB port
387 * to USB device mode. Turn on suspend for the host
388 * port since it is not connected on the N35.
390 * Actually, the host port is available at some pads
391 * on the back of the device, so it would actually be
392 * possible to add a USB device inside the N35 if you
393 * are willing to do some hardware modifications. */
394 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
395 S3C2410_MISCCR_USBSUSPND0 |
396 S3C2410_MISCCR_USBSUSPND1,
397 S3C2410_MISCCR_USBSUSPND1);
399 platform_add_devices(n35_devices, ARRAY_SIZE(n35_devices));
403 MACHINE_START(N30, "Acer-N30")
404 /* Maintainer: Christer Weinigel <christer@weinigel.se>,
405 Ben Dooks <ben-linux@fluff.org>
407 .phys_io = S3C2410_PA_UART,
408 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
409 .boot_params = S3C2410_SDRAM_PA + 0x100,
410 .timer = &s3c24xx_timer,
411 .init_machine = n30_init,
412 .init_irq = n30_init_irq,
413 .map_io = n30_map_io,
416 MACHINE_START(N35, "Acer-N35")
417 /* Maintainer: Christer Weinigel <christer@weinigel.se>
419 .phys_io = S3C2410_PA_UART,
420 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
421 .boot_params = S3C2410_SDRAM_PA + 0x100,
422 .timer = &s3c24xx_timer,
423 .init_machine = n30_init,
424 .init_irq = n30_init_irq,
425 .map_io = n30_map_io,