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_backlight.h>
22 #include <linux/platform_data/s3c-hsotg.h>
24 #include <asm/mach/arch.h>
25 #include <asm/hardware/gic.h>
26 #include <asm/mach-types.h>
28 #include <video/platform_lcd.h>
29 #include <plat/regs-serial.h>
30 #include <plat/regs-srom.h>
31 #include <plat/regs-fb-v4.h>
33 #include <plat/devs.h>
35 #include <plat/keypad.h>
36 #include <plat/sdhci.h>
38 #include <plat/gpio-cfg.h>
39 #include <plat/backlight.h>
41 #include <plat/ehci.h>
42 #include <plat/clock.h>
45 #include <mach/ohci.h>
47 #include <drm/exynos_drm.h>
50 /* Following are default values for UCON, ULCON and UFCON UART registers */
51 #define SMDKV310_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
52 S3C2410_UCON_RXILEVEL | \
53 S3C2410_UCON_TXIRQMODE | \
54 S3C2410_UCON_RXIRQMODE | \
55 S3C2410_UCON_RXFIFO_TOI | \
56 S3C2443_UCON_RXERR_IRQEN)
58 #define SMDKV310_ULCON_DEFAULT S3C2410_LCON_CS8
60 #define SMDKV310_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
61 S5PV210_UFCON_TXTRIG4 | \
62 S5PV210_UFCON_RXTRIG4)
64 static struct s3c2410_uartcfg smdkv310_uartcfgs
[] __initdata
= {
68 .ucon
= SMDKV310_UCON_DEFAULT
,
69 .ulcon
= SMDKV310_ULCON_DEFAULT
,
70 .ufcon
= SMDKV310_UFCON_DEFAULT
,
75 .ucon
= SMDKV310_UCON_DEFAULT
,
76 .ulcon
= SMDKV310_ULCON_DEFAULT
,
77 .ufcon
= SMDKV310_UFCON_DEFAULT
,
82 .ucon
= SMDKV310_UCON_DEFAULT
,
83 .ulcon
= SMDKV310_ULCON_DEFAULT
,
84 .ufcon
= SMDKV310_UFCON_DEFAULT
,
89 .ucon
= SMDKV310_UCON_DEFAULT
,
90 .ulcon
= SMDKV310_ULCON_DEFAULT
,
91 .ufcon
= SMDKV310_UFCON_DEFAULT
,
95 static struct s3c_sdhci_platdata smdkv310_hsmmc0_pdata __initdata
= {
96 .cd_type
= S3C_SDHCI_CD_INTERNAL
,
97 #ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT
99 .host_caps
= MMC_CAP_8_BIT_DATA
,
103 static struct s3c_sdhci_platdata smdkv310_hsmmc1_pdata __initdata
= {
104 .cd_type
= S3C_SDHCI_CD_GPIO
,
105 .ext_cd_gpio
= EXYNOS4_GPK0(2),
106 .ext_cd_gpio_invert
= 1,
109 static struct s3c_sdhci_platdata smdkv310_hsmmc2_pdata __initdata
= {
110 .cd_type
= S3C_SDHCI_CD_INTERNAL
,
111 #ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT
113 .host_caps
= MMC_CAP_8_BIT_DATA
,
117 static struct s3c_sdhci_platdata smdkv310_hsmmc3_pdata __initdata
= {
118 .cd_type
= S3C_SDHCI_CD_GPIO
,
119 .ext_cd_gpio
= EXYNOS4_GPK2(2),
120 .ext_cd_gpio_invert
= 1,
123 static void lcd_lte480wv_set_power(struct plat_lcd_data
*pd
,
127 #if !defined(CONFIG_BACKLIGHT_PWM)
128 gpio_request_one(EXYNOS4_GPD0(1), GPIOF_OUT_INIT_HIGH
, "GPD0");
129 gpio_free(EXYNOS4_GPD0(1));
131 /* fire nRESET on power up */
132 gpio_request_one(EXYNOS4_GPX0(6), GPIOF_OUT_INIT_HIGH
, "GPX0");
135 gpio_set_value(EXYNOS4_GPX0(6), 0);
138 gpio_set_value(EXYNOS4_GPX0(6), 1);
141 gpio_free(EXYNOS4_GPX0(6));
143 #if !defined(CONFIG_BACKLIGHT_PWM)
144 gpio_request_one(EXYNOS4_GPD0(1), GPIOF_OUT_INIT_LOW
, "GPD0");
145 gpio_free(EXYNOS4_GPD0(1));
150 static struct plat_lcd_data smdkv310_lcd_lte480wv_data
= {
151 .set_power
= lcd_lte480wv_set_power
,
154 static struct platform_device smdkv310_lcd_lte480wv
= {
155 .name
= "platform-lcd",
156 .dev
.parent
= &s5p_device_fimd0
.dev
,
157 .dev
.platform_data
= &smdkv310_lcd_lte480wv_data
,
160 #ifdef CONFIG_DRM_EXYNOS
161 static struct exynos_drm_fimd_pdata drm_fimd_pdata
= {
174 .vidcon0
= VIDCON0_VIDOUT_RGB
| VIDCON0_PNRMODE_RGB
,
175 .vidcon1
= VIDCON1_INV_HSYNC
| VIDCON1_INV_VSYNC
,
180 static struct s3c_fb_pd_win smdkv310_fb_win0
= {
187 static struct fb_videomode smdkv310_lcd_timing
= {
198 static struct s3c_fb_platdata smdkv310_lcd0_pdata __initdata
= {
199 .win
[0] = &smdkv310_fb_win0
,
200 .vtiming
= &smdkv310_lcd_timing
,
201 .vidcon0
= VIDCON0_VIDOUT_RGB
| VIDCON0_PNRMODE_RGB
,
202 .vidcon1
= VIDCON1_INV_HSYNC
| VIDCON1_INV_VSYNC
,
203 .setup_gpio
= exynos4_fimd0_gpio_setup_24bpp
,
207 static struct resource smdkv310_smsc911x_resources
[] = {
208 [0] = DEFINE_RES_MEM(EXYNOS4_PA_SROM_BANK(1), SZ_64K
),
209 [1] = DEFINE_RES_NAMED(IRQ_EINT(5), 1, NULL
, IORESOURCE_IRQ \
213 static struct smsc911x_platform_config smsc9215_config
= {
214 .irq_polarity
= SMSC911X_IRQ_POLARITY_ACTIVE_LOW
,
215 .irq_type
= SMSC911X_IRQ_TYPE_PUSH_PULL
,
216 .flags
= SMSC911X_USE_16BIT
| SMSC911X_FORCE_INTERNAL_PHY
,
217 .phy_interface
= PHY_INTERFACE_MODE_MII
,
218 .mac
= {0x00, 0x80, 0x00, 0x23, 0x45, 0x67},
221 static struct platform_device smdkv310_smsc911x
= {
224 .num_resources
= ARRAY_SIZE(smdkv310_smsc911x_resources
),
225 .resource
= smdkv310_smsc911x_resources
,
227 .platform_data
= &smsc9215_config
,
231 static uint32_t smdkv310_keymap
[] __initdata
= {
232 /* KEY(row, col, keycode) */
233 KEY(0, 3, KEY_1
), KEY(0, 4, KEY_2
), KEY(0, 5, KEY_3
),
234 KEY(0, 6, KEY_4
), KEY(0, 7, KEY_5
),
235 KEY(1, 3, KEY_A
), KEY(1, 4, KEY_B
), KEY(1, 5, KEY_C
),
236 KEY(1, 6, KEY_D
), KEY(1, 7, KEY_E
)
239 static struct matrix_keymap_data smdkv310_keymap_data __initdata
= {
240 .keymap
= smdkv310_keymap
,
241 .keymap_size
= ARRAY_SIZE(smdkv310_keymap
),
244 static struct samsung_keypad_platdata smdkv310_keypad_data __initdata
= {
245 .keymap_data
= &smdkv310_keymap_data
,
250 static struct i2c_board_info i2c_devs1
[] __initdata
= {
251 {I2C_BOARD_INFO("wm8994", 0x1a),},
255 static struct s5p_ehci_platdata smdkv310_ehci_pdata
;
257 static void __init
smdkv310_ehci_init(void)
259 struct s5p_ehci_platdata
*pdata
= &smdkv310_ehci_pdata
;
261 s5p_ehci_set_platdata(pdata
);
265 static struct exynos4_ohci_platdata smdkv310_ohci_pdata
;
267 static void __init
smdkv310_ohci_init(void)
269 struct exynos4_ohci_platdata
*pdata
= &smdkv310_ohci_pdata
;
271 exynos4_ohci_set_platdata(pdata
);
275 static struct s3c_hsotg_plat smdkv310_hsotg_pdata
;
278 static struct platform_device smdkv310_device_audio
= {
279 .name
= "smdk-audio",
283 static struct platform_device
*smdkv310_devices
[] __initdata
= {
289 &s5p_device_i2c_hdmiphy
,
291 &s3c_device_usb_hsotg
,
301 #ifdef CONFIG_DRM_EXYNOS
304 &exynos4_device_ac97
,
305 &exynos4_device_i2s0
,
306 &exynos4_device_ohci
,
307 &samsung_device_keypad
,
311 &exynos4_device_spdif
,
315 &smdkv310_device_audio
,
316 &smdkv310_lcd_lte480wv
,
318 &exynos4_device_ahci
,
323 static void __init
smdkv310_smsc911x_init(void)
327 /* configure nCS1 width to 16 bits */
328 cs1
= __raw_readl(S5P_SROM_BW
) &
329 ~(S5P_SROM_BW__CS_MASK
<< S5P_SROM_BW__NCS1__SHIFT
);
330 cs1
|= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT
) |
331 (1 << S5P_SROM_BW__WAITENABLE__SHIFT
) |
332 (1 << S5P_SROM_BW__BYTEENABLE__SHIFT
)) <<
333 S5P_SROM_BW__NCS1__SHIFT
;
334 __raw_writel(cs1
, S5P_SROM_BW
);
336 /* set timing for nCS1 suitable for ethernet chip */
337 __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT
) |
338 (0x9 << S5P_SROM_BCX__TACP__SHIFT
) |
339 (0xc << S5P_SROM_BCX__TCAH__SHIFT
) |
340 (0x1 << S5P_SROM_BCX__TCOH__SHIFT
) |
341 (0x6 << S5P_SROM_BCX__TACC__SHIFT
) |
342 (0x1 << S5P_SROM_BCX__TCOS__SHIFT
) |
343 (0x1 << S5P_SROM_BCX__TACS__SHIFT
), S5P_SROM_BC1
);
346 /* LCD Backlight data */
347 static struct samsung_bl_gpio_info smdkv310_bl_gpio_info
= {
348 .no
= EXYNOS4_GPD0(1),
349 .func
= S3C_GPIO_SFN(2),
352 static struct platform_pwm_backlight_data smdkv310_bl_data
= {
354 .pwm_period_ns
= 1000,
357 static void s5p_tv_setup(void)
359 /* direct HPD to HDMI chip */
360 WARN_ON(gpio_request_one(EXYNOS4_GPX3(7), GPIOF_IN
, "hpd-plug"));
361 s3c_gpio_cfgpin(EXYNOS4_GPX3(7), S3C_GPIO_SFN(0x3));
362 s3c_gpio_setpull(EXYNOS4_GPX3(7), S3C_GPIO_PULL_NONE
);
365 static void __init
smdkv310_map_io(void)
367 exynos_init_io(NULL
, 0);
368 s3c24xx_init_clocks(clk_xusbxti
.rate
);
369 s3c24xx_init_uarts(smdkv310_uartcfgs
, ARRAY_SIZE(smdkv310_uartcfgs
));
372 static void __init
smdkv310_reserve(void)
374 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
377 static void __init
smdkv310_machine_init(void)
379 s3c_i2c1_set_platdata(NULL
);
380 i2c_register_board_info(1, i2c_devs1
, ARRAY_SIZE(i2c_devs1
));
382 smdkv310_smsc911x_init();
384 s3c_sdhci0_set_platdata(&smdkv310_hsmmc0_pdata
);
385 s3c_sdhci1_set_platdata(&smdkv310_hsmmc1_pdata
);
386 s3c_sdhci2_set_platdata(&smdkv310_hsmmc2_pdata
);
387 s3c_sdhci3_set_platdata(&smdkv310_hsmmc3_pdata
);
390 s5p_i2c_hdmiphy_set_platdata(NULL
);
392 samsung_keypad_set_platdata(&smdkv310_keypad_data
);
394 samsung_bl_set(&smdkv310_bl_gpio_info
, &smdkv310_bl_data
);
395 #ifdef CONFIG_DRM_EXYNOS
396 s5p_device_fimd0
.dev
.platform_data
= &drm_fimd_pdata
;
397 exynos4_fimd0_gpio_setup_24bpp();
399 s5p_fimd0_set_platdata(&smdkv310_lcd0_pdata
);
402 smdkv310_ehci_init();
403 smdkv310_ohci_init();
404 s3c_hsotg_set_platdata(&smdkv310_hsotg_pdata
);
406 platform_add_devices(smdkv310_devices
, ARRAY_SIZE(smdkv310_devices
));
409 MACHINE_START(SMDKV310
, "SMDKV310")
410 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
411 /* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */
412 .atag_offset
= 0x100,
413 .init_irq
= exynos4_init_irq
,
414 .map_io
= smdkv310_map_io
,
415 .handle_irq
= gic_handle_irq
,
416 .init_machine
= smdkv310_machine_init
,
417 .timer
= &exynos4_timer
,
418 .reserve
= &smdkv310_reserve
,
419 .restart
= exynos4_restart
,
422 MACHINE_START(SMDKC210
, "SMDKC210")
423 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
424 .atag_offset
= 0x100,
425 .init_irq
= exynos4_init_irq
,
426 .map_io
= smdkv310_map_io
,
427 .handle_irq
= gic_handle_irq
,
428 .init_machine
= smdkv310_machine_init
,
429 .init_late
= exynos_init_late
,
430 .timer
= &exynos4_timer
,
431 .reserve
= &smdkv310_reserve
,
432 .restart
= exynos4_restart
,