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>
22 #include <linux/lcd.h>
23 #include <linux/rfkill-gpio.h>
25 #include <asm/mach/arch.h>
26 #include <asm/hardware/gic.h>
27 #include <asm/mach-types.h>
29 #include <video/platform_lcd.h>
31 #include <plat/regs-serial.h>
32 #include <plat/regs-fb-v4.h>
34 #include <plat/devs.h>
35 #include <plat/sdhci.h>
37 #include <plat/ehci.h>
38 #include <plat/clock.h>
39 #include <plat/gpio-cfg.h>
40 #include <plat/backlight.h>
44 #include <mach/ohci.h>
47 #include <drm/exynos_drm.h>
50 /* Following are default values for UCON, ULCON and UFCON UART registers */
51 #define ORIGEN_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
52 S3C2410_UCON_RXILEVEL | \
53 S3C2410_UCON_TXIRQMODE | \
54 S3C2410_UCON_RXIRQMODE | \
55 S3C2410_UCON_RXFIFO_TOI | \
56 S3C2443_UCON_RXERR_IRQEN)
58 #define ORIGEN_ULCON_DEFAULT S3C2410_LCON_CS8
60 #define ORIGEN_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
61 S5PV210_UFCON_TXTRIG4 | \
62 S5PV210_UFCON_RXTRIG4)
64 static struct s3c2410_uartcfg origen_uartcfgs
[] __initdata
= {
68 .ucon
= ORIGEN_UCON_DEFAULT
,
69 .ulcon
= ORIGEN_ULCON_DEFAULT
,
70 .ufcon
= ORIGEN_UFCON_DEFAULT
,
75 .ucon
= ORIGEN_UCON_DEFAULT
,
76 .ulcon
= ORIGEN_ULCON_DEFAULT
,
77 .ufcon
= ORIGEN_UFCON_DEFAULT
,
82 .ucon
= ORIGEN_UCON_DEFAULT
,
83 .ulcon
= ORIGEN_ULCON_DEFAULT
,
84 .ufcon
= ORIGEN_UFCON_DEFAULT
,
89 .ucon
= ORIGEN_UCON_DEFAULT
,
90 .ulcon
= ORIGEN_ULCON_DEFAULT
,
91 .ufcon
= ORIGEN_UFCON_DEFAULT
,
95 static struct regulator_consumer_supply __initdata ldo3_consumer
[] = {
96 REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */
97 REGULATOR_SUPPLY("vdd", "exynos4-hdmi"), /* HDMI */
98 REGULATOR_SUPPLY("vdd_pll", "exynos4-hdmi"), /* HDMI */
100 static struct regulator_consumer_supply __initdata ldo6_consumer
[] = {
101 REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"), /* MIPI */
103 static struct regulator_consumer_supply __initdata ldo7_consumer
[] = {
104 REGULATOR_SUPPLY("avdd", "alc5625"), /* Realtek ALC5625 */
106 static struct regulator_consumer_supply __initdata ldo8_consumer
[] = {
107 REGULATOR_SUPPLY("vdd", "s5p-adc"), /* ADC */
108 REGULATOR_SUPPLY("vdd_osc", "exynos4-hdmi"), /* HDMI */
110 static struct regulator_consumer_supply __initdata ldo9_consumer
[] = {
111 REGULATOR_SUPPLY("dvdd", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */
113 static struct regulator_consumer_supply __initdata ldo11_consumer
[] = {
114 REGULATOR_SUPPLY("dvdd", "alc5625"), /* Realtek ALC5625 */
116 static struct regulator_consumer_supply __initdata ldo14_consumer
[] = {
117 REGULATOR_SUPPLY("avdd18", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */
119 static struct regulator_consumer_supply __initdata ldo17_consumer
[] = {
120 REGULATOR_SUPPLY("vdd33", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */
122 static struct regulator_consumer_supply __initdata buck1_consumer
[] = {
123 REGULATOR_SUPPLY("vdd_arm", NULL
), /* CPUFREQ */
125 static struct regulator_consumer_supply __initdata buck2_consumer
[] = {
126 REGULATOR_SUPPLY("vdd_int", NULL
), /* CPUFREQ */
128 static struct regulator_consumer_supply __initdata buck3_consumer
[] = {
129 REGULATOR_SUPPLY("vdd_g3d", "mali_drm"), /* G3D */
131 static struct regulator_consumer_supply __initdata buck7_consumer
[] = {
132 REGULATOR_SUPPLY("vcc", "platform-lcd"), /* LCD */
135 static struct regulator_init_data __initdata max8997_ldo1_data
= {
137 .name
= "VDD_ABB_3.3V",
147 static struct regulator_init_data __initdata max8997_ldo2_data
= {
149 .name
= "VDD_ALIVE_1.1V",
160 static struct regulator_init_data __initdata max8997_ldo3_data
= {
162 .name
= "VMIPI_1.1V",
166 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
171 .num_consumer_supplies
= ARRAY_SIZE(ldo3_consumer
),
172 .consumer_supplies
= ldo3_consumer
,
175 static struct regulator_init_data __initdata max8997_ldo4_data
= {
177 .name
= "VDD_RTC_1.8V",
188 static struct regulator_init_data __initdata max8997_ldo6_data
= {
190 .name
= "VMIPI_1.8V",
194 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
199 .num_consumer_supplies
= ARRAY_SIZE(ldo6_consumer
),
200 .consumer_supplies
= ldo6_consumer
,
203 static struct regulator_init_data __initdata max8997_ldo7_data
= {
205 .name
= "VDD_AUD_1.8V",
209 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
214 .num_consumer_supplies
= ARRAY_SIZE(ldo7_consumer
),
215 .consumer_supplies
= ldo7_consumer
,
218 static struct regulator_init_data __initdata max8997_ldo8_data
= {
224 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
229 .num_consumer_supplies
= ARRAY_SIZE(ldo8_consumer
),
230 .consumer_supplies
= ldo8_consumer
,
233 static struct regulator_init_data __initdata max8997_ldo9_data
= {
235 .name
= "DVDD_SWB_2.8V",
240 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
245 .num_consumer_supplies
= ARRAY_SIZE(ldo9_consumer
),
246 .consumer_supplies
= ldo9_consumer
,
249 static struct regulator_init_data __initdata max8997_ldo10_data
= {
251 .name
= "VDD_PLL_1.1V",
262 static struct regulator_init_data __initdata max8997_ldo11_data
= {
264 .name
= "VDD_AUD_3V",
268 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
273 .num_consumer_supplies
= ARRAY_SIZE(ldo11_consumer
),
274 .consumer_supplies
= ldo11_consumer
,
277 static struct regulator_init_data __initdata max8997_ldo14_data
= {
279 .name
= "AVDD18_SWB_1.8V",
284 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
289 .num_consumer_supplies
= ARRAY_SIZE(ldo14_consumer
),
290 .consumer_supplies
= ldo14_consumer
,
293 static struct regulator_init_data __initdata max8997_ldo17_data
= {
295 .name
= "VDD_SWB_3.3V",
300 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
305 .num_consumer_supplies
= ARRAY_SIZE(ldo17_consumer
),
306 .consumer_supplies
= ldo17_consumer
,
309 static struct regulator_init_data __initdata max8997_ldo21_data
= {
311 .name
= "VDD_MIF_1.2V",
322 static struct regulator_init_data __initdata max8997_buck1_data
= {
324 .name
= "VDD_ARM_1.2V",
329 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
,
334 .num_consumer_supplies
= ARRAY_SIZE(buck1_consumer
),
335 .consumer_supplies
= buck1_consumer
,
338 static struct regulator_init_data __initdata max8997_buck2_data
= {
340 .name
= "VDD_INT_1.1V",
345 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
,
350 .num_consumer_supplies
= ARRAY_SIZE(buck2_consumer
),
351 .consumer_supplies
= buck2_consumer
,
354 static struct regulator_init_data __initdata max8997_buck3_data
= {
356 .name
= "VDD_G3D_1.1V",
359 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
360 REGULATOR_CHANGE_STATUS
,
365 .num_consumer_supplies
= ARRAY_SIZE(buck3_consumer
),
366 .consumer_supplies
= buck3_consumer
,
369 static struct regulator_init_data __initdata max8997_buck5_data
= {
371 .name
= "VDDQ_M1M2_1.2V",
382 static struct regulator_init_data __initdata max8997_buck7_data
= {
384 .name
= "VDD_LCD_3.3V",
389 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
394 .num_consumer_supplies
= ARRAY_SIZE(buck7_consumer
),
395 .consumer_supplies
= buck7_consumer
,
398 static struct max8997_regulator_data __initdata origen_max8997_regulators
[] = {
399 { MAX8997_LDO1
, &max8997_ldo1_data
},
400 { MAX8997_LDO2
, &max8997_ldo2_data
},
401 { MAX8997_LDO3
, &max8997_ldo3_data
},
402 { MAX8997_LDO4
, &max8997_ldo4_data
},
403 { MAX8997_LDO6
, &max8997_ldo6_data
},
404 { MAX8997_LDO7
, &max8997_ldo7_data
},
405 { MAX8997_LDO8
, &max8997_ldo8_data
},
406 { MAX8997_LDO9
, &max8997_ldo9_data
},
407 { MAX8997_LDO10
, &max8997_ldo10_data
},
408 { MAX8997_LDO11
, &max8997_ldo11_data
},
409 { MAX8997_LDO14
, &max8997_ldo14_data
},
410 { MAX8997_LDO17
, &max8997_ldo17_data
},
411 { MAX8997_LDO21
, &max8997_ldo21_data
},
412 { MAX8997_BUCK1
, &max8997_buck1_data
},
413 { MAX8997_BUCK2
, &max8997_buck2_data
},
414 { MAX8997_BUCK3
, &max8997_buck3_data
},
415 { MAX8997_BUCK5
, &max8997_buck5_data
},
416 { MAX8997_BUCK7
, &max8997_buck7_data
},
419 static struct max8997_platform_data __initdata origen_max8997_pdata
= {
420 .num_regulators
= ARRAY_SIZE(origen_max8997_regulators
),
421 .regulators
= origen_max8997_regulators
,
424 .buck1_gpiodvs
= false,
425 .buck2_gpiodvs
= false,
426 .buck5_gpiodvs
= false,
427 .irq_base
= IRQ_GPIO_END
+ 1,
429 .ignore_gpiodvs_side_effect
= true,
430 .buck125_default_idx
= 0x0,
432 .buck125_gpios
[0] = EXYNOS4_GPX0(0),
433 .buck125_gpios
[1] = EXYNOS4_GPX0(1),
434 .buck125_gpios
[2] = EXYNOS4_GPX0(2),
436 .buck1_voltage
[0] = 1350000,
437 .buck1_voltage
[1] = 1300000,
438 .buck1_voltage
[2] = 1250000,
439 .buck1_voltage
[3] = 1200000,
440 .buck1_voltage
[4] = 1150000,
441 .buck1_voltage
[5] = 1100000,
442 .buck1_voltage
[6] = 1000000,
443 .buck1_voltage
[7] = 950000,
445 .buck2_voltage
[0] = 1100000,
446 .buck2_voltage
[1] = 1100000,
447 .buck2_voltage
[2] = 1100000,
448 .buck2_voltage
[3] = 1100000,
449 .buck2_voltage
[4] = 1000000,
450 .buck2_voltage
[5] = 1000000,
451 .buck2_voltage
[6] = 1000000,
452 .buck2_voltage
[7] = 1000000,
454 .buck5_voltage
[0] = 1200000,
455 .buck5_voltage
[1] = 1200000,
456 .buck5_voltage
[2] = 1200000,
457 .buck5_voltage
[3] = 1200000,
458 .buck5_voltage
[4] = 1200000,
459 .buck5_voltage
[5] = 1200000,
460 .buck5_voltage
[6] = 1200000,
461 .buck5_voltage
[7] = 1200000,
465 static struct i2c_board_info i2c0_devs
[] __initdata
= {
467 I2C_BOARD_INFO("max8997", (0xCC >> 1)),
468 .platform_data
= &origen_max8997_pdata
,
473 static struct s3c_sdhci_platdata origen_hsmmc0_pdata __initdata
= {
474 .cd_type
= S3C_SDHCI_CD_INTERNAL
,
477 static struct s3c_sdhci_platdata origen_hsmmc2_pdata __initdata
= {
478 .cd_type
= S3C_SDHCI_CD_INTERNAL
,
482 static struct s5p_ehci_platdata origen_ehci_pdata
;
484 static void __init
origen_ehci_init(void)
486 struct s5p_ehci_platdata
*pdata
= &origen_ehci_pdata
;
488 s5p_ehci_set_platdata(pdata
);
492 static struct exynos4_ohci_platdata origen_ohci_pdata
;
494 static void __init
origen_ohci_init(void)
496 struct exynos4_ohci_platdata
*pdata
= &origen_ohci_pdata
;
498 exynos4_ohci_set_platdata(pdata
);
501 static struct gpio_keys_button origen_gpio_keys_table
[] = {
504 .gpio
= EXYNOS4_GPX1(5),
505 .desc
= "gpio-keys: KEY_MENU",
509 .debounce_interval
= 1,
512 .gpio
= EXYNOS4_GPX1(6),
513 .desc
= "gpio-keys: KEY_HOME",
517 .debounce_interval
= 1,
520 .gpio
= EXYNOS4_GPX1(7),
521 .desc
= "gpio-keys: KEY_BACK",
525 .debounce_interval
= 1,
528 .gpio
= EXYNOS4_GPX2(0),
529 .desc
= "gpio-keys: KEY_UP",
533 .debounce_interval
= 1,
536 .gpio
= EXYNOS4_GPX2(1),
537 .desc
= "gpio-keys: KEY_DOWN",
541 .debounce_interval
= 1,
545 static struct gpio_keys_platform_data origen_gpio_keys_data
= {
546 .buttons
= origen_gpio_keys_table
,
547 .nbuttons
= ARRAY_SIZE(origen_gpio_keys_table
),
550 static struct platform_device origen_device_gpiokeys
= {
553 .platform_data
= &origen_gpio_keys_data
,
557 static void lcd_hv070wsa_set_power(struct plat_lcd_data
*pd
, unsigned int power
)
562 ret
= gpio_request_one(EXYNOS4_GPE3(4),
563 GPIOF_OUT_INIT_HIGH
, "GPE3_4");
565 ret
= gpio_request_one(EXYNOS4_GPE3(4),
566 GPIOF_OUT_INIT_LOW
, "GPE3_4");
568 gpio_free(EXYNOS4_GPE3(4));
571 pr_err("failed to request gpio for LCD power: %d\n", ret
);
574 static struct plat_lcd_data origen_lcd_hv070wsa_data
= {
575 .set_power
= lcd_hv070wsa_set_power
,
578 static struct platform_device origen_lcd_hv070wsa
= {
579 .name
= "platform-lcd",
580 .dev
.parent
= &s5p_device_fimd0
.dev
,
581 .dev
.platform_data
= &origen_lcd_hv070wsa_data
,
584 #ifdef CONFIG_DRM_EXYNOS
585 static struct exynos_drm_fimd_pdata drm_fimd_pdata
= {
598 .vidcon0
= VIDCON0_VIDOUT_RGB
| VIDCON0_PNRMODE_RGB
,
599 .vidcon1
= VIDCON1_INV_HSYNC
| VIDCON1_INV_VSYNC
|
605 static struct s3c_fb_pd_win origen_fb_win0
= {
611 .virtual_y
= 2 * 600,
614 static struct fb_videomode origen_lcd_timing
= {
625 static struct s3c_fb_platdata origen_lcd_pdata __initdata
= {
626 .win
[0] = &origen_fb_win0
,
627 .vtiming
= &origen_lcd_timing
,
628 .vidcon0
= VIDCON0_VIDOUT_RGB
| VIDCON0_PNRMODE_RGB
,
629 .vidcon1
= VIDCON1_INV_HSYNC
| VIDCON1_INV_VSYNC
|
631 .setup_gpio
= exynos4_fimd0_gpio_setup_24bpp
,
635 /* Bluetooth rfkill gpio platform data */
636 static struct rfkill_gpio_platform_data origen_bt_pdata
= {
637 .reset_gpio
= EXYNOS4_GPX2(2),
639 .type
= RFKILL_TYPE_BLUETOOTH
,
643 /* Bluetooth Platform device */
644 static struct platform_device origen_device_bluetooth
= {
645 .name
= "rfkill_gpio",
648 .platform_data
= &origen_bt_pdata
,
652 static struct platform_device
*origen_devices
[] __initdata
= {
667 &s5p_device_i2c_hdmiphy
,
673 #ifdef CONFIG_DRM_EXYNOS
676 &exynos4_device_ohci
,
677 &origen_device_gpiokeys
,
678 &origen_lcd_hv070wsa
,
679 &origen_device_bluetooth
,
682 /* LCD Backlight data */
683 static struct samsung_bl_gpio_info origen_bl_gpio_info
= {
684 .no
= EXYNOS4_GPD0(0),
685 .func
= S3C_GPIO_SFN(2),
688 static struct platform_pwm_backlight_data origen_bl_data
= {
690 .pwm_period_ns
= 1000,
693 static void __init
origen_bt_setup(void)
695 gpio_request(EXYNOS4_GPA0(0), "GPIO BT_UART");
696 /* 4 UART Pins configuration */
697 s3c_gpio_cfgrange_nopull(EXYNOS4_GPA0(0), 4, S3C_GPIO_SFN(2));
698 /* Setup BT Reset, this gpio will be requesed by rfkill-gpio */
699 s3c_gpio_cfgpin(EXYNOS4_GPX2(2), S3C_GPIO_OUTPUT
);
700 s3c_gpio_setpull(EXYNOS4_GPX2(2), S3C_GPIO_PULL_NONE
);
703 static void s5p_tv_setup(void)
705 /* Direct HPD to HDMI chip */
706 gpio_request_one(EXYNOS4_GPX3(7), GPIOF_IN
, "hpd-plug");
707 s3c_gpio_cfgpin(EXYNOS4_GPX3(7), S3C_GPIO_SFN(0x3));
708 s3c_gpio_setpull(EXYNOS4_GPX3(7), S3C_GPIO_PULL_NONE
);
711 static void __init
origen_map_io(void)
713 exynos_init_io(NULL
, 0);
714 s3c24xx_init_clocks(24000000);
715 s3c24xx_init_uarts(origen_uartcfgs
, ARRAY_SIZE(origen_uartcfgs
));
718 static void __init
origen_power_init(void)
720 gpio_request(EXYNOS4_GPX0(4), "PMIC_IRQ");
721 s3c_gpio_cfgpin(EXYNOS4_GPX0(4), S3C_GPIO_SFN(0xf));
722 s3c_gpio_setpull(EXYNOS4_GPX0(4), S3C_GPIO_PULL_NONE
);
725 static void __init
origen_reserve(void)
727 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
730 static void __init
origen_machine_init(void)
734 s3c_i2c0_set_platdata(NULL
);
735 i2c_register_board_info(0, i2c0_devs
, ARRAY_SIZE(i2c0_devs
));
738 * Since sdhci instance 2 can contain a bootable media,
739 * sdhci instance 0 is registered after instance 2.
741 s3c_sdhci2_set_platdata(&origen_hsmmc2_pdata
);
742 s3c_sdhci0_set_platdata(&origen_hsmmc0_pdata
);
746 clk_xusbxti
.rate
= 24000000;
749 s5p_i2c_hdmiphy_set_platdata(NULL
);
751 #ifdef CONFIG_DRM_EXYNOS
752 s5p_device_fimd0
.dev
.platform_data
= &drm_fimd_pdata
;
753 exynos4_fimd0_gpio_setup_24bpp();
755 s5p_fimd0_set_platdata(&origen_lcd_pdata
);
758 platform_add_devices(origen_devices
, ARRAY_SIZE(origen_devices
));
760 samsung_bl_set(&origen_bl_gpio_info
, &origen_bl_data
);
765 MACHINE_START(ORIGEN
, "ORIGEN")
766 /* Maintainer: JeongHyeon Kim <jhkim@insignal.co.kr> */
767 .atag_offset
= 0x100,
768 .init_irq
= exynos4_init_irq
,
769 .map_io
= origen_map_io
,
770 .handle_irq
= gic_handle_irq
,
771 .init_machine
= origen_machine_init
,
772 .init_late
= exynos_init_late
,
773 .timer
= &exynos4_timer
,
774 .reserve
= &origen_reserve
,
775 .restart
= exynos4_restart
,