]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/arm/mach-s5pc100/mach-smdkc100.c
Merge branches 'perf-fixes-for-linus' and 'x86-fixes-for-linus' of git://git.kernel...
[net-next-2.6.git] / arch / arm / mach-s5pc100 / mach-smdkc100.c
CommitLineData
e119766f
BM
1/* linux/arch/arm/mach-s5pc100/mach-smdkc100.c
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Author: Byungho Min <bhmin@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
12#include <linux/kernel.h>
13#include <linux/types.h>
14#include <linux/interrupt.h>
15#include <linux/list.h>
16#include <linux/timer.h>
17#include <linux/init.h>
18#include <linux/serial_core.h>
19#include <linux/platform_device.h>
20#include <linux/io.h>
21#include <linux/gpio.h>
22#include <linux/i2c.h>
23#include <linux/fb.h>
24#include <linux/delay.h>
2211f28c 25#include <linux/input.h>
e119766f
BM
26
27#include <asm/mach/arch.h>
28#include <asm/mach/map.h>
29
30#include <mach/map.h>
079b0324
KP
31#include <mach/regs-fb.h>
32#include <video/platform_lcd.h>
e119766f
BM
33
34#include <asm/irq.h>
35#include <asm/mach-types.h>
36
37#include <plat/regs-serial.h>
079b0324 38#include <plat/gpio-cfg.h>
e119766f
BM
39
40#include <plat/clock.h>
41#include <plat/devs.h>
42#include <plat/cpu.h>
43#include <plat/s5pc100.h>
079b0324 44#include <plat/fb.h>
067f131d 45#include <plat/iic.h>
66194a74 46#include <plat/ata.h>
327b9030 47#include <plat/adc.h>
2211f28c 48#include <plat/keypad.h>
327b9030 49#include <plat/ts.h>
068b432d 50#include <plat/audio.h>
e119766f 51
13e51fad 52/* Following are default values for UCON, ULCON and UFCON UART registers */
c8def085 53#define SMDKC100_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
13e51fad
MS
54 S3C2410_UCON_RXILEVEL | \
55 S3C2410_UCON_TXIRQMODE | \
56 S3C2410_UCON_RXIRQMODE | \
57 S3C2410_UCON_RXFIFO_TOI | \
58 S3C2443_UCON_RXERR_IRQEN)
59
c8def085 60#define SMDKC100_ULCON_DEFAULT S3C2410_LCON_CS8
13e51fad 61
c8def085 62#define SMDKC100_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
13e51fad
MS
63 S3C2440_UFCON_RXTRIG8 | \
64 S3C2440_UFCON_TXTRIG16)
e119766f
BM
65
66static struct s3c2410_uartcfg smdkc100_uartcfgs[] __initdata = {
67 [0] = {
68 .hwport = 0,
69 .flags = 0,
c8def085
KK
70 .ucon = SMDKC100_UCON_DEFAULT,
71 .ulcon = SMDKC100_ULCON_DEFAULT,
72 .ufcon = SMDKC100_UFCON_DEFAULT,
e119766f
BM
73 },
74 [1] = {
75 .hwport = 1,
76 .flags = 0,
c8def085
KK
77 .ucon = SMDKC100_UCON_DEFAULT,
78 .ulcon = SMDKC100_ULCON_DEFAULT,
79 .ufcon = SMDKC100_UFCON_DEFAULT,
e119766f
BM
80 },
81 [2] = {
82 .hwport = 2,
83 .flags = 0,
c8def085
KK
84 .ucon = SMDKC100_UCON_DEFAULT,
85 .ulcon = SMDKC100_ULCON_DEFAULT,
86 .ufcon = SMDKC100_UFCON_DEFAULT,
e119766f
BM
87 },
88 [3] = {
89 .hwport = 3,
90 .flags = 0,
c8def085
KK
91 .ucon = SMDKC100_UCON_DEFAULT,
92 .ulcon = SMDKC100_ULCON_DEFAULT,
93 .ufcon = SMDKC100_UFCON_DEFAULT,
e119766f
BM
94 },
95};
96
067f131d
KP
97/* I2C0 */
98static struct i2c_board_info i2c_devs0[] __initdata = {
99};
100
101/* I2C1 */
102static struct i2c_board_info i2c_devs1[] __initdata = {
103};
104
079b0324
KP
105/* LCD power controller */
106static void smdkc100_lcd_power_set(struct plat_lcd_data *pd,
107 unsigned int power)
108{
109 /* backlight */
110 gpio_direction_output(S5PC100_GPD(0), power);
111
112 if (power) {
113 /* module reset */
114 gpio_direction_output(S5PC100_GPH0(6), 1);
115 mdelay(100);
116 gpio_direction_output(S5PC100_GPH0(6), 0);
117 mdelay(10);
118 gpio_direction_output(S5PC100_GPH0(6), 1);
119 mdelay(10);
120 }
121}
122
123static struct plat_lcd_data smdkc100_lcd_power_data = {
124 .set_power = smdkc100_lcd_power_set,
125};
126
127static struct platform_device smdkc100_lcd_powerdev = {
128 .name = "platform-lcd",
129 .dev.parent = &s3c_device_fb.dev,
130 .dev.platform_data = &smdkc100_lcd_power_data,
131};
132
133/* Frame Buffer */
134static struct s3c_fb_pd_win smdkc100_fb_win0 = {
135 /* this is to ensure we use win0 */
136 .win_mode = {
079b0324
KP
137 .left_margin = 8,
138 .right_margin = 13,
139 .upper_margin = 7,
140 .lower_margin = 5,
141 .hsync_len = 3,
142 .vsync_len = 1,
143 .xres = 800,
144 .yres = 480,
daf695fc 145 .refresh = 80,
079b0324
KP
146 },
147 .max_bpp = 32,
148 .default_bpp = 16,
149};
150
151static struct s3c_fb_platdata smdkc100_lcd_pdata __initdata = {
152 .win[0] = &smdkc100_fb_win0,
153 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
154 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
155 .setup_gpio = s5pc100_fb_gpio_setup_24bpp,
156};
157
66194a74
AK
158static struct s3c_ide_platdata smdkc100_ide_pdata __initdata = {
159 .setup_gpio = s5pc100_ide_setup_gpio,
160};
161
2211f28c
NKC
162static uint32_t smdkc100_keymap[] __initdata = {
163 /* KEY(row, col, keycode) */
164 KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
165 KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
166 KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
167 KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
168};
169
170static struct matrix_keymap_data smdkc100_keymap_data __initdata = {
171 .keymap = smdkc100_keymap,
172 .keymap_size = ARRAY_SIZE(smdkc100_keymap),
173};
174
175static struct samsung_keypad_platdata smdkc100_keypad_data __initdata = {
176 .keymap_data = &smdkc100_keymap_data,
177 .rows = 2,
178 .cols = 8,
179};
180
e119766f 181static struct platform_device *smdkc100_devices[] __initdata = {
327b9030 182 &s3c_device_adc,
c4023617 183 &s3c_device_cfcon,
067f131d
KP
184 &s3c_device_i2c0,
185 &s3c_device_i2c1,
079b0324 186 &s3c_device_fb,
0c318628
KP
187 &s3c_device_hsmmc0,
188 &s3c_device_hsmmc1,
189 &s3c_device_hsmmc2,
327b9030 190 &s3c_device_ts,
c4023617 191 &s3c_device_wdt,
079b0324 192 &smdkc100_lcd_powerdev,
99c56e0c 193 &s5pc100_device_iis0,
2211f28c 194 &samsung_device_keypad,
99c56e0c 195 &s5pc100_device_ac97,
fa9ce742 196 &s3c_device_rtc,
db94a2f4
SN
197 &s5p_device_fimc0,
198 &s5p_device_fimc1,
199 &s5p_device_fimc2,
068b432d 200 &s5pc100_device_spdif,
e119766f
BM
201};
202
327b9030
NKC
203static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
204 .delay = 10000,
205 .presc = 49,
206 .oversampling_shift = 2,
e119766f
BM
207};
208
209static void __init smdkc100_map_io(void)
210{
acc84707 211 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
e119766f
BM
212 s3c24xx_init_clocks(12000000);
213 s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs));
214}
215
216static void __init smdkc100_machine_init(void)
217{
327b9030
NKC
218 s3c24xx_ts_set_platdata(&s3c_ts_platform);
219
067f131d
KP
220 /* I2C */
221 s3c_i2c0_set_platdata(NULL);
222 s3c_i2c1_set_platdata(NULL);
223 i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
224 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
225
079b0324 226 s3c_fb_set_platdata(&smdkc100_lcd_pdata);
66194a74 227 s3c_ide_set_platdata(&smdkc100_ide_pdata);
079b0324 228
2211f28c 229 samsung_keypad_set_platdata(&smdkc100_keypad_data);
079b0324 230
068b432d
SY
231 s5pc100_spdif_setup_gpio(S5PC100_SPDIF_GPD);
232
079b0324
KP
233 /* LCD init */
234 gpio_request(S5PC100_GPD(0), "GPD");
235 gpio_request(S5PC100_GPH0(6), "GPH0");
236 smdkc100_lcd_power_set(&smdkc100_lcd_power_data, 0);
e119766f
BM
237 platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices));
238}
239
240MACHINE_START(SMDKC100, "SMDKC100")
241 /* Maintainer: Byungho Min <bhmin@samsung.com> */
acc84707 242 .boot_params = S5P_PA_SDRAM + 0x100,
e119766f
BM
243 .init_irq = s5pc100_init_irq,
244 .map_io = smdkc100_map_io,
245 .init_machine = smdkc100_machine_init,
246 .timer = &s3c24xx_timer,
247MACHINE_END