blob: 2196c231cfd2d2bdceb445b60b24474a49c59f00 [file] [log] [blame]
Kukjin Kim98174412010-02-24 16:40:49 +09001/* 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>
Naveen Krishna Ch170d7412010-07-21 09:21:56 +053013#include <linux/i2c.h>
Kukjin Kim98174412010-02-24 16:40:49 +090014#include <linux/init.h>
15#include <linux/serial_core.h>
Abhilash Kesavan9adf2622010-10-08 09:07:19 +053016#include <linux/sysdev.h>
Thomas Abraham8f497202010-11-26 13:19:49 +090017#include <linux/fb.h>
18#include <linux/gpio.h>
19#include <linux/delay.h>
Kukjin Kim98174412010-02-24 16:40:49 +090020
21#include <asm/mach/arch.h>
22#include <asm/mach/map.h>
23#include <asm/setup.h>
24#include <asm/mach-types.h>
25
Thomas Abraham8f497202010-11-26 13:19:49 +090026#include <video/platform_lcd.h>
27
Kukjin Kim98174412010-02-24 16:40:49 +090028#include <mach/map.h>
29#include <mach/regs-clock.h>
Thomas Abraham8f497202010-11-26 13:19:49 +090030#include <mach/regs-fb.h>
Kukjin Kim98174412010-02-24 16:40:49 +090031
32#include <plat/regs-serial.h>
33#include <plat/s5pv210.h>
34#include <plat/devs.h>
35#include <plat/cpu.h>
Naveen Krishna Ch41d82892010-05-20 11:39:54 +090036#include <plat/adc.h>
37#include <plat/ts.h>
Abhilash Kesavan4b9a5ad2010-06-08 17:11:43 +090038#include <plat/ata.h>
Naveen Krishna Ch170d7412010-07-21 09:21:56 +053039#include <plat/iic.h>
Naveen Krishna Ch88a1cc42010-06-21 16:47:16 +090040#include <plat/keypad.h>
Jongpill Leeea31fd42010-10-02 19:13:42 +090041#include <plat/pm.h>
Thomas Abraham8f497202010-11-26 13:19:49 +090042#include <plat/fb.h>
Kukjin Kim98174412010-02-24 16:40:49 +090043
44/* Following are default values for UCON, ULCON and UFCON UART registers */
Kukjin Kimc8def082010-07-21 09:19:51 +090045#define SMDKV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
Kukjin Kim98174412010-02-24 16:40:49 +090046 S3C2410_UCON_RXILEVEL | \
47 S3C2410_UCON_TXIRQMODE | \
48 S3C2410_UCON_RXIRQMODE | \
49 S3C2410_UCON_RXFIFO_TOI | \
50 S3C2443_UCON_RXERR_IRQEN)
51
Kukjin Kimc8def082010-07-21 09:19:51 +090052#define SMDKV210_ULCON_DEFAULT S3C2410_LCON_CS8
Kukjin Kim98174412010-02-24 16:40:49 +090053
Kukjin Kimc8def082010-07-21 09:19:51 +090054#define SMDKV210_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
Kukjin Kim98174412010-02-24 16:40:49 +090055 S5PV210_UFCON_TXTRIG4 | \
56 S5PV210_UFCON_RXTRIG4)
57
58static struct s3c2410_uartcfg smdkv210_uartcfgs[] __initdata = {
59 [0] = {
60 .hwport = 0,
61 .flags = 0,
Kukjin Kimc8def082010-07-21 09:19:51 +090062 .ucon = SMDKV210_UCON_DEFAULT,
63 .ulcon = SMDKV210_ULCON_DEFAULT,
64 .ufcon = SMDKV210_UFCON_DEFAULT,
Kukjin Kim98174412010-02-24 16:40:49 +090065 },
66 [1] = {
67 .hwport = 1,
68 .flags = 0,
Kukjin Kimc8def082010-07-21 09:19:51 +090069 .ucon = SMDKV210_UCON_DEFAULT,
70 .ulcon = SMDKV210_ULCON_DEFAULT,
71 .ufcon = SMDKV210_UFCON_DEFAULT,
Kukjin Kim98174412010-02-24 16:40:49 +090072 },
73 [2] = {
74 .hwport = 2,
75 .flags = 0,
Kukjin Kimc8def082010-07-21 09:19:51 +090076 .ucon = SMDKV210_UCON_DEFAULT,
77 .ulcon = SMDKV210_ULCON_DEFAULT,
78 .ufcon = SMDKV210_UFCON_DEFAULT,
Kukjin Kim98174412010-02-24 16:40:49 +090079 },
80 [3] = {
81 .hwport = 3,
82 .flags = 0,
Kukjin Kimc8def082010-07-21 09:19:51 +090083 .ucon = SMDKV210_UCON_DEFAULT,
84 .ulcon = SMDKV210_ULCON_DEFAULT,
85 .ufcon = SMDKV210_UFCON_DEFAULT,
Kukjin Kim98174412010-02-24 16:40:49 +090086 },
87};
88
Abhilash Kesavan4b9a5ad2010-06-08 17:11:43 +090089static struct s3c_ide_platdata smdkv210_ide_pdata __initdata = {
90 .setup_gpio = s5pv210_ide_setup_gpio,
91};
92
Naveen Krishna Ch88a1cc42010-06-21 16:47:16 +090093static uint32_t smdkv210_keymap[] __initdata = {
94 /* KEY(row, col, keycode) */
95 KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
96 KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
97 KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
98 KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
99};
100
101static struct matrix_keymap_data smdkv210_keymap_data __initdata = {
102 .keymap = smdkv210_keymap,
103 .keymap_size = ARRAY_SIZE(smdkv210_keymap),
104};
105
106static struct samsung_keypad_platdata smdkv210_keypad_data __initdata = {
107 .keymap_data = &smdkv210_keymap_data,
108 .rows = 8,
109 .cols = 8,
110};
111
Thomas Abraham8f497202010-11-26 13:19:49 +0900112static void smdkv210_lte480wv_set_power(struct plat_lcd_data *pd,
113 unsigned int power)
114{
115 if (power) {
116#if !defined(CONFIG_BACKLIGHT_PWM)
117 gpio_request(S5PV210_GPD0(3), "GPD0");
118 gpio_direction_output(S5PV210_GPD0(3), 1);
119 gpio_free(S5PV210_GPD0(3));
120#endif
121
122 /* fire nRESET on power up */
123 gpio_request(S5PV210_GPH0(6), "GPH0");
124
125 gpio_direction_output(S5PV210_GPH0(6), 1);
126
127 gpio_set_value(S5PV210_GPH0(6), 0);
128 mdelay(10);
129
130 gpio_set_value(S5PV210_GPH0(6), 1);
131 mdelay(10);
132
133 gpio_free(S5PV210_GPH0(6));
134 } else {
135#if !defined(CONFIG_BACKLIGHT_PWM)
136 gpio_request(S5PV210_GPD0(3), "GPD0");
137 gpio_direction_output(S5PV210_GPD0(3), 0);
138 gpio_free(S5PV210_GPD0(3));
139#endif
140 }
141}
142
143static struct plat_lcd_data smdkv210_lcd_lte480wv_data = {
144 .set_power = smdkv210_lte480wv_set_power,
145};
146
147static struct platform_device smdkv210_lcd_lte480wv = {
148 .name = "platform-lcd",
149 .dev.parent = &s3c_device_fb.dev,
150 .dev.platform_data = &smdkv210_lcd_lte480wv_data,
151};
152
153static struct s3c_fb_pd_win smdkv210_fb_win0 = {
154 .win_mode = {
155 .left_margin = 13,
156 .right_margin = 8,
157 .upper_margin = 7,
158 .lower_margin = 5,
159 .hsync_len = 3,
160 .vsync_len = 1,
161 .xres = 800,
162 .yres = 480,
163 },
164 .max_bpp = 32,
165 .default_bpp = 24,
166};
167
168static struct s3c_fb_platdata smdkv210_lcd0_pdata __initdata = {
169 .win[0] = &smdkv210_fb_win0,
170 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
171 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
172 .setup_gpio = s5pv210_fb_gpio_setup_24bpp,
173};
174
Kukjin Kim98174412010-02-24 16:40:49 +0900175static struct platform_device *smdkv210_devices[] __initdata = {
Jassi Brar9b5f1e02010-05-18 16:02:30 +0900176 &s5pv210_device_iis0,
177 &s5pv210_device_ac97,
Seungwhan Youn494edad2010-10-14 10:35:24 +0900178 &s5pv210_device_spdif,
Naveen Krishna Ch41d82892010-05-20 11:39:54 +0900179 &s3c_device_adc,
Abhilash Kesavan4b9a5ad2010-06-08 17:11:43 +0900180 &s3c_device_cfcon,
Thomas Abraham8f497202010-11-26 13:19:49 +0900181 &s3c_device_fb,
Hyuk Lee976a62f2010-06-14 10:18:56 +0900182 &s3c_device_hsmmc0,
183 &s3c_device_hsmmc1,
184 &s3c_device_hsmmc2,
185 &s3c_device_hsmmc3,
Naveen Krishna Ch170d7412010-07-21 09:21:56 +0530186 &s3c_device_i2c0,
187 &s3c_device_i2c1,
188 &s3c_device_i2c2,
Naveen Krishna Ch88a1cc42010-06-21 16:47:16 +0900189 &samsung_device_keypad,
Atul Dahiyaf5807262010-07-21 17:36:02 +0900190 &s3c_device_rtc,
Naveen Krishna Ch41d82892010-05-20 11:39:54 +0900191 &s3c_device_ts,
Banajit Goswami5b7d7b22010-05-20 16:21:32 +0900192 &s3c_device_wdt,
Thomas Abraham8f497202010-11-26 13:19:49 +0900193 &smdkv210_lcd_lte480wv,
Naveen Krishna Ch41d82892010-05-20 11:39:54 +0900194};
195
Naveen Krishna Ch170d7412010-07-21 09:21:56 +0530196static struct i2c_board_info smdkv210_i2c_devs0[] __initdata = {
197 { I2C_BOARD_INFO("24c08", 0x50), }, /* Samsung S524AD0XD1 */
198};
199
200static struct i2c_board_info smdkv210_i2c_devs1[] __initdata = {
201 /* To Be Updated */
202};
203
204static struct i2c_board_info smdkv210_i2c_devs2[] __initdata = {
205 /* To Be Updated */
206};
207
Naveen Krishna Ch41d82892010-05-20 11:39:54 +0900208static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
209 .delay = 10000,
210 .presc = 49,
211 .oversampling_shift = 2,
Kukjin Kim98174412010-02-24 16:40:49 +0900212};
213
214static void __init smdkv210_map_io(void)
215{
216 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
217 s3c24xx_init_clocks(24000000);
218 s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
219}
220
221static void __init smdkv210_machine_init(void)
222{
Jongpill Leeea31fd42010-10-02 19:13:42 +0900223 s3c_pm_init();
224
Naveen Krishna Ch88a1cc42010-06-21 16:47:16 +0900225 samsung_keypad_set_platdata(&smdkv210_keypad_data);
Naveen Krishna Ch41d82892010-05-20 11:39:54 +0900226 s3c24xx_ts_set_platdata(&s3c_ts_platform);
Naveen Krishna Ch170d7412010-07-21 09:21:56 +0530227
228 s3c_i2c0_set_platdata(NULL);
229 s3c_i2c1_set_platdata(NULL);
230 s3c_i2c2_set_platdata(NULL);
231 i2c_register_board_info(0, smdkv210_i2c_devs0,
232 ARRAY_SIZE(smdkv210_i2c_devs0));
233 i2c_register_board_info(1, smdkv210_i2c_devs1,
234 ARRAY_SIZE(smdkv210_i2c_devs1));
235 i2c_register_board_info(2, smdkv210_i2c_devs2,
236 ARRAY_SIZE(smdkv210_i2c_devs2));
237
Abhilash Kesavan4b9a5ad2010-06-08 17:11:43 +0900238 s3c_ide_set_platdata(&smdkv210_ide_pdata);
239
Thomas Abraham8f497202010-11-26 13:19:49 +0900240 s3c_fb_set_platdata(&smdkv210_lcd0_pdata);
241
Kukjin Kim98174412010-02-24 16:40:49 +0900242 platform_add_devices(smdkv210_devices, ARRAY_SIZE(smdkv210_devices));
243}
244
245MACHINE_START(SMDKV210, "SMDKV210")
246 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
Kukjin Kim98174412010-02-24 16:40:49 +0900247 .boot_params = S5P_PA_SDRAM + 0x100,
248 .init_irq = s5pv210_init_irq,
249 .map_io = smdkv210_map_io,
250 .init_machine = smdkv210_machine_init,
251 .timer = &s3c24xx_timer,
252MACHINE_END