1 /* linux/arch/arm/mach-s5p64x0/mach-smdk6440.c
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
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.
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>
22 #include <linux/module.h>
23 #include <linux/clk.h>
24 #include <linux/gpio.h>
25 #include <linux/pwm_backlight.h>
28 #include <video/platform_lcd.h>
30 #include <asm/hardware/vic.h>
31 #include <asm/mach/arch.h>
32 #include <asm/mach/map.h>
34 #include <asm/mach-types.h>
36 #include <mach/hardware.h>
38 #include <mach/regs-clock.h>
40 #include <mach/regs-gpio.h>
42 #include <plat/regs-serial.h>
43 #include <plat/gpio-cfg.h>
44 #include <plat/clock.h>
45 #include <plat/devs.h>
51 #include <plat/s5p-time.h>
52 #include <plat/backlight.h>
54 #include <plat/regs-fb.h>
58 #define SMDK6440_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)
65 #define SMDK6440_ULCON_DEFAULT S3C2410_LCON_CS8
67 #define SMDK6440_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
68 S3C2440_UFCON_TXTRIG16 | \
69 S3C2410_UFCON_RXTRIG8)
71 static struct s3c2410_uartcfg smdk6440_uartcfgs
[] __initdata
= {
75 .ucon
= SMDK6440_UCON_DEFAULT
,
76 .ulcon
= SMDK6440_ULCON_DEFAULT
,
77 .ufcon
= SMDK6440_UFCON_DEFAULT
,
82 .ucon
= SMDK6440_UCON_DEFAULT
,
83 .ulcon
= SMDK6440_ULCON_DEFAULT
,
84 .ufcon
= SMDK6440_UFCON_DEFAULT
,
89 .ucon
= SMDK6440_UCON_DEFAULT
,
90 .ulcon
= SMDK6440_ULCON_DEFAULT
,
91 .ufcon
= SMDK6440_UFCON_DEFAULT
,
96 .ucon
= SMDK6440_UCON_DEFAULT
,
97 .ulcon
= SMDK6440_ULCON_DEFAULT
,
98 .ufcon
= SMDK6440_UFCON_DEFAULT
,
103 static struct s3c_fb_pd_win smdk6440_fb_win0
= {
118 static struct s3c_fb_platdata smdk6440_lcd_pdata __initdata
= {
119 .win
[0] = &smdk6440_fb_win0
,
120 .vidcon0
= VIDCON0_VIDOUT_RGB
| VIDCON0_PNRMODE_RGB
,
121 .vidcon1
= VIDCON1_INV_HSYNC
| VIDCON1_INV_VSYNC
,
122 .setup_gpio
= s5p64x0_fb_gpio_setup_24bpp
,
125 /* LCD power controller */
126 static void smdk6440_lte480_reset_power(struct plat_lcd_data
*pd
,
132 err
= gpio_request(S5P6440_GPN(5), "GPN");
134 printk(KERN_ERR
"failed to request GPN for lcd reset\n");
138 gpio_direction_output(S5P6440_GPN(5), 1);
139 gpio_set_value(S5P6440_GPN(5), 0);
140 gpio_set_value(S5P6440_GPN(5), 1);
141 gpio_free(S5P6440_GPN(5));
145 static struct plat_lcd_data smdk6440_lcd_power_data
= {
146 .set_power
= smdk6440_lte480_reset_power
,
149 static struct platform_device smdk6440_lcd_lte480wv
= {
150 .name
= "platform-lcd",
151 .dev
.parent
= &s3c_device_fb
.dev
,
152 .dev
.platform_data
= &smdk6440_lcd_power_data
,
155 static struct platform_device
*smdk6440_devices
[] __initdata
= {
165 &smdk6440_lcd_lte480wv
,
168 static struct s3c2410_platform_i2c s5p6440_i2c0_data __initdata
= {
171 .frequency
= 100*1000,
173 .cfg_gpio
= s5p6440_i2c0_cfg_gpio
,
176 static struct s3c2410_platform_i2c s5p6440_i2c1_data __initdata
= {
180 .frequency
= 100*1000,
182 .cfg_gpio
= s5p6440_i2c1_cfg_gpio
,
185 static struct i2c_board_info smdk6440_i2c_devs0
[] __initdata
= {
186 { I2C_BOARD_INFO("24c08", 0x50), },
187 { I2C_BOARD_INFO("wm8580", 0x1b), },
190 static struct i2c_board_info smdk6440_i2c_devs1
[] __initdata
= {
191 /* To be populated */
194 /* LCD Backlight data */
195 static struct samsung_bl_gpio_info smdk6440_bl_gpio_info
= {
196 .no
= S5P6440_GPF(15),
197 .func
= S3C_GPIO_SFN(2),
200 static struct platform_pwm_backlight_data smdk6440_bl_data
= {
204 static void __init
smdk6440_map_io(void)
206 s5p64x0_init_io(NULL
, 0);
207 s3c24xx_init_clocks(12000000);
208 s3c24xx_init_uarts(smdk6440_uartcfgs
, ARRAY_SIZE(smdk6440_uartcfgs
));
209 s5p_set_timer_source(S5P_PWM3
, S5P_PWM4
);
212 static void s5p6440_set_lcd_interface(void)
216 /* select TFT LCD type (RGB I/F) */
217 cfg
= __raw_readl(S5P64X0_SPCON0
);
218 cfg
&= ~S5P64X0_SPCON0_LCD_SEL_MASK
;
219 cfg
|= S5P64X0_SPCON0_LCD_SEL_RGB
;
220 __raw_writel(cfg
, S5P64X0_SPCON0
);
223 static void __init
smdk6440_machine_init(void)
225 s3c24xx_ts_set_platdata(NULL
);
227 s3c_i2c0_set_platdata(&s5p6440_i2c0_data
);
228 s3c_i2c1_set_platdata(&s5p6440_i2c1_data
);
229 i2c_register_board_info(0, smdk6440_i2c_devs0
,
230 ARRAY_SIZE(smdk6440_i2c_devs0
));
231 i2c_register_board_info(1, smdk6440_i2c_devs1
,
232 ARRAY_SIZE(smdk6440_i2c_devs1
));
234 samsung_bl_set(&smdk6440_bl_gpio_info
, &smdk6440_bl_data
);
236 s5p6440_set_lcd_interface();
237 s3c_fb_set_platdata(&smdk6440_lcd_pdata
);
239 platform_add_devices(smdk6440_devices
, ARRAY_SIZE(smdk6440_devices
));
242 MACHINE_START(SMDK6440
, "SMDK6440")
243 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
244 .atag_offset
= 0x100,
246 .init_irq
= s5p6440_init_irq
,
247 .handle_irq
= vic_handle_irq
,
248 .map_io
= smdk6440_map_io
,
249 .init_machine
= smdk6440_machine_init
,
251 .restart
= s5p64x0_restart
,