blob: a40e325d62c88d51adee0e6f0449535508042751 [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>
Rajeshwari Shinde66407902011-12-26 16:33:00 +090027#include <linux/mmc/host.h>
Ajay Kumar1030e5c2011-09-27 07:51:22 +090028
29#include <video/platform_lcd.h>
Kukjin Kimd25168e2010-01-14 08:22:00 +090030
Jamie Ilesbb3a4eb2011-09-27 20:53:31 +010031#include <asm/hardware/vic.h>
Kukjin Kimd25168e2010-01-14 08:22:00 +090032#include <asm/mach/arch.h>
33#include <asm/mach/map.h>
Kukjin Kimd25168e2010-01-14 08:22:00 +090034#include <asm/irq.h>
35#include <asm/mach-types.h>
36
Kukjin Kim6f315cb2010-09-01 13:03:39 +090037#include <mach/hardware.h>
38#include <mach/map.h>
39#include <mach/regs-clock.h>
40#include <mach/i2c.h>
Banajit Goswamifec524a2011-02-28 20:31:27 +053041#include <mach/regs-gpio.h>
Kukjin Kimd25168e2010-01-14 08:22:00 +090042
Kukjin Kim6f315cb2010-09-01 13:03:39 +090043#include <plat/regs-serial.h>
44#include <plat/gpio-cfg.h>
Kukjin Kimd25168e2010-01-14 08:22:00 +090045#include <plat/clock.h>
Kukjin Kimd25168e2010-01-14 08:22:00 +090046#include <plat/devs.h>
47#include <plat/cpu.h>
Naveen Krishna Ch2c978862010-08-06 19:32:43 +090048#include <plat/iic.h>
Kukjin Kimd25168e2010-01-14 08:22:00 +090049#include <plat/pll.h>
Naveen Krishna Ch09cae8f2010-05-20 11:39:53 +090050#include <plat/adc.h>
51#include <plat/ts.h>
Sangbeom Kim20780fc2011-03-12 08:02:12 +090052#include <plat/s5p-time.h>
Banajit Goswami499d2962011-07-20 23:45:22 +090053#include <plat/backlight.h>
Ajay Kumar1030e5c2011-09-27 07:51:22 +090054#include <plat/fb.h>
55#include <plat/regs-fb.h>
Rajeshwari Shinde66407902011-12-26 16:33:00 +090056#include <plat/sdhci.h>
Kukjin Kimd25168e2010-01-14 08:22:00 +090057
Kukjin Kim95af2142011-12-22 23:28:28 +010058#include "common.h"
59
Kukjin Kimc8def082010-07-21 09:19:51 +090060#define SMDK6440_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
Kukjin Kimd25168e2010-01-14 08:22:00 +090061 S3C2410_UCON_RXILEVEL | \
62 S3C2410_UCON_TXIRQMODE | \
63 S3C2410_UCON_RXIRQMODE | \
64 S3C2410_UCON_RXFIFO_TOI | \
65 S3C2443_UCON_RXERR_IRQEN)
66
Kukjin Kimc8def082010-07-21 09:19:51 +090067#define SMDK6440_ULCON_DEFAULT S3C2410_LCON_CS8
Kukjin Kimd25168e2010-01-14 08:22:00 +090068
Kukjin Kimc8def082010-07-21 09:19:51 +090069#define SMDK6440_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
Kukjin Kimd25168e2010-01-14 08:22:00 +090070 S3C2440_UFCON_TXTRIG16 | \
71 S3C2410_UFCON_RXTRIG8)
72
73static struct s3c2410_uartcfg smdk6440_uartcfgs[] __initdata = {
74 [0] = {
Kukjin Kim6f315cb2010-09-01 13:03:39 +090075 .hwport = 0,
76 .flags = 0,
77 .ucon = SMDK6440_UCON_DEFAULT,
78 .ulcon = SMDK6440_ULCON_DEFAULT,
79 .ufcon = SMDK6440_UFCON_DEFAULT,
Kukjin Kimd25168e2010-01-14 08:22:00 +090080 },
81 [1] = {
Kukjin Kim6f315cb2010-09-01 13:03:39 +090082 .hwport = 1,
83 .flags = 0,
84 .ucon = SMDK6440_UCON_DEFAULT,
85 .ulcon = SMDK6440_ULCON_DEFAULT,
86 .ufcon = SMDK6440_UFCON_DEFAULT,
Kukjin Kimd25168e2010-01-14 08:22:00 +090087 },
88 [2] = {
Kukjin Kim6f315cb2010-09-01 13:03:39 +090089 .hwport = 2,
90 .flags = 0,
91 .ucon = SMDK6440_UCON_DEFAULT,
92 .ulcon = SMDK6440_ULCON_DEFAULT,
93 .ufcon = SMDK6440_UFCON_DEFAULT,
Kukjin Kimd25168e2010-01-14 08:22:00 +090094 },
95 [3] = {
Kukjin Kim6f315cb2010-09-01 13:03:39 +090096 .hwport = 3,
97 .flags = 0,
98 .ucon = SMDK6440_UCON_DEFAULT,
99 .ulcon = SMDK6440_ULCON_DEFAULT,
100 .ufcon = SMDK6440_UFCON_DEFAULT,
Kukjin Kimd25168e2010-01-14 08:22:00 +0900101 },
102};
103
Ajay Kumar1030e5c2011-09-27 07:51:22 +0900104/* Frame Buffer */
105static struct s3c_fb_pd_win smdk6440_fb_win0 = {
106 .win_mode = {
107 .left_margin = 8,
108 .right_margin = 13,
109 .upper_margin = 7,
110 .lower_margin = 5,
111 .hsync_len = 3,
112 .vsync_len = 1,
113 .xres = 800,
114 .yres = 480,
115 },
116 .max_bpp = 32,
117 .default_bpp = 24,
118};
119
120static struct s3c_fb_platdata smdk6440_lcd_pdata __initdata = {
121 .win[0] = &smdk6440_fb_win0,
122 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
123 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
124 .setup_gpio = s5p64x0_fb_gpio_setup_24bpp,
125};
126
127/* LCD power controller */
128static void smdk6440_lte480_reset_power(struct plat_lcd_data *pd,
129 unsigned int power)
130{
131 int err;
132
133 if (power) {
134 err = gpio_request(S5P6440_GPN(5), "GPN");
135 if (err) {
136 printk(KERN_ERR "failed to request GPN for lcd reset\n");
137 return;
138 }
139
140 gpio_direction_output(S5P6440_GPN(5), 1);
141 gpio_set_value(S5P6440_GPN(5), 0);
142 gpio_set_value(S5P6440_GPN(5), 1);
143 gpio_free(S5P6440_GPN(5));
144 }
145}
146
147static struct plat_lcd_data smdk6440_lcd_power_data = {
148 .set_power = smdk6440_lte480_reset_power,
149};
150
151static struct platform_device smdk6440_lcd_lte480wv = {
152 .name = "platform-lcd",
153 .dev.parent = &s3c_device_fb.dev,
154 .dev.platform_data = &smdk6440_lcd_power_data,
155};
156
Kukjin Kimd25168e2010-01-14 08:22:00 +0900157static struct platform_device *smdk6440_devices[] __initdata = {
Naveen Krishna Ch09cae8f2010-05-20 11:39:53 +0900158 &s3c_device_adc,
Atul Dahiyaff7124a2010-07-21 17:32:56 +0900159 &s3c_device_rtc,
Naveen Krishna Ch2c978862010-08-06 19:32:43 +0900160 &s3c_device_i2c0,
161 &s3c_device_i2c1,
Naveen Krishna Ch09cae8f2010-05-20 11:39:53 +0900162 &s3c_device_ts,
Banajit Goswamia0cce452010-05-20 16:21:31 +0900163 &s3c_device_wdt,
Jassi Brar8418f882010-12-30 09:11:10 +0900164 &samsung_asoc_dma,
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900165 &s5p6440_device_iis,
Ajay Kumar1030e5c2011-09-27 07:51:22 +0900166 &s3c_device_fb,
167 &smdk6440_lcd_lte480wv,
Rajeshwari Shinde66407902011-12-26 16:33:00 +0900168 &s3c_device_hsmmc0,
169 &s3c_device_hsmmc1,
170 &s3c_device_hsmmc2,
171};
172
173static struct s3c_sdhci_platdata smdk6440_hsmmc0_pdata __initdata = {
174 .cd_type = S3C_SDHCI_CD_NONE,
175};
176
177static struct s3c_sdhci_platdata smdk6440_hsmmc1_pdata __initdata = {
178 .cd_type = S3C_SDHCI_CD_INTERNAL,
179#if defined(CONFIG_S5P64X0_SD_CH1_8BIT)
180 .max_width = 8,
181 .host_caps = MMC_CAP_8_BIT_DATA,
182#endif
183};
184
185static struct s3c_sdhci_platdata smdk6440_hsmmc2_pdata __initdata = {
186 .cd_type = S3C_SDHCI_CD_NONE,
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900187};
188
189static struct s3c2410_platform_i2c s5p6440_i2c0_data __initdata = {
190 .flags = 0,
191 .slave_addr = 0x10,
192 .frequency = 100*1000,
193 .sda_delay = 100,
194 .cfg_gpio = s5p6440_i2c0_cfg_gpio,
195};
196
197static struct s3c2410_platform_i2c s5p6440_i2c1_data __initdata = {
198 .flags = 0,
199 .bus_num = 1,
200 .slave_addr = 0x10,
201 .frequency = 100*1000,
202 .sda_delay = 100,
203 .cfg_gpio = s5p6440_i2c1_cfg_gpio,
Naveen Krishna Ch09cae8f2010-05-20 11:39:53 +0900204};
205
Naveen Krishna Ch2c978862010-08-06 19:32:43 +0900206static struct i2c_board_info smdk6440_i2c_devs0[] __initdata = {
207 { I2C_BOARD_INFO("24c08", 0x50), },
Jassi Brar149bb5b2010-12-21 09:46:29 +0900208 { I2C_BOARD_INFO("wm8580", 0x1b), },
Naveen Krishna Ch2c978862010-08-06 19:32:43 +0900209};
210
211static struct i2c_board_info smdk6440_i2c_devs1[] __initdata = {
212 /* To be populated */
213};
214
Banajit Goswami499d2962011-07-20 23:45:22 +0900215/* LCD Backlight data */
216static struct samsung_bl_gpio_info smdk6440_bl_gpio_info = {
217 .no = S5P6440_GPF(15),
218 .func = S3C_GPIO_SFN(2),
219};
220
221static struct platform_pwm_backlight_data smdk6440_bl_data = {
222 .pwm_id = 1,
223};
224
Kukjin Kimd25168e2010-01-14 08:22:00 +0900225static void __init smdk6440_map_io(void)
226{
Kukjin Kim95af2142011-12-22 23:28:28 +0100227 s5p64x0_init_io(NULL, 0);
Kukjin Kimd25168e2010-01-14 08:22:00 +0900228 s3c24xx_init_clocks(12000000);
229 s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs));
Sangbeom Kim20780fc2011-03-12 08:02:12 +0900230 s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
Kukjin Kimd25168e2010-01-14 08:22:00 +0900231}
232
Ajay Kumar1030e5c2011-09-27 07:51:22 +0900233static void s5p6440_set_lcd_interface(void)
234{
235 unsigned int cfg;
236
237 /* select TFT LCD type (RGB I/F) */
238 cfg = __raw_readl(S5P64X0_SPCON0);
239 cfg &= ~S5P64X0_SPCON0_LCD_SEL_MASK;
240 cfg |= S5P64X0_SPCON0_LCD_SEL_RGB;
241 __raw_writel(cfg, S5P64X0_SPCON0);
242}
243
Kukjin Kimd25168e2010-01-14 08:22:00 +0900244static void __init smdk6440_machine_init(void)
245{
Naveen Krishna Chatradhi08047652011-08-19 21:56:10 +0900246 s3c24xx_ts_set_platdata(NULL);
Naveen Krishna Ch09cae8f2010-05-20 11:39:53 +0900247
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900248 s3c_i2c0_set_platdata(&s5p6440_i2c0_data);
249 s3c_i2c1_set_platdata(&s5p6440_i2c1_data);
Naveen Krishna Ch2c978862010-08-06 19:32:43 +0900250 i2c_register_board_info(0, smdk6440_i2c_devs0,
251 ARRAY_SIZE(smdk6440_i2c_devs0));
252 i2c_register_board_info(1, smdk6440_i2c_devs1,
253 ARRAY_SIZE(smdk6440_i2c_devs1));
254
Banajit Goswami499d2962011-07-20 23:45:22 +0900255 samsung_bl_set(&smdk6440_bl_gpio_info, &smdk6440_bl_data);
256
Ajay Kumar1030e5c2011-09-27 07:51:22 +0900257 s5p6440_set_lcd_interface();
258 s3c_fb_set_platdata(&smdk6440_lcd_pdata);
259
Rajeshwari Shinde66407902011-12-26 16:33:00 +0900260 s3c_sdhci0_set_platdata(&smdk6440_hsmmc0_pdata);
261 s3c_sdhci1_set_platdata(&smdk6440_hsmmc1_pdata);
262 s3c_sdhci2_set_platdata(&smdk6440_hsmmc2_pdata);
263
Kukjin Kimd25168e2010-01-14 08:22:00 +0900264 platform_add_devices(smdk6440_devices, ARRAY_SIZE(smdk6440_devices));
265}
266
267MACHINE_START(SMDK6440, "SMDK6440")
268 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
Nicolas Pitre32bc8202011-07-05 22:38:17 -0400269 .atag_offset = 0x100,
Kukjin Kimd25168e2010-01-14 08:22:00 +0900270
271 .init_irq = s5p6440_init_irq,
Jamie Ilesbb3a4eb2011-09-27 20:53:31 +0100272 .handle_irq = vic_handle_irq,
Kukjin Kimd25168e2010-01-14 08:22:00 +0900273 .map_io = smdk6440_map_io,
274 .init_machine = smdk6440_machine_init,
Sangbeom Kim20780fc2011-03-12 08:02:12 +0900275 .timer = &s5p_timer,
Kukjin Kim73aed8b2011-12-22 23:34:25 +0100276 .restart = s5p64x0_restart,
Kukjin Kimd25168e2010-01-14 08:22:00 +0900277MACHINE_END