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/gpio.h>
13 #include <linux/mmc/host.h>
14 #include <linux/platform_device.h>
15 #include <linux/smsc911x.h>
17 #include <linux/i2c.h>
18 #include <linux/input.h>
19 #include <linux/pwm_backlight.h>
21 #include <asm/mach/arch.h>
22 #include <asm/mach-types.h>
24 #include <plat/regs-serial.h>
25 #include <plat/regs-srom.h>
26 #include <plat/exynos4.h>
28 #include <plat/devs.h>
29 #include <plat/keypad.h>
30 #include <plat/sdhci.h>
33 #include <plat/gpio-cfg.h>
34 #include <plat/backlight.h>
39 /* Following are default values for UCON, ULCON and UFCON UART registers */
40 #define SMDKV310_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
41 S3C2410_UCON_RXILEVEL | \
42 S3C2410_UCON_TXIRQMODE | \
43 S3C2410_UCON_RXIRQMODE | \
44 S3C2410_UCON_RXFIFO_TOI | \
45 S3C2443_UCON_RXERR_IRQEN)
47 #define SMDKV310_ULCON_DEFAULT S3C2410_LCON_CS8
49 #define SMDKV310_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
50 S5PV210_UFCON_TXTRIG4 | \
51 S5PV210_UFCON_RXTRIG4)
53 static struct s3c2410_uartcfg smdkv310_uartcfgs
[] __initdata
= {
57 .ucon
= SMDKV310_UCON_DEFAULT
,
58 .ulcon
= SMDKV310_ULCON_DEFAULT
,
59 .ufcon
= SMDKV310_UFCON_DEFAULT
,
64 .ucon
= SMDKV310_UCON_DEFAULT
,
65 .ulcon
= SMDKV310_ULCON_DEFAULT
,
66 .ufcon
= SMDKV310_UFCON_DEFAULT
,
71 .ucon
= SMDKV310_UCON_DEFAULT
,
72 .ulcon
= SMDKV310_ULCON_DEFAULT
,
73 .ufcon
= SMDKV310_UFCON_DEFAULT
,
78 .ucon
= SMDKV310_UCON_DEFAULT
,
79 .ulcon
= SMDKV310_ULCON_DEFAULT
,
80 .ufcon
= SMDKV310_UFCON_DEFAULT
,
84 static struct s3c_sdhci_platdata smdkv310_hsmmc0_pdata __initdata
= {
85 .cd_type
= S3C_SDHCI_CD_INTERNAL
,
86 .clk_type
= S3C_SDHCI_CLK_DIV_EXTERNAL
,
87 #ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT
89 .host_caps
= MMC_CAP_8_BIT_DATA
,
93 static struct s3c_sdhci_platdata smdkv310_hsmmc1_pdata __initdata
= {
94 .cd_type
= S3C_SDHCI_CD_GPIO
,
95 .ext_cd_gpio
= EXYNOS4_GPK0(2),
96 .ext_cd_gpio_invert
= 1,
97 .clk_type
= S3C_SDHCI_CLK_DIV_EXTERNAL
,
100 static struct s3c_sdhci_platdata smdkv310_hsmmc2_pdata __initdata
= {
101 .cd_type
= S3C_SDHCI_CD_INTERNAL
,
102 .clk_type
= S3C_SDHCI_CLK_DIV_EXTERNAL
,
103 #ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT
105 .host_caps
= MMC_CAP_8_BIT_DATA
,
109 static struct s3c_sdhci_platdata smdkv310_hsmmc3_pdata __initdata
= {
110 .cd_type
= S3C_SDHCI_CD_GPIO
,
111 .ext_cd_gpio
= EXYNOS4_GPK2(2),
112 .ext_cd_gpio_invert
= 1,
113 .clk_type
= S3C_SDHCI_CLK_DIV_EXTERNAL
,
116 static struct resource smdkv310_smsc911x_resources
[] = {
118 .start
= EXYNOS4_PA_SROM_BANK(1),
119 .end
= EXYNOS4_PA_SROM_BANK(1) + SZ_64K
- 1,
120 .flags
= IORESOURCE_MEM
,
123 .start
= IRQ_EINT(5),
125 .flags
= IORESOURCE_IRQ
| IRQF_TRIGGER_LOW
,
129 static struct smsc911x_platform_config smsc9215_config
= {
130 .irq_polarity
= SMSC911X_IRQ_POLARITY_ACTIVE_LOW
,
131 .irq_type
= SMSC911X_IRQ_TYPE_PUSH_PULL
,
132 .flags
= SMSC911X_USE_16BIT
| SMSC911X_FORCE_INTERNAL_PHY
,
133 .phy_interface
= PHY_INTERFACE_MODE_MII
,
134 .mac
= {0x00, 0x80, 0x00, 0x23, 0x45, 0x67},
137 static struct platform_device smdkv310_smsc911x
= {
140 .num_resources
= ARRAY_SIZE(smdkv310_smsc911x_resources
),
141 .resource
= smdkv310_smsc911x_resources
,
143 .platform_data
= &smsc9215_config
,
147 static uint32_t smdkv310_keymap
[] __initdata
= {
148 /* KEY(row, col, keycode) */
149 KEY(0, 3, KEY_1
), KEY(0, 4, KEY_2
), KEY(0, 5, KEY_3
),
150 KEY(0, 6, KEY_4
), KEY(0, 7, KEY_5
),
151 KEY(1, 3, KEY_A
), KEY(1, 4, KEY_B
), KEY(1, 5, KEY_C
),
152 KEY(1, 6, KEY_D
), KEY(1, 7, KEY_E
)
155 static struct matrix_keymap_data smdkv310_keymap_data __initdata
= {
156 .keymap
= smdkv310_keymap
,
157 .keymap_size
= ARRAY_SIZE(smdkv310_keymap
),
160 static struct samsung_keypad_platdata smdkv310_keypad_data __initdata
= {
161 .keymap_data
= &smdkv310_keymap_data
,
166 static struct i2c_board_info i2c_devs1
[] __initdata
= {
167 {I2C_BOARD_INFO("wm8994", 0x1a),},
170 static struct platform_device
*smdkv310_devices
[] __initdata
= {
176 &s5p_device_i2c_hdmiphy
,
179 &exynos4_device_ac97
,
180 &exynos4_device_i2s0
,
181 &samsung_device_keypad
,
185 &exynos4_device_pd
[PD_MFC
],
186 &exynos4_device_pd
[PD_G3D
],
187 &exynos4_device_pd
[PD_LCD0
],
188 &exynos4_device_pd
[PD_LCD1
],
189 &exynos4_device_pd
[PD_CAM
],
190 &exynos4_device_pd
[PD_TV
],
191 &exynos4_device_pd
[PD_GPS
],
192 &exynos4_device_spdif
,
193 &exynos4_device_sysmmu
,
197 &exynos4_device_ahci
,
202 static void __init
smdkv310_smsc911x_init(void)
206 /* configure nCS1 width to 16 bits */
207 cs1
= __raw_readl(S5P_SROM_BW
) &
208 ~(S5P_SROM_BW__CS_MASK
<< S5P_SROM_BW__NCS1__SHIFT
);
209 cs1
|= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT
) |
210 (1 << S5P_SROM_BW__WAITENABLE__SHIFT
) |
211 (1 << S5P_SROM_BW__BYTEENABLE__SHIFT
)) <<
212 S5P_SROM_BW__NCS1__SHIFT
;
213 __raw_writel(cs1
, S5P_SROM_BW
);
215 /* set timing for nCS1 suitable for ethernet chip */
216 __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT
) |
217 (0x9 << S5P_SROM_BCX__TACP__SHIFT
) |
218 (0xc << S5P_SROM_BCX__TCAH__SHIFT
) |
219 (0x1 << S5P_SROM_BCX__TCOH__SHIFT
) |
220 (0x6 << S5P_SROM_BCX__TACC__SHIFT
) |
221 (0x1 << S5P_SROM_BCX__TCOS__SHIFT
) |
222 (0x1 << S5P_SROM_BCX__TACS__SHIFT
), S5P_SROM_BC1
);
225 /* LCD Backlight data */
226 static struct samsung_bl_gpio_info smdkv310_bl_gpio_info
= {
227 .no
= EXYNOS4_GPD0(1),
228 .func
= S3C_GPIO_SFN(2),
231 static struct platform_pwm_backlight_data smdkv310_bl_data
= {
233 .pwm_period_ns
= 1000,
236 static void s5p_tv_setup(void)
238 /* direct HPD to HDMI chip */
239 WARN_ON(gpio_request_one(EXYNOS4_GPX3(7), GPIOF_IN
, "hpd-plug"));
240 s3c_gpio_cfgpin(EXYNOS4_GPX3(7), S3C_GPIO_SFN(0x3));
241 s3c_gpio_setpull(EXYNOS4_GPX3(7), S3C_GPIO_PULL_NONE
);
243 /* setup dependencies between TV devices */
244 s5p_device_hdmi
.dev
.parent
= &exynos4_device_pd
[PD_TV
].dev
;
245 s5p_device_mixer
.dev
.parent
= &exynos4_device_pd
[PD_TV
].dev
;
248 static void __init
smdkv310_map_io(void)
250 s5p_init_io(NULL
, 0, S5P_VA_CHIPID
);
251 s3c24xx_init_clocks(24000000);
252 s3c24xx_init_uarts(smdkv310_uartcfgs
, ARRAY_SIZE(smdkv310_uartcfgs
));
255 static void __init
smdkv310_reserve(void)
257 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
260 static void __init
smdkv310_machine_init(void)
262 s3c_i2c1_set_platdata(NULL
);
263 i2c_register_board_info(1, i2c_devs1
, ARRAY_SIZE(i2c_devs1
));
265 smdkv310_smsc911x_init();
267 s3c_sdhci0_set_platdata(&smdkv310_hsmmc0_pdata
);
268 s3c_sdhci1_set_platdata(&smdkv310_hsmmc1_pdata
);
269 s3c_sdhci2_set_platdata(&smdkv310_hsmmc2_pdata
);
270 s3c_sdhci3_set_platdata(&smdkv310_hsmmc3_pdata
);
273 s5p_i2c_hdmiphy_set_platdata(NULL
);
275 samsung_keypad_set_platdata(&smdkv310_keypad_data
);
277 samsung_bl_set(&smdkv310_bl_gpio_info
, &smdkv310_bl_data
);
279 platform_add_devices(smdkv310_devices
, ARRAY_SIZE(smdkv310_devices
));
280 s5p_device_mfc
.dev
.parent
= &exynos4_device_pd
[PD_MFC
].dev
;
283 MACHINE_START(SMDKV310
, "SMDKV310")
284 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
285 /* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */
286 .boot_params
= S5P_PA_SDRAM
+ 0x100,
287 .init_irq
= exynos4_init_irq
,
288 .map_io
= smdkv310_map_io
,
289 .init_machine
= smdkv310_machine_init
,
290 .timer
= &exynos4_timer
,
291 .reserve
= &smdkv310_reserve
,