blob: b6d9a8876e45b952fe8c6b56c78ec491fb75e9ab [file] [log] [blame]
JeongHyeon Kim699efdd2011-07-21 16:19:19 +09001/* linux/arch/arm/mach-exynos4/mach-origen.c
2 *
3 * Copyright (c) 2011 Insignal Co., Ltd.
4 * http://www.insignal.co.kr/
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>
Ricardo Salveti de Araujo29e7d582012-07-19 14:46:36 +090012#include <linux/leds.h>
JeongHyeon Kim699efdd2011-07-21 16:19:19 +090013#include <linux/gpio.h>
14#include <linux/mmc/host.h>
15#include <linux/platform_device.h>
16#include <linux/io.h>
17#include <linux/input.h>
Giridhar Maruthy9edff0f2011-08-31 15:58:52 +090018#include <linux/pwm_backlight.h>
Sachin Kamatc86cfdd2011-09-16 21:41:25 +090019#include <linux/gpio_keys.h>
Inderpal Singh6e012802011-10-03 08:51:20 +090020#include <linux/i2c.h>
21#include <linux/regulator/machine.h>
22#include <linux/mfd/max8997.h>
Tushar Behera9421a762011-10-03 09:12:56 +090023#include <linux/lcd.h>
Sangwook Lee62d30f82011-11-03 16:14:14 +090024#include <linux/rfkill-gpio.h>
Sachin Kamat9c278d52012-05-20 07:46:40 +090025#include <linux/platform_data/s3c-hsotg.h>
JeongHyeon Kim699efdd2011-07-21 16:19:19 +090026
27#include <asm/mach/arch.h>
Marc Zyngier4e44d2c2011-05-30 11:04:53 +010028#include <asm/hardware/gic.h>
JeongHyeon Kim699efdd2011-07-21 16:19:19 +090029#include <asm/mach-types.h>
30
Tushar Behera9421a762011-10-03 09:12:56 +090031#include <video/platform_lcd.h>
32
JeongHyeon Kim699efdd2011-07-21 16:19:19 +090033#include <plat/regs-serial.h>
Tushar Behera9421a762011-10-03 09:12:56 +090034#include <plat/regs-fb-v4.h>
JeongHyeon Kim699efdd2011-07-21 16:19:19 +090035#include <plat/cpu.h>
36#include <plat/devs.h>
37#include <plat/sdhci.h>
38#include <plat/iic.h>
Sachin Kamat24f9e1f2011-08-31 15:47:16 +090039#include <plat/ehci.h>
40#include <plat/clock.h>
Giridhar Maruthy9edff0f2011-08-31 15:58:52 +090041#include <plat/gpio-cfg.h>
42#include <plat/backlight.h>
Tushar Behera9421a762011-10-03 09:12:56 +090043#include <plat/pd.h>
44#include <plat/fb.h>
Sachin Kamatdf74a282011-10-13 15:38:21 +090045#include <plat/mfc.h>
JeongHyeon Kim699efdd2011-07-21 16:19:19 +090046
Tushar Behera95de77d2011-12-24 12:09:06 +090047#include <mach/ohci.h>
JeongHyeon Kim699efdd2011-07-21 16:19:19 +090048#include <mach/map.h>
49
Sachin Kamat84e6aef2012-05-12 16:33:46 +090050#include <drm/exynos_drm.h>
Kukjin Kimcc511b82011-12-27 08:18:36 +010051#include "common.h"
52
JeongHyeon Kim699efdd2011-07-21 16:19:19 +090053/* Following are default values for UCON, ULCON and UFCON UART registers */
54#define ORIGEN_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
55 S3C2410_UCON_RXILEVEL | \
56 S3C2410_UCON_TXIRQMODE | \
57 S3C2410_UCON_RXIRQMODE | \
58 S3C2410_UCON_RXFIFO_TOI | \
59 S3C2443_UCON_RXERR_IRQEN)
60
61#define ORIGEN_ULCON_DEFAULT S3C2410_LCON_CS8
62
63#define ORIGEN_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
64 S5PV210_UFCON_TXTRIG4 | \
65 S5PV210_UFCON_RXTRIG4)
66
67static struct s3c2410_uartcfg origen_uartcfgs[] __initdata = {
68 [0] = {
69 .hwport = 0,
70 .flags = 0,
71 .ucon = ORIGEN_UCON_DEFAULT,
72 .ulcon = ORIGEN_ULCON_DEFAULT,
73 .ufcon = ORIGEN_UFCON_DEFAULT,
74 },
75 [1] = {
76 .hwport = 1,
77 .flags = 0,
78 .ucon = ORIGEN_UCON_DEFAULT,
79 .ulcon = ORIGEN_ULCON_DEFAULT,
80 .ufcon = ORIGEN_UFCON_DEFAULT,
81 },
82 [2] = {
83 .hwport = 2,
84 .flags = 0,
85 .ucon = ORIGEN_UCON_DEFAULT,
86 .ulcon = ORIGEN_ULCON_DEFAULT,
87 .ufcon = ORIGEN_UFCON_DEFAULT,
88 },
89 [3] = {
90 .hwport = 3,
91 .flags = 0,
92 .ucon = ORIGEN_UCON_DEFAULT,
93 .ulcon = ORIGEN_ULCON_DEFAULT,
94 .ufcon = ORIGEN_UFCON_DEFAULT,
95 },
96};
97
Inderpal Singh6e012802011-10-03 08:51:20 +090098static struct regulator_consumer_supply __initdata ldo3_consumer[] = {
99 REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */
Sachin Kamat5dfb1aa2011-10-10 19:54:53 +0900100 REGULATOR_SUPPLY("vdd", "exynos4-hdmi"), /* HDMI */
101 REGULATOR_SUPPLY("vdd_pll", "exynos4-hdmi"), /* HDMI */
Inderpal Singh6e012802011-10-03 08:51:20 +0900102};
103static struct regulator_consumer_supply __initdata ldo6_consumer[] = {
104 REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"), /* MIPI */
105};
106static struct regulator_consumer_supply __initdata ldo7_consumer[] = {
107 REGULATOR_SUPPLY("avdd", "alc5625"), /* Realtek ALC5625 */
108};
109static struct regulator_consumer_supply __initdata ldo8_consumer[] = {
110 REGULATOR_SUPPLY("vdd", "s5p-adc"), /* ADC */
Sachin Kamat5dfb1aa2011-10-10 19:54:53 +0900111 REGULATOR_SUPPLY("vdd_osc", "exynos4-hdmi"), /* HDMI */
Inderpal Singh6e012802011-10-03 08:51:20 +0900112};
113static struct regulator_consumer_supply __initdata ldo9_consumer[] = {
114 REGULATOR_SUPPLY("dvdd", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */
115};
116static struct regulator_consumer_supply __initdata ldo11_consumer[] = {
117 REGULATOR_SUPPLY("dvdd", "alc5625"), /* Realtek ALC5625 */
118};
119static struct regulator_consumer_supply __initdata ldo14_consumer[] = {
120 REGULATOR_SUPPLY("avdd18", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */
121};
122static struct regulator_consumer_supply __initdata ldo17_consumer[] = {
123 REGULATOR_SUPPLY("vdd33", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */
124};
125static struct regulator_consumer_supply __initdata buck1_consumer[] = {
126 REGULATOR_SUPPLY("vdd_arm", NULL), /* CPUFREQ */
127};
128static struct regulator_consumer_supply __initdata buck2_consumer[] = {
129 REGULATOR_SUPPLY("vdd_int", NULL), /* CPUFREQ */
130};
131static struct regulator_consumer_supply __initdata buck3_consumer[] = {
132 REGULATOR_SUPPLY("vdd_g3d", "mali_drm"), /* G3D */
133};
134static struct regulator_consumer_supply __initdata buck7_consumer[] = {
135 REGULATOR_SUPPLY("vcc", "platform-lcd"), /* LCD */
136};
137
138static struct regulator_init_data __initdata max8997_ldo1_data = {
139 .constraints = {
140 .name = "VDD_ABB_3.3V",
141 .min_uV = 3300000,
142 .max_uV = 3300000,
143 .apply_uV = 1,
144 .state_mem = {
145 .disabled = 1,
146 },
147 },
148};
149
150static struct regulator_init_data __initdata max8997_ldo2_data = {
151 .constraints = {
152 .name = "VDD_ALIVE_1.1V",
153 .min_uV = 1100000,
154 .max_uV = 1100000,
155 .apply_uV = 1,
156 .always_on = 1,
157 .state_mem = {
158 .enabled = 1,
159 },
160 },
161};
162
163static struct regulator_init_data __initdata max8997_ldo3_data = {
164 .constraints = {
165 .name = "VMIPI_1.1V",
166 .min_uV = 1100000,
167 .max_uV = 1100000,
168 .apply_uV = 1,
169 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
170 .state_mem = {
171 .disabled = 1,
172 },
173 },
174 .num_consumer_supplies = ARRAY_SIZE(ldo3_consumer),
175 .consumer_supplies = ldo3_consumer,
176};
177
178static struct regulator_init_data __initdata max8997_ldo4_data = {
179 .constraints = {
180 .name = "VDD_RTC_1.8V",
181 .min_uV = 1800000,
182 .max_uV = 1800000,
183 .apply_uV = 1,
184 .always_on = 1,
185 .state_mem = {
186 .disabled = 1,
187 },
188 },
189};
190
191static struct regulator_init_data __initdata max8997_ldo6_data = {
192 .constraints = {
193 .name = "VMIPI_1.8V",
194 .min_uV = 1800000,
195 .max_uV = 1800000,
196 .apply_uV = 1,
197 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
198 .state_mem = {
199 .disabled = 1,
200 },
201 },
202 .num_consumer_supplies = ARRAY_SIZE(ldo6_consumer),
203 .consumer_supplies = ldo6_consumer,
204};
205
206static struct regulator_init_data __initdata max8997_ldo7_data = {
207 .constraints = {
208 .name = "VDD_AUD_1.8V",
209 .min_uV = 1800000,
210 .max_uV = 1800000,
211 .apply_uV = 1,
212 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
213 .state_mem = {
214 .disabled = 1,
215 },
216 },
217 .num_consumer_supplies = ARRAY_SIZE(ldo7_consumer),
218 .consumer_supplies = ldo7_consumer,
219};
220
221static struct regulator_init_data __initdata max8997_ldo8_data = {
222 .constraints = {
223 .name = "VADC_3.3V",
224 .min_uV = 3300000,
225 .max_uV = 3300000,
226 .apply_uV = 1,
227 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
228 .state_mem = {
229 .disabled = 1,
230 },
231 },
232 .num_consumer_supplies = ARRAY_SIZE(ldo8_consumer),
233 .consumer_supplies = ldo8_consumer,
234};
235
236static struct regulator_init_data __initdata max8997_ldo9_data = {
237 .constraints = {
238 .name = "DVDD_SWB_2.8V",
239 .min_uV = 2800000,
240 .max_uV = 2800000,
241 .apply_uV = 1,
Sangwook Lee62d30f82011-11-03 16:14:14 +0900242 .always_on = 1,
Inderpal Singh6e012802011-10-03 08:51:20 +0900243 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
244 .state_mem = {
245 .disabled = 1,
246 },
247 },
248 .num_consumer_supplies = ARRAY_SIZE(ldo9_consumer),
249 .consumer_supplies = ldo9_consumer,
250};
251
252static struct regulator_init_data __initdata max8997_ldo10_data = {
253 .constraints = {
254 .name = "VDD_PLL_1.1V",
255 .min_uV = 1100000,
256 .max_uV = 1100000,
257 .apply_uV = 1,
258 .always_on = 1,
259 .state_mem = {
260 .disabled = 1,
261 },
262 },
263};
264
265static struct regulator_init_data __initdata max8997_ldo11_data = {
266 .constraints = {
267 .name = "VDD_AUD_3V",
268 .min_uV = 3000000,
269 .max_uV = 3000000,
270 .apply_uV = 1,
271 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
272 .state_mem = {
273 .disabled = 1,
274 },
275 },
276 .num_consumer_supplies = ARRAY_SIZE(ldo11_consumer),
277 .consumer_supplies = ldo11_consumer,
278};
279
280static struct regulator_init_data __initdata max8997_ldo14_data = {
281 .constraints = {
282 .name = "AVDD18_SWB_1.8V",
283 .min_uV = 1800000,
284 .max_uV = 1800000,
285 .apply_uV = 1,
Sangwook Lee62d30f82011-11-03 16:14:14 +0900286 .always_on = 1,
Inderpal Singh6e012802011-10-03 08:51:20 +0900287 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
288 .state_mem = {
289 .disabled = 1,
290 },
291 },
292 .num_consumer_supplies = ARRAY_SIZE(ldo14_consumer),
293 .consumer_supplies = ldo14_consumer,
294};
295
296static struct regulator_init_data __initdata max8997_ldo17_data = {
297 .constraints = {
298 .name = "VDD_SWB_3.3V",
299 .min_uV = 3300000,
300 .max_uV = 3300000,
301 .apply_uV = 1,
Sangwook Lee62d30f82011-11-03 16:14:14 +0900302 .always_on = 1,
Inderpal Singh6e012802011-10-03 08:51:20 +0900303 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
304 .state_mem = {
305 .disabled = 1,
306 },
307 },
308 .num_consumer_supplies = ARRAY_SIZE(ldo17_consumer),
309 .consumer_supplies = ldo17_consumer,
310};
311
312static struct regulator_init_data __initdata max8997_ldo21_data = {
313 .constraints = {
314 .name = "VDD_MIF_1.2V",
315 .min_uV = 1200000,
316 .max_uV = 1200000,
317 .apply_uV = 1,
318 .always_on = 1,
319 .state_mem = {
320 .disabled = 1,
321 },
322 },
323};
324
325static struct regulator_init_data __initdata max8997_buck1_data = {
326 .constraints = {
327 .name = "VDD_ARM_1.2V",
328 .min_uV = 950000,
329 .max_uV = 1350000,
330 .always_on = 1,
331 .boot_on = 1,
332 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
333 .state_mem = {
334 .disabled = 1,
335 },
336 },
337 .num_consumer_supplies = ARRAY_SIZE(buck1_consumer),
338 .consumer_supplies = buck1_consumer,
339};
340
341static struct regulator_init_data __initdata max8997_buck2_data = {
342 .constraints = {
343 .name = "VDD_INT_1.1V",
344 .min_uV = 900000,
345 .max_uV = 1100000,
346 .always_on = 1,
347 .boot_on = 1,
348 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
349 .state_mem = {
350 .disabled = 1,
351 },
352 },
353 .num_consumer_supplies = ARRAY_SIZE(buck2_consumer),
354 .consumer_supplies = buck2_consumer,
355};
356
357static struct regulator_init_data __initdata max8997_buck3_data = {
358 .constraints = {
359 .name = "VDD_G3D_1.1V",
360 .min_uV = 900000,
361 .max_uV = 1100000,
362 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
363 REGULATOR_CHANGE_STATUS,
364 .state_mem = {
365 .disabled = 1,
366 },
367 },
368 .num_consumer_supplies = ARRAY_SIZE(buck3_consumer),
369 .consumer_supplies = buck3_consumer,
370};
371
372static struct regulator_init_data __initdata max8997_buck5_data = {
373 .constraints = {
374 .name = "VDDQ_M1M2_1.2V",
375 .min_uV = 1200000,
376 .max_uV = 1200000,
377 .apply_uV = 1,
378 .always_on = 1,
379 .state_mem = {
380 .disabled = 1,
381 },
382 },
383};
384
385static struct regulator_init_data __initdata max8997_buck7_data = {
386 .constraints = {
387 .name = "VDD_LCD_3.3V",
388 .min_uV = 3300000,
389 .max_uV = 3300000,
390 .boot_on = 1,
391 .apply_uV = 1,
392 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
393 .state_mem = {
394 .disabled = 1
395 },
396 },
397 .num_consumer_supplies = ARRAY_SIZE(buck7_consumer),
398 .consumer_supplies = buck7_consumer,
399};
400
401static struct max8997_regulator_data __initdata origen_max8997_regulators[] = {
402 { MAX8997_LDO1, &max8997_ldo1_data },
403 { MAX8997_LDO2, &max8997_ldo2_data },
404 { MAX8997_LDO3, &max8997_ldo3_data },
405 { MAX8997_LDO4, &max8997_ldo4_data },
406 { MAX8997_LDO6, &max8997_ldo6_data },
407 { MAX8997_LDO7, &max8997_ldo7_data },
408 { MAX8997_LDO8, &max8997_ldo8_data },
409 { MAX8997_LDO9, &max8997_ldo9_data },
410 { MAX8997_LDO10, &max8997_ldo10_data },
411 { MAX8997_LDO11, &max8997_ldo11_data },
412 { MAX8997_LDO14, &max8997_ldo14_data },
413 { MAX8997_LDO17, &max8997_ldo17_data },
414 { MAX8997_LDO21, &max8997_ldo21_data },
415 { MAX8997_BUCK1, &max8997_buck1_data },
416 { MAX8997_BUCK2, &max8997_buck2_data },
417 { MAX8997_BUCK3, &max8997_buck3_data },
418 { MAX8997_BUCK5, &max8997_buck5_data },
419 { MAX8997_BUCK7, &max8997_buck7_data },
420};
421
Kukjin Kime745e062012-01-21 10:47:14 +0900422static struct max8997_platform_data __initdata origen_max8997_pdata = {
Inderpal Singh6e012802011-10-03 08:51:20 +0900423 .num_regulators = ARRAY_SIZE(origen_max8997_regulators),
424 .regulators = origen_max8997_regulators,
425
426 .wakeup = true,
427 .buck1_gpiodvs = false,
428 .buck2_gpiodvs = false,
429 .buck5_gpiodvs = false,
430 .irq_base = IRQ_GPIO_END + 1,
431
432 .ignore_gpiodvs_side_effect = true,
433 .buck125_default_idx = 0x0,
434
435 .buck125_gpios[0] = EXYNOS4_GPX0(0),
436 .buck125_gpios[1] = EXYNOS4_GPX0(1),
437 .buck125_gpios[2] = EXYNOS4_GPX0(2),
438
439 .buck1_voltage[0] = 1350000,
440 .buck1_voltage[1] = 1300000,
441 .buck1_voltage[2] = 1250000,
442 .buck1_voltage[3] = 1200000,
443 .buck1_voltage[4] = 1150000,
444 .buck1_voltage[5] = 1100000,
445 .buck1_voltage[6] = 1000000,
446 .buck1_voltage[7] = 950000,
447
448 .buck2_voltage[0] = 1100000,
449 .buck2_voltage[1] = 1100000,
450 .buck2_voltage[2] = 1100000,
451 .buck2_voltage[3] = 1100000,
452 .buck2_voltage[4] = 1000000,
453 .buck2_voltage[5] = 1000000,
454 .buck2_voltage[6] = 1000000,
455 .buck2_voltage[7] = 1000000,
456
457 .buck5_voltage[0] = 1200000,
458 .buck5_voltage[1] = 1200000,
459 .buck5_voltage[2] = 1200000,
460 .buck5_voltage[3] = 1200000,
461 .buck5_voltage[4] = 1200000,
462 .buck5_voltage[5] = 1200000,
463 .buck5_voltage[6] = 1200000,
464 .buck5_voltage[7] = 1200000,
465};
466
467/* I2C0 */
468static struct i2c_board_info i2c0_devs[] __initdata = {
469 {
470 I2C_BOARD_INFO("max8997", (0xCC >> 1)),
471 .platform_data = &origen_max8997_pdata,
472 .irq = IRQ_EINT(4),
473 },
474};
475
Tushar Beheracf1dad92011-08-31 16:57:37 +0900476static struct s3c_sdhci_platdata origen_hsmmc0_pdata __initdata = {
477 .cd_type = S3C_SDHCI_CD_INTERNAL,
Tushar Beheracf1dad92011-08-31 16:57:37 +0900478};
479
JeongHyeon Kim699efdd2011-07-21 16:19:19 +0900480static struct s3c_sdhci_platdata origen_hsmmc2_pdata __initdata = {
Tushar Behera92e41ef2011-08-31 16:01:15 +0900481 .cd_type = S3C_SDHCI_CD_INTERNAL,
JeongHyeon Kim699efdd2011-07-21 16:19:19 +0900482};
483
Sachin Kamat24f9e1f2011-08-31 15:47:16 +0900484/* USB EHCI */
485static struct s5p_ehci_platdata origen_ehci_pdata;
486
487static void __init origen_ehci_init(void)
488{
489 struct s5p_ehci_platdata *pdata = &origen_ehci_pdata;
490
491 s5p_ehci_set_platdata(pdata);
492}
493
Tushar Behera95de77d2011-12-24 12:09:06 +0900494/* USB OHCI */
495static struct exynos4_ohci_platdata origen_ohci_pdata;
496
497static void __init origen_ohci_init(void)
498{
499 struct exynos4_ohci_platdata *pdata = &origen_ohci_pdata;
500
501 exynos4_ohci_set_platdata(pdata);
502}
503
Sachin Kamat9c278d52012-05-20 07:46:40 +0900504/* USB OTG */
505static struct s3c_hsotg_plat origen_hsotg_pdata;
506
Ricardo Salveti de Araujo29e7d582012-07-19 14:46:36 +0900507static struct gpio_led origen_gpio_leds[] = {
508 {
509 .name = "origen::status1",
510 .default_trigger = "heartbeat",
511 .gpio = EXYNOS4_GPX1(3),
512 .active_low = 1,
513 },
514 {
515 .name = "origen::status2",
516 .default_trigger = "mmc0",
517 .gpio = EXYNOS4_GPX1(4),
518 .active_low = 1,
519 },
520};
521
522static struct gpio_led_platform_data origen_gpio_led_info = {
523 .leds = origen_gpio_leds,
524 .num_leds = ARRAY_SIZE(origen_gpio_leds),
525};
526
527static struct platform_device origen_leds_gpio = {
528 .name = "leds-gpio",
529 .id = -1,
530 .dev = {
531 .platform_data = &origen_gpio_led_info,
532 },
533};
534
Sachin Kamatc86cfdd2011-09-16 21:41:25 +0900535static struct gpio_keys_button origen_gpio_keys_table[] = {
536 {
537 .code = KEY_MENU,
538 .gpio = EXYNOS4_GPX1(5),
539 .desc = "gpio-keys: KEY_MENU",
540 .type = EV_KEY,
541 .active_low = 1,
542 .wakeup = 1,
543 .debounce_interval = 1,
544 }, {
545 .code = KEY_HOME,
546 .gpio = EXYNOS4_GPX1(6),
547 .desc = "gpio-keys: KEY_HOME",
548 .type = EV_KEY,
549 .active_low = 1,
550 .wakeup = 1,
551 .debounce_interval = 1,
552 }, {
553 .code = KEY_BACK,
554 .gpio = EXYNOS4_GPX1(7),
555 .desc = "gpio-keys: KEY_BACK",
556 .type = EV_KEY,
557 .active_low = 1,
558 .wakeup = 1,
559 .debounce_interval = 1,
560 }, {
561 .code = KEY_UP,
562 .gpio = EXYNOS4_GPX2(0),
563 .desc = "gpio-keys: KEY_UP",
564 .type = EV_KEY,
565 .active_low = 1,
566 .wakeup = 1,
567 .debounce_interval = 1,
568 }, {
569 .code = KEY_DOWN,
570 .gpio = EXYNOS4_GPX2(1),
571 .desc = "gpio-keys: KEY_DOWN",
572 .type = EV_KEY,
573 .active_low = 1,
574 .wakeup = 1,
575 .debounce_interval = 1,
576 },
577};
578
579static struct gpio_keys_platform_data origen_gpio_keys_data = {
580 .buttons = origen_gpio_keys_table,
581 .nbuttons = ARRAY_SIZE(origen_gpio_keys_table),
582};
583
584static struct platform_device origen_device_gpiokeys = {
585 .name = "gpio-keys",
586 .dev = {
587 .platform_data = &origen_gpio_keys_data,
588 },
589};
590
Tushar Behera9421a762011-10-03 09:12:56 +0900591static void lcd_hv070wsa_set_power(struct plat_lcd_data *pd, unsigned int power)
592{
593 int ret;
594
595 if (power)
596 ret = gpio_request_one(EXYNOS4_GPE3(4),
597 GPIOF_OUT_INIT_HIGH, "GPE3_4");
598 else
599 ret = gpio_request_one(EXYNOS4_GPE3(4),
600 GPIOF_OUT_INIT_LOW, "GPE3_4");
601
602 gpio_free(EXYNOS4_GPE3(4));
603
604 if (ret)
605 pr_err("failed to request gpio for LCD power: %d\n", ret);
606}
607
608static struct plat_lcd_data origen_lcd_hv070wsa_data = {
609 .set_power = lcd_hv070wsa_set_power,
610};
611
612static struct platform_device origen_lcd_hv070wsa = {
613 .name = "platform-lcd",
614 .dev.parent = &s5p_device_fimd0.dev,
615 .dev.platform_data = &origen_lcd_hv070wsa_data,
616};
617
Sachin Kamat84e6aef2012-05-12 16:33:46 +0900618#ifdef CONFIG_DRM_EXYNOS
619static struct exynos_drm_fimd_pdata drm_fimd_pdata = {
620 .panel = {
621 .timing = {
622 .left_margin = 64,
623 .right_margin = 16,
624 .upper_margin = 64,
625 .lower_margin = 16,
626 .hsync_len = 48,
627 .vsync_len = 3,
628 .xres = 1024,
629 .yres = 600,
630 },
631 },
632 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
633 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
634 VIDCON1_INV_VCLK,
635 .default_win = 0,
636 .bpp = 32,
637};
638#else
Tushar Behera9421a762011-10-03 09:12:56 +0900639static struct s3c_fb_pd_win origen_fb_win0 = {
Thomas Abraham79d3c412012-03-24 21:58:48 +0530640 .xres = 1024,
641 .yres = 600,
Tushar Behera9421a762011-10-03 09:12:56 +0900642 .max_bpp = 32,
643 .default_bpp = 24,
Tushar Behera384b1042012-04-21 08:25:57 -0700644 .virtual_x = 1024,
645 .virtual_y = 2 * 600,
Tushar Behera9421a762011-10-03 09:12:56 +0900646};
647
Thomas Abraham79d3c412012-03-24 21:58:48 +0530648static struct fb_videomode origen_lcd_timing = {
649 .left_margin = 64,
650 .right_margin = 16,
651 .upper_margin = 64,
652 .lower_margin = 16,
653 .hsync_len = 48,
654 .vsync_len = 3,
655 .xres = 1024,
656 .yres = 600,
657};
658
Tushar Behera9421a762011-10-03 09:12:56 +0900659static struct s3c_fb_platdata origen_lcd_pdata __initdata = {
660 .win[0] = &origen_fb_win0,
Thomas Abraham79d3c412012-03-24 21:58:48 +0530661 .vtiming = &origen_lcd_timing,
Tushar Behera9421a762011-10-03 09:12:56 +0900662 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
Tushar Behera815ed6f2011-12-29 16:48:08 +0900663 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
664 VIDCON1_INV_VCLK,
Tushar Behera9421a762011-10-03 09:12:56 +0900665 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
666};
Sachin Kamat84e6aef2012-05-12 16:33:46 +0900667#endif
Tushar Behera9421a762011-10-03 09:12:56 +0900668
Sangwook Lee62d30f82011-11-03 16:14:14 +0900669/* Bluetooth rfkill gpio platform data */
Sachin Kamat023c9ff2012-05-12 16:30:45 +0900670static struct rfkill_gpio_platform_data origen_bt_pdata = {
Sangwook Lee62d30f82011-11-03 16:14:14 +0900671 .reset_gpio = EXYNOS4_GPX2(2),
672 .shutdown_gpio = -1,
673 .type = RFKILL_TYPE_BLUETOOTH,
674 .name = "origen-bt",
675};
676
677/* Bluetooth Platform device */
678static struct platform_device origen_device_bluetooth = {
679 .name = "rfkill_gpio",
680 .id = -1,
681 .dev = {
682 .platform_data = &origen_bt_pdata,
683 },
684};
685
JeongHyeon Kim699efdd2011-07-21 16:19:19 +0900686static struct platform_device *origen_devices[] __initdata = {
687 &s3c_device_hsmmc2,
Tushar Beheracf1dad92011-08-31 16:57:37 +0900688 &s3c_device_hsmmc0,
Tushar Behera9421a762011-10-03 09:12:56 +0900689 &s3c_device_i2c0,
JeongHyeon Kim699efdd2011-07-21 16:19:19 +0900690 &s3c_device_rtc,
Sachin Kamat9c278d52012-05-20 07:46:40 +0900691 &s3c_device_usb_hsotg,
JeongHyeon Kim699efdd2011-07-21 16:19:19 +0900692 &s3c_device_wdt,
Sachin Kamat24f9e1f2011-08-31 15:47:16 +0900693 &s5p_device_ehci,
Sachin Kamat6f8eb322011-08-31 15:52:27 +0900694 &s5p_device_fimc0,
695 &s5p_device_fimc1,
696 &s5p_device_fimc2,
697 &s5p_device_fimc3,
Sachin Kamat26e14512012-01-31 13:28:59 +0900698 &s5p_device_fimc_md,
Tushar Behera9421a762011-10-03 09:12:56 +0900699 &s5p_device_fimd0,
Sachin Kamat84207d82011-12-29 16:46:16 +0900700 &s5p_device_g2d,
Sachin Kamat6ca3f8b2011-09-17 11:42:43 +0900701 &s5p_device_hdmi,
702 &s5p_device_i2c_hdmiphy,
Sachin Kamat965a3302012-03-09 08:19:27 -0800703 &s5p_device_jpeg,
Sachin Kamatdf74a282011-10-13 15:38:21 +0900704 &s5p_device_mfc,
705 &s5p_device_mfc_l,
706 &s5p_device_mfc_r,
Sachin Kamat6ca3f8b2011-09-17 11:42:43 +0900707 &s5p_device_mixer,
Sachin Kamat84e6aef2012-05-12 16:33:46 +0900708#ifdef CONFIG_DRM_EXYNOS
709 &exynos_device_drm,
710#endif
Tushar Behera95de77d2011-12-24 12:09:06 +0900711 &exynos4_device_ohci,
Sachin Kamatc86cfdd2011-09-16 21:41:25 +0900712 &origen_device_gpiokeys,
Tushar Behera9421a762011-10-03 09:12:56 +0900713 &origen_lcd_hv070wsa,
Ricardo Salveti de Araujo29e7d582012-07-19 14:46:36 +0900714 &origen_leds_gpio,
Sangwook Lee62d30f82011-11-03 16:14:14 +0900715 &origen_device_bluetooth,
JeongHyeon Kim699efdd2011-07-21 16:19:19 +0900716};
717
Giridhar Maruthy9edff0f2011-08-31 15:58:52 +0900718/* LCD Backlight data */
719static struct samsung_bl_gpio_info origen_bl_gpio_info = {
Inderpal Singh6e012802011-10-03 08:51:20 +0900720 .no = EXYNOS4_GPD0(0),
721 .func = S3C_GPIO_SFN(2),
Giridhar Maruthy9edff0f2011-08-31 15:58:52 +0900722};
723
724static struct platform_pwm_backlight_data origen_bl_data = {
Inderpal Singh6e012802011-10-03 08:51:20 +0900725 .pwm_id = 0,
726 .pwm_period_ns = 1000,
Giridhar Maruthy9edff0f2011-08-31 15:58:52 +0900727};
728
Sangwook Lee62d30f82011-11-03 16:14:14 +0900729static void __init origen_bt_setup(void)
730{
731 gpio_request(EXYNOS4_GPA0(0), "GPIO BT_UART");
732 /* 4 UART Pins configuration */
733 s3c_gpio_cfgrange_nopull(EXYNOS4_GPA0(0), 4, S3C_GPIO_SFN(2));
734 /* Setup BT Reset, this gpio will be requesed by rfkill-gpio */
735 s3c_gpio_cfgpin(EXYNOS4_GPX2(2), S3C_GPIO_OUTPUT);
736 s3c_gpio_setpull(EXYNOS4_GPX2(2), S3C_GPIO_PULL_NONE);
737}
738
Sachin Kamat3c766692011-10-03 09:16:53 +0900739static void s5p_tv_setup(void)
740{
741 /* Direct HPD to HDMI chip */
742 gpio_request_one(EXYNOS4_GPX3(7), GPIOF_IN, "hpd-plug");
743 s3c_gpio_cfgpin(EXYNOS4_GPX3(7), S3C_GPIO_SFN(0x3));
744 s3c_gpio_setpull(EXYNOS4_GPX3(7), S3C_GPIO_PULL_NONE);
745}
746
JeongHyeon Kim699efdd2011-07-21 16:19:19 +0900747static void __init origen_map_io(void)
748{
Kukjin Kimcc511b82011-12-27 08:18:36 +0100749 exynos_init_io(NULL, 0);
Kukjin Kim2e274372012-07-12 18:03:52 +0900750 s3c24xx_init_clocks(clk_xusbxti.rate);
JeongHyeon Kim699efdd2011-07-21 16:19:19 +0900751 s3c24xx_init_uarts(origen_uartcfgs, ARRAY_SIZE(origen_uartcfgs));
752}
753
Inderpal Singh6e012802011-10-03 08:51:20 +0900754static void __init origen_power_init(void)
755{
756 gpio_request(EXYNOS4_GPX0(4), "PMIC_IRQ");
757 s3c_gpio_cfgpin(EXYNOS4_GPX0(4), S3C_GPIO_SFN(0xf));
758 s3c_gpio_setpull(EXYNOS4_GPX0(4), S3C_GPIO_PULL_NONE);
759}
760
Sachin Kamatdf74a282011-10-13 15:38:21 +0900761static void __init origen_reserve(void)
762{
763 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
764}
765
JeongHyeon Kim699efdd2011-07-21 16:19:19 +0900766static void __init origen_machine_init(void)
767{
Inderpal Singh6e012802011-10-03 08:51:20 +0900768 origen_power_init();
769
770 s3c_i2c0_set_platdata(NULL);
771 i2c_register_board_info(0, i2c0_devs, ARRAY_SIZE(i2c0_devs));
772
Tushar Beheracf1dad92011-08-31 16:57:37 +0900773 /*
774 * Since sdhci instance 2 can contain a bootable media,
775 * sdhci instance 0 is registered after instance 2.
776 */
JeongHyeon Kim699efdd2011-07-21 16:19:19 +0900777 s3c_sdhci2_set_platdata(&origen_hsmmc2_pdata);
Tushar Beheracf1dad92011-08-31 16:57:37 +0900778 s3c_sdhci0_set_platdata(&origen_hsmmc0_pdata);
Sachin Kamat24f9e1f2011-08-31 15:47:16 +0900779
780 origen_ehci_init();
Tushar Behera95de77d2011-12-24 12:09:06 +0900781 origen_ohci_init();
Sachin Kamat9c278d52012-05-20 07:46:40 +0900782 s3c_hsotg_set_platdata(&origen_hsotg_pdata);
Sachin Kamat24f9e1f2011-08-31 15:47:16 +0900783
Sachin Kamat3c766692011-10-03 09:16:53 +0900784 s5p_tv_setup();
Sachin Kamat6ca3f8b2011-09-17 11:42:43 +0900785 s5p_i2c_hdmiphy_set_platdata(NULL);
786
Sachin Kamat84e6aef2012-05-12 16:33:46 +0900787#ifdef CONFIG_DRM_EXYNOS
788 s5p_device_fimd0.dev.platform_data = &drm_fimd_pdata;
789 exynos4_fimd0_gpio_setup_24bpp();
790#else
Tushar Behera9421a762011-10-03 09:12:56 +0900791 s5p_fimd0_set_platdata(&origen_lcd_pdata);
Sachin Kamat84e6aef2012-05-12 16:33:46 +0900792#endif
Tushar Behera9421a762011-10-03 09:12:56 +0900793
JeongHyeon Kim699efdd2011-07-21 16:19:19 +0900794 platform_add_devices(origen_devices, ARRAY_SIZE(origen_devices));
Sachin Kamatdf74a282011-10-13 15:38:21 +0900795
Giridhar Maruthy9edff0f2011-08-31 15:58:52 +0900796 samsung_bl_set(&origen_bl_gpio_info, &origen_bl_data);
Sangwook Lee62d30f82011-11-03 16:14:14 +0900797
798 origen_bt_setup();
JeongHyeon Kim699efdd2011-07-21 16:19:19 +0900799}
800
801MACHINE_START(ORIGEN, "ORIGEN")
802 /* Maintainer: JeongHyeon Kim <jhkim@insignal.co.kr> */
Tushar Behera1abd3282011-09-19 20:09:01 +0900803 .atag_offset = 0x100,
JeongHyeon Kim699efdd2011-07-21 16:19:19 +0900804 .init_irq = exynos4_init_irq,
805 .map_io = origen_map_io,
Marc Zyngier4e44d2c2011-05-30 11:04:53 +0100806 .handle_irq = gic_handle_irq,
JeongHyeon Kim699efdd2011-07-21 16:19:19 +0900807 .init_machine = origen_machine_init,
Shawn Guobb13fab2012-04-26 10:35:40 +0800808 .init_late = exynos_init_late,
JeongHyeon Kim699efdd2011-07-21 16:19:19 +0900809 .timer = &exynos4_timer,
Sachin Kamatdf74a282011-10-13 15:38:21 +0900810 .reserve = &origen_reserve,
Russell King9eb48592012-01-03 11:56:53 +0100811 .restart = exynos4_restart,
JeongHyeon Kim699efdd2011-07-21 16:19:19 +0900812MACHINE_END