blob: 242a415dcf6b9a88f6bcc61ff9e48729a5fc4928 [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>
Rajeshwari Shinde66407902011-12-26 16:33:00 +090027#include <linux/mmc/host.h>
Ajay Kumar73017942011-09-27 07:53:20 +090028
29#include <video/platform_lcd.h>
Kukjin Kim6f315cb2010-09-01 13:03:39 +090030
31#include <asm/mach/arch.h>
32#include <asm/mach/map.h>
33#include <asm/irq.h>
34#include <asm/mach-types.h>
35
36#include <mach/hardware.h>
37#include <mach/map.h>
38#include <mach/regs-clock.h>
39#include <mach/i2c.h>
Banajit Goswamib0fd6442011-02-28 23:31:17 +053040#include <mach/regs-gpio.h>
Kukjin Kim6f315cb2010-09-01 13:03:39 +090041
42#include <plat/regs-serial.h>
43#include <plat/gpio-cfg.h>
44#include <plat/s5p6450.h>
45#include <plat/clock.h>
46#include <plat/devs.h>
47#include <plat/cpu.h>
48#include <plat/iic.h>
49#include <plat/pll.h>
50#include <plat/adc.h>
51#include <plat/ts.h>
Sangbeom Kim20780fc2011-03-12 08:02:12 +090052#include <plat/s5p-time.h>
Banajit Goswami543601f2011-07-20 23:45:22 +090053#include <plat/backlight.h>
Ajay Kumar73017942011-09-27 07:53:20 +090054#include <plat/fb.h>
55#include <plat/regs-fb.h>
Rajeshwari Shinde66407902011-12-26 16:33:00 +090056#include <plat/sdhci.h>
Kukjin Kim6f315cb2010-09-01 13:03:39 +090057
58#define SMDK6450_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
59 S3C2410_UCON_RXILEVEL | \
60 S3C2410_UCON_TXIRQMODE | \
61 S3C2410_UCON_RXIRQMODE | \
62 S3C2410_UCON_RXFIFO_TOI | \
63 S3C2443_UCON_RXERR_IRQEN)
64
65#define SMDK6450_ULCON_DEFAULT S3C2410_LCON_CS8
66
67#define SMDK6450_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
68 S3C2440_UFCON_TXTRIG16 | \
69 S3C2410_UFCON_RXTRIG8)
70
71static struct s3c2410_uartcfg smdk6450_uartcfgs[] __initdata = {
72 [0] = {
73 .hwport = 0,
74 .flags = 0,
75 .ucon = SMDK6450_UCON_DEFAULT,
76 .ulcon = SMDK6450_ULCON_DEFAULT,
77 .ufcon = SMDK6450_UFCON_DEFAULT,
78 },
79 [1] = {
80 .hwport = 1,
81 .flags = 0,
82 .ucon = SMDK6450_UCON_DEFAULT,
83 .ulcon = SMDK6450_ULCON_DEFAULT,
84 .ufcon = SMDK6450_UFCON_DEFAULT,
85 },
86 [2] = {
87 .hwport = 2,
88 .flags = 0,
89 .ucon = SMDK6450_UCON_DEFAULT,
90 .ulcon = SMDK6450_ULCON_DEFAULT,
91 .ufcon = SMDK6450_UFCON_DEFAULT,
92 },
93 [3] = {
94 .hwport = 3,
95 .flags = 0,
96 .ucon = SMDK6450_UCON_DEFAULT,
97 .ulcon = SMDK6450_ULCON_DEFAULT,
98 .ufcon = SMDK6450_UFCON_DEFAULT,
99 },
100#if CONFIG_SERIAL_SAMSUNG_UARTS > 4
101 [4] = {
102 .hwport = 4,
103 .flags = 0,
104 .ucon = SMDK6450_UCON_DEFAULT,
105 .ulcon = SMDK6450_ULCON_DEFAULT,
106 .ufcon = SMDK6450_UFCON_DEFAULT,
107 },
108#endif
109#if CONFIG_SERIAL_SAMSUNG_UARTS > 5
110 [5] = {
111 .hwport = 5,
112 .flags = 0,
113 .ucon = SMDK6450_UCON_DEFAULT,
114 .ulcon = SMDK6450_ULCON_DEFAULT,
115 .ufcon = SMDK6450_UFCON_DEFAULT,
116 },
117#endif
118};
119
Ajay Kumar73017942011-09-27 07:53:20 +0900120/* Frame Buffer */
121static struct s3c_fb_pd_win smdk6450_fb_win0 = {
122 .win_mode = {
123 .left_margin = 8,
124 .right_margin = 13,
125 .upper_margin = 7,
126 .lower_margin = 5,
127 .hsync_len = 3,
128 .vsync_len = 1,
129 .xres = 800,
130 .yres = 480,
131 },
132 .max_bpp = 32,
133 .default_bpp = 24,
134};
135
136static struct s3c_fb_platdata smdk6450_lcd_pdata __initdata = {
137 .win[0] = &smdk6450_fb_win0,
138 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
139 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
140 .setup_gpio = s5p64x0_fb_gpio_setup_24bpp,
141};
142
143/* LCD power controller */
144static void smdk6450_lte480_reset_power(struct plat_lcd_data *pd,
145 unsigned int power)
146{
147 int err;
148
149 if (power) {
150 err = gpio_request(S5P6450_GPN(5), "GPN");
151 if (err) {
152 printk(KERN_ERR "failed to request GPN for lcd reset\n");
153 return;
154 }
155
156 gpio_direction_output(S5P6450_GPN(5), 1);
157 gpio_set_value(S5P6450_GPN(5), 0);
158 gpio_set_value(S5P6450_GPN(5), 1);
159 gpio_free(S5P6450_GPN(5));
160 }
161}
162
163static struct plat_lcd_data smdk6450_lcd_power_data = {
164 .set_power = smdk6450_lte480_reset_power,
165};
166
167static struct platform_device smdk6450_lcd_lte480wv = {
168 .name = "platform-lcd",
169 .dev.parent = &s3c_device_fb.dev,
170 .dev.platform_data = &smdk6450_lcd_power_data,
171};
172
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900173static struct platform_device *smdk6450_devices[] __initdata = {
174 &s3c_device_adc,
175 &s3c_device_rtc,
176 &s3c_device_i2c0,
177 &s3c_device_i2c1,
178 &s3c_device_ts,
179 &s3c_device_wdt,
Jassi Brarbe370ad2010-12-30 09:12:32 +0900180 &samsung_asoc_dma,
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900181 &s5p6450_device_iis0,
Ajay Kumar73017942011-09-27 07:53:20 +0900182 &s3c_device_fb,
183 &smdk6450_lcd_lte480wv,
Rajeshwari Shinde66407902011-12-26 16:33:00 +0900184 &s3c_device_hsmmc0,
185 &s3c_device_hsmmc1,
186 &s3c_device_hsmmc2,
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900187 /* s5p6450_device_spi0 will be added */
188};
189
Rajeshwari Shinde66407902011-12-26 16:33:00 +0900190static struct s3c_sdhci_platdata smdk6450_hsmmc0_pdata __initdata = {
191 .cd_type = S3C_SDHCI_CD_NONE,
192};
193
194static struct s3c_sdhci_platdata smdk6450_hsmmc1_pdata __initdata = {
195 .cd_type = S3C_SDHCI_CD_NONE,
196#if defined(CONFIG_S5P64X0_SD_CH1_8BIT)
197 .max_width = 8,
198 .host_caps = MMC_CAP_8_BIT_DATA,
199#endif
200};
201
202static struct s3c_sdhci_platdata smdk6450_hsmmc2_pdata __initdata = {
203 .cd_type = S3C_SDHCI_CD_NONE,
204};
205
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900206static struct s3c2410_platform_i2c s5p6450_i2c0_data __initdata = {
207 .flags = 0,
208 .slave_addr = 0x10,
209 .frequency = 100*1000,
210 .sda_delay = 100,
211 .cfg_gpio = s5p6450_i2c0_cfg_gpio,
212};
213
214static struct s3c2410_platform_i2c s5p6450_i2c1_data __initdata = {
215 .flags = 0,
216 .bus_num = 1,
217 .slave_addr = 0x10,
218 .frequency = 100*1000,
219 .sda_delay = 100,
220 .cfg_gpio = s5p6450_i2c1_cfg_gpio,
221};
222
223static struct i2c_board_info smdk6450_i2c_devs0[] __initdata = {
Jassi Brarfcf88972010-12-21 09:48:32 +0900224 { I2C_BOARD_INFO("wm8580", 0x1b), },
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900225 { I2C_BOARD_INFO("24c08", 0x50), }, /* Samsung KS24C080C EEPROM */
226};
227
228static struct i2c_board_info smdk6450_i2c_devs1[] __initdata = {
229 { I2C_BOARD_INFO("24c128", 0x57), },/* Samsung S524AD0XD1 EEPROM */
230};
231
Banajit Goswami543601f2011-07-20 23:45:22 +0900232/* LCD Backlight data */
233static struct samsung_bl_gpio_info smdk6450_bl_gpio_info = {
234 .no = S5P6450_GPF(15),
235 .func = S3C_GPIO_SFN(2),
236};
237
238static struct platform_pwm_backlight_data smdk6450_bl_data = {
239 .pwm_id = 1,
240};
241
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900242static void __init smdk6450_map_io(void)
243{
244 s5p_init_io(NULL, 0, S5P64X0_SYS_ID);
245 s3c24xx_init_clocks(19200000);
246 s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs));
Sangbeom Kim20780fc2011-03-12 08:02:12 +0900247 s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900248}
249
Ajay Kumar73017942011-09-27 07:53:20 +0900250static void s5p6450_set_lcd_interface(void)
251{
252 unsigned int cfg;
253
254 /* select TFT LCD type (RGB I/F) */
255 cfg = __raw_readl(S5P64X0_SPCON0);
256 cfg &= ~S5P64X0_SPCON0_LCD_SEL_MASK;
257 cfg |= S5P64X0_SPCON0_LCD_SEL_RGB;
258 __raw_writel(cfg, S5P64X0_SPCON0);
259}
260
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900261static void __init smdk6450_machine_init(void)
262{
Naveen Krishna Chatradhi08047652011-08-19 21:56:10 +0900263 s3c24xx_ts_set_platdata(NULL);
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900264
265 s3c_i2c0_set_platdata(&s5p6450_i2c0_data);
266 s3c_i2c1_set_platdata(&s5p6450_i2c1_data);
267 i2c_register_board_info(0, smdk6450_i2c_devs0,
268 ARRAY_SIZE(smdk6450_i2c_devs0));
269 i2c_register_board_info(1, smdk6450_i2c_devs1,
270 ARRAY_SIZE(smdk6450_i2c_devs1));
271
Banajit Goswami543601f2011-07-20 23:45:22 +0900272 samsung_bl_set(&smdk6450_bl_gpio_info, &smdk6450_bl_data);
273
Ajay Kumar73017942011-09-27 07:53:20 +0900274 s5p6450_set_lcd_interface();
275 s3c_fb_set_platdata(&smdk6450_lcd_pdata);
276
Rajeshwari Shinde66407902011-12-26 16:33:00 +0900277 s3c_sdhci0_set_platdata(&smdk6450_hsmmc0_pdata);
278 s3c_sdhci1_set_platdata(&smdk6450_hsmmc1_pdata);
279 s3c_sdhci2_set_platdata(&smdk6450_hsmmc2_pdata);
280
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900281 platform_add_devices(smdk6450_devices, ARRAY_SIZE(smdk6450_devices));
282}
283
284MACHINE_START(SMDK6450, "SMDK6450")
285 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
Nicolas Pitre32bc8202011-07-05 22:38:17 -0400286 .atag_offset = 0x100,
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900287
288 .init_irq = s5p6450_init_irq,
289 .map_io = smdk6450_map_io,
290 .init_machine = smdk6450_machine_init,
Sangbeom Kim20780fc2011-03-12 08:02:12 +0900291 .timer = &s5p_timer,
Kukjin Kim6f315cb2010-09-01 13:03:39 +0900292MACHINE_END