1 /* linux/arch/arm/mach-exynos4/mach-smdkc210.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>
21 #include <asm/mach/arch.h>
22 #include <asm/mach-types.h>
24 #include <video/platform_lcd.h>
26 #include <plat/regs-serial.h>
27 #include <plat/regs-srom.h>
28 #include <plat/regs-fb-v4.h>
29 #include <plat/exynos4.h>
31 #include <plat/devs.h>
33 #include <plat/sdhci.h>
39 /* Following are default values for UCON, ULCON and UFCON UART registers */
40 #define SMDKC210_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 SMDKC210_ULCON_DEFAULT S3C2410_LCON_CS8
49 #define SMDKC210_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
50 S5PV210_UFCON_TXTRIG4 | \
51 S5PV210_UFCON_RXTRIG4)
53 static struct s3c2410_uartcfg smdkc210_uartcfgs
[] __initdata
= {
57 .ucon
= SMDKC210_UCON_DEFAULT
,
58 .ulcon
= SMDKC210_ULCON_DEFAULT
,
59 .ufcon
= SMDKC210_UFCON_DEFAULT
,
64 .ucon
= SMDKC210_UCON_DEFAULT
,
65 .ulcon
= SMDKC210_ULCON_DEFAULT
,
66 .ufcon
= SMDKC210_UFCON_DEFAULT
,
71 .ucon
= SMDKC210_UCON_DEFAULT
,
72 .ulcon
= SMDKC210_ULCON_DEFAULT
,
73 .ufcon
= SMDKC210_UFCON_DEFAULT
,
78 .ucon
= SMDKC210_UCON_DEFAULT
,
79 .ulcon
= SMDKC210_ULCON_DEFAULT
,
80 .ufcon
= SMDKC210_UFCON_DEFAULT
,
84 static struct s3c_sdhci_platdata smdkc210_hsmmc0_pdata __initdata
= {
85 .cd_type
= S3C_SDHCI_CD_GPIO
,
86 .ext_cd_gpio
= EXYNOS4_GPK0(2),
87 .ext_cd_gpio_invert
= 1,
88 .clk_type
= S3C_SDHCI_CLK_DIV_EXTERNAL
,
89 #ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT
91 .host_caps
= MMC_CAP_8_BIT_DATA
,
95 static struct s3c_sdhci_platdata smdkc210_hsmmc1_pdata __initdata
= {
96 .cd_type
= S3C_SDHCI_CD_GPIO
,
97 .ext_cd_gpio
= EXYNOS4_GPK0(2),
98 .ext_cd_gpio_invert
= 1,
99 .clk_type
= S3C_SDHCI_CLK_DIV_EXTERNAL
,
102 static struct s3c_sdhci_platdata smdkc210_hsmmc2_pdata __initdata
= {
103 .cd_type
= S3C_SDHCI_CD_GPIO
,
104 .ext_cd_gpio
= EXYNOS4_GPK2(2),
105 .ext_cd_gpio_invert
= 1,
106 .clk_type
= S3C_SDHCI_CLK_DIV_EXTERNAL
,
107 #ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT
109 .host_caps
= MMC_CAP_8_BIT_DATA
,
113 static struct s3c_sdhci_platdata smdkc210_hsmmc3_pdata __initdata
= {
114 .cd_type
= S3C_SDHCI_CD_GPIO
,
115 .ext_cd_gpio
= EXYNOS4_GPK2(2),
116 .ext_cd_gpio_invert
= 1,
117 .clk_type
= S3C_SDHCI_CLK_DIV_EXTERNAL
,
120 static void lcd_lte480wv_set_power(struct plat_lcd_data
*pd
,
124 #if !defined(CONFIG_BACKLIGHT_PWM)
125 gpio_request_one(EXYNOS4_GPD0(1), GPIOF_OUT_INIT_HIGH
, "GPD0");
126 gpio_free(EXYNOS4_GPD0(1));
128 /* fire nRESET on power up */
129 gpio_request(EXYNOS4_GPX0(6), "GPX0");
131 gpio_direction_output(EXYNOS4_GPX0(6), 1);
134 gpio_set_value(EXYNOS4_GPX0(6), 0);
137 gpio_set_value(EXYNOS4_GPX0(6), 1);
140 gpio_free(EXYNOS4_GPX0(6));
142 #if !defined(CONFIG_BACKLIGHT_PWM)
143 gpio_request_one(EXYNOS4_GPD0(1), GPIOF_OUT_INIT_LOW
, "GPD0");
144 gpio_free(EXYNOS4_GPD0(1));
149 static struct plat_lcd_data smdkc210_lcd_lte480wv_data
= {
150 .set_power
= lcd_lte480wv_set_power
,
153 static struct platform_device smdkc210_lcd_lte480wv
= {
154 .name
= "platform-lcd",
155 .dev
.parent
= &s5p_device_fimd0
.dev
,
156 .dev
.platform_data
= &smdkc210_lcd_lte480wv_data
,
159 static struct s3c_fb_pd_win smdkc210_fb_win0
= {
174 static struct s3c_fb_platdata smdkc210_lcd0_pdata __initdata
= {
175 .win
[0] = &smdkc210_fb_win0
,
176 .vidcon0
= VIDCON0_VIDOUT_RGB
| VIDCON0_PNRMODE_RGB
,
177 .vidcon1
= VIDCON1_INV_HSYNC
| VIDCON1_INV_VSYNC
,
178 .setup_gpio
= exynos4_fimd0_gpio_setup_24bpp
,
181 static struct resource smdkc210_smsc911x_resources
[] = {
183 .start
= EXYNOS4_PA_SROM_BANK(1),
184 .end
= EXYNOS4_PA_SROM_BANK(1) + SZ_64K
- 1,
185 .flags
= IORESOURCE_MEM
,
188 .start
= IRQ_EINT(5),
190 .flags
= IORESOURCE_IRQ
| IRQF_TRIGGER_LOW
,
194 static struct smsc911x_platform_config smsc9215_config
= {
195 .irq_polarity
= SMSC911X_IRQ_POLARITY_ACTIVE_LOW
,
196 .irq_type
= SMSC911X_IRQ_TYPE_PUSH_PULL
,
197 .flags
= SMSC911X_USE_16BIT
| SMSC911X_FORCE_INTERNAL_PHY
,
198 .phy_interface
= PHY_INTERFACE_MODE_MII
,
199 .mac
= {0x00, 0x80, 0x00, 0x23, 0x45, 0x67},
202 static struct platform_device smdkc210_smsc911x
= {
205 .num_resources
= ARRAY_SIZE(smdkc210_smsc911x_resources
),
206 .resource
= smdkc210_smsc911x_resources
,
208 .platform_data
= &smsc9215_config
,
212 static struct i2c_board_info i2c_devs1
[] __initdata
= {
213 {I2C_BOARD_INFO("wm8994", 0x1a),},
216 static struct platform_device
*smdkc210_devices
[] __initdata
= {
224 &exynos4_device_ac97
,
225 &exynos4_device_i2s0
,
226 &exynos4_device_pd
[PD_MFC
],
227 &exynos4_device_pd
[PD_G3D
],
228 &exynos4_device_pd
[PD_LCD0
],
229 &exynos4_device_pd
[PD_LCD1
],
230 &exynos4_device_pd
[PD_CAM
],
231 &exynos4_device_pd
[PD_TV
],
232 &exynos4_device_pd
[PD_GPS
],
233 &exynos4_device_sysmmu
,
236 &smdkc210_lcd_lte480wv
,
240 static void __init
smdkc210_smsc911x_init(void)
244 /* configure nCS1 width to 16 bits */
245 cs1
= __raw_readl(S5P_SROM_BW
) &
246 ~(S5P_SROM_BW__CS_MASK
<< S5P_SROM_BW__NCS1__SHIFT
);
247 cs1
|= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT
) |
248 (1 << S5P_SROM_BW__WAITENABLE__SHIFT
) |
249 (1 << S5P_SROM_BW__BYTEENABLE__SHIFT
)) <<
250 S5P_SROM_BW__NCS1__SHIFT
;
251 __raw_writel(cs1
, S5P_SROM_BW
);
253 /* set timing for nCS1 suitable for ethernet chip */
254 __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT
) |
255 (0x9 << S5P_SROM_BCX__TACP__SHIFT
) |
256 (0xc << S5P_SROM_BCX__TCAH__SHIFT
) |
257 (0x1 << S5P_SROM_BCX__TCOH__SHIFT
) |
258 (0x6 << S5P_SROM_BCX__TACC__SHIFT
) |
259 (0x1 << S5P_SROM_BCX__TCOS__SHIFT
) |
260 (0x1 << S5P_SROM_BCX__TACS__SHIFT
), S5P_SROM_BC1
);
263 static void __init
smdkc210_map_io(void)
265 s5p_init_io(NULL
, 0, S5P_VA_CHIPID
);
266 s3c24xx_init_clocks(24000000);
267 s3c24xx_init_uarts(smdkc210_uartcfgs
, ARRAY_SIZE(smdkc210_uartcfgs
));
270 static void __init
smdkc210_machine_init(void)
272 s3c_i2c1_set_platdata(NULL
);
273 i2c_register_board_info(1, i2c_devs1
, ARRAY_SIZE(i2c_devs1
));
275 smdkc210_smsc911x_init();
277 s3c_sdhci0_set_platdata(&smdkc210_hsmmc0_pdata
);
278 s3c_sdhci1_set_platdata(&smdkc210_hsmmc1_pdata
);
279 s3c_sdhci2_set_platdata(&smdkc210_hsmmc2_pdata
);
280 s3c_sdhci3_set_platdata(&smdkc210_hsmmc3_pdata
);
282 s5p_fimd0_set_platdata(&smdkc210_lcd0_pdata
);
284 platform_add_devices(smdkc210_devices
, ARRAY_SIZE(smdkc210_devices
));
287 MACHINE_START(SMDKC210
, "SMDKC210")
288 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
289 .boot_params
= S5P_PA_SDRAM
+ 0x100,
290 .init_irq
= exynos4_init_irq
,
291 .map_io
= smdkc210_map_io
,
292 .init_machine
= smdkc210_machine_init
,
293 .timer
= &exynos4_timer
,