blob: 4a1250cd1356b364c5a4c38160610caadccf3292 [file] [log] [blame]
Kukjin Kim6f315cb2010-09-01 13:03:39 +09001/* linux/arch/arm/mach-s5p64x0/mach-smdk6440.c
Kukjin Kimd25168e2010-01-14 08:22:00 +09002 *
Kukjin Kim6f315cb2010-09-01 13:03:39 +09003 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
Kukjin Kimd25168e2010-01-14 08:22:00 +09005 *
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>
Naveen Krishna Ch2c978862010-08-06 19:32:43 +090018#include <linux/i2c.h>
Kukjin Kimd25168e2010-01-14 08:22:00 +090019#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>
Kukjin Kim6f315cb2010-09-01 13:03:39 +090024#include <linux/gpio.h>
Banajit Goswamifec524a2011-02-28 20:31:27 +053025#include <linux/pwm_backlight.h>
Ajay Kumar1030e5c2011-09-27 07:51:22 +090026#include <linux/fb.h>
27
28#include <video/platform_lcd.h>
Kukjin Kimd25168e2010-01-14 08:22:00 +090029
30#include <asm/mach/arch.h>
31#include <asm/mach/map.h>
Kukjin Kimd25168e2010-01-14 08:22:00 +090032#include <asm/irq.h>
33#include <asm/mach-types.h>
34
Kukjin Kim6f315cb2010-09-01 13:03:39 +090035#include <mach/hardware.h>
36#include <mach/map.h>
37#include <mach/regs-clock.h>
38#include <mach/i2c.h>
Banajit Goswamifec524a2011-02-28 20:31:27 +053039#include <mach/regs-gpio.h>
Kukjin Kimd25168e2010-01-14 08:22:00 +090040
Kukjin Kim6f315cb2010-09-01 13:03:39 +090041#include <plat/regs-serial.h>
42#include <plat/gpio-cfg.h>
Kukjin Kimd25168e2010-01-14 08:22:00 +090043#include <plat/s5p6440.h>
44#include <plat/clock.h>
Kukjin Kimd25168e2010-01-14 08:22:00 +090045#include <plat/devs.h>
46#include <plat/cpu.h>
Naveen Krishna Ch2c978862010-08-06 19:32:43 +090047#include <plat/iic.h>
Kukjin Kimd25168e2010-01-14 08:22:00 +090048#include <plat/pll.h>
Naveen Krishna Ch09cae8f2010-05-20 11:39:53 +090049#include <plat/adc.h>
50#include <plat/ts.h>
Sangbeom Kim20780fc2011-03-12 08:02:12 +090051#include <plat/s5p-time.h>
Banajit Goswami499d2962011-07-20 23:45:22 +090052#include <plat/backlight.h>
Ajay Kumar1030e5c2011-09-27 07:51:22 +090053#include <plat/fb.h>
54#include <plat/regs-fb.h>
Kukjin Kimd25168e2010-01-14 08:22:00 +090055
Kukjin Kimc8def082010-07-21 09:19:51 +090056#define SMDK6440_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
Kukjin Kimd25168e2010-01-14 08:22:00 +090057 S3C2410_UCON_RXILEVEL | \
58 S3C2410_UCON_TXIRQMODE | \
59 S3C2410_UCON_RXIRQMODE | \
60 S3C2410_UCON_RXFIFO_TOI | \
61 S3C2443_UCON_RXERR_IRQEN)
62
Kukjin Kimc8def082010-07-21 09:19:51 +090063#define SMDK6440_ULCON_DEFAULT S3C2410_LCON_CS8
Kukjin Kimd25168e2010-01-14 08:22:00 +090064
Kukjin Kimc8def082010-07-21 09:19:51 +090065#define SMDK6440_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
Kukjin Kimd25168e2010-01-14 08:22:00 +090066 S3C2440_UFCON_TXTRIG16 | \
67 S3C2410_UFCON_RXTRIG8)
68
69static struct s3c2410_uartcfg smdk6440_uartcfgs[] __initdata = {
70 [0] = {
Kukjin Kim6f315cb2010-09-01 13:03:39 +090071 .hwport = 0,
72 .flags = 0,
73 .ucon = SMDK6440_UCON_DEFAULT,
74 .ulcon = SMDK6440_ULCON_DEFAULT,
75 .ufcon = SMDK6440_UFCON_DEFAULT,
Kukjin Kimd25168e2010-01-14 08:22:00 +090076 },
77 [1] = {
Kukjin Kim6f315cb2010-09-01 13:03:39 +090078 .hwport = 1,
79 .flags = 0,
80 .ucon = SMDK6440_UCON_DEFAULT,
81 .ulcon = SMDK6440_ULCON_DEFAULT,
82 .ufcon = SMDK6440_UFCON_DEFAULT,
Kukjin Kimd25168e2010-01-14 08:22:00 +090083 },
84 [2] = {
Kukjin Kim6f315cb2010-09-01 13:03:39 +090085 .hwport = 2,
86 .flags = 0,
87 .ucon = SMDK6440_UCON_DEFAULT,
88 .ulcon = SMDK6440_ULCON_DEFAULT,
89 .ufcon = SMDK6440_UFCON_DEFAULT,
Kukjin Kimd25168e2010-01-14 08:22:00 +090090 },
91 [3] = {
Kukjin Kim6f315cb2010-09-01 13:03:39 +090092 .hwport = 3,
93 .flags = 0,
94 .ucon = SMDK6440_UCON_DEFAULT,
95 .ulcon = SMDK6440_ULCON_DEFAULT,
96 .ufcon = SMDK6440_UFCON_DEFAULT,
Kukjin Kimd25168e2010-01-14 08:22:00 +090097 },
98};
99
Ajay Kumar1030e5c2011-09-27 07:51:22 +0900100/* Frame Buffer */
101static struct s3c_fb_pd_win smdk6440_fb_win0 = {
102 .win_mode = {
103 .left_margin = 8,
104 .right_margin = 13,
105 .upper_margin = 7,
106 .lower_margin = 5,
107 .hsync_len = 3,
108 .vsync_len = 1,
109 .xres = 800,
110 .yres = 480,
111 },
112 .max_bpp = 32,
113 .default_bpp = 24,
114};
115
116static struct s3c_fb_platdata smdk6440_lcd_pdata __initdata = {
117 .win[0] = &smdk6440_fb_win0,
118 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
119 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
120 .setup_gpio = s5p64x0_fb_gpio_setup_24bpp,
121};
122
123/* LCD power controller */
124static void smdk6440_lte480_reset_power(struct plat_lcd_data *pd,
125 unsigned int power)
126{
127 int err;
128
129 if (power) {
130 err = gpio_request(S5P6440_GPN(5), "GPN");
131 if (err) {
132 printk(KERN_ERR "failed to request GPN for lcd reset\n");
133 return;
134 }
135
136 gpio_direction_output(S5P6440_GPN(5), 1);
137 gpio_set_value(S5P6440_GPN(5), 0);
138 gpio_set_value(S5P6440_GPN(5), 1);
139 gpio_free(S5P6440_GPN(5));
140 }
141}
142
143static struct plat_lcd_data smdk6440_lcd_power_data = {
144 .set_power = smdk6440_lte480_reset_power,
145};
146
147static struct platform_device smdk6440_lcd_lte480wv = {
148 .name = "platform-lcd",
149 .dev.parent = &s3c_device_fb.dev,
150 .dev.platform_data = &smdk6440_lcd_power_data,
151};
152
Kukjin Kimd25168e2010-01-14 08:22:00 +0900153static struct platform_device *smdk6440_devices[] __initdata = {
Naveen Krishna Ch09cae8f2010-05-20 11:39:53 +0900154 &s3c_device_adc,
Atul Dahiyaff7124a2010-07-21 17:32:56 +0900155 &s3c_device_rtc,
Naveen Krishna Ch2c978862010-08-06 19:32:43 +0900156 &s3c_device_i2c0,
157 &s3c_device_i2c1,
Naveen Krishna Ch09cae8f2010-05-20 11:39:53 +0900158 &s3c_device_ts,
Banajit Goswamia0cce452010-05-20 16:21:31 +0900159 &s3c_device_wdt,
Jassi Brar8418f882010-12-30 09:11:10 +0900160 &samsung_asoc_dma,
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900161 &s5p6440_device_iis,
Ajay Kumar1030e5c2011-09-27 07:51:22 +0900162 &s3c_device_fb,
163 &smdk6440_lcd_lte480wv,
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900164};
165
166static struct s3c2410_platform_i2c s5p6440_i2c0_data __initdata = {
167 .flags = 0,
168 .slave_addr = 0x10,
169 .frequency = 100*1000,
170 .sda_delay = 100,
171 .cfg_gpio = s5p6440_i2c0_cfg_gpio,
172};
173
174static struct s3c2410_platform_i2c s5p6440_i2c1_data __initdata = {
175 .flags = 0,
176 .bus_num = 1,
177 .slave_addr = 0x10,
178 .frequency = 100*1000,
179 .sda_delay = 100,
180 .cfg_gpio = s5p6440_i2c1_cfg_gpio,
Naveen Krishna Ch09cae8f2010-05-20 11:39:53 +0900181};
182
Naveen Krishna Ch2c978862010-08-06 19:32:43 +0900183static struct i2c_board_info smdk6440_i2c_devs0[] __initdata = {
184 { I2C_BOARD_INFO("24c08", 0x50), },
Jassi Brar149bb5b2010-12-21 09:46:29 +0900185 { I2C_BOARD_INFO("wm8580", 0x1b), },
Naveen Krishna Ch2c978862010-08-06 19:32:43 +0900186};
187
188static struct i2c_board_info smdk6440_i2c_devs1[] __initdata = {
189 /* To be populated */
190};
191
Banajit Goswami499d2962011-07-20 23:45:22 +0900192/* LCD Backlight data */
193static struct samsung_bl_gpio_info smdk6440_bl_gpio_info = {
194 .no = S5P6440_GPF(15),
195 .func = S3C_GPIO_SFN(2),
196};
197
198static struct platform_pwm_backlight_data smdk6440_bl_data = {
199 .pwm_id = 1,
200};
201
Kukjin Kimd25168e2010-01-14 08:22:00 +0900202static void __init smdk6440_map_io(void)
203{
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900204 s5p_init_io(NULL, 0, S5P64X0_SYS_ID);
Kukjin Kimd25168e2010-01-14 08:22:00 +0900205 s3c24xx_init_clocks(12000000);
206 s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs));
Sangbeom Kim20780fc2011-03-12 08:02:12 +0900207 s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
Kukjin Kimd25168e2010-01-14 08:22:00 +0900208}
209
Ajay Kumar1030e5c2011-09-27 07:51:22 +0900210static void s5p6440_set_lcd_interface(void)
211{
212 unsigned int cfg;
213
214 /* select TFT LCD type (RGB I/F) */
215 cfg = __raw_readl(S5P64X0_SPCON0);
216 cfg &= ~S5P64X0_SPCON0_LCD_SEL_MASK;
217 cfg |= S5P64X0_SPCON0_LCD_SEL_RGB;
218 __raw_writel(cfg, S5P64X0_SPCON0);
219}
220
Kukjin Kimd25168e2010-01-14 08:22:00 +0900221static void __init smdk6440_machine_init(void)
222{
Naveen Krishna Chatradhi08047652011-08-19 21:56:10 +0900223 s3c24xx_ts_set_platdata(NULL);
Naveen Krishna Ch09cae8f2010-05-20 11:39:53 +0900224
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900225 s3c_i2c0_set_platdata(&s5p6440_i2c0_data);
226 s3c_i2c1_set_platdata(&s5p6440_i2c1_data);
Naveen Krishna Ch2c978862010-08-06 19:32:43 +0900227 i2c_register_board_info(0, smdk6440_i2c_devs0,
228 ARRAY_SIZE(smdk6440_i2c_devs0));
229 i2c_register_board_info(1, smdk6440_i2c_devs1,
230 ARRAY_SIZE(smdk6440_i2c_devs1));
231
Banajit Goswami499d2962011-07-20 23:45:22 +0900232 samsung_bl_set(&smdk6440_bl_gpio_info, &smdk6440_bl_data);
233
Ajay Kumar1030e5c2011-09-27 07:51:22 +0900234 s5p6440_set_lcd_interface();
235 s3c_fb_set_platdata(&smdk6440_lcd_pdata);
236
Kukjin Kimd25168e2010-01-14 08:22:00 +0900237 platform_add_devices(smdk6440_devices, ARRAY_SIZE(smdk6440_devices));
238}
239
240MACHINE_START(SMDK6440, "SMDK6440")
241 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
Nicolas Pitre32bc8202011-07-05 22:38:17 -0400242 .atag_offset = 0x100,
Kukjin Kimd25168e2010-01-14 08:22:00 +0900243
244 .init_irq = s5p6440_init_irq,
245 .map_io = smdk6440_map_io,
246 .init_machine = smdk6440_machine_init,
Sangbeom Kim20780fc2011-03-12 08:02:12 +0900247 .timer = &s5p_timer,
Kukjin Kimd25168e2010-01-14 08:22:00 +0900248MACHINE_END