blob: 2dc519c172ecbe54afb7aa92509cfe02db96a5d5 [file] [log] [blame]
Byungho Mine1197662009-06-23 21:40:28 +09001/* 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>
Naveen Krishna Ch2211f282010-06-22 07:54:18 +090025#include <linux/input.h>
Byungho Mine1197662009-06-23 21:40:28 +090026
27#include <asm/mach/arch.h>
28#include <asm/mach/map.h>
29
30#include <mach/map.h>
Kyungmin Park079b0322009-11-17 08:41:20 +010031#include <mach/regs-fb.h>
32#include <video/platform_lcd.h>
Byungho Mine1197662009-06-23 21:40:28 +090033
34#include <asm/irq.h>
35#include <asm/mach-types.h>
36
37#include <plat/regs-serial.h>
Kyungmin Park079b0322009-11-17 08:41:20 +010038#include <plat/gpio-cfg.h>
Byungho Mine1197662009-06-23 21:40:28 +090039
40#include <plat/clock.h>
41#include <plat/devs.h>
42#include <plat/cpu.h>
43#include <plat/s5pc100.h>
Kyungmin Park079b0322009-11-17 08:41:20 +010044#include <plat/fb.h>
Kyungmin Park067f1312009-11-17 08:41:22 +010045#include <plat/iic.h>
Abhilash Kesavan66194a72010-06-08 17:02:08 +090046#include <plat/ata.h>
Naveen Krishna Ch327b9032010-06-30 21:50:24 +090047#include <plat/adc.h>
Naveen Krishna Ch2211f282010-06-22 07:54:18 +090048#include <plat/keypad.h>
Naveen Krishna Ch327b9032010-06-30 21:50:24 +090049#include <plat/ts.h>
Byungho Mine1197662009-06-23 21:40:28 +090050
Marek Szyprowski13e51fa2010-05-18 11:30:49 +020051/* Following are default values for UCON, ULCON and UFCON UART registers */
Kukjin Kimc8def082010-07-21 09:19:51 +090052#define SMDKC100_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
Marek Szyprowski13e51fa2010-05-18 11:30:49 +020053 S3C2410_UCON_RXILEVEL | \
54 S3C2410_UCON_TXIRQMODE | \
55 S3C2410_UCON_RXIRQMODE | \
56 S3C2410_UCON_RXFIFO_TOI | \
57 S3C2443_UCON_RXERR_IRQEN)
58
Kukjin Kimc8def082010-07-21 09:19:51 +090059#define SMDKC100_ULCON_DEFAULT S3C2410_LCON_CS8
Marek Szyprowski13e51fa2010-05-18 11:30:49 +020060
Kukjin Kimc8def082010-07-21 09:19:51 +090061#define SMDKC100_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
Marek Szyprowski13e51fa2010-05-18 11:30:49 +020062 S3C2440_UFCON_RXTRIG8 | \
63 S3C2440_UFCON_TXTRIG16)
Byungho Mine1197662009-06-23 21:40:28 +090064
65static struct s3c2410_uartcfg smdkc100_uartcfgs[] __initdata = {
66 [0] = {
67 .hwport = 0,
68 .flags = 0,
Kukjin Kimc8def082010-07-21 09:19:51 +090069 .ucon = SMDKC100_UCON_DEFAULT,
70 .ulcon = SMDKC100_ULCON_DEFAULT,
71 .ufcon = SMDKC100_UFCON_DEFAULT,
Byungho Mine1197662009-06-23 21:40:28 +090072 },
73 [1] = {
74 .hwport = 1,
75 .flags = 0,
Kukjin Kimc8def082010-07-21 09:19:51 +090076 .ucon = SMDKC100_UCON_DEFAULT,
77 .ulcon = SMDKC100_ULCON_DEFAULT,
78 .ufcon = SMDKC100_UFCON_DEFAULT,
Byungho Mine1197662009-06-23 21:40:28 +090079 },
80 [2] = {
81 .hwport = 2,
82 .flags = 0,
Kukjin Kimc8def082010-07-21 09:19:51 +090083 .ucon = SMDKC100_UCON_DEFAULT,
84 .ulcon = SMDKC100_ULCON_DEFAULT,
85 .ufcon = SMDKC100_UFCON_DEFAULT,
Byungho Mine1197662009-06-23 21:40:28 +090086 },
87 [3] = {
88 .hwport = 3,
89 .flags = 0,
Kukjin Kimc8def082010-07-21 09:19:51 +090090 .ucon = SMDKC100_UCON_DEFAULT,
91 .ulcon = SMDKC100_ULCON_DEFAULT,
92 .ufcon = SMDKC100_UFCON_DEFAULT,
Byungho Mine1197662009-06-23 21:40:28 +090093 },
94};
95
Kyungmin Park067f1312009-11-17 08:41:22 +010096/* I2C0 */
97static struct i2c_board_info i2c_devs0[] __initdata = {
98};
99
100/* I2C1 */
101static struct i2c_board_info i2c_devs1[] __initdata = {
102};
103
Kyungmin Park079b0322009-11-17 08:41:20 +0100104/* LCD power controller */
105static void smdkc100_lcd_power_set(struct plat_lcd_data *pd,
106 unsigned int power)
107{
108 /* backlight */
109 gpio_direction_output(S5PC100_GPD(0), power);
110
111 if (power) {
112 /* module reset */
113 gpio_direction_output(S5PC100_GPH0(6), 1);
114 mdelay(100);
115 gpio_direction_output(S5PC100_GPH0(6), 0);
116 mdelay(10);
117 gpio_direction_output(S5PC100_GPH0(6), 1);
118 mdelay(10);
119 }
120}
121
122static struct plat_lcd_data smdkc100_lcd_power_data = {
123 .set_power = smdkc100_lcd_power_set,
124};
125
126static struct platform_device smdkc100_lcd_powerdev = {
127 .name = "platform-lcd",
128 .dev.parent = &s3c_device_fb.dev,
129 .dev.platform_data = &smdkc100_lcd_power_data,
130};
131
132/* Frame Buffer */
133static struct s3c_fb_pd_win smdkc100_fb_win0 = {
134 /* this is to ensure we use win0 */
135 .win_mode = {
Marek Szyprowski08d08fa2010-05-18 11:30:48 +0200136 .pixclock = 1000000000000ULL / ((8+13+3+800)*(7+5+1+480)*80),
Kyungmin Park079b0322009-11-17 08:41:20 +0100137 .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,
145 },
146 .max_bpp = 32,
147 .default_bpp = 16,
148};
149
150static struct s3c_fb_platdata smdkc100_lcd_pdata __initdata = {
151 .win[0] = &smdkc100_fb_win0,
152 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
153 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
154 .setup_gpio = s5pc100_fb_gpio_setup_24bpp,
155};
156
Abhilash Kesavan66194a72010-06-08 17:02:08 +0900157static struct s3c_ide_platdata smdkc100_ide_pdata __initdata = {
158 .setup_gpio = s5pc100_ide_setup_gpio,
159};
160
Naveen Krishna Ch2211f282010-06-22 07:54:18 +0900161static uint32_t smdkc100_keymap[] __initdata = {
162 /* KEY(row, col, keycode) */
163 KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
164 KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
165 KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
166 KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
167};
168
169static struct matrix_keymap_data smdkc100_keymap_data __initdata = {
170 .keymap = smdkc100_keymap,
171 .keymap_size = ARRAY_SIZE(smdkc100_keymap),
172};
173
174static struct samsung_keypad_platdata smdkc100_keypad_data __initdata = {
175 .keymap_data = &smdkc100_keymap_data,
176 .rows = 2,
177 .cols = 8,
178};
179
Byungho Mine1197662009-06-23 21:40:28 +0900180static struct platform_device *smdkc100_devices[] __initdata = {
Naveen Krishna Ch327b9032010-06-30 21:50:24 +0900181 &s3c_device_adc,
Banajit Goswamic4023612010-06-18 12:12:06 +0530182 &s3c_device_cfcon,
Kyungmin Park067f1312009-11-17 08:41:22 +0100183 &s3c_device_i2c0,
184 &s3c_device_i2c1,
Kyungmin Park079b0322009-11-17 08:41:20 +0100185 &s3c_device_fb,
Kyungmin Park0c318622009-11-17 08:41:24 +0100186 &s3c_device_hsmmc0,
187 &s3c_device_hsmmc1,
188 &s3c_device_hsmmc2,
Naveen Krishna Ch327b9032010-06-30 21:50:24 +0900189 &s3c_device_ts,
Banajit Goswamic4023612010-06-18 12:12:06 +0530190 &s3c_device_wdt,
Kyungmin Park079b0322009-11-17 08:41:20 +0100191 &smdkc100_lcd_powerdev,
Jassi Brar99c56e02010-05-18 16:02:44 +0900192 &s5pc100_device_iis0,
Naveen Krishna Ch2211f282010-06-22 07:54:18 +0900193 &samsung_device_keypad,
Jassi Brar99c56e02010-05-18 16:02:44 +0900194 &s5pc100_device_ac97,
Atul Dahiyafa9ce742010-07-21 17:38:23 +0900195 &s3c_device_rtc,
Sylwester Nawrockidb94a2f2010-08-09 16:55:35 +0900196 &s5p_device_fimc0,
197 &s5p_device_fimc1,
198 &s5p_device_fimc2,
Byungho Mine1197662009-06-23 21:40:28 +0900199};
200
Naveen Krishna Ch327b9032010-06-30 21:50:24 +0900201static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
202 .delay = 10000,
203 .presc = 49,
204 .oversampling_shift = 2,
205};
206
Byungho Mine1197662009-06-23 21:40:28 +0900207static void __init smdkc100_map_io(void)
208{
Marek Szyprowskiacc84702010-05-20 07:51:08 +0200209 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
Byungho Mine1197662009-06-23 21:40:28 +0900210 s3c24xx_init_clocks(12000000);
211 s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs));
212}
213
214static void __init smdkc100_machine_init(void)
215{
Naveen Krishna Ch327b9032010-06-30 21:50:24 +0900216 s3c24xx_ts_set_platdata(&s3c_ts_platform);
217
Kyungmin Park067f1312009-11-17 08:41:22 +0100218 /* I2C */
219 s3c_i2c0_set_platdata(NULL);
220 s3c_i2c1_set_platdata(NULL);
221 i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
222 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
223
Kyungmin Park079b0322009-11-17 08:41:20 +0100224 s3c_fb_set_platdata(&smdkc100_lcd_pdata);
Abhilash Kesavan66194a72010-06-08 17:02:08 +0900225 s3c_ide_set_platdata(&smdkc100_ide_pdata);
Kyungmin Park079b0322009-11-17 08:41:20 +0100226
Naveen Krishna Ch2211f282010-06-22 07:54:18 +0900227 samsung_keypad_set_platdata(&smdkc100_keypad_data);
228
Kyungmin Park079b0322009-11-17 08:41:20 +0100229 /* LCD init */
230 gpio_request(S5PC100_GPD(0), "GPD");
231 gpio_request(S5PC100_GPH0(6), "GPH0");
232 smdkc100_lcd_power_set(&smdkc100_lcd_power_data, 0);
Byungho Mine1197662009-06-23 21:40:28 +0900233 platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices));
234}
235
236MACHINE_START(SMDKC100, "SMDKC100")
237 /* Maintainer: Byungho Min <bhmin@samsung.com> */
Marek Szyprowskiacc84702010-05-20 07:51:08 +0200238 .phys_io = S3C_PA_UART & 0xfff00000,
239 .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
240 .boot_params = S5P_PA_SDRAM + 0x100,
Byungho Mine1197662009-06-23 21:40:28 +0900241 .init_irq = s5pc100_init_irq,
242 .map_io = smdkc100_map_io,
243 .init_machine = smdkc100_machine_init,
244 .timer = &s3c24xx_timer,
245MACHINE_END