ARM: delete struct sys_timer
[deliverable/linux.git] / arch / arm / mach-s5p64x0 / mach-smdk6450.c
CommitLineData
6f315cb5
KK
1/* linux/arch/arm/mach-s5p64x0/mach-smdk6450.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.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#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/interrupt.h>
14#include <linux/list.h>
15#include <linux/timer.h>
16#include <linux/delay.h>
17#include <linux/init.h>
18#include <linux/i2c.h>
19#include <linux/serial_core.h>
20#include <linux/platform_device.h>
21#include <linux/io.h>
22#include <linux/module.h>
23#include <linux/clk.h>
24#include <linux/gpio.h>
b0fd644f 25#include <linux/pwm_backlight.h>
7301794c 26#include <linux/fb.h>
6640790c 27#include <linux/mmc/host.h>
7301794c
AK
28
29#include <video/platform_lcd.h>
5a213a55 30#include <video/samsung_fimd.h>
6f315cb5 31
bb3a4ebe 32#include <asm/hardware/vic.h>
6f315cb5
KK
33#include <asm/mach/arch.h>
34#include <asm/mach/map.h>
35#include <asm/irq.h>
36#include <asm/mach-types.h>
37
38#include <mach/hardware.h>
39#include <mach/map.h>
40#include <mach/regs-clock.h>
41#include <mach/i2c.h>
b0fd644f 42#include <mach/regs-gpio.h>
6f315cb5
KK
43
44#include <plat/regs-serial.h>
45#include <plat/gpio-cfg.h>
6f315cb5
KK
46#include <plat/clock.h>
47#include <plat/devs.h>
48#include <plat/cpu.h>
436d42c6 49#include <linux/platform_data/i2c-s3c2410.h>
6f315cb5
KK
50#include <plat/pll.h>
51#include <plat/adc.h>
436d42c6 52#include <linux/platform_data/touchscreen-s3c2410.h>
20780fcc 53#include <plat/s5p-time.h>
543601f5 54#include <plat/backlight.h>
7301794c 55#include <plat/fb.h>
6640790c 56#include <plat/sdhci.h>
6f315cb5 57
95af214b
KK
58#include "common.h"
59
6f315cb5
KK
60#define SMDK6450_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
61 S3C2410_UCON_RXILEVEL | \
62 S3C2410_UCON_TXIRQMODE | \
63 S3C2410_UCON_RXIRQMODE | \
64 S3C2410_UCON_RXFIFO_TOI | \
65 S3C2443_UCON_RXERR_IRQEN)
66
67#define SMDK6450_ULCON_DEFAULT S3C2410_LCON_CS8
68
69#define SMDK6450_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
70 S3C2440_UFCON_TXTRIG16 | \
71 S3C2410_UFCON_RXTRIG8)
72
73static struct s3c2410_uartcfg smdk6450_uartcfgs[] __initdata = {
74 [0] = {
75 .hwport = 0,
76 .flags = 0,
77 .ucon = SMDK6450_UCON_DEFAULT,
78 .ulcon = SMDK6450_ULCON_DEFAULT,
79 .ufcon = SMDK6450_UFCON_DEFAULT,
80 },
81 [1] = {
82 .hwport = 1,
83 .flags = 0,
84 .ucon = SMDK6450_UCON_DEFAULT,
85 .ulcon = SMDK6450_ULCON_DEFAULT,
86 .ufcon = SMDK6450_UFCON_DEFAULT,
87 },
88 [2] = {
89 .hwport = 2,
90 .flags = 0,
91 .ucon = SMDK6450_UCON_DEFAULT,
92 .ulcon = SMDK6450_ULCON_DEFAULT,
93 .ufcon = SMDK6450_UFCON_DEFAULT,
94 },
95 [3] = {
96 .hwport = 3,
97 .flags = 0,
98 .ucon = SMDK6450_UCON_DEFAULT,
99 .ulcon = SMDK6450_ULCON_DEFAULT,
100 .ufcon = SMDK6450_UFCON_DEFAULT,
101 },
102#if CONFIG_SERIAL_SAMSUNG_UARTS > 4
103 [4] = {
104 .hwport = 4,
105 .flags = 0,
106 .ucon = SMDK6450_UCON_DEFAULT,
107 .ulcon = SMDK6450_ULCON_DEFAULT,
108 .ufcon = SMDK6450_UFCON_DEFAULT,
109 },
110#endif
111#if CONFIG_SERIAL_SAMSUNG_UARTS > 5
112 [5] = {
113 .hwport = 5,
114 .flags = 0,
115 .ucon = SMDK6450_UCON_DEFAULT,
116 .ulcon = SMDK6450_ULCON_DEFAULT,
117 .ufcon = SMDK6450_UFCON_DEFAULT,
118 },
119#endif
120};
121
7301794c
AK
122/* Frame Buffer */
123static struct s3c_fb_pd_win smdk6450_fb_win0 = {
7301794c
AK
124 .max_bpp = 32,
125 .default_bpp = 24,
79d3c41a
TA
126 .xres = 800,
127 .yres = 480,
128};
129
130static struct fb_videomode smdk6450_lcd_timing = {
131 .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,
7301794c
AK
139};
140
141static struct s3c_fb_platdata smdk6450_lcd_pdata __initdata = {
142 .win[0] = &smdk6450_fb_win0,
79d3c41a 143 .vtiming = &smdk6450_lcd_timing,
7301794c
AK
144 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
145 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
146 .setup_gpio = s5p64x0_fb_gpio_setup_24bpp,
147};
148
149/* LCD power controller */
150static void smdk6450_lte480_reset_power(struct plat_lcd_data *pd,
151 unsigned int power)
152{
153 int err;
154
155 if (power) {
156 err = gpio_request(S5P6450_GPN(5), "GPN");
157 if (err) {
158 printk(KERN_ERR "failed to request GPN for lcd reset\n");
159 return;
160 }
161
162 gpio_direction_output(S5P6450_GPN(5), 1);
163 gpio_set_value(S5P6450_GPN(5), 0);
164 gpio_set_value(S5P6450_GPN(5), 1);
165 gpio_free(S5P6450_GPN(5));
166 }
167}
168
169static struct plat_lcd_data smdk6450_lcd_power_data = {
170 .set_power = smdk6450_lte480_reset_power,
171};
172
173static struct platform_device smdk6450_lcd_lte480wv = {
174 .name = "platform-lcd",
175 .dev.parent = &s3c_device_fb.dev,
176 .dev.platform_data = &smdk6450_lcd_power_data,
177};
178
6f315cb5
KK
179static struct platform_device *smdk6450_devices[] __initdata = {
180 &s3c_device_adc,
181 &s3c_device_rtc,
182 &s3c_device_i2c0,
183 &s3c_device_i2c1,
184 &s3c_device_ts,
185 &s3c_device_wdt,
186 &s5p6450_device_iis0,
7301794c
AK
187 &s3c_device_fb,
188 &smdk6450_lcd_lte480wv,
6640790c
RS
189 &s3c_device_hsmmc0,
190 &s3c_device_hsmmc1,
191 &s3c_device_hsmmc2,
6f315cb5
KK
192 /* s5p6450_device_spi0 will be added */
193};
194
6640790c
RS
195static struct s3c_sdhci_platdata smdk6450_hsmmc0_pdata __initdata = {
196 .cd_type = S3C_SDHCI_CD_NONE,
197};
198
199static struct s3c_sdhci_platdata smdk6450_hsmmc1_pdata __initdata = {
200 .cd_type = S3C_SDHCI_CD_NONE,
201#if defined(CONFIG_S5P64X0_SD_CH1_8BIT)
202 .max_width = 8,
203 .host_caps = MMC_CAP_8_BIT_DATA,
204#endif
205};
206
207static struct s3c_sdhci_platdata smdk6450_hsmmc2_pdata __initdata = {
208 .cd_type = S3C_SDHCI_CD_NONE,
209};
210
6f315cb5
KK
211static struct s3c2410_platform_i2c s5p6450_i2c0_data __initdata = {
212 .flags = 0,
213 .slave_addr = 0x10,
214 .frequency = 100*1000,
215 .sda_delay = 100,
216 .cfg_gpio = s5p6450_i2c0_cfg_gpio,
217};
218
219static struct s3c2410_platform_i2c s5p6450_i2c1_data __initdata = {
220 .flags = 0,
221 .bus_num = 1,
222 .slave_addr = 0x10,
223 .frequency = 100*1000,
224 .sda_delay = 100,
225 .cfg_gpio = s5p6450_i2c1_cfg_gpio,
226};
227
228static struct i2c_board_info smdk6450_i2c_devs0[] __initdata = {
fcf8897d 229 { I2C_BOARD_INFO("wm8580", 0x1b), },
6f315cb5
KK
230 { I2C_BOARD_INFO("24c08", 0x50), }, /* Samsung KS24C080C EEPROM */
231};
232
233static struct i2c_board_info smdk6450_i2c_devs1[] __initdata = {
234 { I2C_BOARD_INFO("24c128", 0x57), },/* Samsung S524AD0XD1 EEPROM */
235};
236
543601f5
BG
237/* LCD Backlight data */
238static struct samsung_bl_gpio_info smdk6450_bl_gpio_info = {
239 .no = S5P6450_GPF(15),
240 .func = S3C_GPIO_SFN(2),
241};
242
243static struct platform_pwm_backlight_data smdk6450_bl_data = {
244 .pwm_id = 1,
245};
246
6f315cb5
KK
247static void __init smdk6450_map_io(void)
248{
95af214b 249 s5p64x0_init_io(NULL, 0);
6f315cb5
KK
250 s3c24xx_init_clocks(19200000);
251 s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs));
20780fcc 252 s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
6f315cb5
KK
253}
254
7301794c
AK
255static void s5p6450_set_lcd_interface(void)
256{
257 unsigned int cfg;
258
259 /* select TFT LCD type (RGB I/F) */
260 cfg = __raw_readl(S5P64X0_SPCON0);
261 cfg &= ~S5P64X0_SPCON0_LCD_SEL_MASK;
262 cfg |= S5P64X0_SPCON0_LCD_SEL_RGB;
263 __raw_writel(cfg, S5P64X0_SPCON0);
264}
265
6f315cb5
KK
266static void __init smdk6450_machine_init(void)
267{
0804765a 268 s3c24xx_ts_set_platdata(NULL);
6f315cb5
KK
269
270 s3c_i2c0_set_platdata(&s5p6450_i2c0_data);
271 s3c_i2c1_set_platdata(&s5p6450_i2c1_data);
272 i2c_register_board_info(0, smdk6450_i2c_devs0,
273 ARRAY_SIZE(smdk6450_i2c_devs0));
274 i2c_register_board_info(1, smdk6450_i2c_devs1,
275 ARRAY_SIZE(smdk6450_i2c_devs1));
276
543601f5
BG
277 samsung_bl_set(&smdk6450_bl_gpio_info, &smdk6450_bl_data);
278
7301794c
AK
279 s5p6450_set_lcd_interface();
280 s3c_fb_set_platdata(&smdk6450_lcd_pdata);
281
6640790c
RS
282 s3c_sdhci0_set_platdata(&smdk6450_hsmmc0_pdata);
283 s3c_sdhci1_set_platdata(&smdk6450_hsmmc1_pdata);
284 s3c_sdhci2_set_platdata(&smdk6450_hsmmc2_pdata);
285
6f315cb5
KK
286 platform_add_devices(smdk6450_devices, ARRAY_SIZE(smdk6450_devices));
287}
288
289MACHINE_START(SMDK6450, "SMDK6450")
290 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
32bc8201 291 .atag_offset = 0x100,
6f315cb5
KK
292
293 .init_irq = s5p6450_init_irq,
bb3a4ebe 294 .handle_irq = vic_handle_irq,
6f315cb5
KK
295 .map_io = smdk6450_map_io,
296 .init_machine = smdk6450_machine_init,
6bb27d73 297 .init_time = s5p_timer_init,
73aed8b9 298 .restart = s5p64x0_restart,
6f315cb5 299MACHINE_END
This page took 0.14263 seconds and 5 git commands to generate.