blob: 1c637c9ed1bd732c191ce8ed644e1435ae6325d3 [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>
25
26#include <asm/mach/arch.h>
27#include <asm/mach/map.h>
28
29#include <mach/map.h>
Kyungmin Park079b0322009-11-17 08:41:20 +010030#include <mach/regs-fb.h>
31#include <video/platform_lcd.h>
Byungho Mine1197662009-06-23 21:40:28 +090032
33#include <asm/irq.h>
34#include <asm/mach-types.h>
35
36#include <plat/regs-serial.h>
Kyungmin Park079b0322009-11-17 08:41:20 +010037#include <plat/gpio-cfg.h>
Byungho Mine1197662009-06-23 21:40:28 +090038
39#include <plat/clock.h>
40#include <plat/devs.h>
41#include <plat/cpu.h>
42#include <plat/s5pc100.h>
Kyungmin Park079b0322009-11-17 08:41:20 +010043#include <plat/fb.h>
Kyungmin Park067f1312009-11-17 08:41:22 +010044#include <plat/iic.h>
Abhilash Kesavan66194a72010-06-08 17:02:08 +090045#include <plat/ata.h>
Naveen Krishna Ch327b9032010-06-30 21:50:24 +090046#include <plat/adc.h>
47#include <plat/ts.h>
Byungho Mine1197662009-06-23 21:40:28 +090048
Marek Szyprowski13e51fa2010-05-18 11:30:49 +020049/* Following are default values for UCON, ULCON and UFCON UART registers */
50#define S5PC100_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
51 S3C2410_UCON_RXILEVEL | \
52 S3C2410_UCON_TXIRQMODE | \
53 S3C2410_UCON_RXIRQMODE | \
54 S3C2410_UCON_RXFIFO_TOI | \
55 S3C2443_UCON_RXERR_IRQEN)
56
57#define S5PC100_ULCON_DEFAULT S3C2410_LCON_CS8
58
59#define S5PC100_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
60 S3C2440_UFCON_RXTRIG8 | \
61 S3C2440_UFCON_TXTRIG16)
Byungho Mine1197662009-06-23 21:40:28 +090062
63static struct s3c2410_uartcfg smdkc100_uartcfgs[] __initdata = {
64 [0] = {
65 .hwport = 0,
66 .flags = 0,
Marek Szyprowski13e51fa2010-05-18 11:30:49 +020067 .ucon = S5PC100_UCON_DEFAULT,
68 .ulcon = S5PC100_ULCON_DEFAULT,
69 .ufcon = S5PC100_UFCON_DEFAULT,
Byungho Mine1197662009-06-23 21:40:28 +090070 },
71 [1] = {
72 .hwport = 1,
73 .flags = 0,
Marek Szyprowski13e51fa2010-05-18 11:30:49 +020074 .ucon = S5PC100_UCON_DEFAULT,
75 .ulcon = S5PC100_ULCON_DEFAULT,
76 .ufcon = S5PC100_UFCON_DEFAULT,
Byungho Mine1197662009-06-23 21:40:28 +090077 },
78 [2] = {
79 .hwport = 2,
80 .flags = 0,
Marek Szyprowski13e51fa2010-05-18 11:30:49 +020081 .ucon = S5PC100_UCON_DEFAULT,
82 .ulcon = S5PC100_ULCON_DEFAULT,
83 .ufcon = S5PC100_UFCON_DEFAULT,
Byungho Mine1197662009-06-23 21:40:28 +090084 },
85 [3] = {
86 .hwport = 3,
87 .flags = 0,
Marek Szyprowski13e51fa2010-05-18 11:30:49 +020088 .ucon = S5PC100_UCON_DEFAULT,
89 .ulcon = S5PC100_ULCON_DEFAULT,
90 .ufcon = S5PC100_UFCON_DEFAULT,
Byungho Mine1197662009-06-23 21:40:28 +090091 },
92};
93
Kyungmin Park067f1312009-11-17 08:41:22 +010094/* I2C0 */
95static struct i2c_board_info i2c_devs0[] __initdata = {
96};
97
98/* I2C1 */
99static struct i2c_board_info i2c_devs1[] __initdata = {
100};
101
Kyungmin Park079b0322009-11-17 08:41:20 +0100102/* LCD power controller */
103static void smdkc100_lcd_power_set(struct plat_lcd_data *pd,
104 unsigned int power)
105{
106 /* backlight */
107 gpio_direction_output(S5PC100_GPD(0), power);
108
109 if (power) {
110 /* module reset */
111 gpio_direction_output(S5PC100_GPH0(6), 1);
112 mdelay(100);
113 gpio_direction_output(S5PC100_GPH0(6), 0);
114 mdelay(10);
115 gpio_direction_output(S5PC100_GPH0(6), 1);
116 mdelay(10);
117 }
118}
119
120static struct plat_lcd_data smdkc100_lcd_power_data = {
121 .set_power = smdkc100_lcd_power_set,
122};
123
124static struct platform_device smdkc100_lcd_powerdev = {
125 .name = "platform-lcd",
126 .dev.parent = &s3c_device_fb.dev,
127 .dev.platform_data = &smdkc100_lcd_power_data,
128};
129
130/* Frame Buffer */
131static struct s3c_fb_pd_win smdkc100_fb_win0 = {
132 /* this is to ensure we use win0 */
133 .win_mode = {
Marek Szyprowski08d08fa2010-05-18 11:30:48 +0200134 .pixclock = 1000000000000ULL / ((8+13+3+800)*(7+5+1+480)*80),
Kyungmin Park079b0322009-11-17 08:41:20 +0100135 .left_margin = 8,
136 .right_margin = 13,
137 .upper_margin = 7,
138 .lower_margin = 5,
139 .hsync_len = 3,
140 .vsync_len = 1,
141 .xres = 800,
142 .yres = 480,
143 },
144 .max_bpp = 32,
145 .default_bpp = 16,
146};
147
148static struct s3c_fb_platdata smdkc100_lcd_pdata __initdata = {
149 .win[0] = &smdkc100_fb_win0,
150 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
151 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
152 .setup_gpio = s5pc100_fb_gpio_setup_24bpp,
153};
154
Abhilash Kesavan66194a72010-06-08 17:02:08 +0900155static struct s3c_ide_platdata smdkc100_ide_pdata __initdata = {
156 .setup_gpio = s5pc100_ide_setup_gpio,
157};
158
Byungho Mine1197662009-06-23 21:40:28 +0900159static struct platform_device *smdkc100_devices[] __initdata = {
Naveen Krishna Ch327b9032010-06-30 21:50:24 +0900160<<<<<<< HEAD:arch/arm/mach-s5pc100/mach-smdkc100.c
Abhilash Kesavan66194a72010-06-08 17:02:08 +0900161 &s3c_device_cfcon,
Naveen Krishna Ch327b9032010-06-30 21:50:24 +0900162=======
163 &s3c_device_adc,
164>>>>>>> c1b6d71... ARM: S5PC100: Add Touchscreen support.:arch/arm/mach-s5pc100/mach-smdkc100.c
Kyungmin Park067f1312009-11-17 08:41:22 +0100165 &s3c_device_i2c0,
166 &s3c_device_i2c1,
Kyungmin Park079b0322009-11-17 08:41:20 +0100167 &s3c_device_fb,
Kyungmin Park0c318622009-11-17 08:41:24 +0100168 &s3c_device_hsmmc0,
169 &s3c_device_hsmmc1,
170 &s3c_device_hsmmc2,
Naveen Krishna Ch327b9032010-06-30 21:50:24 +0900171 &s3c_device_ts,
Kyungmin Park079b0322009-11-17 08:41:20 +0100172 &smdkc100_lcd_powerdev,
Jassi Brar99c56e02010-05-18 16:02:44 +0900173 &s5pc100_device_iis0,
174 &s5pc100_device_ac97,
Byungho Mine1197662009-06-23 21:40:28 +0900175};
176
Naveen Krishna Ch327b9032010-06-30 21:50:24 +0900177static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
178 .delay = 10000,
179 .presc = 49,
180 .oversampling_shift = 2,
181};
182
Byungho Mine1197662009-06-23 21:40:28 +0900183static void __init smdkc100_map_io(void)
184{
Marek Szyprowskiacc84702010-05-20 07:51:08 +0200185 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
Byungho Mine1197662009-06-23 21:40:28 +0900186 s3c24xx_init_clocks(12000000);
187 s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs));
188}
189
190static void __init smdkc100_machine_init(void)
191{
Naveen Krishna Ch327b9032010-06-30 21:50:24 +0900192 s3c24xx_ts_set_platdata(&s3c_ts_platform);
193
Kyungmin Park067f1312009-11-17 08:41:22 +0100194 /* I2C */
195 s3c_i2c0_set_platdata(NULL);
196 s3c_i2c1_set_platdata(NULL);
197 i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
198 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
199
Kyungmin Park079b0322009-11-17 08:41:20 +0100200 s3c_fb_set_platdata(&smdkc100_lcd_pdata);
Abhilash Kesavan66194a72010-06-08 17:02:08 +0900201 s3c_ide_set_platdata(&smdkc100_ide_pdata);
Kyungmin Park079b0322009-11-17 08:41:20 +0100202
203 /* LCD init */
204 gpio_request(S5PC100_GPD(0), "GPD");
205 gpio_request(S5PC100_GPH0(6), "GPH0");
206 smdkc100_lcd_power_set(&smdkc100_lcd_power_data, 0);
Byungho Mine1197662009-06-23 21:40:28 +0900207 platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices));
208}
209
210MACHINE_START(SMDKC100, "SMDKC100")
211 /* Maintainer: Byungho Min <bhmin@samsung.com> */
Marek Szyprowskiacc84702010-05-20 07:51:08 +0200212 .phys_io = S3C_PA_UART & 0xfff00000,
213 .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
214 .boot_params = S5P_PA_SDRAM + 0x100,
Byungho Mine1197662009-06-23 21:40:28 +0900215 .init_irq = s5pc100_init_irq,
216 .map_io = smdkc100_map_io,
217 .init_machine = smdkc100_machine_init,
218 .timer = &s3c24xx_timer,
219MACHINE_END