blob: 117fbbada526362a38c810ef00053c2e7285c393 [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
Marek Szyprowski13e51fa2010-05-18 11:30:49 +020046/* Following are default values for UCON, ULCON and UFCON UART registers */
47#define S5PC100_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
48 S3C2410_UCON_RXILEVEL | \
49 S3C2410_UCON_TXIRQMODE | \
50 S3C2410_UCON_RXIRQMODE | \
51 S3C2410_UCON_RXFIFO_TOI | \
52 S3C2443_UCON_RXERR_IRQEN)
53
54#define S5PC100_ULCON_DEFAULT S3C2410_LCON_CS8
55
56#define S5PC100_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
57 S3C2440_UFCON_RXTRIG8 | \
58 S3C2440_UFCON_TXTRIG16)
Byungho Mine1197662009-06-23 21:40:28 +090059
60static struct s3c2410_uartcfg smdkc100_uartcfgs[] __initdata = {
61 [0] = {
62 .hwport = 0,
63 .flags = 0,
Marek Szyprowski13e51fa2010-05-18 11:30:49 +020064 .ucon = S5PC100_UCON_DEFAULT,
65 .ulcon = S5PC100_ULCON_DEFAULT,
66 .ufcon = S5PC100_UFCON_DEFAULT,
Byungho Mine1197662009-06-23 21:40:28 +090067 },
68 [1] = {
69 .hwport = 1,
70 .flags = 0,
Marek Szyprowski13e51fa2010-05-18 11:30:49 +020071 .ucon = S5PC100_UCON_DEFAULT,
72 .ulcon = S5PC100_ULCON_DEFAULT,
73 .ufcon = S5PC100_UFCON_DEFAULT,
Byungho Mine1197662009-06-23 21:40:28 +090074 },
75 [2] = {
76 .hwport = 2,
77 .flags = 0,
Marek Szyprowski13e51fa2010-05-18 11:30:49 +020078 .ucon = S5PC100_UCON_DEFAULT,
79 .ulcon = S5PC100_ULCON_DEFAULT,
80 .ufcon = S5PC100_UFCON_DEFAULT,
Byungho Mine1197662009-06-23 21:40:28 +090081 },
82 [3] = {
83 .hwport = 3,
84 .flags = 0,
Marek Szyprowski13e51fa2010-05-18 11:30:49 +020085 .ucon = S5PC100_UCON_DEFAULT,
86 .ulcon = S5PC100_ULCON_DEFAULT,
87 .ufcon = S5PC100_UFCON_DEFAULT,
Byungho Mine1197662009-06-23 21:40:28 +090088 },
89};
90
Kyungmin Park067f1312009-11-17 08:41:22 +010091/* I2C0 */
92static struct i2c_board_info i2c_devs0[] __initdata = {
93};
94
95/* I2C1 */
96static struct i2c_board_info i2c_devs1[] __initdata = {
97};
98
Kyungmin Park079b0322009-11-17 08:41:20 +010099/* LCD power controller */
100static void smdkc100_lcd_power_set(struct plat_lcd_data *pd,
101 unsigned int power)
102{
103 /* backlight */
104 gpio_direction_output(S5PC100_GPD(0), power);
105
106 if (power) {
107 /* module reset */
108 gpio_direction_output(S5PC100_GPH0(6), 1);
109 mdelay(100);
110 gpio_direction_output(S5PC100_GPH0(6), 0);
111 mdelay(10);
112 gpio_direction_output(S5PC100_GPH0(6), 1);
113 mdelay(10);
114 }
115}
116
117static struct plat_lcd_data smdkc100_lcd_power_data = {
118 .set_power = smdkc100_lcd_power_set,
119};
120
121static struct platform_device smdkc100_lcd_powerdev = {
122 .name = "platform-lcd",
123 .dev.parent = &s3c_device_fb.dev,
124 .dev.platform_data = &smdkc100_lcd_power_data,
125};
126
127/* Frame Buffer */
128static struct s3c_fb_pd_win smdkc100_fb_win0 = {
129 /* this is to ensure we use win0 */
130 .win_mode = {
Kyungmin Park079b0322009-11-17 08:41:20 +0100131 .left_margin = 8,
132 .right_margin = 13,
133 .upper_margin = 7,
134 .lower_margin = 5,
135 .hsync_len = 3,
136 .vsync_len = 1,
137 .xres = 800,
138 .yres = 480,
Maurus Cuelenaeredaf695f2010-08-10 18:02:44 -0700139 .refresh = 80,
Kyungmin Park079b0322009-11-17 08:41:20 +0100140 },
141 .max_bpp = 32,
142 .default_bpp = 16,
143};
144
145static struct s3c_fb_platdata smdkc100_lcd_pdata __initdata = {
146 .win[0] = &smdkc100_fb_win0,
147 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
148 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
149 .setup_gpio = s5pc100_fb_gpio_setup_24bpp,
150};
151
Byungho Mine1197662009-06-23 21:40:28 +0900152static struct platform_device *smdkc100_devices[] __initdata = {
Kyungmin Park067f1312009-11-17 08:41:22 +0100153 &s3c_device_i2c0,
154 &s3c_device_i2c1,
Kyungmin Park079b0322009-11-17 08:41:20 +0100155 &s3c_device_fb,
Kyungmin Park0c318622009-11-17 08:41:24 +0100156 &s3c_device_hsmmc0,
157 &s3c_device_hsmmc1,
158 &s3c_device_hsmmc2,
Kyungmin Park079b0322009-11-17 08:41:20 +0100159 &smdkc100_lcd_powerdev,
Jassi Brar99c56e02010-05-18 16:02:44 +0900160 &s5pc100_device_iis0,
161 &s5pc100_device_ac97,
Byungho Mine1197662009-06-23 21:40:28 +0900162};
163
164static void __init smdkc100_map_io(void)
165{
Marek Szyprowskiacc84702010-05-20 07:51:08 +0200166 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
Byungho Mine1197662009-06-23 21:40:28 +0900167 s3c24xx_init_clocks(12000000);
168 s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs));
169}
170
171static void __init smdkc100_machine_init(void)
172{
Kyungmin Park067f1312009-11-17 08:41:22 +0100173 /* I2C */
174 s3c_i2c0_set_platdata(NULL);
175 s3c_i2c1_set_platdata(NULL);
176 i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
177 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
178
Kyungmin Park079b0322009-11-17 08:41:20 +0100179 s3c_fb_set_platdata(&smdkc100_lcd_pdata);
180
181 /* LCD init */
182 gpio_request(S5PC100_GPD(0), "GPD");
183 gpio_request(S5PC100_GPH0(6), "GPH0");
184 smdkc100_lcd_power_set(&smdkc100_lcd_power_data, 0);
Byungho Mine1197662009-06-23 21:40:28 +0900185 platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices));
186}
187
188MACHINE_START(SMDKC100, "SMDKC100")
189 /* Maintainer: Byungho Min <bhmin@samsung.com> */
Marek Szyprowskiacc84702010-05-20 07:51:08 +0200190 .phys_io = S3C_PA_UART & 0xfff00000,
191 .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
192 .boot_params = S5P_PA_SDRAM + 0x100,
Byungho Mine1197662009-06-23 21:40:28 +0900193 .init_irq = s5pc100_init_irq,
194 .map_io = smdkc100_map_io,
195 .init_machine = smdkc100_machine_init,
196 .timer = &s3c24xx_timer,
197MACHINE_END