blob: d5eb607763f76d2ece977a227b63cbf9b8a20bc6 [file] [log] [blame]
Changhwan Younb1d69cc2010-07-16 12:18:36 +09001/* linux/arch/arm/mach-s5pv310/mach-smdkv310.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
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>
Changhwan Younb1d69cc2010-07-16 12:18:36 +090018
19#include <asm/mach/arch.h>
20#include <asm/mach-types.h>
Changhwan Younb1d69cc2010-07-16 12:18:36 +090021
22#include <plat/regs-serial.h>
23#include <plat/s5pv310.h>
24#include <plat/cpu.h>
Changhwan Youncdff6e62010-09-20 15:25:51 +090025#include <plat/devs.h>
Hyuk Lee2b111482010-10-06 14:50:20 +090026#include <plat/sdhci.h>
Jassi Brar6f5c11c2010-12-21 09:59:05 +090027#include <plat/iic.h>
Changhwan Younb1d69cc2010-07-16 12:18:36 +090028
29#include <mach/map.h>
Daein Mooncbff3eb2010-10-26 12:51:17 +090030#include <mach/regs-srom.h>
Changhwan Younb1d69cc2010-07-16 12:18:36 +090031
32/* Following are default values for UCON, ULCON and UFCON UART registers */
33#define SMDKV310_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
34 S3C2410_UCON_RXILEVEL | \
35 S3C2410_UCON_TXIRQMODE | \
36 S3C2410_UCON_RXIRQMODE | \
37 S3C2410_UCON_RXFIFO_TOI | \
38 S3C2443_UCON_RXERR_IRQEN)
39
40#define SMDKV310_ULCON_DEFAULT S3C2410_LCON_CS8
41
42#define SMDKV310_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
43 S5PV210_UFCON_TXTRIG4 | \
44 S5PV210_UFCON_RXTRIG4)
45
46static struct s3c2410_uartcfg smdkv310_uartcfgs[] __initdata = {
47 [0] = {
48 .hwport = 0,
49 .flags = 0,
50 .ucon = SMDKV310_UCON_DEFAULT,
51 .ulcon = SMDKV310_ULCON_DEFAULT,
52 .ufcon = SMDKV310_UFCON_DEFAULT,
53 },
54 [1] = {
55 .hwport = 1,
56 .flags = 0,
57 .ucon = SMDKV310_UCON_DEFAULT,
58 .ulcon = SMDKV310_ULCON_DEFAULT,
59 .ufcon = SMDKV310_UFCON_DEFAULT,
60 },
61 [2] = {
62 .hwport = 2,
63 .flags = 0,
64 .ucon = SMDKV310_UCON_DEFAULT,
65 .ulcon = SMDKV310_ULCON_DEFAULT,
66 .ufcon = SMDKV310_UFCON_DEFAULT,
67 },
68 [3] = {
69 .hwport = 3,
70 .flags = 0,
71 .ucon = SMDKV310_UCON_DEFAULT,
72 .ulcon = SMDKV310_ULCON_DEFAULT,
73 .ufcon = SMDKV310_UFCON_DEFAULT,
74 },
75};
76
Hyuk Lee2b111482010-10-06 14:50:20 +090077static struct s3c_sdhci_platdata smdkv310_hsmmc0_pdata __initdata = {
78 .cd_type = S3C_SDHCI_CD_GPIO,
79 .ext_cd_gpio = S5PV310_GPK0(2),
80 .ext_cd_gpio_invert = 1,
Jeongbae Seo28c80aa2010-10-08 18:03:27 +090081 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
Hyuk Lee2b111482010-10-06 14:50:20 +090082#ifdef CONFIG_S5PV310_SDHCI_CH0_8BIT
83 .max_width = 8,
84 .host_caps = MMC_CAP_8_BIT_DATA,
85#endif
86};
87
88static struct s3c_sdhci_platdata smdkv310_hsmmc1_pdata __initdata = {
89 .cd_type = S3C_SDHCI_CD_GPIO,
90 .ext_cd_gpio = S5PV310_GPK0(2),
91 .ext_cd_gpio_invert = 1,
Jeongbae Seo28c80aa2010-10-08 18:03:27 +090092 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
Hyuk Lee2b111482010-10-06 14:50:20 +090093};
94
95static struct s3c_sdhci_platdata smdkv310_hsmmc2_pdata __initdata = {
96 .cd_type = S3C_SDHCI_CD_GPIO,
97 .ext_cd_gpio = S5PV310_GPK2(2),
98 .ext_cd_gpio_invert = 1,
Jeongbae Seo28c80aa2010-10-08 18:03:27 +090099 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
Hyuk Lee2b111482010-10-06 14:50:20 +0900100#ifdef CONFIG_S5PV310_SDHCI_CH2_8BIT
101 .max_width = 8,
102 .host_caps = MMC_CAP_8_BIT_DATA,
103#endif
104};
105
106static struct s3c_sdhci_platdata smdkv310_hsmmc3_pdata __initdata = {
107 .cd_type = S3C_SDHCI_CD_GPIO,
108 .ext_cd_gpio = S5PV310_GPK2(2),
109 .ext_cd_gpio_invert = 1,
Jeongbae Seo28c80aa2010-10-08 18:03:27 +0900110 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
Hyuk Lee2b111482010-10-06 14:50:20 +0900111};
112
Daein Mooncbff3eb2010-10-26 12:51:17 +0900113static struct resource smdkv310_smsc911x_resources[] = {
114 [0] = {
115 .start = S5PV310_PA_SROM_BANK(1),
116 .end = S5PV310_PA_SROM_BANK(1) + SZ_64K - 1,
117 .flags = IORESOURCE_MEM,
118 },
119 [1] = {
120 .start = IRQ_EINT(5),
121 .end = IRQ_EINT(5),
122 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
123 },
124};
125
126static struct smsc911x_platform_config smsc9215_config = {
127 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
128 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
129 .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
130 .phy_interface = PHY_INTERFACE_MODE_MII,
131 .mac = {0x00, 0x80, 0x00, 0x23, 0x45, 0x67},
132};
133
134static struct platform_device smdkv310_smsc911x = {
135 .name = "smsc911x",
136 .id = -1,
137 .num_resources = ARRAY_SIZE(smdkv310_smsc911x_resources),
138 .resource = smdkv310_smsc911x_resources,
139 .dev = {
140 .platform_data = &smsc9215_config,
141 },
142};
143
Jassi Brar6f5c11c2010-12-21 09:59:05 +0900144static struct i2c_board_info i2c_devs1[] __initdata = {
145 {I2C_BOARD_INFO("wm8994", 0x1a),},
146};
147
Changhwan Youncdff6e62010-09-20 15:25:51 +0900148static struct platform_device *smdkv310_devices[] __initdata = {
Jassi Brar6f5c11c2010-12-21 09:59:05 +0900149 &s3c_device_i2c1,
Hyuk Lee2b111482010-10-06 14:50:20 +0900150 &s3c_device_hsmmc0,
151 &s3c_device_hsmmc1,
152 &s3c_device_hsmmc2,
153 &s3c_device_hsmmc3,
Changhwan Youncdff6e62010-09-20 15:25:51 +0900154 &s3c_device_rtc,
Jemings Ko8d75c912010-09-20 15:33:04 +0900155 &s3c_device_wdt,
Daein Mooncbff3eb2010-10-26 12:51:17 +0900156 &smdkv310_smsc911x,
Jassi Brar906b9822010-12-21 09:57:46 +0900157 &s5pv310_device_ac97,
Jassi Brar6f5c11c2010-12-21 09:59:05 +0900158 &s5pv310_device_i2s0,
Changhwan Youncdff6e62010-09-20 15:25:51 +0900159};
160
Daein Mooncbff3eb2010-10-26 12:51:17 +0900161static void __init smdkv310_smsc911x_init(void)
162{
163 u32 cs1;
164
165 /* configure nCS1 width to 16 bits */
166 cs1 = __raw_readl(S5PV310_SROM_BW) &
167 ~(S5PV310_SROM_BW__CS_MASK <<
168 S5PV310_SROM_BW__NCS1__SHIFT);
169 cs1 |= ((1 << S5PV310_SROM_BW__DATAWIDTH__SHIFT) |
170 (1 << S5PV310_SROM_BW__WAITENABLE__SHIFT) |
171 (1 << S5PV310_SROM_BW__BYTEENABLE__SHIFT)) <<
172 S5PV310_SROM_BW__NCS1__SHIFT;
173 __raw_writel(cs1, S5PV310_SROM_BW);
174
175 /* set timing for nCS1 suitable for ethernet chip */
176 __raw_writel((0x1 << S5PV310_SROM_BCX__PMC__SHIFT) |
177 (0x9 << S5PV310_SROM_BCX__TACP__SHIFT) |
178 (0xc << S5PV310_SROM_BCX__TCAH__SHIFT) |
179 (0x1 << S5PV310_SROM_BCX__TCOH__SHIFT) |
180 (0x6 << S5PV310_SROM_BCX__TACC__SHIFT) |
181 (0x1 << S5PV310_SROM_BCX__TCOS__SHIFT) |
182 (0x1 << S5PV310_SROM_BCX__TACS__SHIFT), S5PV310_SROM_BC1);
183}
184
Changhwan Younb1d69cc2010-07-16 12:18:36 +0900185static void __init smdkv310_map_io(void)
186{
187 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
188 s3c24xx_init_clocks(24000000);
189 s3c24xx_init_uarts(smdkv310_uartcfgs, ARRAY_SIZE(smdkv310_uartcfgs));
190}
191
192static void __init smdkv310_machine_init(void)
193{
Jassi Brar6f5c11c2010-12-21 09:59:05 +0900194 s3c_i2c1_set_platdata(NULL);
195 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
196
Daein Mooncbff3eb2010-10-26 12:51:17 +0900197 smdkv310_smsc911x_init();
198
Hyuk Lee2b111482010-10-06 14:50:20 +0900199 s3c_sdhci0_set_platdata(&smdkv310_hsmmc0_pdata);
200 s3c_sdhci1_set_platdata(&smdkv310_hsmmc1_pdata);
201 s3c_sdhci2_set_platdata(&smdkv310_hsmmc2_pdata);
202 s3c_sdhci3_set_platdata(&smdkv310_hsmmc3_pdata);
203
Changhwan Youncdff6e62010-09-20 15:25:51 +0900204 platform_add_devices(smdkv310_devices, ARRAY_SIZE(smdkv310_devices));
Changhwan Younb1d69cc2010-07-16 12:18:36 +0900205}
206
207MACHINE_START(SMDKV310, "SMDKV310")
208 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
209 /* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */
Changhwan Younb1d69cc2010-07-16 12:18:36 +0900210 .boot_params = S5P_PA_SDRAM + 0x100,
211 .init_irq = s5pv310_init_irq,
212 .map_io = smdkv310_map_io,
213 .init_machine = smdkv310_machine_init,
214 .timer = &s5pv310_timer,
215MACHINE_END