blob: 88e0275143be3e769888aaa48615ee9a1105904e [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 = {
81 .cd_type = S3C_SDHCI_CD_GPIO,
Kukjin Kimd11135c2011-02-14 14:59:52 +090082 .ext_cd_gpio = EXYNOS4_GPK0(2),
Hyuk Lee2b111482010-10-06 14:50:20 +090083 .ext_cd_gpio_invert = 1,
Jeongbae Seo28c80aa2010-10-08 18:03:27 +090084 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
Kukjin Kimd11135c2011-02-14 14:59:52 +090085#ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT
Hyuk Lee2b111482010-10-06 14:50:20 +090086 .max_width = 8,
87 .host_caps = MMC_CAP_8_BIT_DATA,
88#endif
89};
90
91static struct s3c_sdhci_platdata smdkv310_hsmmc1_pdata __initdata = {
92 .cd_type = S3C_SDHCI_CD_GPIO,
Kukjin Kimd11135c2011-02-14 14:59:52 +090093 .ext_cd_gpio = EXYNOS4_GPK0(2),
Hyuk Lee2b111482010-10-06 14:50:20 +090094 .ext_cd_gpio_invert = 1,
Jeongbae Seo28c80aa2010-10-08 18:03:27 +090095 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
Hyuk Lee2b111482010-10-06 14:50:20 +090096};
97
98static struct s3c_sdhci_platdata smdkv310_hsmmc2_pdata __initdata = {
99 .cd_type = S3C_SDHCI_CD_GPIO,
Kukjin Kimd11135c2011-02-14 14:59:52 +0900100 .ext_cd_gpio = EXYNOS4_GPK2(2),
Hyuk Lee2b111482010-10-06 14:50:20 +0900101 .ext_cd_gpio_invert = 1,
Jeongbae Seo28c80aa2010-10-08 18:03:27 +0900102 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
Kukjin Kimd11135c2011-02-14 14:59:52 +0900103#ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT
Hyuk Lee2b111482010-10-06 14:50:20 +0900104 .max_width = 8,
105 .host_caps = MMC_CAP_8_BIT_DATA,
106#endif
107};
108
109static struct s3c_sdhci_platdata smdkv310_hsmmc3_pdata __initdata = {
110 .cd_type = S3C_SDHCI_CD_GPIO,
Kukjin Kimd11135c2011-02-14 14:59:52 +0900111 .ext_cd_gpio = EXYNOS4_GPK2(2),
Hyuk Lee2b111482010-10-06 14:50:20 +0900112 .ext_cd_gpio_invert = 1,
Jeongbae Seo28c80aa2010-10-08 18:03:27 +0900113 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
Hyuk Lee2b111482010-10-06 14:50:20 +0900114};
115
Daein Mooncbff3eb2010-10-26 12:51:17 +0900116static struct resource smdkv310_smsc911x_resources[] = {
117 [0] = {
Kukjin Kimd11135c2011-02-14 14:59:52 +0900118 .start = EXYNOS4_PA_SROM_BANK(1),
119 .end = EXYNOS4_PA_SROM_BANK(1) + SZ_64K - 1,
Daein Mooncbff3eb2010-10-26 12:51:17 +0900120 .flags = IORESOURCE_MEM,
121 },
122 [1] = {
123 .start = IRQ_EINT(5),
124 .end = IRQ_EINT(5),
125 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
126 },
127};
128
129static struct smsc911x_platform_config smsc9215_config = {
130 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
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},
135};
136
137static struct platform_device smdkv310_smsc911x = {
138 .name = "smsc911x",
139 .id = -1,
140 .num_resources = ARRAY_SIZE(smdkv310_smsc911x_resources),
141 .resource = smdkv310_smsc911x_resources,
142 .dev = {
143 .platform_data = &smsc9215_config,
144 },
145};
146
Naveen Krishna Chbe4c33b2011-02-22 17:16:58 +0900147static 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)
153};
154
155static struct matrix_keymap_data smdkv310_keymap_data __initdata = {
156 .keymap = smdkv310_keymap,
157 .keymap_size = ARRAY_SIZE(smdkv310_keymap),
158};
159
160static struct samsung_keypad_platdata smdkv310_keypad_data __initdata = {
161 .keymap_data = &smdkv310_keymap_data,
162 .rows = 2,
163 .cols = 8,
164};
165
Jassi Brar6f5c11c2010-12-21 09:59:05 +0900166static struct i2c_board_info i2c_devs1[] __initdata = {
167 {I2C_BOARD_INFO("wm8994", 0x1a),},
168};
169
Changhwan Youncdff6e62010-09-20 15:25:51 +0900170static struct platform_device *smdkv310_devices[] __initdata = {
Hyuk Lee2b111482010-10-06 14:50:20 +0900171 &s3c_device_hsmmc0,
172 &s3c_device_hsmmc1,
173 &s3c_device_hsmmc2,
174 &s3c_device_hsmmc3,
Kukjin Kim285dee72010-12-31 10:52:05 +0900175 &s3c_device_i2c1,
Changhwan Youncdff6e62010-09-20 15:25:51 +0900176 &s3c_device_rtc,
Jemings Ko8d75c912010-09-20 15:33:04 +0900177 &s3c_device_wdt,
Kukjin Kimd11135c2011-02-14 14:59:52 +0900178 &exynos4_device_ac97,
179 &exynos4_device_i2s0,
Naveen Krishna Chbe4c33b2011-02-22 17:16:58 +0900180 &samsung_device_keypad,
Kukjin Kimd11135c2011-02-14 14:59:52 +0900181 &exynos4_device_pd[PD_MFC],
182 &exynos4_device_pd[PD_G3D],
183 &exynos4_device_pd[PD_LCD0],
184 &exynos4_device_pd[PD_LCD1],
185 &exynos4_device_pd[PD_CAM],
186 &exynos4_device_pd[PD_TV],
187 &exynos4_device_pd[PD_GPS],
188 &exynos4_device_sysmmu,
Jassi Brarfbcb44d2011-01-18 14:41:43 +0900189 &samsung_asoc_dma,
190 &smdkv310_smsc911x,
Changhwan Youncdff6e62010-09-20 15:25:51 +0900191};
192
Daein Mooncbff3eb2010-10-26 12:51:17 +0900193static void __init smdkv310_smsc911x_init(void)
194{
195 u32 cs1;
196
197 /* configure nCS1 width to 16 bits */
Kukjin Kim8cf460a2010-11-15 09:18:57 +0900198 cs1 = __raw_readl(S5P_SROM_BW) &
199 ~(S5P_SROM_BW__CS_MASK << S5P_SROM_BW__NCS1__SHIFT);
200 cs1 |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) |
201 (1 << S5P_SROM_BW__WAITENABLE__SHIFT) |
202 (1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) <<
203 S5P_SROM_BW__NCS1__SHIFT;
204 __raw_writel(cs1, S5P_SROM_BW);
Daein Mooncbff3eb2010-10-26 12:51:17 +0900205
206 /* set timing for nCS1 suitable for ethernet chip */
Kukjin Kim8cf460a2010-11-15 09:18:57 +0900207 __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) |
208 (0x9 << S5P_SROM_BCX__TACP__SHIFT) |
209 (0xc << S5P_SROM_BCX__TCAH__SHIFT) |
210 (0x1 << S5P_SROM_BCX__TCOH__SHIFT) |
211 (0x6 << S5P_SROM_BCX__TACC__SHIFT) |
212 (0x1 << S5P_SROM_BCX__TCOS__SHIFT) |
213 (0x1 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1);
Daein Mooncbff3eb2010-10-26 12:51:17 +0900214}
215
Changhwan Younb1d69cc2010-07-16 12:18:36 +0900216static void __init smdkv310_map_io(void)
217{
218 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
219 s3c24xx_init_clocks(24000000);
220 s3c24xx_init_uarts(smdkv310_uartcfgs, ARRAY_SIZE(smdkv310_uartcfgs));
221}
222
223static void __init smdkv310_machine_init(void)
224{
Jassi Brar6f5c11c2010-12-21 09:59:05 +0900225 s3c_i2c1_set_platdata(NULL);
226 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
227
Daein Mooncbff3eb2010-10-26 12:51:17 +0900228 smdkv310_smsc911x_init();
229
Hyuk Lee2b111482010-10-06 14:50:20 +0900230 s3c_sdhci0_set_platdata(&smdkv310_hsmmc0_pdata);
231 s3c_sdhci1_set_platdata(&smdkv310_hsmmc1_pdata);
232 s3c_sdhci2_set_platdata(&smdkv310_hsmmc2_pdata);
233 s3c_sdhci3_set_platdata(&smdkv310_hsmmc3_pdata);
234
Naveen Krishna Chbe4c33b2011-02-22 17:16:58 +0900235 samsung_keypad_set_platdata(&smdkv310_keypad_data);
236
Changhwan Youncdff6e62010-09-20 15:25:51 +0900237 platform_add_devices(smdkv310_devices, ARRAY_SIZE(smdkv310_devices));
Changhwan Younb1d69cc2010-07-16 12:18:36 +0900238}
239
240MACHINE_START(SMDKV310, "SMDKV310")
241 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
242 /* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */
Changhwan Younb1d69cc2010-07-16 12:18:36 +0900243 .boot_params = S5P_PA_SDRAM + 0x100,
Kukjin Kimd11135c2011-02-14 14:59:52 +0900244 .init_irq = exynos4_init_irq,
Changhwan Younb1d69cc2010-07-16 12:18:36 +0900245 .map_io = smdkv310_map_io,
246 .init_machine = smdkv310_machine_init,
Kukjin Kimd11135c2011-02-14 14:59:52 +0900247 .timer = &exynos4_timer,
Changhwan Younb1d69cc2010-07-16 12:18:36 +0900248MACHINE_END