blob: e16984963e893d7aae6cc10b22245f2bb65d43e1 [file] [log] [blame]
Kyungmin Park516607d2010-08-06 19:59:21 +09001/* linux/arch/arm/mach-s5pv310/mach-universal_c210.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8*/
9
Kyungmin Park34d79312010-08-21 09:49:49 +090010#include <linux/platform_device.h>
Kyungmin Park516607d2010-08-06 19:59:21 +090011#include <linux/serial_core.h>
Kyungmin Park34d79312010-08-21 09:49:49 +090012#include <linux/input.h>
13#include <linux/gpio_keys.h>
14#include <linux/gpio.h>
Kyungmin Park516607d2010-08-06 19:59:21 +090015
16#include <asm/mach/arch.h>
17#include <asm/mach-types.h>
18#include <asm/hardware/cache-l2x0.h>
19
20#include <plat/regs-serial.h>
21#include <plat/s5pv310.h>
22#include <plat/cpu.h>
Kyungmin Parkacf5eda2010-10-08 22:34:52 +090023#include <plat/devs.h>
Kyungmin Park516607d2010-08-06 19:59:21 +090024
25#include <mach/map.h>
26
27/* Following are default values for UCON, ULCON and UFCON UART registers */
28#define UNIVERSAL_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
29 S3C2410_UCON_RXILEVEL | \
30 S3C2410_UCON_TXIRQMODE | \
31 S3C2410_UCON_RXIRQMODE | \
32 S3C2410_UCON_RXFIFO_TOI | \
33 S3C2443_UCON_RXERR_IRQEN)
34
35#define UNIVERSAL_ULCON_DEFAULT S3C2410_LCON_CS8
36
37#define UNIVERSAL_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
38 S5PV210_UFCON_TXTRIG256 | \
39 S5PV210_UFCON_RXTRIG256)
40
41static struct s3c2410_uartcfg universal_uartcfgs[] __initdata = {
42 [0] = {
43 .hwport = 0,
44 .ucon = UNIVERSAL_UCON_DEFAULT,
45 .ulcon = UNIVERSAL_ULCON_DEFAULT,
46 .ufcon = UNIVERSAL_UFCON_DEFAULT,
47 },
48 [1] = {
49 .hwport = 1,
50 .ucon = UNIVERSAL_UCON_DEFAULT,
51 .ulcon = UNIVERSAL_ULCON_DEFAULT,
52 .ufcon = UNIVERSAL_UFCON_DEFAULT,
53 },
54 [2] = {
55 .hwport = 2,
56 .ucon = UNIVERSAL_UCON_DEFAULT,
57 .ulcon = UNIVERSAL_ULCON_DEFAULT,
58 .ufcon = UNIVERSAL_UFCON_DEFAULT,
59 },
60 [3] = {
61 .hwport = 3,
62 .ucon = UNIVERSAL_UCON_DEFAULT,
63 .ulcon = UNIVERSAL_ULCON_DEFAULT,
64 .ufcon = UNIVERSAL_UFCON_DEFAULT,
65 },
66};
67
Kyungmin Park34d79312010-08-21 09:49:49 +090068static struct gpio_keys_button universal_gpio_keys_tables[] = {
69 {
70 .code = KEY_VOLUMEUP,
71 .gpio = S5PV310_GPX2(0), /* XEINT16 */
72 .desc = "gpio-keys: KEY_VOLUMEUP",
73 .type = EV_KEY,
74 .active_low = 1,
75 .debounce_interval = 1,
76 }, {
77 .code = KEY_VOLUMEDOWN,
78 .gpio = S5PV310_GPX2(1), /* XEINT17 */
79 .desc = "gpio-keys: KEY_VOLUMEDOWN",
80 .type = EV_KEY,
81 .active_low = 1,
82 .debounce_interval = 1,
83 }, {
84 .code = KEY_CONFIG,
85 .gpio = S5PV310_GPX2(2), /* XEINT18 */
86 .desc = "gpio-keys: KEY_CONFIG",
87 .type = EV_KEY,
88 .active_low = 1,
89 .debounce_interval = 1,
90 }, {
91 .code = KEY_CAMERA,
92 .gpio = S5PV310_GPX2(3), /* XEINT19 */
93 .desc = "gpio-keys: KEY_CAMERA",
94 .type = EV_KEY,
95 .active_low = 1,
96 .debounce_interval = 1,
97 }, {
98 .code = KEY_OK,
99 .gpio = S5PV310_GPX3(5), /* XEINT29 */
100 .desc = "gpio-keys: KEY_OK",
101 .type = EV_KEY,
102 .active_low = 1,
103 .debounce_interval = 1,
104 },
105};
106
107static struct gpio_keys_platform_data universal_gpio_keys_data = {
108 .buttons = universal_gpio_keys_tables,
109 .nbuttons = ARRAY_SIZE(universal_gpio_keys_tables),
110};
111
112static struct platform_device universal_gpio_keys = {
113 .name = "gpio-keys",
114 .dev = {
115 .platform_data = &universal_gpio_keys_data,
116 },
117};
118
119static struct platform_device *universal_devices[] __initdata = {
120 &universal_gpio_keys,
Kyungmin Parkacf5eda2010-10-08 22:34:52 +0900121 &s5p_device_onenand,
Kyungmin Park34d79312010-08-21 09:49:49 +0900122};
123
Kyungmin Park516607d2010-08-06 19:59:21 +0900124static void __init universal_map_io(void)
125{
126 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
127 s3c24xx_init_clocks(24000000);
128 s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
129}
130
131static void __init universal_machine_init(void)
132{
133#ifdef CONFIG_CACHE_L2X0
134 l2x0_init(S5P_VA_L2CC, 1 << 28, 0xffffffff);
135#endif
Kyungmin Park34d79312010-08-21 09:49:49 +0900136
137 /* Last */
138 platform_add_devices(universal_devices, ARRAY_SIZE(universal_devices));
Kyungmin Park516607d2010-08-06 19:59:21 +0900139}
140
141MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
142 /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
143 .phys_io = S3C_PA_UART & 0xfff00000,
144 .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
145 .boot_params = S5P_PA_SDRAM + 0x100,
146 .init_irq = s5pv310_init_irq,
147 .map_io = universal_map_io,
148 .init_machine = universal_machine_init,
149 .timer = &s5pv310_timer,
150MACHINE_END