blob: 92b5de1465b7551ba0d50e72b84c88952f90aae4 [file] [log] [blame]
Kukjin Kim6f315cb2010-09-01 13:03:39 +09001/* 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>
Banajit Goswamib0fd6442011-02-28 23:31:17 +053025#include <linux/pwm_backlight.h>
Ajay Kumar73017942011-09-27 07:53:20 +090026#include <linux/fb.h>
27
28#include <video/platform_lcd.h>
Kukjin Kim6f315cb2010-09-01 13:03:39 +090029
30#include <asm/mach/arch.h>
31#include <asm/mach/map.h>
32#include <asm/irq.h>
33#include <asm/mach-types.h>
34
35#include <mach/hardware.h>
36#include <mach/map.h>
37#include <mach/regs-clock.h>
38#include <mach/i2c.h>
Banajit Goswamib0fd6442011-02-28 23:31:17 +053039#include <mach/regs-gpio.h>
Kukjin Kim6f315cb2010-09-01 13:03:39 +090040
41#include <plat/regs-serial.h>
42#include <plat/gpio-cfg.h>
43#include <plat/s5p6450.h>
44#include <plat/clock.h>
45#include <plat/devs.h>
46#include <plat/cpu.h>
47#include <plat/iic.h>
48#include <plat/pll.h>
49#include <plat/adc.h>
50#include <plat/ts.h>
Sangbeom Kim20780fc2011-03-12 08:02:12 +090051#include <plat/s5p-time.h>
Banajit Goswami543601f2011-07-20 23:45:22 +090052#include <plat/backlight.h>
Ajay Kumar73017942011-09-27 07:53:20 +090053#include <plat/fb.h>
54#include <plat/regs-fb.h>
Kukjin Kim6f315cb2010-09-01 13:03:39 +090055
56#define SMDK6450_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
57 S3C2410_UCON_RXILEVEL | \
58 S3C2410_UCON_TXIRQMODE | \
59 S3C2410_UCON_RXIRQMODE | \
60 S3C2410_UCON_RXFIFO_TOI | \
61 S3C2443_UCON_RXERR_IRQEN)
62
63#define SMDK6450_ULCON_DEFAULT S3C2410_LCON_CS8
64
65#define SMDK6450_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
66 S3C2440_UFCON_TXTRIG16 | \
67 S3C2410_UFCON_RXTRIG8)
68
69static struct s3c2410_uartcfg smdk6450_uartcfgs[] __initdata = {
70 [0] = {
71 .hwport = 0,
72 .flags = 0,
73 .ucon = SMDK6450_UCON_DEFAULT,
74 .ulcon = SMDK6450_ULCON_DEFAULT,
75 .ufcon = SMDK6450_UFCON_DEFAULT,
76 },
77 [1] = {
78 .hwport = 1,
79 .flags = 0,
80 .ucon = SMDK6450_UCON_DEFAULT,
81 .ulcon = SMDK6450_ULCON_DEFAULT,
82 .ufcon = SMDK6450_UFCON_DEFAULT,
83 },
84 [2] = {
85 .hwport = 2,
86 .flags = 0,
87 .ucon = SMDK6450_UCON_DEFAULT,
88 .ulcon = SMDK6450_ULCON_DEFAULT,
89 .ufcon = SMDK6450_UFCON_DEFAULT,
90 },
91 [3] = {
92 .hwport = 3,
93 .flags = 0,
94 .ucon = SMDK6450_UCON_DEFAULT,
95 .ulcon = SMDK6450_ULCON_DEFAULT,
96 .ufcon = SMDK6450_UFCON_DEFAULT,
97 },
98#if CONFIG_SERIAL_SAMSUNG_UARTS > 4
99 [4] = {
100 .hwport = 4,
101 .flags = 0,
102 .ucon = SMDK6450_UCON_DEFAULT,
103 .ulcon = SMDK6450_ULCON_DEFAULT,
104 .ufcon = SMDK6450_UFCON_DEFAULT,
105 },
106#endif
107#if CONFIG_SERIAL_SAMSUNG_UARTS > 5
108 [5] = {
109 .hwport = 5,
110 .flags = 0,
111 .ucon = SMDK6450_UCON_DEFAULT,
112 .ulcon = SMDK6450_ULCON_DEFAULT,
113 .ufcon = SMDK6450_UFCON_DEFAULT,
114 },
115#endif
116};
117
Ajay Kumar73017942011-09-27 07:53:20 +0900118/* Frame Buffer */
119static struct s3c_fb_pd_win smdk6450_fb_win0 = {
120 .win_mode = {
121 .left_margin = 8,
122 .right_margin = 13,
123 .upper_margin = 7,
124 .lower_margin = 5,
125 .hsync_len = 3,
126 .vsync_len = 1,
127 .xres = 800,
128 .yres = 480,
129 },
130 .max_bpp = 32,
131 .default_bpp = 24,
132};
133
134static struct s3c_fb_platdata smdk6450_lcd_pdata __initdata = {
135 .win[0] = &smdk6450_fb_win0,
136 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
137 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
138 .setup_gpio = s5p64x0_fb_gpio_setup_24bpp,
139};
140
141/* LCD power controller */
142static void smdk6450_lte480_reset_power(struct plat_lcd_data *pd,
143 unsigned int power)
144{
145 int err;
146
147 if (power) {
148 err = gpio_request(S5P6450_GPN(5), "GPN");
149 if (err) {
150 printk(KERN_ERR "failed to request GPN for lcd reset\n");
151 return;
152 }
153
154 gpio_direction_output(S5P6450_GPN(5), 1);
155 gpio_set_value(S5P6450_GPN(5), 0);
156 gpio_set_value(S5P6450_GPN(5), 1);
157 gpio_free(S5P6450_GPN(5));
158 }
159}
160
161static struct plat_lcd_data smdk6450_lcd_power_data = {
162 .set_power = smdk6450_lte480_reset_power,
163};
164
165static struct platform_device smdk6450_lcd_lte480wv = {
166 .name = "platform-lcd",
167 .dev.parent = &s3c_device_fb.dev,
168 .dev.platform_data = &smdk6450_lcd_power_data,
169};
170
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900171static struct platform_device *smdk6450_devices[] __initdata = {
172 &s3c_device_adc,
173 &s3c_device_rtc,
174 &s3c_device_i2c0,
175 &s3c_device_i2c1,
176 &s3c_device_ts,
177 &s3c_device_wdt,
Jassi Brarbe370ad2010-12-30 09:12:32 +0900178 &samsung_asoc_dma,
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900179 &s5p6450_device_iis0,
Ajay Kumar73017942011-09-27 07:53:20 +0900180 &s3c_device_fb,
181 &smdk6450_lcd_lte480wv,
182
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900183 /* s5p6450_device_spi0 will be added */
184};
185
186static struct s3c2410_platform_i2c s5p6450_i2c0_data __initdata = {
187 .flags = 0,
188 .slave_addr = 0x10,
189 .frequency = 100*1000,
190 .sda_delay = 100,
191 .cfg_gpio = s5p6450_i2c0_cfg_gpio,
192};
193
194static struct s3c2410_platform_i2c s5p6450_i2c1_data __initdata = {
195 .flags = 0,
196 .bus_num = 1,
197 .slave_addr = 0x10,
198 .frequency = 100*1000,
199 .sda_delay = 100,
200 .cfg_gpio = s5p6450_i2c1_cfg_gpio,
201};
202
203static struct i2c_board_info smdk6450_i2c_devs0[] __initdata = {
Jassi Brarfcf88972010-12-21 09:48:32 +0900204 { I2C_BOARD_INFO("wm8580", 0x1b), },
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900205 { I2C_BOARD_INFO("24c08", 0x50), }, /* Samsung KS24C080C EEPROM */
206};
207
208static struct i2c_board_info smdk6450_i2c_devs1[] __initdata = {
209 { I2C_BOARD_INFO("24c128", 0x57), },/* Samsung S524AD0XD1 EEPROM */
210};
211
212static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
213 .delay = 10000,
214 .presc = 49,
215 .oversampling_shift = 2,
216};
217
Banajit Goswami543601f2011-07-20 23:45:22 +0900218/* LCD Backlight data */
219static struct samsung_bl_gpio_info smdk6450_bl_gpio_info = {
220 .no = S5P6450_GPF(15),
221 .func = S3C_GPIO_SFN(2),
222};
223
224static struct platform_pwm_backlight_data smdk6450_bl_data = {
225 .pwm_id = 1,
226};
227
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900228static void __init smdk6450_map_io(void)
229{
230 s5p_init_io(NULL, 0, S5P64X0_SYS_ID);
231 s3c24xx_init_clocks(19200000);
232 s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs));
Sangbeom Kim20780fc2011-03-12 08:02:12 +0900233 s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900234}
235
Ajay Kumar73017942011-09-27 07:53:20 +0900236static void s5p6450_set_lcd_interface(void)
237{
238 unsigned int cfg;
239
240 /* select TFT LCD type (RGB I/F) */
241 cfg = __raw_readl(S5P64X0_SPCON0);
242 cfg &= ~S5P64X0_SPCON0_LCD_SEL_MASK;
243 cfg |= S5P64X0_SPCON0_LCD_SEL_RGB;
244 __raw_writel(cfg, S5P64X0_SPCON0);
245}
246
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900247static void __init smdk6450_machine_init(void)
248{
249 s3c24xx_ts_set_platdata(&s3c_ts_platform);
250
251 s3c_i2c0_set_platdata(&s5p6450_i2c0_data);
252 s3c_i2c1_set_platdata(&s5p6450_i2c1_data);
253 i2c_register_board_info(0, smdk6450_i2c_devs0,
254 ARRAY_SIZE(smdk6450_i2c_devs0));
255 i2c_register_board_info(1, smdk6450_i2c_devs1,
256 ARRAY_SIZE(smdk6450_i2c_devs1));
257
Banajit Goswami543601f2011-07-20 23:45:22 +0900258 samsung_bl_set(&smdk6450_bl_gpio_info, &smdk6450_bl_data);
259
Ajay Kumar73017942011-09-27 07:53:20 +0900260 s5p6450_set_lcd_interface();
261 s3c_fb_set_platdata(&smdk6450_lcd_pdata);
262
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900263 platform_add_devices(smdk6450_devices, ARRAY_SIZE(smdk6450_devices));
264}
265
266MACHINE_START(SMDK6450, "SMDK6450")
267 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900268 .boot_params = S5P64X0_PA_SDRAM + 0x100,
269
270 .init_irq = s5p6450_init_irq,
271 .map_io = smdk6450_map_io,
272 .init_machine = smdk6450_machine_init,
Sangbeom Kim20780fc2011-03-12 08:02:12 +0900273 .timer = &s5p_timer,
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900274MACHINE_END