blob: 2c1a076c6a73a3ffe9bb2b520eacaac1f0f2bb44 [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>
Kukjin Kim42c0d262011-08-18 21:14:28 +090012#include <linux/delay.h>
Hyuk Lee2b111482010-10-06 14:50:20 +090013#include <linux/gpio.h>
Kukjin Kim42c0d262011-08-18 21:14:28 +090014#include <linux/lcd.h>
Hyuk Lee2b111482010-10-06 14:50:20 +090015#include <linux/mmc/host.h>
16#include <linux/platform_device.h>
Daein Mooncbff3eb2010-10-26 12:51:17 +090017#include <linux/smsc911x.h>
18#include <linux/io.h>
Jassi Brar6f5c11c2010-12-21 09:59:05 +090019#include <linux/i2c.h>
Naveen Krishna Chbe4c33b2011-02-22 17:16:58 +090020#include <linux/input.h>
Banajit Goswami8689de72011-07-20 23:45:21 +090021#include <linux/pwm_backlight.h>
Changhwan Younb1d69cc2010-07-16 12:18:36 +090022
23#include <asm/mach/arch.h>
24#include <asm/mach-types.h>
Changhwan Younb1d69cc2010-07-16 12:18:36 +090025
Kukjin Kim42c0d262011-08-18 21:14:28 +090026#include <video/platform_lcd.h>
Changhwan Younb1d69cc2010-07-16 12:18:36 +090027#include <plat/regs-serial.h>
Kukjin Kim8cf460a2010-11-15 09:18:57 +090028#include <plat/regs-srom.h>
Kukjin Kim42c0d262011-08-18 21:14:28 +090029#include <plat/regs-fb-v4.h>
Kukjin Kimd11135c2011-02-14 14:59:52 +090030#include <plat/exynos4.h>
Changhwan Younb1d69cc2010-07-16 12:18:36 +090031#include <plat/cpu.h>
Changhwan Youncdff6e62010-09-20 15:25:51 +090032#include <plat/devs.h>
Kukjin Kim42c0d262011-08-18 21:14:28 +090033#include <plat/fb.h>
Naveen Krishna Chbe4c33b2011-02-22 17:16:58 +090034#include <plat/keypad.h>
Hyuk Lee2b111482010-10-06 14:50:20 +090035#include <plat/sdhci.h>
Jassi Brar6f5c11c2010-12-21 09:59:05 +090036#include <plat/iic.h>
Changhwan Yound6d8b482010-12-03 17:15:40 +090037#include <plat/pd.h>
Banajit Goswami8689de72011-07-20 23:45:21 +090038#include <plat/gpio-cfg.h>
39#include <plat/backlight.h>
Changhwan Younb1d69cc2010-07-16 12:18:36 +090040
41#include <mach/map.h>
42
43/* Following are default values for UCON, ULCON and UFCON UART registers */
44#define SMDKV310_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
45 S3C2410_UCON_RXILEVEL | \
46 S3C2410_UCON_TXIRQMODE | \
47 S3C2410_UCON_RXIRQMODE | \
48 S3C2410_UCON_RXFIFO_TOI | \
49 S3C2443_UCON_RXERR_IRQEN)
50
51#define SMDKV310_ULCON_DEFAULT S3C2410_LCON_CS8
52
53#define SMDKV310_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
54 S5PV210_UFCON_TXTRIG4 | \
55 S5PV210_UFCON_RXTRIG4)
56
57static struct s3c2410_uartcfg smdkv310_uartcfgs[] __initdata = {
58 [0] = {
59 .hwport = 0,
60 .flags = 0,
61 .ucon = SMDKV310_UCON_DEFAULT,
62 .ulcon = SMDKV310_ULCON_DEFAULT,
63 .ufcon = SMDKV310_UFCON_DEFAULT,
64 },
65 [1] = {
66 .hwport = 1,
67 .flags = 0,
68 .ucon = SMDKV310_UCON_DEFAULT,
69 .ulcon = SMDKV310_ULCON_DEFAULT,
70 .ufcon = SMDKV310_UFCON_DEFAULT,
71 },
72 [2] = {
73 .hwport = 2,
74 .flags = 0,
75 .ucon = SMDKV310_UCON_DEFAULT,
76 .ulcon = SMDKV310_ULCON_DEFAULT,
77 .ufcon = SMDKV310_UFCON_DEFAULT,
78 },
79 [3] = {
80 .hwport = 3,
81 .flags = 0,
82 .ucon = SMDKV310_UCON_DEFAULT,
83 .ulcon = SMDKV310_ULCON_DEFAULT,
84 .ufcon = SMDKV310_UFCON_DEFAULT,
85 },
86};
87
Hyuk Lee2b111482010-10-06 14:50:20 +090088static struct s3c_sdhci_platdata smdkv310_hsmmc0_pdata __initdata = {
Thomas Abrahama0d8efe2011-06-16 16:12:35 +090089 .cd_type = S3C_SDHCI_CD_INTERNAL,
Jeongbae Seo28c80aa2010-10-08 18:03:27 +090090 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
Kukjin Kimd11135c2011-02-14 14:59:52 +090091#ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT
Hyuk Lee2b111482010-10-06 14:50:20 +090092 .max_width = 8,
93 .host_caps = MMC_CAP_8_BIT_DATA,
94#endif
95};
96
97static struct s3c_sdhci_platdata smdkv310_hsmmc1_pdata __initdata = {
98 .cd_type = S3C_SDHCI_CD_GPIO,
Kukjin Kimd11135c2011-02-14 14:59:52 +090099 .ext_cd_gpio = EXYNOS4_GPK0(2),
Hyuk Lee2b111482010-10-06 14:50:20 +0900100 .ext_cd_gpio_invert = 1,
Jeongbae Seo28c80aa2010-10-08 18:03:27 +0900101 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
Hyuk Lee2b111482010-10-06 14:50:20 +0900102};
103
104static struct s3c_sdhci_platdata smdkv310_hsmmc2_pdata __initdata = {
Thomas Abrahama0d8efe2011-06-16 16:12:35 +0900105 .cd_type = S3C_SDHCI_CD_INTERNAL,
Jeongbae Seo28c80aa2010-10-08 18:03:27 +0900106 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
Kukjin Kimd11135c2011-02-14 14:59:52 +0900107#ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT
Hyuk Lee2b111482010-10-06 14:50:20 +0900108 .max_width = 8,
109 .host_caps = MMC_CAP_8_BIT_DATA,
110#endif
111};
112
113static struct s3c_sdhci_platdata smdkv310_hsmmc3_pdata __initdata = {
114 .cd_type = S3C_SDHCI_CD_GPIO,
Kukjin Kimd11135c2011-02-14 14:59:52 +0900115 .ext_cd_gpio = EXYNOS4_GPK2(2),
Hyuk Lee2b111482010-10-06 14:50:20 +0900116 .ext_cd_gpio_invert = 1,
Jeongbae Seo28c80aa2010-10-08 18:03:27 +0900117 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
Hyuk Lee2b111482010-10-06 14:50:20 +0900118};
119
Kukjin Kim42c0d262011-08-18 21:14:28 +0900120static void lcd_lte480wv_set_power(struct plat_lcd_data *pd,
121 unsigned int power)
122{
123 if (power) {
124#if !defined(CONFIG_BACKLIGHT_PWM)
125 gpio_request_one(EXYNOS4_GPD0(1), GPIOF_OUT_INIT_HIGH, "GPD0");
126 gpio_free(EXYNOS4_GPD0(1));
127#endif
128 /* fire nRESET on power up */
129 gpio_request(EXYNOS4_GPX0(6), "GPX0");
130
131 gpio_direction_output(EXYNOS4_GPX0(6), 1);
132 mdelay(100);
133
134 gpio_set_value(EXYNOS4_GPX0(6), 0);
135 mdelay(10);
136
137 gpio_set_value(EXYNOS4_GPX0(6), 1);
138 mdelay(10);
139
140 gpio_free(EXYNOS4_GPX0(6));
141 } else {
142#if !defined(CONFIG_BACKLIGHT_PWM)
143 gpio_request_one(EXYNOS4_GPD0(1), GPIOF_OUT_INIT_LOW, "GPD0");
144 gpio_free(EXYNOS4_GPD0(1));
145#endif
146 }
147}
148
149static struct plat_lcd_data smdkv310_lcd_lte480wv_data = {
150 .set_power = lcd_lte480wv_set_power,
151};
152
153static struct platform_device smdkv310_lcd_lte480wv = {
154 .name = "platform-lcd",
155 .dev.parent = &s5p_device_fimd0.dev,
156 .dev.platform_data = &smdkv310_lcd_lte480wv_data,
157};
158
159static struct s3c_fb_pd_win smdkv310_fb_win0 = {
160 .win_mode = {
161 .left_margin = 13,
162 .right_margin = 8,
163 .upper_margin = 7,
164 .lower_margin = 5,
165 .hsync_len = 3,
166 .vsync_len = 1,
167 .xres = 800,
168 .yres = 480,
169 },
170 .max_bpp = 32,
171 .default_bpp = 24,
172};
173
174static struct s3c_fb_platdata smdkv310_lcd0_pdata __initdata = {
175 .win[0] = &smdkv310_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,
179};
180
Daein Mooncbff3eb2010-10-26 12:51:17 +0900181static struct resource smdkv310_smsc911x_resources[] = {
182 [0] = {
Kukjin Kimd11135c2011-02-14 14:59:52 +0900183 .start = EXYNOS4_PA_SROM_BANK(1),
184 .end = EXYNOS4_PA_SROM_BANK(1) + SZ_64K - 1,
Daein Mooncbff3eb2010-10-26 12:51:17 +0900185 .flags = IORESOURCE_MEM,
186 },
187 [1] = {
188 .start = IRQ_EINT(5),
189 .end = IRQ_EINT(5),
190 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
191 },
192};
193
194static struct smsc911x_platform_config smsc9215_config = {
Jeongtae Parkcd0527c2011-03-25 15:48:15 +0900195 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
Daein Mooncbff3eb2010-10-26 12:51:17 +0900196 .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},
200};
201
202static struct platform_device smdkv310_smsc911x = {
203 .name = "smsc911x",
204 .id = -1,
205 .num_resources = ARRAY_SIZE(smdkv310_smsc911x_resources),
206 .resource = smdkv310_smsc911x_resources,
207 .dev = {
208 .platform_data = &smsc9215_config,
209 },
210};
211
Naveen Krishna Chbe4c33b2011-02-22 17:16:58 +0900212static uint32_t smdkv310_keymap[] __initdata = {
213 /* KEY(row, col, keycode) */
214 KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
215 KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
216 KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
217 KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
218};
219
220static struct matrix_keymap_data smdkv310_keymap_data __initdata = {
221 .keymap = smdkv310_keymap,
222 .keymap_size = ARRAY_SIZE(smdkv310_keymap),
223};
224
225static struct samsung_keypad_platdata smdkv310_keypad_data __initdata = {
226 .keymap_data = &smdkv310_keymap_data,
227 .rows = 2,
228 .cols = 8,
229};
230
Jassi Brar6f5c11c2010-12-21 09:59:05 +0900231static struct i2c_board_info i2c_devs1[] __initdata = {
232 {I2C_BOARD_INFO("wm8994", 0x1a),},
233};
234
Changhwan Youncdff6e62010-09-20 15:25:51 +0900235static struct platform_device *smdkv310_devices[] __initdata = {
Hyuk Lee2b111482010-10-06 14:50:20 +0900236 &s3c_device_hsmmc0,
237 &s3c_device_hsmmc1,
238 &s3c_device_hsmmc2,
239 &s3c_device_hsmmc3,
Kukjin Kim285dee72010-12-31 10:52:05 +0900240 &s3c_device_i2c1,
Changhwan Youncdff6e62010-09-20 15:25:51 +0900241 &s3c_device_rtc,
Jemings Ko8d75c912010-09-20 15:33:04 +0900242 &s3c_device_wdt,
Kukjin Kimd11135c2011-02-14 14:59:52 +0900243 &exynos4_device_ac97,
244 &exynos4_device_i2s0,
Naveen Krishna Chbe4c33b2011-02-22 17:16:58 +0900245 &samsung_device_keypad,
Kukjin Kimd11135c2011-02-14 14:59:52 +0900246 &exynos4_device_pd[PD_MFC],
247 &exynos4_device_pd[PD_G3D],
248 &exynos4_device_pd[PD_LCD0],
249 &exynos4_device_pd[PD_LCD1],
250 &exynos4_device_pd[PD_CAM],
251 &exynos4_device_pd[PD_TV],
252 &exynos4_device_pd[PD_GPS],
Naveen Krishna Chatradhi2ba707a2011-07-18 15:14:01 +0900253 &exynos4_device_spdif,
Kukjin Kimd11135c2011-02-14 14:59:52 +0900254 &exynos4_device_sysmmu,
Jassi Brarfbcb44d2011-01-18 14:41:43 +0900255 &samsung_asoc_dma,
Sangbeom Kim2839cc12011-07-21 14:12:19 +0900256 &samsung_asoc_idma,
Kukjin Kim42c0d262011-08-18 21:14:28 +0900257 &s5p_device_fimd0,
258 &smdkv310_lcd_lte480wv,
Jassi Brarfbcb44d2011-01-18 14:41:43 +0900259 &smdkv310_smsc911x,
Inderpal Singh0d855f42011-07-04 19:19:36 +0900260 &exynos4_device_ahci,
Changhwan Youncdff6e62010-09-20 15:25:51 +0900261};
262
Daein Mooncbff3eb2010-10-26 12:51:17 +0900263static void __init smdkv310_smsc911x_init(void)
264{
265 u32 cs1;
266
267 /* configure nCS1 width to 16 bits */
Kukjin Kim8cf460a2010-11-15 09:18:57 +0900268 cs1 = __raw_readl(S5P_SROM_BW) &
269 ~(S5P_SROM_BW__CS_MASK << S5P_SROM_BW__NCS1__SHIFT);
270 cs1 |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) |
271 (1 << S5P_SROM_BW__WAITENABLE__SHIFT) |
272 (1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) <<
273 S5P_SROM_BW__NCS1__SHIFT;
274 __raw_writel(cs1, S5P_SROM_BW);
Daein Mooncbff3eb2010-10-26 12:51:17 +0900275
276 /* set timing for nCS1 suitable for ethernet chip */
Kukjin Kim8cf460a2010-11-15 09:18:57 +0900277 __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) |
278 (0x9 << S5P_SROM_BCX__TACP__SHIFT) |
279 (0xc << S5P_SROM_BCX__TCAH__SHIFT) |
280 (0x1 << S5P_SROM_BCX__TCOH__SHIFT) |
281 (0x6 << S5P_SROM_BCX__TACC__SHIFT) |
282 (0x1 << S5P_SROM_BCX__TCOS__SHIFT) |
283 (0x1 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1);
Daein Mooncbff3eb2010-10-26 12:51:17 +0900284}
285
Banajit Goswami8689de72011-07-20 23:45:21 +0900286/* LCD Backlight data */
287static struct samsung_bl_gpio_info smdkv310_bl_gpio_info = {
288 .no = EXYNOS4_GPD0(1),
289 .func = S3C_GPIO_SFN(2),
290};
291
292static struct platform_pwm_backlight_data smdkv310_bl_data = {
293 .pwm_id = 1,
294 .pwm_period_ns = 1000,
295};
296
Changhwan Younb1d69cc2010-07-16 12:18:36 +0900297static void __init smdkv310_map_io(void)
298{
299 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
300 s3c24xx_init_clocks(24000000);
301 s3c24xx_init_uarts(smdkv310_uartcfgs, ARRAY_SIZE(smdkv310_uartcfgs));
302}
303
304static void __init smdkv310_machine_init(void)
305{
Jassi Brar6f5c11c2010-12-21 09:59:05 +0900306 s3c_i2c1_set_platdata(NULL);
307 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
308
Daein Mooncbff3eb2010-10-26 12:51:17 +0900309 smdkv310_smsc911x_init();
310
Hyuk Lee2b111482010-10-06 14:50:20 +0900311 s3c_sdhci0_set_platdata(&smdkv310_hsmmc0_pdata);
312 s3c_sdhci1_set_platdata(&smdkv310_hsmmc1_pdata);
313 s3c_sdhci2_set_platdata(&smdkv310_hsmmc2_pdata);
314 s3c_sdhci3_set_platdata(&smdkv310_hsmmc3_pdata);
315
Naveen Krishna Chbe4c33b2011-02-22 17:16:58 +0900316 samsung_keypad_set_platdata(&smdkv310_keypad_data);
317
Banajit Goswami8689de72011-07-20 23:45:21 +0900318 samsung_bl_set(&smdkv310_bl_gpio_info, &smdkv310_bl_data);
Kukjin Kim42c0d262011-08-18 21:14:28 +0900319 s5p_fimd0_set_platdata(&smdkv310_lcd0_pdata);
Banajit Goswami8689de72011-07-20 23:45:21 +0900320
Changhwan Youncdff6e62010-09-20 15:25:51 +0900321 platform_add_devices(smdkv310_devices, ARRAY_SIZE(smdkv310_devices));
Changhwan Younb1d69cc2010-07-16 12:18:36 +0900322}
323
324MACHINE_START(SMDKV310, "SMDKV310")
325 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
326 /* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */
Tushar Behera1abd3282011-09-19 20:09:01 +0900327 .atag_offset = 0x100,
Kukjin Kimd11135c2011-02-14 14:59:52 +0900328 .init_irq = exynos4_init_irq,
Changhwan Younb1d69cc2010-07-16 12:18:36 +0900329 .map_io = smdkv310_map_io,
330 .init_machine = smdkv310_machine_init,
Kukjin Kimd11135c2011-02-14 14:59:52 +0900331 .timer = &exynos4_timer,
Changhwan Younb1d69cc2010-07-16 12:18:36 +0900332MACHINE_END
Kukjin Kim42c0d262011-08-18 21:14:28 +0900333
334MACHINE_START(SMDKC210, "SMDKC210")
335 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
Tushar Behera1abd3282011-09-19 20:09:01 +0900336 .atag_offset = 0x100,
Kukjin Kim42c0d262011-08-18 21:14:28 +0900337 .init_irq = exynos4_init_irq,
338 .map_io = smdkv310_map_io,
339 .init_machine = smdkv310_machine_init,
340 .timer = &exynos4_timer,
341MACHINE_END