blob: 62bf38c06ae70951b82daed7992801f463a3db42 [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>
Byungho Mine1197662009-06-23 21:40:28 +090045
46#define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK)
47#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
48#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
49
50static struct s3c2410_uartcfg smdkc100_uartcfgs[] __initdata = {
51 [0] = {
52 .hwport = 0,
53 .flags = 0,
54 .ucon = 0x3c5,
55 .ulcon = 0x03,
56 .ufcon = 0x51,
57 },
58 [1] = {
59 .hwport = 1,
60 .flags = 0,
61 .ucon = 0x3c5,
62 .ulcon = 0x03,
63 .ufcon = 0x51,
64 },
65 [2] = {
66 .hwport = 2,
67 .flags = 0,
68 .ucon = 0x3c5,
69 .ulcon = 0x03,
70 .ufcon = 0x51,
71 },
72 [3] = {
73 .hwport = 3,
74 .flags = 0,
75 .ucon = 0x3c5,
76 .ulcon = 0x03,
77 .ufcon = 0x51,
78 },
79};
80
Kyungmin Park067f1312009-11-17 08:41:22 +010081/* I2C0 */
82static struct i2c_board_info i2c_devs0[] __initdata = {
83};
84
85/* I2C1 */
86static struct i2c_board_info i2c_devs1[] __initdata = {
87};
88
Kyungmin Park079b0322009-11-17 08:41:20 +010089/* LCD power controller */
90static void smdkc100_lcd_power_set(struct plat_lcd_data *pd,
91 unsigned int power)
92{
93 /* backlight */
94 gpio_direction_output(S5PC100_GPD(0), power);
95
96 if (power) {
97 /* module reset */
98 gpio_direction_output(S5PC100_GPH0(6), 1);
99 mdelay(100);
100 gpio_direction_output(S5PC100_GPH0(6), 0);
101 mdelay(10);
102 gpio_direction_output(S5PC100_GPH0(6), 1);
103 mdelay(10);
104 }
105}
106
107static struct plat_lcd_data smdkc100_lcd_power_data = {
108 .set_power = smdkc100_lcd_power_set,
109};
110
111static struct platform_device smdkc100_lcd_powerdev = {
112 .name = "platform-lcd",
113 .dev.parent = &s3c_device_fb.dev,
114 .dev.platform_data = &smdkc100_lcd_power_data,
115};
116
117/* Frame Buffer */
118static struct s3c_fb_pd_win smdkc100_fb_win0 = {
119 /* this is to ensure we use win0 */
120 .win_mode = {
121 .refresh = 70,
122 .pixclock = (8+13+3+800)*(7+5+1+480),
123 .left_margin = 8,
124 .right_margin = 13,
125 .upper_margin = 7,
126 .lower_margin = 5,
127 .hsync_len = 3,
128 .vsync_len = 1,
129 .xres = 800,
130 .yres = 480,
131 },
132 .max_bpp = 32,
133 .default_bpp = 16,
134};
135
136static struct s3c_fb_platdata smdkc100_lcd_pdata __initdata = {
137 .win[0] = &smdkc100_fb_win0,
138 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
139 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
140 .setup_gpio = s5pc100_fb_gpio_setup_24bpp,
141};
142
Byungho Mine1197662009-06-23 21:40:28 +0900143static struct map_desc smdkc100_iodesc[] = {};
144
145static struct platform_device *smdkc100_devices[] __initdata = {
Kyungmin Park067f1312009-11-17 08:41:22 +0100146 &s3c_device_i2c0,
147 &s3c_device_i2c1,
Kyungmin Park079b0322009-11-17 08:41:20 +0100148 &s3c_device_fb,
Kyungmin Park0c318622009-11-17 08:41:24 +0100149 &s3c_device_hsmmc0,
150 &s3c_device_hsmmc1,
151 &s3c_device_hsmmc2,
Kyungmin Park079b0322009-11-17 08:41:20 +0100152 &smdkc100_lcd_powerdev,
Jassi Brar99c56e02010-05-18 16:02:44 +0900153 &s5pc100_device_iis0,
154 &s5pc100_device_ac97,
Byungho Mine1197662009-06-23 21:40:28 +0900155};
156
157static void __init smdkc100_map_io(void)
158{
159 s5pc1xx_init_io(smdkc100_iodesc, ARRAY_SIZE(smdkc100_iodesc));
160 s3c24xx_init_clocks(12000000);
161 s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs));
162}
163
164static void __init smdkc100_machine_init(void)
165{
Kyungmin Park067f1312009-11-17 08:41:22 +0100166 /* I2C */
167 s3c_i2c0_set_platdata(NULL);
168 s3c_i2c1_set_platdata(NULL);
169 i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
170 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
171
Kyungmin Park079b0322009-11-17 08:41:20 +0100172 s3c_fb_set_platdata(&smdkc100_lcd_pdata);
173
174 /* LCD init */
175 gpio_request(S5PC100_GPD(0), "GPD");
176 gpio_request(S5PC100_GPH0(6), "GPH0");
177 smdkc100_lcd_power_set(&smdkc100_lcd_power_data, 0);
Byungho Mine1197662009-06-23 21:40:28 +0900178 platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices));
179}
180
181MACHINE_START(SMDKC100, "SMDKC100")
182 /* Maintainer: Byungho Min <bhmin@samsung.com> */
Kyungmin Parkb0cc3032009-11-17 08:41:11 +0100183 .phys_io = S5PC100_PA_UART & 0xfff00000,
Byungho Mine1197662009-06-23 21:40:28 +0900184 .io_pg_offst = (((u32)S5PC1XX_VA_UART) >> 18) & 0xfffc,
185 .boot_params = S5PC100_PA_SDRAM + 0x100,
186
187 .init_irq = s5pc100_init_irq,
188 .map_io = smdkc100_map_io,
189 .init_machine = smdkc100_machine_init,
190 .timer = &s3c24xx_timer,
191MACHINE_END