1 /* linux/arch/arm/mach-exynos4/mach-origen.c
3 * Copyright (c) 2011 Insignal Co., Ltd.
4 * http://www.insignal.co.kr/
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.
11 #include <linux/serial_core.h>
12 #include <linux/gpio.h>
13 #include <linux/mmc/host.h>
14 #include <linux/platform_device.h>
16 #include <linux/input.h>
17 #include <linux/pwm_backlight.h>
18 #include <linux/gpio_keys.h>
19 #include <linux/i2c.h>
20 #include <linux/regulator/machine.h>
21 #include <linux/mfd/max8997.h>
23 #include <asm/mach/arch.h>
24 #include <asm/mach-types.h>
26 #include <plat/regs-serial.h>
27 #include <plat/exynos4.h>
29 #include <plat/devs.h>
30 #include <plat/sdhci.h>
32 #include <plat/ehci.h>
33 #include <plat/clock.h>
34 #include <plat/gpio-cfg.h>
35 #include <plat/backlight.h>
39 /* Following are default values for UCON, ULCON and UFCON UART registers */
40 #define ORIGEN_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
41 S3C2410_UCON_RXILEVEL | \
42 S3C2410_UCON_TXIRQMODE | \
43 S3C2410_UCON_RXIRQMODE | \
44 S3C2410_UCON_RXFIFO_TOI | \
45 S3C2443_UCON_RXERR_IRQEN)
47 #define ORIGEN_ULCON_DEFAULT S3C2410_LCON_CS8
49 #define ORIGEN_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
50 S5PV210_UFCON_TXTRIG4 | \
51 S5PV210_UFCON_RXTRIG4)
53 static struct s3c2410_uartcfg origen_uartcfgs[] __initdata = {
57 .ucon = ORIGEN_UCON_DEFAULT,
58 .ulcon = ORIGEN_ULCON_DEFAULT,
59 .ufcon = ORIGEN_UFCON_DEFAULT,
64 .ucon = ORIGEN_UCON_DEFAULT,
65 .ulcon = ORIGEN_ULCON_DEFAULT,
66 .ufcon = ORIGEN_UFCON_DEFAULT,
71 .ucon = ORIGEN_UCON_DEFAULT,
72 .ulcon = ORIGEN_ULCON_DEFAULT,
73 .ufcon = ORIGEN_UFCON_DEFAULT,
78 .ucon = ORIGEN_UCON_DEFAULT,
79 .ulcon = ORIGEN_ULCON_DEFAULT,
80 .ufcon = ORIGEN_UFCON_DEFAULT,
84 static struct regulator_consumer_supply __initdata ldo3_consumer[] = {
85 REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */
87 static struct regulator_consumer_supply __initdata ldo6_consumer[] = {
88 REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"), /* MIPI */
90 static struct regulator_consumer_supply __initdata ldo7_consumer[] = {
91 REGULATOR_SUPPLY("avdd", "alc5625"), /* Realtek ALC5625 */
93 static struct regulator_consumer_supply __initdata ldo8_consumer[] = {
94 REGULATOR_SUPPLY("vdd", "s5p-adc"), /* ADC */
96 static struct regulator_consumer_supply __initdata ldo9_consumer[] = {
97 REGULATOR_SUPPLY("dvdd", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */
99 static struct regulator_consumer_supply __initdata ldo11_consumer[] = {
100 REGULATOR_SUPPLY("dvdd", "alc5625"), /* Realtek ALC5625 */
102 static struct regulator_consumer_supply __initdata ldo14_consumer[] = {
103 REGULATOR_SUPPLY("avdd18", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */
105 static struct regulator_consumer_supply __initdata ldo17_consumer[] = {
106 REGULATOR_SUPPLY("vdd33", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */
108 static struct regulator_consumer_supply __initdata buck1_consumer[] = {
109 REGULATOR_SUPPLY("vdd_arm", NULL), /* CPUFREQ */
111 static struct regulator_consumer_supply __initdata buck2_consumer[] = {
112 REGULATOR_SUPPLY("vdd_int", NULL), /* CPUFREQ */
114 static struct regulator_consumer_supply __initdata buck3_consumer[] = {
115 REGULATOR_SUPPLY("vdd_g3d", "mali_drm"), /* G3D */
117 static struct regulator_consumer_supply __initdata buck7_consumer[] = {
118 REGULATOR_SUPPLY("vcc", "platform-lcd"), /* LCD */
121 static struct regulator_init_data __initdata max8997_ldo1_data = {
123 .name = "VDD_ABB_3.3V",
133 static struct regulator_init_data __initdata max8997_ldo2_data = {
135 .name = "VDD_ALIVE_1.1V",
146 static struct regulator_init_data __initdata max8997_ldo3_data = {
148 .name = "VMIPI_1.1V",
152 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
157 .num_consumer_supplies = ARRAY_SIZE(ldo3_consumer),
158 .consumer_supplies = ldo3_consumer,
161 static struct regulator_init_data __initdata max8997_ldo4_data = {
163 .name = "VDD_RTC_1.8V",
174 static struct regulator_init_data __initdata max8997_ldo6_data = {
176 .name = "VMIPI_1.8V",
180 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
185 .num_consumer_supplies = ARRAY_SIZE(ldo6_consumer),
186 .consumer_supplies = ldo6_consumer,
189 static struct regulator_init_data __initdata max8997_ldo7_data = {
191 .name = "VDD_AUD_1.8V",
195 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
200 .num_consumer_supplies = ARRAY_SIZE(ldo7_consumer),
201 .consumer_supplies = ldo7_consumer,
204 static struct regulator_init_data __initdata max8997_ldo8_data = {
210 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
215 .num_consumer_supplies = ARRAY_SIZE(ldo8_consumer),
216 .consumer_supplies = ldo8_consumer,
219 static struct regulator_init_data __initdata max8997_ldo9_data = {
221 .name = "DVDD_SWB_2.8V",
225 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
230 .num_consumer_supplies = ARRAY_SIZE(ldo9_consumer),
231 .consumer_supplies = ldo9_consumer,
234 static struct regulator_init_data __initdata max8997_ldo10_data = {
236 .name = "VDD_PLL_1.1V",
247 static struct regulator_init_data __initdata max8997_ldo11_data = {
249 .name = "VDD_AUD_3V",
253 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
258 .num_consumer_supplies = ARRAY_SIZE(ldo11_consumer),
259 .consumer_supplies = ldo11_consumer,
262 static struct regulator_init_data __initdata max8997_ldo14_data = {
264 .name = "AVDD18_SWB_1.8V",
268 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
273 .num_consumer_supplies = ARRAY_SIZE(ldo14_consumer),
274 .consumer_supplies = ldo14_consumer,
277 static struct regulator_init_data __initdata max8997_ldo17_data = {
279 .name = "VDD_SWB_3.3V",
283 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
288 .num_consumer_supplies = ARRAY_SIZE(ldo17_consumer),
289 .consumer_supplies = ldo17_consumer,
292 static struct regulator_init_data __initdata max8997_ldo21_data = {
294 .name = "VDD_MIF_1.2V",
305 static struct regulator_init_data __initdata max8997_buck1_data = {
307 .name = "VDD_ARM_1.2V",
312 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
317 .num_consumer_supplies = ARRAY_SIZE(buck1_consumer),
318 .consumer_supplies = buck1_consumer,
321 static struct regulator_init_data __initdata max8997_buck2_data = {
323 .name = "VDD_INT_1.1V",
328 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
333 .num_consumer_supplies = ARRAY_SIZE(buck2_consumer),
334 .consumer_supplies = buck2_consumer,
337 static struct regulator_init_data __initdata max8997_buck3_data = {
339 .name = "VDD_G3D_1.1V",
342 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
343 REGULATOR_CHANGE_STATUS,
348 .num_consumer_supplies = ARRAY_SIZE(buck3_consumer),
349 .consumer_supplies = buck3_consumer,
352 static struct regulator_init_data __initdata max8997_buck5_data = {
354 .name = "VDDQ_M1M2_1.2V",
365 static struct regulator_init_data __initdata max8997_buck7_data = {
367 .name = "VDD_LCD_3.3V",
372 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
377 .num_consumer_supplies = ARRAY_SIZE(buck7_consumer),
378 .consumer_supplies = buck7_consumer,
381 static struct max8997_regulator_data __initdata origen_max8997_regulators[] = {
382 { MAX8997_LDO1, &max8997_ldo1_data },
383 { MAX8997_LDO2, &max8997_ldo2_data },
384 { MAX8997_LDO3, &max8997_ldo3_data },
385 { MAX8997_LDO4, &max8997_ldo4_data },
386 { MAX8997_LDO6, &max8997_ldo6_data },
387 { MAX8997_LDO7, &max8997_ldo7_data },
388 { MAX8997_LDO8, &max8997_ldo8_data },
389 { MAX8997_LDO9, &max8997_ldo9_data },
390 { MAX8997_LDO10, &max8997_ldo10_data },
391 { MAX8997_LDO11, &max8997_ldo11_data },
392 { MAX8997_LDO14, &max8997_ldo14_data },
393 { MAX8997_LDO17, &max8997_ldo17_data },
394 { MAX8997_LDO21, &max8997_ldo21_data },
395 { MAX8997_BUCK1, &max8997_buck1_data },
396 { MAX8997_BUCK2, &max8997_buck2_data },
397 { MAX8997_BUCK3, &max8997_buck3_data },
398 { MAX8997_BUCK5, &max8997_buck5_data },
399 { MAX8997_BUCK7, &max8997_buck7_data },
402 struct max8997_platform_data __initdata origen_max8997_pdata = {
403 .num_regulators = ARRAY_SIZE(origen_max8997_regulators),
404 .regulators = origen_max8997_regulators,
407 .buck1_gpiodvs = false,
408 .buck2_gpiodvs = false,
409 .buck5_gpiodvs = false,
410 .irq_base = IRQ_GPIO_END + 1,
412 .ignore_gpiodvs_side_effect = true,
413 .buck125_default_idx = 0x0,
415 .buck125_gpios[0] = EXYNOS4_GPX0(0),
416 .buck125_gpios[1] = EXYNOS4_GPX0(1),
417 .buck125_gpios[2] = EXYNOS4_GPX0(2),
419 .buck1_voltage[0] = 1350000,
420 .buck1_voltage[1] = 1300000,
421 .buck1_voltage[2] = 1250000,
422 .buck1_voltage[3] = 1200000,
423 .buck1_voltage[4] = 1150000,
424 .buck1_voltage[5] = 1100000,
425 .buck1_voltage[6] = 1000000,
426 .buck1_voltage[7] = 950000,
428 .buck2_voltage[0] = 1100000,
429 .buck2_voltage[1] = 1100000,
430 .buck2_voltage[2] = 1100000,
431 .buck2_voltage[3] = 1100000,
432 .buck2_voltage[4] = 1000000,
433 .buck2_voltage[5] = 1000000,
434 .buck2_voltage[6] = 1000000,
435 .buck2_voltage[7] = 1000000,
437 .buck5_voltage[0] = 1200000,
438 .buck5_voltage[1] = 1200000,
439 .buck5_voltage[2] = 1200000,
440 .buck5_voltage[3] = 1200000,
441 .buck5_voltage[4] = 1200000,
442 .buck5_voltage[5] = 1200000,
443 .buck5_voltage[6] = 1200000,
444 .buck5_voltage[7] = 1200000,
448 static struct i2c_board_info i2c0_devs[] __initdata = {
450 I2C_BOARD_INFO("max8997", (0xCC >> 1)),
451 .platform_data = &origen_max8997_pdata,
456 static struct s3c_sdhci_platdata origen_hsmmc0_pdata __initdata = {
457 .cd_type = S3C_SDHCI_CD_INTERNAL,
458 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
461 static struct s3c_sdhci_platdata origen_hsmmc2_pdata __initdata = {
462 .cd_type = S3C_SDHCI_CD_INTERNAL,
463 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
467 static struct s5p_ehci_platdata origen_ehci_pdata;
469 static void __init origen_ehci_init(void)
471 struct s5p_ehci_platdata *pdata = &origen_ehci_pdata;
473 s5p_ehci_set_platdata(pdata);
476 static struct gpio_keys_button origen_gpio_keys_table[] = {
479 .gpio = EXYNOS4_GPX1(5),
480 .desc = "gpio-keys: KEY_MENU",
484 .debounce_interval = 1,
487 .gpio = EXYNOS4_GPX1(6),
488 .desc = "gpio-keys: KEY_HOME",
492 .debounce_interval = 1,
495 .gpio = EXYNOS4_GPX1(7),
496 .desc = "gpio-keys: KEY_BACK",
500 .debounce_interval = 1,
503 .gpio = EXYNOS4_GPX2(0),
504 .desc = "gpio-keys: KEY_UP",
508 .debounce_interval = 1,
511 .gpio = EXYNOS4_GPX2(1),
512 .desc = "gpio-keys: KEY_DOWN",
516 .debounce_interval = 1,
520 static struct gpio_keys_platform_data origen_gpio_keys_data = {
521 .buttons = origen_gpio_keys_table,
522 .nbuttons = ARRAY_SIZE(origen_gpio_keys_table),
525 static struct platform_device origen_device_gpiokeys = {
528 .platform_data = &origen_gpio_keys_data,
532 static struct platform_device *origen_devices[] __initdata = {
544 &s5p_device_i2c_hdmiphy,
546 &origen_device_gpiokeys,
549 /* LCD Backlight data */
550 static struct samsung_bl_gpio_info origen_bl_gpio_info = {
551 .no = EXYNOS4_GPD0(0),
552 .func = S3C_GPIO_SFN(2),
555 static struct platform_pwm_backlight_data origen_bl_data = {
557 .pwm_period_ns = 1000,
560 static void __init origen_map_io(void)
562 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
563 s3c24xx_init_clocks(24000000);
564 s3c24xx_init_uarts(origen_uartcfgs, ARRAY_SIZE(origen_uartcfgs));
567 static void __init origen_power_init(void)
569 gpio_request(EXYNOS4_GPX0(4), "PMIC_IRQ");
570 s3c_gpio_cfgpin(EXYNOS4_GPX0(4), S3C_GPIO_SFN(0xf));
571 s3c_gpio_setpull(EXYNOS4_GPX0(4), S3C_GPIO_PULL_NONE);
574 static void __init origen_machine_init(void)
578 s3c_i2c0_set_platdata(NULL);
579 i2c_register_board_info(0, i2c0_devs, ARRAY_SIZE(i2c0_devs));
582 * Since sdhci instance 2 can contain a bootable media,
583 * sdhci instance 0 is registered after instance 2.
585 s3c_sdhci2_set_platdata(&origen_hsmmc2_pdata);
586 s3c_sdhci0_set_platdata(&origen_hsmmc0_pdata);
589 clk_xusbxti.rate = 24000000;
591 s5p_i2c_hdmiphy_set_platdata(NULL);
593 platform_add_devices(origen_devices, ARRAY_SIZE(origen_devices));
595 samsung_bl_set(&origen_bl_gpio_info, &origen_bl_data);
598 MACHINE_START(ORIGEN, "ORIGEN")
599 /* Maintainer: JeongHyeon Kim <jhkim@insignal.co.kr> */
600 .boot_params = S5P_PA_SDRAM + 0x100,
601 .init_irq = exynos4_init_irq,
602 .map_io = origen_map_io,
603 .init_machine = origen_machine_init,
604 .timer = &exynos4_timer,