1
2
3
4
5
6
7
8
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>
25#include <linux/pwm_backlight.h>
26#include <linux/fb.h>
27#include <linux/mmc/host.h>
28
29#include <video/platform_lcd.h>
30
31#include <asm/hardware/vic.h>
32#include <asm/mach/arch.h>
33#include <asm/mach/map.h>
34#include <asm/irq.h>
35#include <asm/mach-types.h>
36
37#include <mach/hardware.h>
38#include <mach/map.h>
39#include <mach/regs-clock.h>
40#include <mach/i2c.h>
41#include <mach/regs-gpio.h>
42
43#include <plat/regs-serial.h>
44#include <plat/gpio-cfg.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>
52#include <plat/s5p-time.h>
53#include <plat/backlight.h>
54#include <plat/fb.h>
55#include <plat/regs-fb.h>
56#include <plat/sdhci.h>
57
58#include "common.h"
59
60#define SMDK6440_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
61 S3C2410_UCON_RXILEVEL | \
62 S3C2410_UCON_TXIRQMODE | \
63 S3C2410_UCON_RXIRQMODE | \
64 S3C2410_UCON_RXFIFO_TOI | \
65 S3C2443_UCON_RXERR_IRQEN)
66
67#define SMDK6440_ULCON_DEFAULT S3C2410_LCON_CS8
68
69#define SMDK6440_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
70 S3C2440_UFCON_TXTRIG16 | \
71 S3C2410_UFCON_RXTRIG8)
72
73static struct s3c2410_uartcfg smdk6440_uartcfgs[] __initdata = {
74 [0] = {
75 .hwport = 0,
76 .flags = 0,
77 .ucon = SMDK6440_UCON_DEFAULT,
78 .ulcon = SMDK6440_ULCON_DEFAULT,
79 .ufcon = SMDK6440_UFCON_DEFAULT,
80 },
81 [1] = {
82 .hwport = 1,
83 .flags = 0,
84 .ucon = SMDK6440_UCON_DEFAULT,
85 .ulcon = SMDK6440_ULCON_DEFAULT,
86 .ufcon = SMDK6440_UFCON_DEFAULT,
87 },
88 [2] = {
89 .hwport = 2,
90 .flags = 0,
91 .ucon = SMDK6440_UCON_DEFAULT,
92 .ulcon = SMDK6440_ULCON_DEFAULT,
93 .ufcon = SMDK6440_UFCON_DEFAULT,
94 },
95 [3] = {
96 .hwport = 3,
97 .flags = 0,
98 .ucon = SMDK6440_UCON_DEFAULT,
99 .ulcon = SMDK6440_ULCON_DEFAULT,
100 .ufcon = SMDK6440_UFCON_DEFAULT,
101 },
102};
103
104
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
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
157static struct platform_device *smdk6440_devices[] __initdata = {
158 &s3c_device_adc,
159 &s3c_device_rtc,
160 &s3c_device_i2c0,
161 &s3c_device_i2c1,
162 &s3c_device_ts,
163 &s3c_device_wdt,
164 &samsung_asoc_dma,
165 &s5p6440_device_iis,
166 &s3c_device_fb,
167 &smdk6440_lcd_lte480wv,
168 &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,
187};
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,
204};
205
206static struct i2c_board_info smdk6440_i2c_devs0[] __initdata = {
207 { I2C_BOARD_INFO("24c08", 0x50), },
208 { I2C_BOARD_INFO("wm8580", 0x1b), },
209};
210
211static struct i2c_board_info smdk6440_i2c_devs1[] __initdata = {
212
213};
214
215
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
225static void __init smdk6440_map_io(void)
226{
227 s5p64x0_init_io(NULL, 0);
228 s3c24xx_init_clocks(12000000);
229 s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs));
230 s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
231}
232
233static void s5p6440_set_lcd_interface(void)
234{
235 unsigned int cfg;
236
237
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
244static void __init smdk6440_machine_init(void)
245{
246 s3c24xx_ts_set_platdata(NULL);
247
248 s3c_i2c0_set_platdata(&s5p6440_i2c0_data);
249 s3c_i2c1_set_platdata(&s5p6440_i2c1_data);
250 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
255 samsung_bl_set(&smdk6440_bl_gpio_info, &smdk6440_bl_data);
256
257 s5p6440_set_lcd_interface();
258 s3c_fb_set_platdata(&smdk6440_lcd_pdata);
259
260 s3c_sdhci0_set_platdata(&smdk6440_hsmmc0_pdata);
261 s3c_sdhci1_set_platdata(&smdk6440_hsmmc1_pdata);
262 s3c_sdhci2_set_platdata(&smdk6440_hsmmc2_pdata);
263
264 platform_add_devices(smdk6440_devices, ARRAY_SIZE(smdk6440_devices));
265}
266
267MACHINE_START(SMDK6440, "SMDK6440")
268
269 .atag_offset = 0x100,
270
271 .init_irq = s5p6440_init_irq,
272 .handle_irq = vic_handle_irq,
273 .map_io = smdk6440_map_io,
274 .init_machine = smdk6440_machine_init,
275 .timer = &s5p_timer,
276 .restart = s5p64x0_restart,
277MACHINE_END
278