2 * linux/arch/arm/mach-exynos4/mach-nuri.c
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
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/platform_device.h>
12 #include <linux/serial_core.h>
13 #include <linux/input.h>
14 #include <linux/i2c.h>
15 #include <linux/i2c/atmel_mxt_ts.h>
16 #include <linux/i2c-gpio.h>
17 #include <linux/gpio_keys.h>
18 #include <linux/gpio.h>
19 #include <linux/power/max8903_charger.h>
20 #include <linux/power/max17042_battery.h>
21 #include <linux/regulator/machine.h>
22 #include <linux/regulator/fixed.h>
23 #include <linux/mfd/max8997.h>
24 #include <linux/mfd/max8997-private.h>
25 #include <linux/mmc/host.h>
27 #include <linux/pwm_backlight.h>
28 #include <linux/platform_data/i2c-s3c2410.h>
29 #include <linux/platform_data/mipi-csis.h>
30 #include <linux/platform_data/s3c-hsotg.h>
31 #include <linux/platform_data/usb-ehci-s5p.h>
32 #include <drm/exynos_drm.h>
34 #include <video/platform_lcd.h>
35 #include <video/samsung_fimd.h>
36 #include <media/m5mols.h>
37 #include <media/s5k6aa.h>
38 #include <media/s5p_fimc.h>
39 #include <media/v4l2-mediabus.h>
41 #include <asm/mach/arch.h>
42 #include <asm/mach-types.h>
45 #include <plat/regs-serial.h>
47 #include <plat/devs.h>
49 #include <plat/sdhci.h>
50 #include <plat/clock.h>
51 #include <plat/gpio-cfg.h>
53 #include <plat/fimc-core.h>
54 #include <plat/camport.h>
60 /* Following are default values for UCON, ULCON and UFCON UART registers */
61 #define NURI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
62 S3C2410_UCON_RXILEVEL | \
63 S3C2410_UCON_TXIRQMODE | \
64 S3C2410_UCON_RXIRQMODE | \
65 S3C2410_UCON_RXFIFO_TOI | \
66 S3C2443_UCON_RXERR_IRQEN)
68 #define NURI_ULCON_DEFAULT S3C2410_LCON_CS8
70 #define NURI_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
71 S5PV210_UFCON_TXTRIG256 | \
72 S5PV210_UFCON_RXTRIG256)
74 enum fixed_regulator_id {
77 FIXED_REG_ID_CAM_A28V,
79 FIXED_REG_ID_CAM_VT_15V,
82 static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = {
85 .ucon = NURI_UCON_DEFAULT,
86 .ulcon = NURI_ULCON_DEFAULT,
87 .ufcon = NURI_UFCON_DEFAULT,
91 .ucon = NURI_UCON_DEFAULT,
92 .ulcon = NURI_ULCON_DEFAULT,
93 .ufcon = NURI_UFCON_DEFAULT,
97 .ucon = NURI_UCON_DEFAULT,
98 .ulcon = NURI_ULCON_DEFAULT,
99 .ufcon = NURI_UFCON_DEFAULT,
103 .ucon = NURI_UCON_DEFAULT,
104 .ulcon = NURI_ULCON_DEFAULT,
105 .ufcon = NURI_UFCON_DEFAULT,
110 static struct s3c_sdhci_platdata nuri_hsmmc0_data __initdata = {
112 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
113 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
115 .cd_type = S3C_SDHCI_CD_PERMANENT,
118 static struct regulator_consumer_supply emmc_supplies[] = {
119 REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.0"),
120 REGULATOR_SUPPLY("vmmc", "dw_mmc"),
123 static struct regulator_init_data emmc_fixed_voltage_init_data = {
125 .name = "VMEM_VDD_2.8V",
126 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
128 .num_consumer_supplies = ARRAY_SIZE(emmc_supplies),
129 .consumer_supplies = emmc_supplies,
132 static struct fixed_voltage_config emmc_fixed_voltage_config = {
133 .supply_name = "MASSMEMORY_EN (inverted)",
134 .microvolts = 2800000,
135 .gpio = EXYNOS4_GPL1(1),
136 .enable_high = false,
137 .init_data = &emmc_fixed_voltage_init_data,
140 static struct platform_device emmc_fixed_voltage = {
141 .name = "reg-fixed-voltage",
142 .id = FIXED_REG_ID_MMC,
144 .platform_data = &emmc_fixed_voltage_config,
149 static struct s3c_sdhci_platdata nuri_hsmmc2_data __initdata = {
151 .host_caps = MMC_CAP_4_BIT_DATA |
152 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
153 .ext_cd_gpio = EXYNOS4_GPX3(3), /* XEINT_27 */
154 .ext_cd_gpio_invert = 1,
155 .cd_type = S3C_SDHCI_CD_GPIO,
159 static struct s3c_sdhci_platdata nuri_hsmmc3_data __initdata = {
161 .host_caps = MMC_CAP_4_BIT_DATA |
162 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
163 .cd_type = S3C_SDHCI_CD_EXTERNAL,
166 static void __init nuri_sdhci_init(void)
168 s3c_sdhci0_set_platdata(&nuri_hsmmc0_data);
169 s3c_sdhci2_set_platdata(&nuri_hsmmc2_data);
170 s3c_sdhci3_set_platdata(&nuri_hsmmc3_data);
174 static struct gpio_keys_button nuri_gpio_keys_tables[] = {
176 .code = KEY_VOLUMEUP,
177 .gpio = EXYNOS4_GPX2(0), /* XEINT16 */
178 .desc = "gpio-keys: KEY_VOLUMEUP",
181 .debounce_interval = 1,
183 .code = KEY_VOLUMEDOWN,
184 .gpio = EXYNOS4_GPX2(1), /* XEINT17 */
185 .desc = "gpio-keys: KEY_VOLUMEDOWN",
188 .debounce_interval = 1,
191 .gpio = EXYNOS4_GPX2(7), /* XEINT23 */
192 .desc = "gpio-keys: KEY_POWER",
196 .debounce_interval = 1,
200 static struct gpio_keys_platform_data nuri_gpio_keys_data = {
201 .buttons = nuri_gpio_keys_tables,
202 .nbuttons = ARRAY_SIZE(nuri_gpio_keys_tables),
205 static struct platform_device nuri_gpio_keys = {
208 .platform_data = &nuri_gpio_keys_data,
212 #ifdef CONFIG_DRM_EXYNOS
213 static struct exynos_drm_fimd_pdata drm_fimd_pdata = {
227 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
229 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
236 static struct s3c_fb_pd_win nuri_fb_win0 = {
242 .virtual_y = 2 * 600,
245 static struct fb_videomode nuri_lcd_timing = {
257 static struct s3c_fb_platdata nuri_fb_pdata __initdata = {
258 .win[0] = &nuri_fb_win0,
259 .vtiming = &nuri_lcd_timing,
260 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
262 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
263 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
267 static void nuri_lcd_power_on(struct plat_lcd_data *pd, unsigned int power)
269 int gpio = EXYNOS4_GPE1(5);
271 gpio_request(gpio, "LVDS_nSHDN");
272 gpio_direction_output(gpio, power);
276 static int nuri_bl_init(struct device *dev)
278 return gpio_request_one(EXYNOS4_GPE2(3), GPIOF_OUT_INIT_LOW,
282 static int nuri_bl_notify(struct device *dev, int brightness)
287 gpio_set_value(EXYNOS4_GPE2(3), 1);
292 static void nuri_bl_exit(struct device *dev)
294 gpio_free(EXYNOS4_GPE2(3));
297 /* nuri pwm backlight */
298 static struct platform_pwm_backlight_data nuri_backlight_data = {
300 .pwm_period_ns = 30000,
301 .max_brightness = 100,
302 .dft_brightness = 50,
303 .init = nuri_bl_init,
304 .notify = nuri_bl_notify,
305 .exit = nuri_bl_exit,
308 static struct platform_device nuri_backlight_device = {
309 .name = "pwm-backlight",
312 .parent = &s3c_device_timer[0].dev,
313 .platform_data = &nuri_backlight_data,
317 static struct plat_lcd_data nuri_lcd_platform_data = {
318 .set_power = nuri_lcd_power_on,
321 static struct platform_device nuri_lcd_device = {
322 .name = "platform-lcd",
325 .platform_data = &nuri_lcd_platform_data,
330 static struct i2c_board_info i2c1_devs[] __initdata = {
331 /* Gyro, To be updated */
335 static struct mxt_platform_data mxt_platform_data = {
342 .voltage = 2800000, /* 2.8V */
343 .orient = MXT_DIAGONAL_COUNTER,
344 .irqflags = IRQF_TRIGGER_FALLING,
347 static struct s3c2410_platform_i2c i2c3_data __initdata = {
351 .frequency = 400 * 1000,
355 static struct i2c_board_info i2c3_devs[] __initdata = {
357 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
358 .platform_data = &mxt_platform_data,
363 static void __init nuri_tsp_init(void)
367 /* TOUCH_INT: XEINT_4 */
368 gpio = EXYNOS4_GPX0(4);
369 gpio_request(gpio, "TOUCH_INT");
370 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
371 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
374 static struct regulator_consumer_supply __initdata max8997_ldo1_[] = {
375 REGULATOR_SUPPLY("vdd", "s5p-adc"), /* Used by CPU's ADC drv */
377 static struct regulator_consumer_supply __initdata max8997_ldo3_[] = {
378 REGULATOR_SUPPLY("vusb_d", "s3c-hsotg"), /* USB */
379 REGULATOR_SUPPLY("vddcore", "s5p-mipi-csis.0"), /* MIPI */
381 static struct regulator_consumer_supply __initdata max8997_ldo4_[] = {
382 REGULATOR_SUPPLY("vddio", "s5p-mipi-csis.0"), /* MIPI */
384 static struct regulator_consumer_supply __initdata max8997_ldo5_[] = {
385 REGULATOR_SUPPLY("vhsic", "modemctl"), /* MODEM */
387 static struct regulator_consumer_supply nuri_max8997_ldo6_consumer[] = {
388 REGULATOR_SUPPLY("vdd_reg", "6-003c"), /* S5K6AA camera */
390 static struct regulator_consumer_supply __initdata max8997_ldo7_[] = {
391 REGULATOR_SUPPLY("dig_18", "0-001f"), /* HCD803 */
393 static struct regulator_consumer_supply __initdata max8997_ldo8_[] = {
394 REGULATOR_SUPPLY("vusb_a", "s3c-hsotg"), /* USB */
395 REGULATOR_SUPPLY("vdac", NULL), /* Used by CPU */
397 static struct regulator_consumer_supply __initdata max8997_ldo11_[] = {
398 REGULATOR_SUPPLY("vcc", "platform-lcd"), /* U804 LVDS */
400 static struct regulator_consumer_supply __initdata max8997_ldo12_[] = {
401 REGULATOR_SUPPLY("vddio", "6-003c"), /* HDC802 */
403 static struct regulator_consumer_supply __initdata max8997_ldo13_[] = {
404 REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.2"), /* TFLASH */
406 static struct regulator_consumer_supply __initdata max8997_ldo14_[] = {
407 REGULATOR_SUPPLY("inmotor", "max8997-haptic"),
409 static struct regulator_consumer_supply __initdata max8997_ldo15_[] = {
410 REGULATOR_SUPPLY("avdd", "3-004a"), /* Touch Screen */
412 static struct regulator_consumer_supply __initdata max8997_ldo16_[] = {
413 REGULATOR_SUPPLY("d_sensor", "0-001f"), /* HDC803 */
415 static struct regulator_consumer_supply __initdata max8997_ldo18_[] = {
416 REGULATOR_SUPPLY("vdd", "3-004a"), /* Touch Screen */
418 static struct regulator_consumer_supply __initdata max8997_buck1_[] = {
419 REGULATOR_SUPPLY("vdd_arm", NULL), /* CPUFREQ */
421 static struct regulator_consumer_supply __initdata max8997_buck2_[] = {
422 REGULATOR_SUPPLY("vdd_int", "exynos4210-busfreq.0"), /* CPUFREQ */
424 static struct regulator_consumer_supply __initdata max8997_buck3_[] = {
425 REGULATOR_SUPPLY("vdd", "mali_dev.0"), /* G3D of Exynos 4 */
427 static struct regulator_consumer_supply __initdata max8997_buck4_[] = {
428 REGULATOR_SUPPLY("core", "0-001f"), /* HDC803 */
430 static struct regulator_consumer_supply __initdata max8997_buck6_[] = {
431 REGULATOR_SUPPLY("dig_28", "0-001f"), /* pin "7" of HDC803 */
433 static struct regulator_consumer_supply __initdata max8997_esafeout1_[] = {
434 REGULATOR_SUPPLY("usb_vbus", NULL), /* CPU's USB OTG */
436 static struct regulator_consumer_supply __initdata max8997_esafeout2_[] = {
437 REGULATOR_SUPPLY("usb_vbus", "modemctl"), /* VBUS of Modem */
440 static struct regulator_consumer_supply __initdata max8997_charger_[] = {
441 REGULATOR_SUPPLY("vinchg1", "charger-manager.0"),
443 static struct regulator_consumer_supply __initdata max8997_chg_toff_[] = {
444 REGULATOR_SUPPLY("vinchg_stop", NULL), /* for jack interrupt handlers */
447 static struct regulator_consumer_supply __initdata max8997_32khz_ap_[] = {
448 REGULATOR_SUPPLY("gps_clk", "bcm4751"),
449 REGULATOR_SUPPLY("bt_clk", "bcm4330-b1"),
450 REGULATOR_SUPPLY("wifi_clk", "bcm433-b1"),
453 static struct regulator_init_data __initdata max8997_ldo1_data = {
455 .name = "VADC_3.3V_C210",
458 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
464 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo1_),
465 .consumer_supplies = max8997_ldo1_,
468 static struct regulator_init_data __initdata max8997_ldo2_data = {
470 .name = "VALIVE_1.1V_C210",
481 static struct regulator_init_data __initdata max8997_ldo3_data = {
483 .name = "VUSB_1.1V_C210",
486 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
492 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo3_),
493 .consumer_supplies = max8997_ldo3_,
496 static struct regulator_init_data __initdata max8997_ldo4_data = {
498 .name = "VMIPI_1.8V",
501 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
507 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo4_),
508 .consumer_supplies = max8997_ldo4_,
511 static struct regulator_init_data __initdata max8997_ldo5_data = {
513 .name = "VHSIC_1.2V_C210",
516 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
522 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo5_),
523 .consumer_supplies = max8997_ldo5_,
526 static struct regulator_init_data __initdata max8997_ldo6_data = {
528 .name = "VCC_1.8V_PDA",
537 .num_consumer_supplies = ARRAY_SIZE(nuri_max8997_ldo6_consumer),
538 .consumer_supplies = nuri_max8997_ldo6_consumer,
541 static struct regulator_init_data __initdata max8997_ldo7_data = {
543 .name = "CAM_ISP_1.8V",
546 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
552 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo7_),
553 .consumer_supplies = max8997_ldo7_,
556 static struct regulator_init_data __initdata max8997_ldo8_data = {
558 .name = "VUSB+VDAC_3.3V_C210",
561 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
567 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo8_),
568 .consumer_supplies = max8997_ldo8_,
571 static struct regulator_init_data __initdata max8997_ldo9_data = {
573 .name = "VCC_2.8V_PDA",
584 static struct regulator_init_data __initdata max8997_ldo10_data = {
586 .name = "VPLL_1.1V_C210",
597 static struct regulator_init_data __initdata max8997_ldo11_data = {
599 .name = "LVDS_VDD3.3V",
602 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
609 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo11_),
610 .consumer_supplies = max8997_ldo11_,
613 static struct regulator_init_data __initdata max8997_ldo12_data = {
615 .name = "VT_CAM_1.8V",
618 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
624 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo12_),
625 .consumer_supplies = max8997_ldo12_,
628 static struct regulator_init_data __initdata max8997_ldo13_data = {
633 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
639 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo13_),
640 .consumer_supplies = max8997_ldo13_,
643 static struct regulator_init_data __initdata max8997_ldo14_data = {
645 .name = "VCC_3.0V_MOTOR",
648 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
654 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo14_),
655 .consumer_supplies = max8997_ldo14_,
658 static struct regulator_init_data __initdata max8997_ldo15_data = {
660 .name = "VTOUCH_ADVV2.8V",
664 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
669 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo15_),
670 .consumer_supplies = max8997_ldo15_,
673 static struct regulator_init_data __initdata max8997_ldo16_data = {
675 .name = "CAM_SENSOR_IO_1.8V",
678 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
684 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo16_),
685 .consumer_supplies = max8997_ldo16_,
688 static struct regulator_init_data __initdata max8997_ldo18_data = {
690 .name = "VTOUCH_VDD2.8V",
693 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
699 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo18_),
700 .consumer_supplies = max8997_ldo18_,
703 static struct regulator_init_data __initdata max8997_ldo21_data = {
705 .name = "VDDQ_M1M2_1.2V",
716 static struct regulator_init_data __initdata max8997_buck1_data = {
718 .name = "VARM_1.2V_C210",
721 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
727 .num_consumer_supplies = ARRAY_SIZE(max8997_buck1_),
728 .consumer_supplies = max8997_buck1_,
731 static struct regulator_init_data __initdata max8997_buck2_data = {
733 .name = "VINT_1.1V_C210",
736 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
742 .num_consumer_supplies = ARRAY_SIZE(max8997_buck2_),
743 .consumer_supplies = max8997_buck2_,
746 static struct regulator_init_data __initdata max8997_buck3_data = {
748 .name = "VG3D_1.1V_C210",
751 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
752 REGULATOR_CHANGE_STATUS,
757 .num_consumer_supplies = ARRAY_SIZE(max8997_buck3_),
758 .consumer_supplies = max8997_buck3_,
761 static struct regulator_init_data __initdata max8997_buck4_data = {
763 .name = "CAM_ISP_CORE_1.2V",
767 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
772 .num_consumer_supplies = ARRAY_SIZE(max8997_buck4_),
773 .consumer_supplies = max8997_buck4_,
776 static struct regulator_init_data __initdata max8997_buck5_data = {
778 .name = "VMEM_1.2V_C210",
789 static struct regulator_init_data __initdata max8997_buck6_data = {
791 .name = "CAM_AF_2.8V",
794 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
799 .num_consumer_supplies = ARRAY_SIZE(max8997_buck6_),
800 .consumer_supplies = max8997_buck6_,
803 static struct regulator_init_data __initdata max8997_buck7_data = {
805 .name = "VCC_SUB_2.0V",
816 static struct regulator_init_data __initdata max8997_32khz_ap_data = {
824 .num_consumer_supplies = ARRAY_SIZE(max8997_32khz_ap_),
825 .consumer_supplies = max8997_32khz_ap_,
828 static struct regulator_init_data __initdata max8997_32khz_cp_data = {
837 static struct regulator_init_data __initdata max8997_vichg_data = {
846 static struct regulator_init_data __initdata max8997_esafeout1_data = {
849 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
855 .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout1_),
856 .consumer_supplies = max8997_esafeout1_,
859 static struct regulator_init_data __initdata max8997_esafeout2_data = {
862 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
867 .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout2_),
868 .consumer_supplies = max8997_esafeout2_,
871 static struct regulator_init_data __initdata max8997_charger_cv_data = {
873 .name = "CHARGER_CV",
880 static struct regulator_init_data __initdata max8997_charger_data = {
886 .valid_ops_mask = REGULATOR_CHANGE_STATUS |
887 REGULATOR_CHANGE_CURRENT,
889 .num_consumer_supplies = ARRAY_SIZE(max8997_charger_),
890 .consumer_supplies = max8997_charger_,
893 static struct regulator_init_data __initdata max8997_charger_topoff_data = {
895 .name = "CHARGER TOPOFF",
898 .valid_ops_mask = REGULATOR_CHANGE_CURRENT,
900 .num_consumer_supplies = ARRAY_SIZE(max8997_chg_toff_),
901 .consumer_supplies = max8997_chg_toff_,
904 static struct max8997_regulator_data __initdata nuri_max8997_regulators[] = {
905 { MAX8997_LDO1, &max8997_ldo1_data },
906 { MAX8997_LDO2, &max8997_ldo2_data },
907 { MAX8997_LDO3, &max8997_ldo3_data },
908 { MAX8997_LDO4, &max8997_ldo4_data },
909 { MAX8997_LDO5, &max8997_ldo5_data },
910 { MAX8997_LDO6, &max8997_ldo6_data },
911 { MAX8997_LDO7, &max8997_ldo7_data },
912 { MAX8997_LDO8, &max8997_ldo8_data },
913 { MAX8997_LDO9, &max8997_ldo9_data },
914 { MAX8997_LDO10, &max8997_ldo10_data },
915 { MAX8997_LDO11, &max8997_ldo11_data },
916 { MAX8997_LDO12, &max8997_ldo12_data },
917 { MAX8997_LDO13, &max8997_ldo13_data },
918 { MAX8997_LDO14, &max8997_ldo14_data },
919 { MAX8997_LDO15, &max8997_ldo15_data },
920 { MAX8997_LDO16, &max8997_ldo16_data },
922 { MAX8997_LDO18, &max8997_ldo18_data },
923 { MAX8997_LDO21, &max8997_ldo21_data },
925 { MAX8997_BUCK1, &max8997_buck1_data },
926 { MAX8997_BUCK2, &max8997_buck2_data },
927 { MAX8997_BUCK3, &max8997_buck3_data },
928 { MAX8997_BUCK4, &max8997_buck4_data },
929 { MAX8997_BUCK5, &max8997_buck5_data },
930 { MAX8997_BUCK6, &max8997_buck6_data },
931 { MAX8997_BUCK7, &max8997_buck7_data },
933 { MAX8997_EN32KHZ_AP, &max8997_32khz_ap_data },
934 { MAX8997_EN32KHZ_CP, &max8997_32khz_cp_data },
936 { MAX8997_ENVICHG, &max8997_vichg_data },
937 { MAX8997_ESAFEOUT1, &max8997_esafeout1_data },
938 { MAX8997_ESAFEOUT2, &max8997_esafeout2_data },
939 { MAX8997_CHARGER_CV, &max8997_charger_cv_data },
940 { MAX8997_CHARGER, &max8997_charger_data },
941 { MAX8997_CHARGER_TOPOFF, &max8997_charger_topoff_data },
944 static struct max8997_platform_data __initdata nuri_max8997_pdata = {
947 .num_regulators = ARRAY_SIZE(nuri_max8997_regulators),
948 .regulators = nuri_max8997_regulators,
950 .buck125_gpios = { EXYNOS4_GPX0(5), EXYNOS4_GPX0(6), EXYNOS4_GPL0(0) },
952 .buck1_voltage[0] = 1350000, /* 1.35V */
953 .buck1_voltage[1] = 1300000, /* 1.3V */
954 .buck1_voltage[2] = 1250000, /* 1.25V */
955 .buck1_voltage[3] = 1200000, /* 1.2V */
956 .buck1_voltage[4] = 1150000, /* 1.15V */
957 .buck1_voltage[5] = 1100000, /* 1.1V */
958 .buck1_voltage[6] = 1000000, /* 1.0V */
959 .buck1_voltage[7] = 950000, /* 0.95V */
961 .buck2_voltage[0] = 1100000, /* 1.1V */
962 .buck2_voltage[1] = 1000000, /* 1.0V */
963 .buck2_voltage[2] = 950000, /* 0.95V */
964 .buck2_voltage[3] = 900000, /* 0.9V */
965 .buck2_voltage[4] = 1100000, /* 1.1V */
966 .buck2_voltage[5] = 1000000, /* 1.0V */
967 .buck2_voltage[6] = 950000, /* 0.95V */
968 .buck2_voltage[7] = 900000, /* 0.9V */
970 .buck5_voltage[0] = 1200000, /* 1.2V */
971 .buck5_voltage[1] = 1200000, /* 1.2V */
972 .buck5_voltage[2] = 1200000, /* 1.2V */
973 .buck5_voltage[3] = 1200000, /* 1.2V */
974 .buck5_voltage[4] = 1200000, /* 1.2V */
975 .buck5_voltage[5] = 1200000, /* 1.2V */
976 .buck5_voltage[6] = 1200000, /* 1.2V */
977 .buck5_voltage[7] = 1200000, /* 1.2V */
980 /* GPIO I2C 5 (PMIC) */
981 enum { I2C5_MAX8997 };
982 static struct i2c_board_info i2c5_devs[] __initdata = {
984 I2C_BOARD_INFO("max8997", 0xCC >> 1),
985 .platform_data = &nuri_max8997_pdata,
989 static struct max17042_platform_data nuri_battery_platform_data = {
992 /* GPIO I2C 9 (Fuel Gauge) */
993 static struct i2c_gpio_platform_data i2c9_gpio_data = {
994 .sda_pin = EXYNOS4_GPY4(0), /* XM0ADDR_8 */
995 .scl_pin = EXYNOS4_GPY4(1), /* XM0ADDR_9 */
997 static struct platform_device i2c9_gpio = {
1001 .platform_data = &i2c9_gpio_data,
1004 enum { I2C9_MAX17042};
1005 static struct i2c_board_info i2c9_devs[] __initdata = {
1007 I2C_BOARD_INFO("max17042", 0x36),
1008 .platform_data = &nuri_battery_platform_data,
1012 /* MAX8903 Secondary Charger */
1013 static struct regulator_consumer_supply supplies_max8903[] = {
1014 REGULATOR_SUPPLY("vinchg2", "charger-manager.0"),
1017 static struct regulator_init_data max8903_charger_en_data = {
1019 .name = "VOUT_CHARGER",
1020 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
1023 .num_consumer_supplies = ARRAY_SIZE(supplies_max8903),
1024 .consumer_supplies = supplies_max8903,
1027 static struct fixed_voltage_config max8903_charger_en = {
1028 .supply_name = "VOUT_CHARGER",
1029 .microvolts = 5000000, /* Assume 5VDC */
1030 .gpio = EXYNOS4_GPY4(5), /* TA_EN negaged */
1031 .enable_high = 0, /* Enable = Low */
1032 .enabled_at_boot = 1,
1033 .init_data = &max8903_charger_en_data,
1036 static struct platform_device max8903_fixed_reg_dev = {
1037 .name = "reg-fixed-voltage",
1038 .id = FIXED_REG_ID_MAX8903,
1039 .dev = { .platform_data = &max8903_charger_en },
1042 static struct max8903_pdata nuri_max8903 = {
1044 * cen: don't control with the driver, let it be
1045 * controlled by regulator above
1047 .dok = EXYNOS4_GPX1(4), /* TA_nCONNECTED */
1048 /* uok, usus: not connected */
1049 .chg = EXYNOS4_GPE2(0), /* TA_nCHG */
1050 /* flt: vcc_1.8V_pda */
1051 .dcm = EXYNOS4_GPL0(1), /* CURR_ADJ */
1054 .usb_valid = false, /* USB is not wired to MAX8903 */
1057 static struct platform_device nuri_max8903_device = {
1058 .name = "max8903-charger",
1060 .platform_data = &nuri_max8903,
1064 static void __init nuri_power_init(void)
1069 gpio = EXYNOS4_GPX0(7);
1070 gpio_request(gpio, "AP_PMIC_IRQ");
1071 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1072 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
1074 gpio = EXYNOS4_GPX2(3);
1075 gpio_request(gpio, "FUEL_ALERT");
1076 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1077 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
1079 gpio = nuri_max8903.dok;
1080 gpio_request(gpio, "TA_nCONNECTED");
1081 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1082 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
1083 ta_en = gpio_get_value(gpio) ? 0 : 1;
1085 gpio = nuri_max8903.chg;
1086 gpio_request(gpio, "TA_nCHG");
1087 gpio_direction_input(gpio);
1089 gpio = nuri_max8903.dcm;
1090 gpio_request(gpio, "CURR_ADJ");
1091 gpio_direction_output(gpio, ta_en);
1095 static struct s5p_ehci_platdata nuri_ehci_pdata;
1097 static void __init nuri_ehci_init(void)
1099 struct s5p_ehci_platdata *pdata = &nuri_ehci_pdata;
1101 s5p_ehci_set_platdata(pdata);
1105 static struct s3c_hsotg_plat nuri_hsotg_pdata;
1108 static struct regulator_consumer_supply cam_vt_cam15_supply =
1109 REGULATOR_SUPPLY("vdd_core", "6-003c");
1111 static struct regulator_init_data cam_vt_cam15_reg_init_data = {
1112 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1113 .num_consumer_supplies = 1,
1114 .consumer_supplies = &cam_vt_cam15_supply,
1117 static struct fixed_voltage_config cam_vt_cam15_fixed_voltage_cfg = {
1118 .supply_name = "VT_CAM_1.5V",
1119 .microvolts = 1500000,
1120 .gpio = EXYNOS4_GPE2(2), /* VT_CAM_1.5V_EN */
1122 .init_data = &cam_vt_cam15_reg_init_data,
1125 static struct platform_device cam_vt_cam15_fixed_rdev = {
1126 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_VT_15V,
1127 .dev = { .platform_data = &cam_vt_cam15_fixed_voltage_cfg },
1130 static struct regulator_consumer_supply cam_vdda_supply[] = {
1131 REGULATOR_SUPPLY("vdda", "6-003c"),
1132 REGULATOR_SUPPLY("a_sensor", "0-001f"),
1135 static struct regulator_init_data cam_vdda_reg_init_data = {
1136 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1137 .num_consumer_supplies = ARRAY_SIZE(cam_vdda_supply),
1138 .consumer_supplies = cam_vdda_supply,
1141 static struct fixed_voltage_config cam_vdda_fixed_voltage_cfg = {
1142 .supply_name = "CAM_IO_EN",
1143 .microvolts = 2800000,
1144 .gpio = EXYNOS4_GPE2(1), /* CAM_IO_EN */
1146 .init_data = &cam_vdda_reg_init_data,
1149 static struct platform_device cam_vdda_fixed_rdev = {
1150 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_A28V,
1151 .dev = { .platform_data = &cam_vdda_fixed_voltage_cfg },
1154 static struct regulator_consumer_supply camera_8m_12v_supply =
1155 REGULATOR_SUPPLY("dig_12", "0-001f");
1157 static struct regulator_init_data cam_8m_12v_reg_init_data = {
1158 .num_consumer_supplies = 1,
1159 .consumer_supplies = &camera_8m_12v_supply,
1161 .valid_ops_mask = REGULATOR_CHANGE_STATUS
1165 static struct fixed_voltage_config cam_8m_12v_fixed_voltage_cfg = {
1166 .supply_name = "8M_1.2V",
1167 .microvolts = 1200000,
1168 .gpio = EXYNOS4_GPE2(5), /* 8M_1.2V_EN */
1170 .init_data = &cam_8m_12v_reg_init_data,
1173 static struct platform_device cam_8m_12v_fixed_rdev = {
1174 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_12V,
1175 .dev = { .platform_data = &cam_8m_12v_fixed_voltage_cfg },
1178 static struct s5p_platform_mipi_csis mipi_csis_platdata = {
1179 .clk_rate = 166000000UL,
1184 #define GPIO_CAM_MEGA_RST EXYNOS4_GPY3(7) /* ISP_RESET */
1185 #define GPIO_CAM_8M_ISP_INT EXYNOS4_GPL2(5)
1186 #define GPIO_CAM_VT_NSTBY EXYNOS4_GPL2(0)
1187 #define GPIO_CAM_VT_NRST EXYNOS4_GPL2(1)
1189 static struct s5k6aa_platform_data s5k6aa_pldata = {
1190 .mclk_frequency = 24000000UL,
1191 .gpio_reset = { GPIO_CAM_VT_NRST, 0 },
1192 .gpio_stby = { GPIO_CAM_VT_NSTBY, 0 },
1193 .bus_type = V4L2_MBUS_PARALLEL,
1197 static struct i2c_board_info s5k6aa_board_info = {
1198 I2C_BOARD_INFO("S5K6AA", 0x3c),
1199 .platform_data = &s5k6aa_pldata,
1202 static struct m5mols_platform_data m5mols_platdata = {
1203 .gpio_reset = GPIO_CAM_MEGA_RST,
1206 static struct i2c_board_info m5mols_board_info = {
1207 I2C_BOARD_INFO("M5MOLS", 0x1F),
1208 .platform_data = &m5mols_platdata,
1211 static struct fimc_source_info nuri_camera_sensors[] = {
1213 .flags = V4L2_MBUS_PCLK_SAMPLE_RISING |
1214 V4L2_MBUS_VSYNC_ACTIVE_LOW,
1215 .fimc_bus_type = FIMC_BUS_TYPE_ITU_601,
1216 .board_info = &s5k6aa_board_info,
1217 .clk_frequency = 24000000UL,
1220 .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING |
1221 V4L2_MBUS_VSYNC_ACTIVE_LOW,
1222 .fimc_bus_type = FIMC_BUS_TYPE_MIPI_CSI2,
1223 .board_info = &m5mols_board_info,
1224 .clk_frequency = 24000000UL,
1228 static struct s5p_platform_fimc fimc_md_platdata = {
1229 .source_info = nuri_camera_sensors,
1230 .num_clients = ARRAY_SIZE(nuri_camera_sensors),
1233 static struct gpio nuri_camera_gpios[] = {
1234 { GPIO_CAM_VT_NSTBY, GPIOF_OUT_INIT_LOW, "CAM_VGA_NSTBY" },
1235 { GPIO_CAM_VT_NRST, GPIOF_OUT_INIT_LOW, "CAM_VGA_NRST" },
1236 { GPIO_CAM_8M_ISP_INT, GPIOF_IN, "8M_ISP_INT" },
1237 { GPIO_CAM_MEGA_RST, GPIOF_OUT_INIT_LOW, "CAM_8M_NRST" },
1240 static void __init nuri_camera_init(void)
1242 s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata),
1243 &s5p_device_mipi_csis0);
1244 s3c_set_platdata(&fimc_md_platdata, sizeof(fimc_md_platdata),
1245 &s5p_device_fimc_md);
1247 if (gpio_request_array(nuri_camera_gpios,
1248 ARRAY_SIZE(nuri_camera_gpios))) {
1249 pr_err("%s: GPIO request failed\n", __func__);
1253 m5mols_board_info.irq = s5p_register_gpio_interrupt(GPIO_CAM_8M_ISP_INT);
1254 if (!IS_ERR_VALUE(m5mols_board_info.irq))
1255 s3c_gpio_cfgpin(GPIO_CAM_8M_ISP_INT, S3C_GPIO_SFN(0xF));
1257 pr_err("%s: Failed to configure 8M_ISP_INT GPIO\n", __func__);
1259 /* Free GPIOs controlled directly by the sensor drivers. */
1260 gpio_free(GPIO_CAM_VT_NRST);
1261 gpio_free(GPIO_CAM_VT_NSTBY);
1262 gpio_free(GPIO_CAM_MEGA_RST);
1264 if (exynos4_fimc_setup_gpio(S5P_CAMPORT_A)) {
1265 pr_err("%s: Camera port A setup failed\n", __func__);
1268 /* Increase drive strength of the sensor clock output */
1269 s5p_gpio_set_drvstr(EXYNOS4_GPJ1(3), S5P_GPIO_DRVSTR_LV4);
1272 static struct s3c2410_platform_i2c nuri_i2c6_platdata __initdata = {
1273 .frequency = 400000U,
1278 static struct s3c2410_platform_i2c nuri_i2c0_platdata __initdata = {
1279 .frequency = 400000U,
1283 /* DEVFREQ controlling memory/bus */
1284 static struct platform_device exynos4_bus_devfreq = {
1285 .name = "exynos4210-busfreq",
1288 static struct platform_device *nuri_devices[] __initdata = {
1289 /* Samsung Platform Devices */
1290 &s3c_device_i2c5, /* PMIC should initialize first */
1293 &emmc_fixed_voltage,
1294 &s5p_device_mipi_csis0,
1304 &s3c_device_timer[0],
1315 &s5p_device_fimc_md,
1316 &s3c_device_usb_hsotg,
1321 &nuri_backlight_device,
1322 &max8903_fixed_reg_dev,
1323 &nuri_max8903_device,
1324 &cam_vt_cam15_fixed_rdev,
1325 &cam_vdda_fixed_rdev,
1326 &cam_8m_12v_fixed_rdev,
1327 &exynos4_bus_devfreq,
1330 static void __init nuri_map_io(void)
1332 exynos_init_io(NULL, 0);
1333 s3c24xx_init_clocks(clk_xusbxti.rate);
1334 s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs));
1337 static void __init nuri_reserve(void)
1339 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
1342 static void __init nuri_machine_init(void)
1348 s3c_i2c0_set_platdata(&nuri_i2c0_platdata);
1349 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
1350 s3c_i2c3_set_platdata(&i2c3_data);
1351 i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs));
1352 s3c_i2c5_set_platdata(NULL);
1353 i2c5_devs[I2C5_MAX8997].irq = gpio_to_irq(EXYNOS4_GPX0(7));
1354 i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
1355 i2c9_devs[I2C9_MAX17042].irq = gpio_to_irq(EXYNOS4_GPX2(3));
1356 i2c_register_board_info(9, i2c9_devs, ARRAY_SIZE(i2c9_devs));
1357 s3c_i2c6_set_platdata(&nuri_i2c6_platdata);
1359 #ifdef CONFIG_DRM_EXYNOS
1360 s5p_device_fimd0.dev.platform_data = &drm_fimd_pdata;
1361 exynos4_fimd0_gpio_setup_24bpp();
1363 s5p_fimd0_set_platdata(&nuri_fb_pdata);
1369 s3c_hsotg_set_platdata(&nuri_hsotg_pdata);
1372 platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices));
1375 MACHINE_START(NURI, "NURI")
1376 /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
1377 .atag_offset = 0x100,
1378 .smp = smp_ops(exynos_smp_ops),
1379 .init_irq = exynos4_init_irq,
1380 .map_io = nuri_map_io,
1381 .init_machine = nuri_machine_init,
1382 .init_late = exynos_init_late,
1383 .init_time = exynos4_timer_init,
1384 .reserve = &nuri_reserve,
1385 .restart = exynos4_restart,