Merge branch 'for-2.6.37/barrier' of git://git.kernel.dk/linux-2.6-block
[pandora-kernel.git] / arch / arm / mach-s5pv210 / mach-smdkv210.c
1 /* linux/arch/arm/mach-s5pv210/mach-smdkv210.c
2  *
3  * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4  *              http://www.samsung.com/
5  *
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 */
10
11 #include <linux/kernel.h>
12 #include <linux/types.h>
13 #include <linux/i2c.h>
14 #include <linux/init.h>
15 #include <linux/serial_core.h>
16
17 #include <asm/mach/arch.h>
18 #include <asm/mach/map.h>
19 #include <asm/setup.h>
20 #include <asm/mach-types.h>
21
22 #include <mach/map.h>
23 #include <mach/regs-clock.h>
24
25 #include <plat/regs-serial.h>
26 #include <plat/s5pv210.h>
27 #include <plat/devs.h>
28 #include <plat/cpu.h>
29 #include <plat/adc.h>
30 #include <plat/ts.h>
31 #include <plat/ata.h>
32 #include <plat/iic.h>
33 #include <plat/keypad.h>
34
35 /* Following are default values for UCON, ULCON and UFCON UART registers */
36 #define SMDKV210_UCON_DEFAULT   (S3C2410_UCON_TXILEVEL |        \
37                                  S3C2410_UCON_RXILEVEL |        \
38                                  S3C2410_UCON_TXIRQMODE |       \
39                                  S3C2410_UCON_RXIRQMODE |       \
40                                  S3C2410_UCON_RXFIFO_TOI |      \
41                                  S3C2443_UCON_RXERR_IRQEN)
42
43 #define SMDKV210_ULCON_DEFAULT  S3C2410_LCON_CS8
44
45 #define SMDKV210_UFCON_DEFAULT  (S3C2410_UFCON_FIFOMODE |       \
46                                  S5PV210_UFCON_TXTRIG4 |        \
47                                  S5PV210_UFCON_RXTRIG4)
48
49 static struct s3c2410_uartcfg smdkv210_uartcfgs[] __initdata = {
50         [0] = {
51                 .hwport         = 0,
52                 .flags          = 0,
53                 .ucon           = SMDKV210_UCON_DEFAULT,
54                 .ulcon          = SMDKV210_ULCON_DEFAULT,
55                 .ufcon          = SMDKV210_UFCON_DEFAULT,
56         },
57         [1] = {
58                 .hwport         = 1,
59                 .flags          = 0,
60                 .ucon           = SMDKV210_UCON_DEFAULT,
61                 .ulcon          = SMDKV210_ULCON_DEFAULT,
62                 .ufcon          = SMDKV210_UFCON_DEFAULT,
63         },
64         [2] = {
65                 .hwport         = 2,
66                 .flags          = 0,
67                 .ucon           = SMDKV210_UCON_DEFAULT,
68                 .ulcon          = SMDKV210_ULCON_DEFAULT,
69                 .ufcon          = SMDKV210_UFCON_DEFAULT,
70         },
71         [3] = {
72                 .hwport         = 3,
73                 .flags          = 0,
74                 .ucon           = SMDKV210_UCON_DEFAULT,
75                 .ulcon          = SMDKV210_ULCON_DEFAULT,
76                 .ufcon          = SMDKV210_UFCON_DEFAULT,
77         },
78 };
79
80 static struct s3c_ide_platdata smdkv210_ide_pdata __initdata = {
81         .setup_gpio     = s5pv210_ide_setup_gpio,
82 };
83
84 static uint32_t smdkv210_keymap[] __initdata = {
85         /* KEY(row, col, keycode) */
86         KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
87         KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
88         KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
89         KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
90 };
91
92 static struct matrix_keymap_data smdkv210_keymap_data __initdata = {
93         .keymap         = smdkv210_keymap,
94         .keymap_size    = ARRAY_SIZE(smdkv210_keymap),
95 };
96
97 static struct samsung_keypad_platdata smdkv210_keypad_data __initdata = {
98         .keymap_data    = &smdkv210_keymap_data,
99         .rows           = 8,
100         .cols           = 8,
101 };
102
103 static struct platform_device *smdkv210_devices[] __initdata = {
104         &s5pv210_device_iis0,
105         &s5pv210_device_ac97,
106         &s3c_device_adc,
107         &s3c_device_cfcon,
108         &s3c_device_hsmmc0,
109         &s3c_device_hsmmc1,
110         &s3c_device_hsmmc2,
111         &s3c_device_hsmmc3,
112         &s3c_device_i2c0,
113         &s3c_device_i2c1,
114         &s3c_device_i2c2,
115         &samsung_device_keypad,
116         &s3c_device_rtc,
117         &s3c_device_ts,
118         &s3c_device_wdt,
119 };
120
121 static struct i2c_board_info smdkv210_i2c_devs0[] __initdata = {
122         { I2C_BOARD_INFO("24c08", 0x50), },     /* Samsung S524AD0XD1 */
123 };
124
125 static struct i2c_board_info smdkv210_i2c_devs1[] __initdata = {
126         /* To Be Updated */
127 };
128
129 static struct i2c_board_info smdkv210_i2c_devs2[] __initdata = {
130         /* To Be Updated */
131 };
132
133 static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
134         .delay                  = 10000,
135         .presc                  = 49,
136         .oversampling_shift     = 2,
137 };
138
139 static void __init smdkv210_map_io(void)
140 {
141         s5p_init_io(NULL, 0, S5P_VA_CHIPID);
142         s3c24xx_init_clocks(24000000);
143         s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
144 }
145
146 static void __init smdkv210_machine_init(void)
147 {
148         samsung_keypad_set_platdata(&smdkv210_keypad_data);
149         s3c24xx_ts_set_platdata(&s3c_ts_platform);
150
151         s3c_i2c0_set_platdata(NULL);
152         s3c_i2c1_set_platdata(NULL);
153         s3c_i2c2_set_platdata(NULL);
154         i2c_register_board_info(0, smdkv210_i2c_devs0,
155                         ARRAY_SIZE(smdkv210_i2c_devs0));
156         i2c_register_board_info(1, smdkv210_i2c_devs1,
157                         ARRAY_SIZE(smdkv210_i2c_devs1));
158         i2c_register_board_info(2, smdkv210_i2c_devs2,
159                         ARRAY_SIZE(smdkv210_i2c_devs2));
160
161         s3c_ide_set_platdata(&smdkv210_ide_pdata);
162
163         platform_add_devices(smdkv210_devices, ARRAY_SIZE(smdkv210_devices));
164 }
165
166 MACHINE_START(SMDKV210, "SMDKV210")
167         /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
168         .boot_params    = S5P_PA_SDRAM + 0x100,
169         .init_irq       = s5pv210_init_irq,
170         .map_io         = smdkv210_map_io,
171         .init_machine   = smdkv210_machine_init,
172         .timer          = &s3c24xx_timer,
173 MACHINE_END