2008-07-08 01:12:45 +08:00
|
|
|
/* Machine specific code for the Acer n30, Acer N35, Navman PiN 570,
|
|
|
|
* Yakumo AlphaX and Airis NC05 PDAs.
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* Copyright (c) 2003-2005 Simtec Electronics
|
|
|
|
* Ben Dooks <ben@simtec.co.uk>
|
|
|
|
*
|
2008-07-08 01:12:41 +08:00
|
|
|
* Copyright (c) 2005-2008 Christer Weinigel <christer@weinigel.se>
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* There is a wiki with more information about the n30 port at
|
|
|
|
* http://handhelds.org/moin/moin.cgi/AcerN30Documentation .
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
2008-07-08 01:12:45 +08:00
|
|
|
*/
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/types.h>
|
2008-07-08 01:12:41 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/delay.h>
|
2008-07-08 01:12:43 +08:00
|
|
|
#include <linux/gpio_keys.h>
|
2008-07-08 01:12:41 +08:00
|
|
|
#include <linux/init.h>
|
2008-07-08 01:12:43 +08:00
|
|
|
#include <linux/input.h>
|
2008-07-08 01:12:41 +08:00
|
|
|
#include <linux/interrupt.h>
|
2005-10-30 02:07:23 +08:00
|
|
|
#include <linux/platform_device.h>
|
2008-07-08 01:12:41 +08:00
|
|
|
#include <linux/serial_core.h>
|
|
|
|
#include <linux/timer.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#include <asm/hardware.h>
|
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/irq.h>
|
|
|
|
#include <asm/mach-types.h>
|
|
|
|
|
2008-07-08 01:12:46 +08:00
|
|
|
#include <asm/arch/fb.h>
|
2008-07-08 01:12:44 +08:00
|
|
|
#include <asm/arch/leds-gpio.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/arch/regs-gpio.h>
|
2008-07-08 01:12:46 +08:00
|
|
|
#include <asm/arch/regs-lcd.h>
|
2008-07-08 01:12:41 +08:00
|
|
|
|
|
|
|
#include <asm/mach/arch.h>
|
|
|
|
#include <asm/mach/irq.h>
|
|
|
|
#include <asm/mach/map.h>
|
|
|
|
|
2007-07-22 23:05:25 +08:00
|
|
|
#include <asm/plat-s3c/iic.h>
|
2008-07-08 01:12:41 +08:00
|
|
|
#include <asm/plat-s3c/regs-serial.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2007-02-12 01:31:01 +08:00
|
|
|
#include <asm/plat-s3c24xx/clock.h>
|
|
|
|
#include <asm/plat-s3c24xx/cpu.h>
|
2008-07-08 01:12:41 +08:00
|
|
|
#include <asm/plat-s3c24xx/devs.h>
|
|
|
|
#include <asm/plat-s3c24xx/s3c2410.h>
|
2008-07-08 01:12:42 +08:00
|
|
|
#include <asm/plat-s3c24xx/udc.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
static struct map_desc n30_iodesc[] __initdata = {
|
|
|
|
/* nothing here yet */
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct s3c2410_uartcfg n30_uartcfgs[] = {
|
|
|
|
/* Normal serial port */
|
|
|
|
[0] = {
|
|
|
|
.hwport = 0,
|
|
|
|
.flags = 0,
|
|
|
|
.ucon = 0x2c5,
|
|
|
|
.ulcon = 0x03,
|
|
|
|
.ufcon = 0x51,
|
|
|
|
},
|
|
|
|
/* IR port */
|
|
|
|
[1] = {
|
|
|
|
.hwport = 1,
|
|
|
|
.flags = 0,
|
|
|
|
.uart_flags = UPF_CONS_FLOW,
|
|
|
|
.ucon = 0x2c5,
|
|
|
|
.ulcon = 0x43,
|
|
|
|
.ufcon = 0x51,
|
|
|
|
},
|
2008-07-08 01:12:45 +08:00
|
|
|
/* On the N30 the bluetooth controller is connected here.
|
|
|
|
* On the N35 and variants the GPS receiver is connected here. */
|
2005-04-17 06:20:36 +08:00
|
|
|
[2] = {
|
|
|
|
.hwport = 2,
|
|
|
|
.flags = 0,
|
|
|
|
.ucon = 0x2c5,
|
|
|
|
.ulcon = 0x03,
|
|
|
|
.ufcon = 0x51,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2008-07-08 01:12:42 +08:00
|
|
|
static void n30_udc_pullup(enum s3c2410_udc_cmd_e cmd)
|
|
|
|
{
|
|
|
|
switch (cmd)
|
|
|
|
{
|
|
|
|
case S3C2410_UDC_P_ENABLE :
|
|
|
|
s3c2410_gpio_setpin(S3C2410_GPB3, 1);
|
|
|
|
break;
|
|
|
|
case S3C2410_UDC_P_DISABLE :
|
|
|
|
s3c2410_gpio_setpin(S3C2410_GPB3, 0);
|
|
|
|
break;
|
|
|
|
case S3C2410_UDC_P_RESET :
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct s3c2410_udc_mach_info n30_udc_cfg __initdata = {
|
|
|
|
.udc_command = n30_udc_pullup,
|
|
|
|
.vbus_pin = S3C2410_GPG1,
|
|
|
|
.vbus_pin_inverted = 0,
|
|
|
|
};
|
|
|
|
|
2008-07-08 01:12:43 +08:00
|
|
|
static struct gpio_keys_button n30_buttons[] = {
|
|
|
|
{
|
|
|
|
.gpio = S3C2410_GPF0,
|
|
|
|
.code = KEY_POWER,
|
|
|
|
.desc = "Power",
|
|
|
|
.active_low = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.gpio = S3C2410_GPG9,
|
|
|
|
.code = KEY_UP,
|
|
|
|
.desc = "Thumbwheel Up",
|
|
|
|
.active_low = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.gpio = S3C2410_GPG8,
|
|
|
|
.code = KEY_DOWN,
|
|
|
|
.desc = "Thumbwheel Down",
|
|
|
|
.active_low = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.gpio = S3C2410_GPG7,
|
|
|
|
.code = KEY_ENTER,
|
|
|
|
.desc = "Thumbwheel Press",
|
|
|
|
.active_low = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.gpio = S3C2410_GPF7,
|
|
|
|
.code = KEY_HOMEPAGE,
|
|
|
|
.desc = "Home",
|
|
|
|
.active_low = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.gpio = S3C2410_GPF6,
|
|
|
|
.code = KEY_CALENDAR,
|
|
|
|
.desc = "Calendar",
|
|
|
|
.active_low = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.gpio = S3C2410_GPF5,
|
|
|
|
.code = KEY_ADDRESSBOOK,
|
|
|
|
.desc = "Contacts",
|
|
|
|
.active_low = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.gpio = S3C2410_GPF4,
|
|
|
|
.code = KEY_MAIL,
|
|
|
|
.desc = "Mail",
|
|
|
|
.active_low = 0,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct gpio_keys_platform_data n30_button_data = {
|
|
|
|
.buttons = n30_buttons,
|
|
|
|
.nbuttons = ARRAY_SIZE(n30_buttons),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device n30_button_device = {
|
|
|
|
.name = "gpio-keys",
|
|
|
|
.id = -1,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &n30_button_data,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-07-08 01:12:45 +08:00
|
|
|
static struct gpio_keys_button n35_buttons[] = {
|
|
|
|
{
|
|
|
|
.gpio = S3C2410_GPF0,
|
|
|
|
.code = KEY_POWER,
|
|
|
|
.desc = "Power",
|
|
|
|
.active_low = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.gpio = S3C2410_GPG9,
|
|
|
|
.code = KEY_UP,
|
|
|
|
.desc = "Joystick Up",
|
|
|
|
.active_low = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.gpio = S3C2410_GPG8,
|
|
|
|
.code = KEY_DOWN,
|
|
|
|
.desc = "Joystick Down",
|
|
|
|
.active_low = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.gpio = S3C2410_GPG6,
|
|
|
|
.code = KEY_DOWN,
|
|
|
|
.desc = "Joystick Left",
|
|
|
|
.active_low = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.gpio = S3C2410_GPG5,
|
|
|
|
.code = KEY_DOWN,
|
|
|
|
.desc = "Joystick Right",
|
|
|
|
.active_low = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.gpio = S3C2410_GPG7,
|
|
|
|
.code = KEY_ENTER,
|
|
|
|
.desc = "Joystick Press",
|
|
|
|
.active_low = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.gpio = S3C2410_GPF7,
|
|
|
|
.code = KEY_HOMEPAGE,
|
|
|
|
.desc = "Home",
|
|
|
|
.active_low = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.gpio = S3C2410_GPF6,
|
|
|
|
.code = KEY_CALENDAR,
|
|
|
|
.desc = "Calendar",
|
|
|
|
.active_low = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.gpio = S3C2410_GPF5,
|
|
|
|
.code = KEY_ADDRESSBOOK,
|
|
|
|
.desc = "Contacts",
|
|
|
|
.active_low = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.gpio = S3C2410_GPF4,
|
|
|
|
.code = KEY_MAIL,
|
|
|
|
.desc = "Mail",
|
|
|
|
.active_low = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.gpio = S3C2410_GPF3,
|
|
|
|
.code = SW_RADIO,
|
|
|
|
.desc = "GPS Antenna",
|
|
|
|
.active_low = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.gpio = S3C2410_GPG2,
|
|
|
|
.code = SW_HEADPHONE_INSERT,
|
|
|
|
.desc = "Headphone",
|
|
|
|
.active_low = 0,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct gpio_keys_platform_data n35_button_data = {
|
|
|
|
.buttons = n35_buttons,
|
|
|
|
.nbuttons = ARRAY_SIZE(n35_buttons),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device n35_button_device = {
|
|
|
|
.name = "gpio-keys",
|
|
|
|
.id = -1,
|
|
|
|
.num_resources = 0,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &n35_button_data,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-07-08 01:12:44 +08:00
|
|
|
/* This is the bluetooth LED on the device. */
|
|
|
|
static struct s3c24xx_led_platdata n30_blue_led_pdata = {
|
|
|
|
.name = "blue_led",
|
|
|
|
.gpio = S3C2410_GPG6,
|
|
|
|
.def_trigger = "",
|
|
|
|
};
|
|
|
|
|
|
|
|
/* This LED is driven by the battery microcontroller, and is blinking
|
|
|
|
* red, blinking green or solid green when the battery is low,
|
|
|
|
* charging or full respectively. By driving GPD9 low, it's possible
|
|
|
|
* to force the LED to blink red, so call that warning LED. */
|
|
|
|
static struct s3c24xx_led_platdata n30_warning_led_pdata = {
|
|
|
|
.name = "warning_led",
|
|
|
|
.flags = S3C24XX_LEDF_ACTLOW,
|
|
|
|
.gpio = S3C2410_GPD9,
|
|
|
|
.def_trigger = "",
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device n30_blue_led = {
|
|
|
|
.name = "s3c24xx_led",
|
|
|
|
.id = 1,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &n30_blue_led_pdata,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device n30_warning_led = {
|
|
|
|
.name = "s3c24xx_led",
|
|
|
|
.id = 2,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &n30_warning_led_pdata,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2008-07-08 01:12:46 +08:00
|
|
|
static struct s3c2410fb_display n30_display __initdata = {
|
|
|
|
.type = S3C2410_LCDCON1_TFT,
|
|
|
|
.width = 240,
|
|
|
|
.height = 320,
|
|
|
|
.pixclock = 170000,
|
|
|
|
.xres = 240,
|
|
|
|
.yres = 320,
|
|
|
|
.bpp = 16,
|
|
|
|
.left_margin = 3,
|
|
|
|
.right_margin = 40,
|
|
|
|
.hsync_len = 40,
|
|
|
|
.upper_margin = 2,
|
|
|
|
.lower_margin = 3,
|
|
|
|
.vsync_len = 2,
|
|
|
|
|
|
|
|
.lcdcon5 = S3C2410_LCDCON5_INVVLINE | S3C2410_LCDCON5_INVVFRAME,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct s3c2410fb_mach_info n30_fb_info __initdata = {
|
|
|
|
.displays = &n30_display,
|
|
|
|
.num_displays = 1,
|
|
|
|
.default_display = 0,
|
|
|
|
.lpcsel= 0x06,
|
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
static struct platform_device *n30_devices[] __initdata = {
|
|
|
|
&s3c_device_lcd,
|
|
|
|
&s3c_device_wdt,
|
|
|
|
&s3c_device_i2c,
|
|
|
|
&s3c_device_iis,
|
2008-07-08 01:12:41 +08:00
|
|
|
&s3c_device_usb,
|
2005-04-17 06:20:36 +08:00
|
|
|
&s3c_device_usbgadget,
|
2008-07-08 01:12:43 +08:00
|
|
|
&n30_button_device,
|
2008-07-08 01:12:44 +08:00
|
|
|
&n30_blue_led,
|
|
|
|
&n30_warning_led,
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2008-07-08 01:12:45 +08:00
|
|
|
static struct platform_device *n35_devices[] __initdata = {
|
|
|
|
&s3c_device_lcd,
|
|
|
|
&s3c_device_wdt,
|
|
|
|
&s3c_device_i2c,
|
|
|
|
&s3c_device_iis,
|
|
|
|
&s3c_device_usbgadget,
|
|
|
|
&n35_button_device,
|
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
static struct s3c2410_platform_i2c n30_i2ccfg = {
|
|
|
|
.flags = 0,
|
|
|
|
.slave_addr = 0x10,
|
|
|
|
.bus_freq = 10*1000,
|
|
|
|
.max_freq = 10*1000,
|
|
|
|
};
|
|
|
|
|
2005-09-21 00:24:33 +08:00
|
|
|
static void __init n30_map_io(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc));
|
|
|
|
s3c24xx_init_clocks(0);
|
|
|
|
s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
|
|
|
|
}
|
|
|
|
|
2005-09-21 00:24:33 +08:00
|
|
|
static void __init n30_init_irq(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
s3c24xx_init_irq();
|
|
|
|
}
|
|
|
|
|
2005-09-06 03:47:53 +08:00
|
|
|
/* GPB3 is the line that controls the pull-up for the USB D+ line */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-09-21 00:24:33 +08:00
|
|
|
static void __init n30_init(void)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2008-07-08 01:12:46 +08:00
|
|
|
s3c24xx_fb_set_platdata(&n30_fb_info);
|
2005-04-17 06:20:36 +08:00
|
|
|
s3c_device_i2c.dev.platform_data = &n30_i2ccfg;
|
2008-07-08 01:12:42 +08:00
|
|
|
s3c24xx_udc_set_platdata(&n30_udc_cfg);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-09-06 03:47:53 +08:00
|
|
|
/* Turn off suspend on both USB ports, and switch the
|
|
|
|
* selectable USB port to USB device mode. */
|
|
|
|
|
|
|
|
s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
|
|
|
|
S3C2410_MISCCR_USBSUSPND0 |
|
|
|
|
S3C2410_MISCCR_USBSUSPND1, 0x0);
|
2007-04-20 18:19:16 +08:00
|
|
|
|
2008-07-08 01:12:45 +08:00
|
|
|
if (machine_is_n30()) {
|
|
|
|
/* Turn off suspend on both USB ports, and switch the
|
|
|
|
* selectable USB port to USB device mode. */
|
|
|
|
s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
|
|
|
|
S3C2410_MISCCR_USBSUSPND0 |
|
|
|
|
S3C2410_MISCCR_USBSUSPND1, 0x0);
|
|
|
|
|
|
|
|
platform_add_devices(n30_devices, ARRAY_SIZE(n30_devices));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (machine_is_n35()) {
|
|
|
|
/* Turn off suspend and switch the selectable USB port
|
|
|
|
* to USB device mode. Turn on suspend for the host
|
|
|
|
* port since it is not connected on the N35.
|
|
|
|
*
|
|
|
|
* Actually, the host port is available at some pads
|
|
|
|
* on the back of the device, so it would actually be
|
|
|
|
* possible to add a USB device inside the N35 if you
|
|
|
|
* are willing to do some hardware modifications. */
|
|
|
|
s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
|
|
|
|
S3C2410_MISCCR_USBSUSPND0 |
|
|
|
|
S3C2410_MISCCR_USBSUSPND1,
|
|
|
|
S3C2410_MISCCR_USBSUSPND1);
|
|
|
|
|
|
|
|
platform_add_devices(n35_devices, ARRAY_SIZE(n35_devices));
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
MACHINE_START(N30, "Acer-N30")
|
2005-09-06 03:47:53 +08:00
|
|
|
/* Maintainer: Christer Weinigel <christer@weinigel.se>,
|
|
|
|
Ben Dooks <ben-linux@fluff.org>
|
|
|
|
*/
|
2005-07-04 00:38:58 +08:00
|
|
|
.phys_io = S3C2410_PA_UART,
|
|
|
|
.io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
|
|
|
|
.boot_params = S3C2410_SDRAM_PA + 0x100,
|
2005-04-17 06:20:36 +08:00
|
|
|
.timer = &s3c24xx_timer,
|
|
|
|
.init_machine = n30_init,
|
|
|
|
.init_irq = n30_init_irq,
|
|
|
|
.map_io = n30_map_io,
|
|
|
|
MACHINE_END
|
2008-07-08 01:12:45 +08:00
|
|
|
|
|
|
|
MACHINE_START(N35, "Acer-N35")
|
|
|
|
/* Maintainer: Christer Weinigel <christer@weinigel.se>
|
|
|
|
*/
|
|
|
|
.phys_io = S3C2410_PA_UART,
|
|
|
|
.io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
|
|
|
|
.boot_params = S3C2410_SDRAM_PA + 0x100,
|
|
|
|
.timer = &s3c24xx_timer,
|
|
|
|
.init_machine = n30_init,
|
|
|
|
.init_irq = n30_init_irq,
|
|
|
|
.map_io = n30_map_io,
|
|
|
|
MACHINE_END
|