blob: edd814110da86efcf451e1c1c0585651a447011b [file] [log] [blame]
Kukjin Kimd11135c2011-02-14 14:59:52 +09001/* linux/arch/arm/mach-exynos4/mach-smdkv310.c
Changhwan Younb1d69cc2010-07-16 12:18:36 +09002 *
Kukjin Kimd11135c2011-02-14 14:59:52 +09003 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
Changhwan Younb1d69cc2010-07-16 12:18:36 +09005 *
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.
9*/
10
11#include <linux/serial_core.h>
Hyuk Lee2b111482010-10-06 14:50:20 +090012#include <linux/gpio.h>
13#include <linux/mmc/host.h>
14#include <linux/platform_device.h>
Daein Mooncbff3eb2010-10-26 12:51:17 +090015#include <linux/smsc911x.h>
16#include <linux/io.h>
Jassi Brar6f5c11c2010-12-21 09:59:05 +090017#include <linux/i2c.h>
Naveen Krishna Chbe4c33b2011-02-22 17:16:58 +090018#include <linux/input.h>
Changhwan Younb1d69cc2010-07-16 12:18:36 +090019
20#include <asm/mach/arch.h>
21#include <asm/mach-types.h>
Changhwan Younb1d69cc2010-07-16 12:18:36 +090022
23#include <plat/regs-serial.h>
Kukjin Kim8cf460a2010-11-15 09:18:57 +090024#include <plat/regs-srom.h>
Kukjin Kimd11135c2011-02-14 14:59:52 +090025#include <plat/exynos4.h>
Changhwan Younb1d69cc2010-07-16 12:18:36 +090026#include <plat/cpu.h>
Changhwan Youncdff6e62010-09-20 15:25:51 +090027#include <plat/devs.h>
Naveen Krishna Chbe4c33b2011-02-22 17:16:58 +090028#include <plat/keypad.h>
Hyuk Lee2b111482010-10-06 14:50:20 +090029#include <plat/sdhci.h>
Jassi Brar6f5c11c2010-12-21 09:59:05 +090030#include <plat/iic.h>
Changhwan Yound6d8b482010-12-03 17:15:40 +090031#include <plat/pd.h>
Changhwan Younb1d69cc2010-07-16 12:18:36 +090032
33#include <mach/map.h>
34
35/* Following are default values for UCON, ULCON and UFCON UART registers */
36#define SMDKV310_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
37 S3C2410_UCON_RXILEVEL | \
38 S3C2410_UCON_TXIRQMODE | \
39 S3C2410_UCON_RXIRQMODE | \
40 S3C2410_UCON_RXFIFO_TOI | \
41 S3C2443_UCON_RXERR_IRQEN)
42
43#define SMDKV310_ULCON_DEFAULT S3C2410_LCON_CS8
44
45#define SMDKV310_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
46 S5PV210_UFCON_TXTRIG4 | \
47 S5PV210_UFCON_RXTRIG4)
48
49static struct s3c2410_uartcfg smdkv310_uartcfgs[] __initdata = {
50 [0] = {
51 .hwport = 0,
52 .flags = 0,
53 .ucon = SMDKV310_UCON_DEFAULT,
54 .ulcon = SMDKV310_ULCON_DEFAULT,
55 .ufcon = SMDKV310_UFCON_DEFAULT,
56 },
57 [1] = {
58 .hwport = 1,
59 .flags = 0,
60 .ucon = SMDKV310_UCON_DEFAULT,
61 .ulcon = SMDKV310_ULCON_DEFAULT,
62 .ufcon = SMDKV310_UFCON_DEFAULT,
63 },
64 [2] = {
65 .hwport = 2,
66 .flags = 0,
67 .ucon = SMDKV310_UCON_DEFAULT,
68 .ulcon = SMDKV310_ULCON_DEFAULT,
69 .ufcon = SMDKV310_UFCON_DEFAULT,
70 },
71 [3] = {
72 .hwport = 3,
73 .flags = 0,
74 .ucon = SMDKV310_UCON_DEFAULT,
75 .ulcon = SMDKV310_ULCON_DEFAULT,
76 .ufcon = SMDKV310_UFCON_DEFAULT,
77 },
78};
79
Hyuk Lee2b111482010-10-06 14:50:20 +090080static struct s3c_sdhci_platdata smdkv310_hsmmc0_pdata __initdata = {
Thomas Abrahama0d8efe2011-06-16 16:12:35 +090081 .cd_type = S3C_SDHCI_CD_INTERNAL,
Jeongbae Seo28c80aa2010-10-08 18:03:27 +090082 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
Kukjin Kimd11135c2011-02-14 14:59:52 +090083#ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT
Hyuk Lee2b111482010-10-06 14:50:20 +090084 .max_width = 8,
85 .host_caps = MMC_CAP_8_BIT_DATA,
86#endif
87};
88
89static struct s3c_sdhci_platdata smdkv310_hsmmc1_pdata __initdata = {
90 .cd_type = S3C_SDHCI_CD_GPIO,
Kukjin Kimd11135c2011-02-14 14:59:52 +090091 .ext_cd_gpio = EXYNOS4_GPK0(2),
Hyuk Lee2b111482010-10-06 14:50:20 +090092 .ext_cd_gpio_invert = 1,
Jeongbae Seo28c80aa2010-10-08 18:03:27 +090093 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
Hyuk Lee2b111482010-10-06 14:50:20 +090094};
95
96static struct s3c_sdhci_platdata smdkv310_hsmmc2_pdata __initdata = {
Thomas Abrahama0d8efe2011-06-16 16:12:35 +090097 .cd_type = S3C_SDHCI_CD_INTERNAL,
Jeongbae Seo28c80aa2010-10-08 18:03:27 +090098 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
Kukjin Kimd11135c2011-02-14 14:59:52 +090099#ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT
Hyuk Lee2b111482010-10-06 14:50:20 +0900100 .max_width = 8,
101 .host_caps = MMC_CAP_8_BIT_DATA,
102#endif
103};
104
105static struct s3c_sdhci_platdata smdkv310_hsmmc3_pdata __initdata = {
106 .cd_type = S3C_SDHCI_CD_GPIO,
Kukjin Kimd11135c2011-02-14 14:59:52 +0900107 .ext_cd_gpio = EXYNOS4_GPK2(2),
Hyuk Lee2b111482010-10-06 14:50:20 +0900108 .ext_cd_gpio_invert = 1,
Jeongbae Seo28c80aa2010-10-08 18:03:27 +0900109 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
Hyuk Lee2b111482010-10-06 14:50:20 +0900110};
111
Daein Mooncbff3eb2010-10-26 12:51:17 +0900112static struct resource smdkv310_smsc911x_resources[] = {
113 [0] = {
Kukjin Kimd11135c2011-02-14 14:59:52 +0900114 .start = EXYNOS4_PA_SROM_BANK(1),
115 .end = EXYNOS4_PA_SROM_BANK(1) + SZ_64K - 1,
Daein Mooncbff3eb2010-10-26 12:51:17 +0900116 .flags = IORESOURCE_MEM,
117 },
118 [1] = {
119 .start = IRQ_EINT(5),
120 .end = IRQ_EINT(5),
121 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
122 },
123};
124
125static struct smsc911x_platform_config smsc9215_config = {
Jeongtae Parkcd0527c2011-03-25 15:48:15 +0900126 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
Daein Mooncbff3eb2010-10-26 12:51:17 +0900127 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
128 .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
129 .phy_interface = PHY_INTERFACE_MODE_MII,
130 .mac = {0x00, 0x80, 0x00, 0x23, 0x45, 0x67},
131};
132
133static struct platform_device smdkv310_smsc911x = {
134 .name = "smsc911x",
135 .id = -1,
136 .num_resources = ARRAY_SIZE(smdkv310_smsc911x_resources),
137 .resource = smdkv310_smsc911x_resources,
138 .dev = {
139 .platform_data = &smsc9215_config,
140 },
141};
142
Naveen Krishna Chbe4c33b2011-02-22 17:16:58 +0900143static uint32_t smdkv310_keymap[] __initdata = {
144 /* KEY(row, col, keycode) */
145 KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
146 KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
147 KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
148 KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
149};
150
151static struct matrix_keymap_data smdkv310_keymap_data __initdata = {
152 .keymap = smdkv310_keymap,
153 .keymap_size = ARRAY_SIZE(smdkv310_keymap),
154};
155
156static struct samsung_keypad_platdata smdkv310_keypad_data __initdata = {
157 .keymap_data = &smdkv310_keymap_data,
158 .rows = 2,
159 .cols = 8,
160};
161
Jassi Brar6f5c11c2010-12-21 09:59:05 +0900162static struct i2c_board_info i2c_devs1[] __initdata = {
163 {I2C_BOARD_INFO("wm8994", 0x1a),},
164};
165
Changhwan Youncdff6e62010-09-20 15:25:51 +0900166static struct platform_device *smdkv310_devices[] __initdata = {
Hyuk Lee2b111482010-10-06 14:50:20 +0900167 &s3c_device_hsmmc0,
168 &s3c_device_hsmmc1,
169 &s3c_device_hsmmc2,
170 &s3c_device_hsmmc3,
Kukjin Kim285dee72010-12-31 10:52:05 +0900171 &s3c_device_i2c1,
Changhwan Youncdff6e62010-09-20 15:25:51 +0900172 &s3c_device_rtc,
Jemings Ko8d75c912010-09-20 15:33:04 +0900173 &s3c_device_wdt,
Kukjin Kimd11135c2011-02-14 14:59:52 +0900174 &exynos4_device_ac97,
175 &exynos4_device_i2s0,
Naveen Krishna Chbe4c33b2011-02-22 17:16:58 +0900176 &samsung_device_keypad,
Kukjin Kimd11135c2011-02-14 14:59:52 +0900177 &exynos4_device_pd[PD_MFC],
178 &exynos4_device_pd[PD_G3D],
179 &exynos4_device_pd[PD_LCD0],
180 &exynos4_device_pd[PD_LCD1],
181 &exynos4_device_pd[PD_CAM],
182 &exynos4_device_pd[PD_TV],
183 &exynos4_device_pd[PD_GPS],
184 &exynos4_device_sysmmu,
Jassi Brarfbcb44d2011-01-18 14:41:43 +0900185 &samsung_asoc_dma,
186 &smdkv310_smsc911x,
Changhwan Youncdff6e62010-09-20 15:25:51 +0900187};
188
Daein Mooncbff3eb2010-10-26 12:51:17 +0900189static void __init smdkv310_smsc911x_init(void)
190{
191 u32 cs1;
192
193 /* configure nCS1 width to 16 bits */
Kukjin Kim8cf460a2010-11-15 09:18:57 +0900194 cs1 = __raw_readl(S5P_SROM_BW) &
195 ~(S5P_SROM_BW__CS_MASK << S5P_SROM_BW__NCS1__SHIFT);
196 cs1 |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) |
197 (1 << S5P_SROM_BW__WAITENABLE__SHIFT) |
198 (1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) <<
199 S5P_SROM_BW__NCS1__SHIFT;
200 __raw_writel(cs1, S5P_SROM_BW);
Daein Mooncbff3eb2010-10-26 12:51:17 +0900201
202 /* set timing for nCS1 suitable for ethernet chip */
Kukjin Kim8cf460a2010-11-15 09:18:57 +0900203 __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) |
204 (0x9 << S5P_SROM_BCX__TACP__SHIFT) |
205 (0xc << S5P_SROM_BCX__TCAH__SHIFT) |
206 (0x1 << S5P_SROM_BCX__TCOH__SHIFT) |
207 (0x6 << S5P_SROM_BCX__TACC__SHIFT) |
208 (0x1 << S5P_SROM_BCX__TCOS__SHIFT) |
209 (0x1 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1);
Daein Mooncbff3eb2010-10-26 12:51:17 +0900210}
211
Changhwan Younb1d69cc2010-07-16 12:18:36 +0900212static void __init smdkv310_map_io(void)
213{
214 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
215 s3c24xx_init_clocks(24000000);
216 s3c24xx_init_uarts(smdkv310_uartcfgs, ARRAY_SIZE(smdkv310_uartcfgs));
217}
218
219static void __init smdkv310_machine_init(void)
220{
Jassi Brar6f5c11c2010-12-21 09:59:05 +0900221 s3c_i2c1_set_platdata(NULL);
222 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
223
Daein Mooncbff3eb2010-10-26 12:51:17 +0900224 smdkv310_smsc911x_init();
225
Hyuk Lee2b111482010-10-06 14:50:20 +0900226 s3c_sdhci0_set_platdata(&smdkv310_hsmmc0_pdata);
227 s3c_sdhci1_set_platdata(&smdkv310_hsmmc1_pdata);
228 s3c_sdhci2_set_platdata(&smdkv310_hsmmc2_pdata);
229 s3c_sdhci3_set_platdata(&smdkv310_hsmmc3_pdata);
230
Naveen Krishna Chbe4c33b2011-02-22 17:16:58 +0900231 samsung_keypad_set_platdata(&smdkv310_keypad_data);
232
Changhwan Youncdff6e62010-09-20 15:25:51 +0900233 platform_add_devices(smdkv310_devices, ARRAY_SIZE(smdkv310_devices));
Changhwan Younb1d69cc2010-07-16 12:18:36 +0900234}
235
236MACHINE_START(SMDKV310, "SMDKV310")
237 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
238 /* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */
Changhwan Younb1d69cc2010-07-16 12:18:36 +0900239 .boot_params = S5P_PA_SDRAM + 0x100,
Kukjin Kimd11135c2011-02-14 14:59:52 +0900240 .init_irq = exynos4_init_irq,
Changhwan Younb1d69cc2010-07-16 12:18:36 +0900241 .map_io = smdkv310_map_io,
242 .init_machine = smdkv310_machine_init,
Kukjin Kimd11135c2011-02-14 14:59:52 +0900243 .timer = &exynos4_timer,
Changhwan Younb1d69cc2010-07-16 12:18:36 +0900244MACHINE_END