ARM: S5PV210: Add keypad device to the SMDKV210 board
[linux-2.6/cjktty.git] / arch / arm / mach-s5pv210 / mach-smdkv210.c
blob485ea339dbc4c871324a6168da930066e3cf64fa
1 /* linux/arch/arm/mach-s5pv210/mach-smdkv210.c
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
11 #include <linux/kernel.h>
12 #include <linux/types.h>
13 #include <linux/init.h>
14 #include <linux/serial_core.h>
16 #include <asm/mach/arch.h>
17 #include <asm/mach/map.h>
18 #include <asm/setup.h>
19 #include <asm/mach-types.h>
21 #include <mach/map.h>
22 #include <mach/regs-clock.h>
24 #include <plat/regs-serial.h>
25 #include <plat/s5pv210.h>
26 #include <plat/devs.h>
27 #include <plat/cpu.h>
28 #include <plat/adc.h>
29 #include <plat/ts.h>
30 #include <plat/ata.h>
31 #include <plat/keypad.h>
33 /* Following are default values for UCON, ULCON and UFCON UART registers */
34 #define S5PV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
35 S3C2410_UCON_RXILEVEL | \
36 S3C2410_UCON_TXIRQMODE | \
37 S3C2410_UCON_RXIRQMODE | \
38 S3C2410_UCON_RXFIFO_TOI | \
39 S3C2443_UCON_RXERR_IRQEN)
41 #define S5PV210_ULCON_DEFAULT S3C2410_LCON_CS8
43 #define S5PV210_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
44 S5PV210_UFCON_TXTRIG4 | \
45 S5PV210_UFCON_RXTRIG4)
47 static struct s3c2410_uartcfg smdkv210_uartcfgs[] __initdata = {
48 [0] = {
49 .hwport = 0,
50 .flags = 0,
51 .ucon = S5PV210_UCON_DEFAULT,
52 .ulcon = S5PV210_ULCON_DEFAULT,
53 .ufcon = S5PV210_UFCON_DEFAULT,
55 [1] = {
56 .hwport = 1,
57 .flags = 0,
58 .ucon = S5PV210_UCON_DEFAULT,
59 .ulcon = S5PV210_ULCON_DEFAULT,
60 .ufcon = S5PV210_UFCON_DEFAULT,
62 [2] = {
63 .hwport = 2,
64 .flags = 0,
65 .ucon = S5PV210_UCON_DEFAULT,
66 .ulcon = S5PV210_ULCON_DEFAULT,
67 .ufcon = S5PV210_UFCON_DEFAULT,
69 [3] = {
70 .hwport = 3,
71 .flags = 0,
72 .ucon = S5PV210_UCON_DEFAULT,
73 .ulcon = S5PV210_ULCON_DEFAULT,
74 .ufcon = S5PV210_UFCON_DEFAULT,
78 static struct s3c_ide_platdata smdkv210_ide_pdata __initdata = {
79 .setup_gpio = s5pv210_ide_setup_gpio,
82 static uint32_t smdkv210_keymap[] __initdata = {
83 /* KEY(row, col, keycode) */
84 KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
85 KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
86 KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
87 KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
90 static struct matrix_keymap_data smdkv210_keymap_data __initdata = {
91 .keymap = smdkv210_keymap,
92 .keymap_size = ARRAY_SIZE(smdkv210_keymap),
95 static struct samsung_keypad_platdata smdkv210_keypad_data __initdata = {
96 .keymap_data = &smdkv210_keymap_data,
97 .rows = 8,
98 .cols = 8,
101 static struct platform_device *smdkv210_devices[] __initdata = {
102 &s5pv210_device_iis0,
103 &s5pv210_device_ac97,
104 &s3c_device_adc,
105 &s3c_device_cfcon,
106 &samsung_device_keypad,
107 &s3c_device_ts,
108 &s3c_device_wdt,
111 static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
112 .delay = 10000,
113 .presc = 49,
114 .oversampling_shift = 2,
117 static void __init smdkv210_map_io(void)
119 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
120 s3c24xx_init_clocks(24000000);
121 s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
124 static void __init smdkv210_machine_init(void)
126 samsung_keypad_set_platdata(&smdkv210_keypad_data);
127 s3c24xx_ts_set_platdata(&s3c_ts_platform);
128 s3c_ide_set_platdata(&smdkv210_ide_pdata);
130 platform_add_devices(smdkv210_devices, ARRAY_SIZE(smdkv210_devices));
133 MACHINE_START(SMDKV210, "SMDKV210")
134 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
135 .phys_io = S3C_PA_UART & 0xfff00000,
136 .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
137 .boot_params = S5P_PA_SDRAM + 0x100,
138 .init_irq = s5pv210_init_irq,
139 .map_io = smdkv210_map_io,
140 .init_machine = smdkv210_machine_init,
141 .timer = &s3c24xx_timer,
142 MACHINE_END