1 /* linux/arch/arm/mach-exynos4/mach-smdkv310.c
3 * Copyright (c) 2010-2011 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/serial_core.h>
12 #include <linux/delay.h>
13 #include <linux/gpio.h>
14 #include <linux/lcd.h>
15 #include <linux/mmc/host.h>
16 #include <linux/platform_device.h>
17 #include <linux/smsc911x.h>
19 #include <linux/i2c.h>
20 #include <linux/input.h>
21 #include <linux/pwm.h>
22 #include <linux/pwm_backlight.h>
23 #include <linux/platform_data/i2c-s3c2410.h>
24 #include <linux/platform_data/s3c-hsotg.h>
25 #include <linux/platform_data/usb-ehci-s5p.h>
26 #include <linux/platform_data/usb-exynos.h>
28 #include <asm/mach/arch.h>
29 #include <asm/hardware/gic.h>
30 #include <asm/mach-types.h>
32 #include <video/platform_lcd.h>
33 #include <video/samsung_fimd.h>
34 #include <plat/regs-serial.h>
35 #include <plat/regs-srom.h>
37 #include <plat/devs.h>
39 #include <plat/keypad.h>
40 #include <plat/sdhci.h>
41 #include <plat/gpio-cfg.h>
42 #include <plat/backlight.h>
44 #include <plat/clock.h>
45 #include <plat/hdmi.h>
49 #include <drm/exynos_drm.h>
52 /* Following are default values for UCON, ULCON and UFCON UART registers */
53 #define SMDKV310_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
54 S3C2410_UCON_RXILEVEL | \
55 S3C2410_UCON_TXIRQMODE | \
56 S3C2410_UCON_RXIRQMODE | \
57 S3C2410_UCON_RXFIFO_TOI | \
58 S3C2443_UCON_RXERR_IRQEN)
60 #define SMDKV310_ULCON_DEFAULT S3C2410_LCON_CS8
62 #define SMDKV310_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
63 S5PV210_UFCON_TXTRIG4 | \
64 S5PV210_UFCON_RXTRIG4)
66 static struct s3c2410_uartcfg smdkv310_uartcfgs[] __initdata = {
70 .ucon = SMDKV310_UCON_DEFAULT,
71 .ulcon = SMDKV310_ULCON_DEFAULT,
72 .ufcon = SMDKV310_UFCON_DEFAULT,
77 .ucon = SMDKV310_UCON_DEFAULT,
78 .ulcon = SMDKV310_ULCON_DEFAULT,
79 .ufcon = SMDKV310_UFCON_DEFAULT,
84 .ucon = SMDKV310_UCON_DEFAULT,
85 .ulcon = SMDKV310_ULCON_DEFAULT,
86 .ufcon = SMDKV310_UFCON_DEFAULT,
91 .ucon = SMDKV310_UCON_DEFAULT,
92 .ulcon = SMDKV310_ULCON_DEFAULT,
93 .ufcon = SMDKV310_UFCON_DEFAULT,
97 static struct s3c_sdhci_platdata smdkv310_hsmmc0_pdata __initdata = {
98 .cd_type = S3C_SDHCI_CD_INTERNAL,
99 #ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT
101 .host_caps = MMC_CAP_8_BIT_DATA,
105 static struct s3c_sdhci_platdata smdkv310_hsmmc1_pdata __initdata = {
106 .cd_type = S3C_SDHCI_CD_GPIO,
107 .ext_cd_gpio = EXYNOS4_GPK0(2),
108 .ext_cd_gpio_invert = 1,
111 static struct s3c_sdhci_platdata smdkv310_hsmmc2_pdata __initdata = {
112 .cd_type = S3C_SDHCI_CD_INTERNAL,
113 #ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT
115 .host_caps = MMC_CAP_8_BIT_DATA,
119 static struct s3c_sdhci_platdata smdkv310_hsmmc3_pdata __initdata = {
120 .cd_type = S3C_SDHCI_CD_GPIO,
121 .ext_cd_gpio = EXYNOS4_GPK2(2),
122 .ext_cd_gpio_invert = 1,
125 static void lcd_lte480wv_set_power(struct plat_lcd_data *pd,
129 #if !defined(CONFIG_BACKLIGHT_PWM)
130 gpio_request_one(EXYNOS4_GPD0(1), GPIOF_OUT_INIT_HIGH, "GPD0");
131 gpio_free(EXYNOS4_GPD0(1));
133 /* fire nRESET on power up */
134 gpio_request_one(EXYNOS4_GPX0(6), GPIOF_OUT_INIT_HIGH, "GPX0");
137 gpio_set_value(EXYNOS4_GPX0(6), 0);
140 gpio_set_value(EXYNOS4_GPX0(6), 1);
143 gpio_free(EXYNOS4_GPX0(6));
145 #if !defined(CONFIG_BACKLIGHT_PWM)
146 gpio_request_one(EXYNOS4_GPD0(1), GPIOF_OUT_INIT_LOW, "GPD0");
147 gpio_free(EXYNOS4_GPD0(1));
152 static struct plat_lcd_data smdkv310_lcd_lte480wv_data = {
153 .set_power = lcd_lte480wv_set_power,
156 static struct platform_device smdkv310_lcd_lte480wv = {
157 .name = "platform-lcd",
158 .dev.parent = &s5p_device_fimd0.dev,
159 .dev.platform_data = &smdkv310_lcd_lte480wv_data,
162 #ifdef CONFIG_DRM_EXYNOS_FIMD
163 static struct exynos_drm_fimd_pdata drm_fimd_pdata = {
176 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
177 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
182 static struct s3c_fb_pd_win smdkv310_fb_win0 = {
189 static struct fb_videomode smdkv310_lcd_timing = {
200 static struct s3c_fb_platdata smdkv310_lcd0_pdata __initdata = {
201 .win[0] = &smdkv310_fb_win0,
202 .vtiming = &smdkv310_lcd_timing,
203 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
204 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
205 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
209 static struct resource smdkv310_smsc911x_resources[] = {
210 [0] = DEFINE_RES_MEM(EXYNOS4_PA_SROM_BANK(1), SZ_64K),
211 [1] = DEFINE_RES_NAMED(IRQ_EINT(5), 1, NULL, IORESOURCE_IRQ \
215 static struct smsc911x_platform_config smsc9215_config = {
216 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
217 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
218 .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
219 .phy_interface = PHY_INTERFACE_MODE_MII,
220 .mac = {0x00, 0x80, 0x00, 0x23, 0x45, 0x67},
223 static struct platform_device smdkv310_smsc911x = {
226 .num_resources = ARRAY_SIZE(smdkv310_smsc911x_resources),
227 .resource = smdkv310_smsc911x_resources,
229 .platform_data = &smsc9215_config,
233 static uint32_t smdkv310_keymap[] __initdata = {
234 /* KEY(row, col, keycode) */
235 KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
236 KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
237 KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
238 KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
241 static struct matrix_keymap_data smdkv310_keymap_data __initdata = {
242 .keymap = smdkv310_keymap,
243 .keymap_size = ARRAY_SIZE(smdkv310_keymap),
246 static struct samsung_keypad_platdata smdkv310_keypad_data __initdata = {
247 .keymap_data = &smdkv310_keymap_data,
252 static struct i2c_board_info i2c_devs1[] __initdata = {
253 {I2C_BOARD_INFO("wm8994", 0x1a),},
257 static struct s5p_ehci_platdata smdkv310_ehci_pdata;
259 static void __init smdkv310_ehci_init(void)
261 struct s5p_ehci_platdata *pdata = &smdkv310_ehci_pdata;
263 s5p_ehci_set_platdata(pdata);
267 static struct exynos4_ohci_platdata smdkv310_ohci_pdata;
269 static void __init smdkv310_ohci_init(void)
271 struct exynos4_ohci_platdata *pdata = &smdkv310_ohci_pdata;
273 exynos4_ohci_set_platdata(pdata);
277 static struct s3c_hsotg_plat smdkv310_hsotg_pdata;
280 static struct platform_device smdkv310_device_audio = {
281 .name = "smdk-audio",
285 static struct platform_device *smdkv310_devices[] __initdata = {
291 &s5p_device_i2c_hdmiphy,
293 &s3c_device_usb_hsotg,
303 &exynos4_device_ac97,
304 &exynos4_device_i2s0,
305 &exynos4_device_ohci,
306 &samsung_device_keypad,
310 &exynos4_device_spdif,
313 &smdkv310_device_audio,
314 &smdkv310_lcd_lte480wv,
316 &exynos4_device_ahci,
321 static void __init smdkv310_smsc911x_init(void)
325 /* configure nCS1 width to 16 bits */
326 cs1 = __raw_readl(S5P_SROM_BW) &
327 ~(S5P_SROM_BW__CS_MASK << S5P_SROM_BW__NCS1__SHIFT);
328 cs1 |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) |
329 (1 << S5P_SROM_BW__WAITENABLE__SHIFT) |
330 (1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) <<
331 S5P_SROM_BW__NCS1__SHIFT;
332 __raw_writel(cs1, S5P_SROM_BW);
334 /* set timing for nCS1 suitable for ethernet chip */
335 __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) |
336 (0x9 << S5P_SROM_BCX__TACP__SHIFT) |
337 (0xc << S5P_SROM_BCX__TCAH__SHIFT) |
338 (0x1 << S5P_SROM_BCX__TCOH__SHIFT) |
339 (0x6 << S5P_SROM_BCX__TACC__SHIFT) |
340 (0x1 << S5P_SROM_BCX__TCOS__SHIFT) |
341 (0x1 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1);
344 /* LCD Backlight data */
345 static struct samsung_bl_gpio_info smdkv310_bl_gpio_info = {
346 .no = EXYNOS4_GPD0(1),
347 .func = S3C_GPIO_SFN(2),
350 static struct platform_pwm_backlight_data smdkv310_bl_data = {
352 .pwm_period_ns = 1000,
355 /* I2C module and id for HDMIPHY */
356 static struct i2c_board_info hdmiphy_info = {
357 I2C_BOARD_INFO("hdmiphy-exynos4210", 0x38),
360 static struct pwm_lookup smdkv310_pwm_lookup[] = {
361 PWM_LOOKUP("s3c24xx-pwm.1", 0, "pwm-backlight.0", NULL),
364 static void s5p_tv_setup(void)
366 /* direct HPD to HDMI chip */
367 WARN_ON(gpio_request_one(EXYNOS4_GPX3(7), GPIOF_IN, "hpd-plug"));
368 s3c_gpio_cfgpin(EXYNOS4_GPX3(7), S3C_GPIO_SFN(0x3));
369 s3c_gpio_setpull(EXYNOS4_GPX3(7), S3C_GPIO_PULL_NONE);
372 static void __init smdkv310_map_io(void)
374 exynos_init_io(NULL, 0);
375 s3c24xx_init_clocks(clk_xusbxti.rate);
376 s3c24xx_init_uarts(smdkv310_uartcfgs, ARRAY_SIZE(smdkv310_uartcfgs));
379 static void __init smdkv310_reserve(void)
381 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
384 static void __init smdkv310_machine_init(void)
386 s3c_i2c1_set_platdata(NULL);
387 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
389 smdkv310_smsc911x_init();
391 s3c_sdhci0_set_platdata(&smdkv310_hsmmc0_pdata);
392 s3c_sdhci1_set_platdata(&smdkv310_hsmmc1_pdata);
393 s3c_sdhci2_set_platdata(&smdkv310_hsmmc2_pdata);
394 s3c_sdhci3_set_platdata(&smdkv310_hsmmc3_pdata);
397 s5p_i2c_hdmiphy_set_platdata(NULL);
398 s5p_hdmi_set_platdata(&hdmiphy_info, NULL, 0);
400 samsung_keypad_set_platdata(&smdkv310_keypad_data);
402 samsung_bl_set(&smdkv310_bl_gpio_info, &smdkv310_bl_data);
403 pwm_add_table(smdkv310_pwm_lookup, ARRAY_SIZE(smdkv310_pwm_lookup));
405 #ifdef CONFIG_DRM_EXYNOS_FIMD
406 s5p_device_fimd0.dev.platform_data = &drm_fimd_pdata;
407 exynos4_fimd0_gpio_setup_24bpp();
409 s5p_fimd0_set_platdata(&smdkv310_lcd0_pdata);
412 smdkv310_ehci_init();
413 smdkv310_ohci_init();
414 s3c_hsotg_set_platdata(&smdkv310_hsotg_pdata);
416 platform_add_devices(smdkv310_devices, ARRAY_SIZE(smdkv310_devices));
419 MACHINE_START(SMDKV310, "SMDKV310")
420 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
421 /* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */
422 .atag_offset = 0x100,
423 .smp = smp_ops(exynos_smp_ops),
424 .init_irq = exynos4_init_irq,
425 .map_io = smdkv310_map_io,
426 .handle_irq = gic_handle_irq,
427 .init_machine = smdkv310_machine_init,
428 .timer = &exynos4_timer,
429 .reserve = &smdkv310_reserve,
430 .restart = exynos4_restart,
433 MACHINE_START(SMDKC210, "SMDKC210")
434 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
435 .atag_offset = 0x100,
436 .smp = smp_ops(exynos_smp_ops),
437 .init_irq = exynos4_init_irq,
438 .map_io = smdkv310_map_io,
439 .handle_irq = gic_handle_irq,
440 .init_machine = smdkv310_machine_init,
441 .init_late = exynos_init_late,
442 .timer = &exynos4_timer,
443 .reserve = &smdkv310_reserve,
444 .restart = exynos4_restart,