blob: 90463ddcbe39f16febe638ae82f43ed733c218e7 [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>
Kukjin Kim6f315cb2010-09-01 13:03:39 +090043#include <plat/clock.h>
44#include <plat/devs.h>
45#include <plat/cpu.h>
46#include <plat/iic.h>
47#include <plat/pll.h>
48#include <plat/adc.h>
49#include <plat/ts.h>
Sangbeom Kim20780fc2011-03-12 08:02:12 +090050#include <plat/s5p-time.h>
Banajit Goswami543601f2011-07-20 23:45:22 +090051#include <plat/backlight.h>
Ajay Kumar73017942011-09-27 07:53:20 +090052#include <plat/fb.h>
53#include <plat/regs-fb.h>
Kukjin Kim6f315cb2010-09-01 13:03:39 +090054
Kukjin Kim95af2142011-12-22 23:28:28 +010055#include "common.h"
56
Kukjin Kim6f315cb2010-09-01 13:03:39 +090057#define SMDK6450_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
58 S3C2410_UCON_RXILEVEL | \
59 S3C2410_UCON_TXIRQMODE | \
60 S3C2410_UCON_RXIRQMODE | \
61 S3C2410_UCON_RXFIFO_TOI | \
62 S3C2443_UCON_RXERR_IRQEN)
63
64#define SMDK6450_ULCON_DEFAULT S3C2410_LCON_CS8
65
66#define SMDK6450_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
67 S3C2440_UFCON_TXTRIG16 | \
68 S3C2410_UFCON_RXTRIG8)
69
70static struct s3c2410_uartcfg smdk6450_uartcfgs[] __initdata = {
71 [0] = {
72 .hwport = 0,
73 .flags = 0,
74 .ucon = SMDK6450_UCON_DEFAULT,
75 .ulcon = SMDK6450_ULCON_DEFAULT,
76 .ufcon = SMDK6450_UFCON_DEFAULT,
77 },
78 [1] = {
79 .hwport = 1,
80 .flags = 0,
81 .ucon = SMDK6450_UCON_DEFAULT,
82 .ulcon = SMDK6450_ULCON_DEFAULT,
83 .ufcon = SMDK6450_UFCON_DEFAULT,
84 },
85 [2] = {
86 .hwport = 2,
87 .flags = 0,
88 .ucon = SMDK6450_UCON_DEFAULT,
89 .ulcon = SMDK6450_ULCON_DEFAULT,
90 .ufcon = SMDK6450_UFCON_DEFAULT,
91 },
92 [3] = {
93 .hwport = 3,
94 .flags = 0,
95 .ucon = SMDK6450_UCON_DEFAULT,
96 .ulcon = SMDK6450_ULCON_DEFAULT,
97 .ufcon = SMDK6450_UFCON_DEFAULT,
98 },
99#if CONFIG_SERIAL_SAMSUNG_UARTS > 4
100 [4] = {
101 .hwport = 4,
102 .flags = 0,
103 .ucon = SMDK6450_UCON_DEFAULT,
104 .ulcon = SMDK6450_ULCON_DEFAULT,
105 .ufcon = SMDK6450_UFCON_DEFAULT,
106 },
107#endif
108#if CONFIG_SERIAL_SAMSUNG_UARTS > 5
109 [5] = {
110 .hwport = 5,
111 .flags = 0,
112 .ucon = SMDK6450_UCON_DEFAULT,
113 .ulcon = SMDK6450_ULCON_DEFAULT,
114 .ufcon = SMDK6450_UFCON_DEFAULT,
115 },
116#endif
117};
118
Ajay Kumar73017942011-09-27 07:53:20 +0900119/* Frame Buffer */
120static struct s3c_fb_pd_win smdk6450_fb_win0 = {
121 .win_mode = {
122 .left_margin = 8,
123 .right_margin = 13,
124 .upper_margin = 7,
125 .lower_margin = 5,
126 .hsync_len = 3,
127 .vsync_len = 1,
128 .xres = 800,
129 .yres = 480,
130 },
131 .max_bpp = 32,
132 .default_bpp = 24,
133};
134
135static struct s3c_fb_platdata smdk6450_lcd_pdata __initdata = {
136 .win[0] = &smdk6450_fb_win0,
137 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
138 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
139 .setup_gpio = s5p64x0_fb_gpio_setup_24bpp,
140};
141
142/* LCD power controller */
143static void smdk6450_lte480_reset_power(struct plat_lcd_data *pd,
144 unsigned int power)
145{
146 int err;
147
148 if (power) {
149 err = gpio_request(S5P6450_GPN(5), "GPN");
150 if (err) {
151 printk(KERN_ERR "failed to request GPN for lcd reset\n");
152 return;
153 }
154
155 gpio_direction_output(S5P6450_GPN(5), 1);
156 gpio_set_value(S5P6450_GPN(5), 0);
157 gpio_set_value(S5P6450_GPN(5), 1);
158 gpio_free(S5P6450_GPN(5));
159 }
160}
161
162static struct plat_lcd_data smdk6450_lcd_power_data = {
163 .set_power = smdk6450_lte480_reset_power,
164};
165
166static struct platform_device smdk6450_lcd_lte480wv = {
167 .name = "platform-lcd",
168 .dev.parent = &s3c_device_fb.dev,
169 .dev.platform_data = &smdk6450_lcd_power_data,
170};
171
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900172static struct platform_device *smdk6450_devices[] __initdata = {
173 &s3c_device_adc,
174 &s3c_device_rtc,
175 &s3c_device_i2c0,
176 &s3c_device_i2c1,
177 &s3c_device_ts,
178 &s3c_device_wdt,
Jassi Brarbe370ad2010-12-30 09:12:32 +0900179 &samsung_asoc_dma,
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900180 &s5p6450_device_iis0,
Ajay Kumar73017942011-09-27 07:53:20 +0900181 &s3c_device_fb,
182 &smdk6450_lcd_lte480wv,
183
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900184 /* s5p6450_device_spi0 will be added */
185};
186
187static struct s3c2410_platform_i2c s5p6450_i2c0_data __initdata = {
188 .flags = 0,
189 .slave_addr = 0x10,
190 .frequency = 100*1000,
191 .sda_delay = 100,
192 .cfg_gpio = s5p6450_i2c0_cfg_gpio,
193};
194
195static struct s3c2410_platform_i2c s5p6450_i2c1_data __initdata = {
196 .flags = 0,
197 .bus_num = 1,
198 .slave_addr = 0x10,
199 .frequency = 100*1000,
200 .sda_delay = 100,
201 .cfg_gpio = s5p6450_i2c1_cfg_gpio,
202};
203
204static struct i2c_board_info smdk6450_i2c_devs0[] __initdata = {
Jassi Brarfcf88972010-12-21 09:48:32 +0900205 { I2C_BOARD_INFO("wm8580", 0x1b), },
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900206 { I2C_BOARD_INFO("24c08", 0x50), }, /* Samsung KS24C080C EEPROM */
207};
208
209static struct i2c_board_info smdk6450_i2c_devs1[] __initdata = {
210 { I2C_BOARD_INFO("24c128", 0x57), },/* Samsung S524AD0XD1 EEPROM */
211};
212
Banajit Goswami543601f2011-07-20 23:45:22 +0900213/* LCD Backlight data */
214static struct samsung_bl_gpio_info smdk6450_bl_gpio_info = {
215 .no = S5P6450_GPF(15),
216 .func = S3C_GPIO_SFN(2),
217};
218
219static struct platform_pwm_backlight_data smdk6450_bl_data = {
220 .pwm_id = 1,
221};
222
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900223static void __init smdk6450_map_io(void)
224{
Kukjin Kim95af2142011-12-22 23:28:28 +0100225 s5p64x0_init_io(NULL, 0);
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900226 s3c24xx_init_clocks(19200000);
227 s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs));
Sangbeom Kim20780fc2011-03-12 08:02:12 +0900228 s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900229}
230
Ajay Kumar73017942011-09-27 07:53:20 +0900231static void s5p6450_set_lcd_interface(void)
232{
233 unsigned int cfg;
234
235 /* select TFT LCD type (RGB I/F) */
236 cfg = __raw_readl(S5P64X0_SPCON0);
237 cfg &= ~S5P64X0_SPCON0_LCD_SEL_MASK;
238 cfg |= S5P64X0_SPCON0_LCD_SEL_RGB;
239 __raw_writel(cfg, S5P64X0_SPCON0);
240}
241
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900242static void __init smdk6450_machine_init(void)
243{
Naveen Krishna Chatradhi08047652011-08-19 21:56:10 +0900244 s3c24xx_ts_set_platdata(NULL);
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900245
246 s3c_i2c0_set_platdata(&s5p6450_i2c0_data);
247 s3c_i2c1_set_platdata(&s5p6450_i2c1_data);
248 i2c_register_board_info(0, smdk6450_i2c_devs0,
249 ARRAY_SIZE(smdk6450_i2c_devs0));
250 i2c_register_board_info(1, smdk6450_i2c_devs1,
251 ARRAY_SIZE(smdk6450_i2c_devs1));
252
Banajit Goswami543601f2011-07-20 23:45:22 +0900253 samsung_bl_set(&smdk6450_bl_gpio_info, &smdk6450_bl_data);
254
Ajay Kumar73017942011-09-27 07:53:20 +0900255 s5p6450_set_lcd_interface();
256 s3c_fb_set_platdata(&smdk6450_lcd_pdata);
257
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900258 platform_add_devices(smdk6450_devices, ARRAY_SIZE(smdk6450_devices));
259}
260
261MACHINE_START(SMDK6450, "SMDK6450")
262 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
Nicolas Pitre32bc8202011-07-05 22:38:17 -0400263 .atag_offset = 0x100,
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900264
265 .init_irq = s5p6450_init_irq,
266 .map_io = smdk6450_map_io,
267 .init_machine = smdk6450_machine_init,
Sangbeom Kim20780fc2011-03-12 08:02:12 +0900268 .timer = &s5p_timer,
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900269MACHINE_END