2 * SAMSUNG EXYNOS5250 Flattened Device Tree enabled machine
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #include <linux/gpio.h>
13 #include <linux/of_gpio.h>
14 #include <linux/of_platform.h>
15 #include <linux/platform_data/dwc3-exynos.h>
16 #include <linux/regulator/fixed.h>
17 #include <linux/regulator/machine.h>
18 #include <linux/serial_core.h>
19 #include <linux/smsc911x.h>
20 #include <linux/delay.h>
21 #include <linux/i2c.h>
22 #include <linux/pwm_backlight.h>
23 #include <linux/mfd/wm8994/pdata.h>
24 #include <linux/regulator/machine.h>
25 #include <linux/spi/spi.h>
26 #include <linux/memblock.h>
27 #include <linux/of_fdt.h>
29 #include <asm/mach/arch.h>
30 #include <asm/hardware/gic.h>
32 #include <mach/ohci.h>
33 #include <mach/regs-pmu.h>
34 #include <mach/sysmmu.h>
35 #include <mach/ohci.h>
36 #include <mach/regs-audss.h>
37 #include <mach/regs-pmu.h>
39 #include <plat/audio.h>
41 #include <plat/dsim.h>
43 #include <plat/mipi_dsi.h>
44 #include <plat/gpio-cfg.h>
45 #include <plat/regs-fb.h>
46 #include <plat/regs-serial.h>
47 #include <plat/regs-srom.h>
48 #include <plat/backlight.h>
49 #include <plat/devs.h>
50 #include <plat/usb-phy.h>
51 #include <plat/ehci.h>
53 #include <plat/s3c64xx-spi.h>
55 #include <video/platform_lcd.h>
57 #include "drm/exynos_drm.h"
60 static void __init smsc911x_init(int ncs)
64 /* configure nCS1 width to 16 bits */
65 data = __raw_readl(S5P_SROM_BW) &
66 ~(S5P_SROM_BW__CS_MASK << (ncs * 4));
67 data |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) |
68 (1 << S5P_SROM_BW__WAITENABLE__SHIFT) |
69 (1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) << (ncs * 4);
70 __raw_writel(data, S5P_SROM_BW);
72 /* set timing for nCS1 suitable for ethernet chip */
73 __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) |
74 (0x9 << S5P_SROM_BCX__TACP__SHIFT) |
75 (0xc << S5P_SROM_BCX__TCAH__SHIFT) |
76 (0x1 << S5P_SROM_BCX__TCOH__SHIFT) |
77 (0x6 << S5P_SROM_BCX__TACC__SHIFT) |
78 (0x1 << S5P_SROM_BCX__TCOS__SHIFT) |
79 (0x1 << S5P_SROM_BCX__TACS__SHIFT),
80 S5P_SROM_BC0 + (ncs * 4));
83 static struct s3c_fb_pd_win smdk5250_fb_win0 = {
102 static struct s3c_fb_pd_win smdk5250_fb_win1 = {
114 .virtual_y = 800 * 2,
121 static struct s3c_fb_pd_win smdk5250_fb_win2 = {
133 .virtual_y = 800 * 2,
140 static struct fb_videomode snow_fb_window[] = {
141 [0] = { /* Only LCD Connected */
151 [1] = { /* TV & LCD Connected */
167 static void exynos_fimd_gpio_setup_24bpp(void)
169 unsigned int reg = 0;
172 * Set DISP1BLK_CFG register for Display path selection
173 * FIMD of DISP1_BLK Bypass selection : DISP1BLK_CFG[15]
174 * ---------------------
176 * 1 | FIMD : selected
178 reg = __raw_readl(S3C_VA_SYS + 0x0214);
179 reg &= ~(1 << 15); /* To save other reset values */
181 __raw_writel(reg, S3C_VA_SYS + 0x0214);
184 static void exynos_dp_gpio_setup_24bpp(void)
186 exynos_fimd_gpio_setup_24bpp();
188 /* Set Hotplug detect for DP */
189 gpio_request(EXYNOS5_GPX0(7), "DP hotplug");
190 s3c_gpio_cfgpin(EXYNOS5_GPX0(7), S3C_GPIO_SFN(3));
193 #ifdef CONFIG_DRM_EXYNOS_HDMI
194 static struct platform_device exynos_drm_hdmi_device = {
195 .name = "exynos-drm-hdmi",
198 static struct exynos_drm_hdmi_pdata drm_mixer_pdata = {
210 static struct exynos_drm_hdmi_pdata drm_hdmi_pdata = {
223 #ifdef CONFIG_DRM_EXYNOS_FIMD
224 static struct exynos_drm_fimd_pdata smdk5250_lcd1_pdata = {
251 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
252 .vidcon1 = VIDCON1_INV_VCLK,
255 .clock_rate = 800 * 1000 * 1000,
258 static struct s3c_fb_platdata smdk5250_lcd1_pdata __initdata = {
259 .win[0] = &smdk5250_fb_win0,
260 .win[1] = &smdk5250_fb_win1,
261 .win[2] = &smdk5250_fb_win2,
263 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
264 .vidcon1 = VIDCON1_INV_VCLK,
265 .setup_gpio = exynos_fimd_gpio_setup_24bpp,
266 .clock_rate = 800 * 1000 * 1000,
270 static struct mipi_dsim_config dsim_info = {
271 .e_interface = DSIM_VIDEO,
272 .e_pixel_format = DSIM_24BPP_888,
273 /* main frame fifo auto flush at VSYNC pulse */
275 .eot_disable = false,
276 .auto_vertical_cnt = false,
282 .e_no_data_lane = DSIM_DATA_LANE_4,
283 .e_byte_clk = DSIM_PLL_OUT_DIV8,
284 .e_burst_mode = DSIM_BURST,
290 /* D-PHY PLL stable time spec :min = 200usec ~ max 400usec */
291 .pll_stable_time = 500,
293 .esc_clk = 0.4 * 1000000, /* escape clk : 10MHz */
295 /* stop state holding counter after bta change count 0 ~ 0xfff */
296 .stop_holding_cnt = 0x0f,
297 .bta_timeout = 0xff, /* bta timeout 0 ~ 0xff */
298 .rx_timeout = 0xffff, /* lp rx timeout 0 ~ 0xffff */
300 .dsim_ddi_pd = &tc358764_mipi_lcd_driver,
303 static struct mipi_dsim_lcd_config dsim_lcd_info = {
304 .rgb_timing.left_margin = 0x4,
305 .rgb_timing.right_margin = 0x4,
306 .rgb_timing.upper_margin = 0x4,
307 .rgb_timing.lower_margin = 0x4,
308 .rgb_timing.hsync_len = 0x4,
309 .rgb_timing.vsync_len = 0x4,
310 .cpu_timing.cs_setup = 0,
311 .cpu_timing.wr_setup = 1,
312 .cpu_timing.wr_act = 0,
313 .cpu_timing.wr_hold = 0,
314 .lcd_size.width = 1280,
315 .lcd_size.height = 800,
318 static struct s5p_platform_mipi_dsim dsim_platform_data = {
320 .dsim_config = &dsim_info,
321 .dsim_lcd_config = &dsim_lcd_info,
323 .part_reset = s5p_dsim_part_reset,
324 .init_d_phy = s5p_dsim_init_d_phy,
325 .get_fb_frame_done = NULL,
329 * the stable time of needing to write data on SFR
330 * when the mipi mode becomes LP mode.
332 .delay_for_stabilization = 600,
335 static struct platform_device exynos_drm_device = {
336 .name = "exynos-drm",
338 .dma_mask = &exynos_drm_device.dev.coherent_dma_mask,
339 .coherent_dma_mask = 0xffffffffUL,
343 static void lcd_set_power(struct plat_lcd_data *pd,
346 if (of_machine_is_compatible("google,daisy") ||
347 of_machine_is_compatible("google,snow")) {
348 struct regulator *lcd_fet;
350 lcd_fet = regulator_get(NULL, "lcd_vdd");
351 if (!IS_ERR(lcd_fet)) {
353 regulator_enable(lcd_fet);
355 regulator_disable(lcd_fet);
357 regulator_put(lcd_fet);
361 if (!of_machine_is_compatible("google,snow")) {
363 gpio_request_one(EXYNOS5_GPX1(5), GPIOF_OUT_INIT_HIGH, "GPX1");
365 gpio_set_value(EXYNOS5_GPX1(5), 0);
367 gpio_set_value(EXYNOS5_GPX1(5), 1);
369 gpio_free(EXYNOS5_GPX1(5));
374 /* Turn on regulator for backlight */
375 if (of_machine_is_compatible("google,daisy") ||
376 of_machine_is_compatible("google,snow")) {
377 struct regulator *backlight_fet;
379 backlight_fet = regulator_get(NULL, "vcd_led");
380 if (!IS_ERR(backlight_fet)) {
382 regulator_enable(backlight_fet);
384 regulator_disable(backlight_fet);
386 regulator_put(backlight_fet);
388 /* Wait 10 ms between regulator on and PWM start per spec */
393 static int smdk5250_match_fb(struct plat_lcd_data *pd, struct fb_info *info)
395 /* Don't call .set_power callback while unblanking */
399 static struct plat_lcd_data smdk5250_lcd_data = {
400 .set_power = lcd_set_power,
401 .match_fb = smdk5250_match_fb,
404 static struct platform_device smdk5250_lcd = {
405 .name = "platform-lcd",
406 .dev.platform_data = &smdk5250_lcd_data,
409 static int smdk5250_bl_notify(struct device *unused, int brightness)
411 /* manage lcd_bl_en signal */
413 gpio_set_value(EXYNOS5_GPX3(0), 1);
415 gpio_set_value(EXYNOS5_GPX3(0), 0);
420 /* LCD Backlight data */
421 static struct samsung_bl_gpio_info smdk5250_bl_gpio_info = {
422 .no = EXYNOS5_GPB2(0),
423 .func = S3C_GPIO_SFN(2),
426 static struct platform_pwm_backlight_data smdk5250_bl_data = {
427 .pwm_period_ns = 1000000,
428 .notify = smdk5250_bl_notify,
431 struct platform_device exynos_device_md0 = {
432 .name = "exynos-mdev",
436 struct platform_device exynos_device_md1 = {
437 .name = "exynos-mdev",
441 struct platform_device exynos_device_md2 = {
442 .name = "exynos-mdev",
446 static struct regulator_consumer_supply wm8994_avdd1_supply =
447 REGULATOR_SUPPLY("AVDD1", "1-001a");
449 static struct regulator_consumer_supply wm8994_dcvdd_supply =
450 REGULATOR_SUPPLY("DCVDD", "1-001a");
452 static struct regulator_init_data wm8994_ldo1_data = {
456 .num_consumer_supplies = 1,
457 .consumer_supplies = &wm8994_avdd1_supply,
460 static struct regulator_init_data wm8994_ldo2_data = {
464 .num_consumer_supplies = 1,
465 .consumer_supplies = &wm8994_dcvdd_supply,
468 static struct wm8994_pdata wm8994_platform_data = {
469 /* configure gpio1 function: 0x0001(Logic level input/output) */
470 .gpio_defaults[0] = 0x0001,
471 /* If the i2s0 and i2s2 is enabled simultaneously */
472 .gpio_defaults[7] = 0x8100, /* GPIO8 DACDAT3 in */
473 .gpio_defaults[8] = 0x0100, /* GPIO9 ADCDAT3 out */
474 .gpio_defaults[9] = 0x0100, /* GPIO10 LRCLK3 out */
475 .gpio_defaults[10] = 0x0100,/* GPIO11 BCLK3 out */
476 .ldo[0] = { 0, &wm8994_ldo1_data },
477 .ldo[1] = { 0, &wm8994_ldo2_data },
480 static struct i2c_board_info i2c_devs1[] __initdata = {
482 I2C_BOARD_INFO("wm8994", 0x1a),
483 .platform_data = &wm8994_platform_data,
487 static struct s3c64xx_spi_csinfo spi1_csi[] = {
489 .line = EXYNOS5_GPA2(5),
494 static struct spi_board_info spi1_board_info[] __initdata = {
496 .modalias = "spidev",
497 .platform_data = NULL,
498 .max_speed_hz = 10*1000*1000,
502 .controller_data = spi1_csi,
506 struct sysmmu_platform_data platdata_sysmmu_mfc_l = {
508 .clockname = "sysmmu",
511 struct sysmmu_platform_data platdata_sysmmu_mfc_r = {
513 .clockname = "sysmmu",
516 struct sysmmu_platform_data platdata_sysmmu_gsc = {
518 .clockname = "sysmmu",
521 struct sysmmu_platform_data platdata_sysmmu_g2d = {
523 .clockname = "sysmmu",
526 struct sysmmu_platform_data platdata_sysmmu_fimd = {
528 .clockname = "sysmmu",
531 struct sysmmu_platform_data platdata_sysmmu_tv = {
533 .clockname = "sysmmu",
536 #ifdef CONFIG_VIDEO_FIMG2D4X
537 static struct fimg2d_platdata fimg2d_data __initdata = {
539 .gate_clkname = "fimg2d",
543 static struct exynos4_ohci_platdata smdk5250_ohci_pdata = {
544 .phy_init = s5p_usb_phy_init,
545 .phy_exit = s5p_usb_phy_exit,
548 static struct s5p_ehci_platdata smdk5250_ehci_pdata = {
549 .phy_init = s5p_usb_phy_init,
550 .phy_exit = s5p_usb_phy_exit,
553 static struct dwc3_exynos_data smdk5250_xhci_pdata = {
554 .phy_type = S5P_USB_PHY_DRD,
555 .phy_init = s5p_usb_phy_init,
556 .phy_exit = s5p_usb_phy_exit,
559 struct exynos_gpio_cfg {
565 static const char *rclksrc[] = {
570 static struct video_info smdk5250_dp_config = {
571 .name = "eDP-LVDS NXP PTN3460",
573 .h_sync_polarity = 0,
574 .v_sync_polarity = 0,
577 .color_space = COLOR_RGB,
578 .dynamic_range = VESA,
579 .ycbcr_coeff = COLOR_YCBCR601,
580 .color_depth = COLOR_8,
582 .link_rate = LINK_RATE_2_70GBPS,
583 .lane_count = LANE_COUNT2,
586 static struct exynos_dp_platdata smdk5250_dp_data = {
587 .video_info = &smdk5250_dp_config,
588 .training_type = SW_LINK_TRAINING,
589 .phy_init = s5p_dp_phy_init,
590 .phy_exit = s5p_dp_phy_exit,
593 #define S5P_PMU_DEBUG S5P_PMUREG(0x0A00)
594 /* PMU_DEBUG bits [12:8] = 0x10000 selects XXTI clock source */
595 #define PMU_DEBUG_XXTI (0x10 << 8)
596 /* Mask bit[12:8] for xxti clock selection */
597 #define PMU_DEBUG_CLKOUT_SEL_MASK 0x1f00
599 static void __init enable_xclkout(void)
603 tmp = readl(S5P_PMU_DEBUG);
604 tmp &= ~PMU_DEBUG_CLKOUT_SEL_MASK;
605 tmp |= PMU_DEBUG_XXTI;
606 writel(tmp, S5P_PMU_DEBUG);
609 static int exynos_cfg_i2s_gpio(struct platform_device *pdev)
612 /* configure GPIO for i2s port */
613 struct exynos_gpio_cfg exynos5_cfg[3] = {
614 { EXYNOS5_GPZ(0), 7, S3C_GPIO_SFN(2) },
615 { EXYNOS5_GPB0(0), 5, S3C_GPIO_SFN(2) },
616 { EXYNOS5_GPB1(0), 5, S3C_GPIO_SFN(2) }
619 if (pdev->dev.of_node) {
620 id = of_alias_get_id(pdev->dev.of_node, "i2s");
622 dev_err(&pdev->dev, "failed to get alias id:%d\n", id);
627 if (id < 0 || id > 2) {
628 printk(KERN_ERR "Invalid Device %d\n", id);
632 s3c_gpio_cfgpin_range(exynos5_cfg[id].addr,
633 exynos5_cfg[id].num, exynos5_cfg[id].bit);
638 static struct s3c_audio_pdata i2sv5_pdata = {
639 .cfg_gpio = exynos_cfg_i2s_gpio,
642 .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI
645 .idma_addr = EXYNOS4_AUDSS_INT_MEM,
651 * The following lookup table is used to override device names when devices
652 * are registered from device tree. This is temporarily added to enable
653 * device tree support addition for the EXYNOS5 architecture.
655 * For drivers that require platform data to be provided from the machine
656 * file, a platform data pointer can also be supplied along with the
657 * devices names. Usually, the platform data elements that cannot be parsed
658 * from the device tree by the drivers (example: function pointers) are
659 * supplied. But it should be noted that this is a temporary mechanism and
660 * at some point, the drivers should be capable of parsing all the platform
661 * data from the device tree.
663 static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
664 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART0,
665 "exynos4210-uart.0", NULL),
666 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART1,
667 "exynos4210-uart.1", NULL),
668 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART2,
669 "exynos4210-uart.2", NULL),
670 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART3,
671 "exynos4210-uart.3", NULL),
672 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(0),
673 "s3c2440-i2c.0", NULL),
674 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(1),
675 "s3c2440-i2c.1", NULL),
676 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(2),
677 "s3c2440-i2c.2", NULL),
678 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(3),
679 "s3c2440-i2c.3", NULL),
680 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(4),
681 "s3c2440-i2c.4", NULL),
682 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(5),
683 "s3c2440-i2c.5", NULL),
684 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(6),
685 "s3c2440-i2c.6", NULL),
686 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(7),
687 "s3c2440-i2c.7", NULL),
688 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(8),
689 "s3c2440-hdmiphy-i2c", NULL),
690 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI0,
691 "exynos4210-spi.0", NULL),
692 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI1,
693 "exynos4210-spi.1", NULL),
694 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI2,
695 "exynos4210-spi.2", NULL),
696 OF_DEV_AUXDATA("synopsis,dw-mshc-exynos5250", 0x12200000,
698 OF_DEV_AUXDATA("synopsis,dw-mshc-exynos5250", 0x12210000,
700 OF_DEV_AUXDATA("synopsis,dw-mshc-exynos5250", 0x12220000,
702 OF_DEV_AUXDATA("synopsis,dw-mshc-exynos5250", 0x12230000,
704 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL),
705 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL),
706 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL),
707 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x10A60000,
708 "s5p-sysmmu.2", &platdata_sysmmu_g2d),
709 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x11210000,
710 "s5p-sysmmu.3", &platdata_sysmmu_mfc_l),
711 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x11200000,
712 "s5p-sysmmu.4", &platdata_sysmmu_mfc_r),
713 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x14640000,
714 "s5p-sysmmu.27", &platdata_sysmmu_fimd),
715 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x14650000,
716 "s5p-sysmmu.28", &platdata_sysmmu_tv),
717 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x13E80000,
718 "s5p-sysmmu.23", &platdata_sysmmu_gsc),
719 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x13E90000,
720 "s5p-sysmmu.24", &platdata_sysmmu_gsc),
721 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x13EA0000,
722 "s5p-sysmmu.25", &platdata_sysmmu_gsc),
723 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x13EB0000,
724 "s5p-sysmmu.26", &platdata_sysmmu_gsc),
725 OF_DEV_AUXDATA("samsung,exynos5-fb", 0x14400000,
726 "exynos5-fb", &smdk5250_lcd1_pdata),
727 OF_DEV_AUXDATA("samsung,exynos5-mipi", 0x14500000,
728 "s5p-mipi-dsim", &dsim_platform_data),
729 OF_DEV_AUXDATA("samsung,exynos5-dp", 0x145B0000,
730 "s5p-dp", &smdk5250_dp_data),
731 OF_DEV_AUXDATA("samsung,s5p-mfc-v6", 0x11000000, "s5p-mfc-v6", NULL),
732 OF_DEV_AUXDATA("samsung,exynos-gsc", 0x13E00000,
733 "exynos-gsc.0", NULL),
734 OF_DEV_AUXDATA("samsung,exynos-gsc", 0x13E10000,
735 "exynos-gsc.1", NULL),
736 OF_DEV_AUXDATA("samsung,exynos-gsc", 0x13E20000,
737 "exynos-gsc.2", NULL),
738 OF_DEV_AUXDATA("samsung,exynos-gsc", 0x13E30000,
739 "exynos-gsc.3", NULL),
740 #ifdef CONFIG_VIDEO_FIMG2D4X
741 OF_DEV_AUXDATA("samsung,s5p-g2d", 0x10850000,
742 "s5p-g2d", &fimg2d_data),
744 OF_DEV_AUXDATA("samsung,exynos-ohci", 0x12120000,
745 "exynos-ohci", &smdk5250_ohci_pdata),
746 OF_DEV_AUXDATA("samsung,exynos-ehci", 0x12110000,
747 "s5p-ehci", &smdk5250_ehci_pdata),
748 OF_DEV_AUXDATA("samsung,exynos-xhci", 0x12000000,
749 "exynos-dwc3", &smdk5250_xhci_pdata),
750 OF_DEV_AUXDATA("samsung,i2s", 0x03830000,
751 "samsung-i2s.0", &i2sv5_pdata),
752 #ifdef CONFIG_DRM_EXYNOS_HDMI
753 OF_DEV_AUXDATA("samsung,exynos5-hdmi", 0x14530000,
754 "exynos5-hdmi", &drm_hdmi_pdata),
755 OF_DEV_AUXDATA("samsung,s5p-mixer", 0x14450000,
756 "s5p-mixer", &drm_mixer_pdata),
758 OF_DEV_AUXDATA("samsung,exynos5-hdmi", 0x14530000,
759 "exynos5-hdmi", NULL),
760 OF_DEV_AUXDATA("samsung,s5p-mixer", 0x14450000,
766 static struct platform_device *smdk5250_devices[] __initdata = {
767 &smdk5250_lcd, /* for platform_lcd device */
768 &exynos_device_md0, /* for media device framework */
769 &exynos_device_md1, /* for media device framework */
770 &exynos_device_md2, /* for media device framework */
771 &samsung_asoc_dma, /* for audio dma interface device */
773 #ifdef CONFIG_DRM_EXYNOS_HDMI
774 &exynos_drm_hdmi_device,
778 static struct regulator_consumer_supply dummy_supplies[] = {
779 REGULATOR_SUPPLY("vddvario", "7000000.lan9215"),
780 REGULATOR_SUPPLY("vdd33a", "7000000.lan9215"),
783 static void __init exynos5250_dt_map_io(void)
785 exynos_init_io(NULL, 0);
786 s3c24xx_init_clocks(24000000);
789 static unsigned long ramoops_dt_start, ramoops_dt_size;
790 static int __init init_dt_scan_ramoops(unsigned long node, const char *uname,
791 int depth, void *data)
796 if (!of_flat_dt_is_compatible(node, "ramoops"))
799 reg = of_get_flat_dt_prop(node, "reg", &l);
802 endp = reg + (l / sizeof(__be32));
804 /* This architecture uses single cells for address and size.
805 * Other architectures may differ. */
806 ramoops_dt_start = be32_to_cpu(reg[0]);
807 ramoops_dt_size = be32_to_cpu(reg[1]);
811 static void __init exynos5_ramoops_reserve(void)
813 unsigned long start, size;
815 of_scan_flat_dt(init_dt_scan_ramoops, NULL);
817 /* If necessary, lower start and raise size to align to 1M. */
818 start = round_down(ramoops_dt_start, SZ_1M);
819 size = ramoops_dt_size + ramoops_dt_start - start;
820 size = round_up(size, SZ_1M);
822 if (memblock_remove(start, size)) {
823 pr_err("Failed to remove ramoops %08lx@%08lx from memory\n",
826 pr_info("Ramoops: %08lx - %08lx\n", start, start + size - 1);
830 static void __init exynos5_reserve(void)
832 /* required to have enough address range to remap the IOMMU
833 * allocated buffers */
834 init_consistent_dma_size(SZ_64M);
836 exynos5_ramoops_reserve();
839 static void s5p_tv_setup(void)
841 /* direct HPD to HDMI chip */
842 gpio_request(EXYNOS5_GPX3(7), "hpd-plug");
844 gpio_direction_input(EXYNOS5_GPX3(7));
845 s3c_gpio_cfgpin(EXYNOS5_GPX3(7), S3C_GPIO_SFN(0x3));
846 s3c_gpio_setpull(EXYNOS5_GPX3(7), S3C_GPIO_PULL_NONE);
849 static void exynos5_i2c_setup(void)
851 /* Setup the low-speed i2c controller interrupts */
852 writel(0x0, EXYNOS5_SYS_I2C_CFG);
855 static void __init exynos5250_dt_machine_init(void)
857 struct device_node *srom_np, *np;
860 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
862 /* Setup pins for any SMSC 911x controller on the SROMC bus */
863 srom_np = of_find_node_by_path("/sromc-bus");
865 printk(KERN_ERR "No /sromc-bus property.\n");
868 for_each_child_of_node(srom_np, np) {
869 if (of_device_is_compatible(np, "smsc,lan9115")) {
871 of_property_read_u32(np, "reg", ®);
877 * Request lcd_bl_en GPIO for smdk5250_bl_notify().
878 * TODO: Fix this so we are not at risk of requesting the GPIO
879 * multiple times, this should be done with device tree, and
880 * likely integrated into the plat-samsung/dev-backlight.c init.
882 gpio_request_one(EXYNOS5_GPX3(0), GPIOF_OUT_INIT_HIGH, "lcd_bl_en");
884 samsung_bl_set(&smdk5250_bl_gpio_info, &smdk5250_bl_data);
887 * HACK ALERT! TODO: FIXME!
889 * We're going to hack in Daisy LCD info here for bringup purposes.
890 * Lots of things wrong with what we're doing here, but it works for
894 if (of_machine_is_compatible("google,daisy")) {
895 #ifdef CONFIG_DRM_EXYNOS_FIMD
896 smdk5250_lcd1_pdata.panel[0].timing.xres = 1366;
897 smdk5250_lcd1_pdata.panel[0].timing.yres = 768;
898 smdk5250_lcd1_pdata.panel[1].timing.xres = 1280;
899 smdk5250_lcd1_pdata.panel[1].timing.yres = 720;
900 smdk5250_lcd1_pdata.panel[2].timing.xres = -1;
901 smdk5250_lcd1_pdata.panel[2].timing.yres = -1;
902 smdk5250_lcd1_pdata.panel_type = MIPI_LCD;
904 smdk5250_fb_win0.win_mode.xres = 1366;
905 smdk5250_fb_win0.win_mode.yres = 768;
906 smdk5250_fb_win0.virtual_x = 1366;
907 smdk5250_fb_win0.virtual_y = 768 * 2;
909 smdk5250_fb_win1.win_mode.xres = 1366;
910 smdk5250_fb_win1.win_mode.yres = 768;
911 smdk5250_fb_win1.virtual_x = 1366;
912 smdk5250_fb_win1.virtual_y = 768 * 2;
914 smdk5250_fb_win2.win_mode.xres = 1366;
915 smdk5250_fb_win2.win_mode.yres = 768;
916 smdk5250_fb_win2.virtual_x = 1366;
917 smdk5250_fb_win2.virtual_y = 768 * 2;
919 dsim_lcd_info.lcd_size.width = 1366;
920 dsim_lcd_info.lcd_size.height = 768;
921 } else if (of_machine_is_compatible("google,snow")) {
922 #ifdef CONFIG_DRM_EXYNOS_FIMD
923 for (i = 0;i < ARRAY_SIZE(snow_fb_window);i++)
924 smdk5250_lcd1_pdata.panel[i].timing = snow_fb_window[i];
926 smdk5250_lcd1_pdata.panel_type = DP_LCD;
927 smdk5250_lcd1_pdata.clock_rate = 70250000;
928 smdk5250_lcd1_pdata.vidcon1 = 0;
932 if (gpio_request_one(EXYNOS5_GPX2(6), GPIOF_OUT_INIT_HIGH,
933 "HOST_VBUS_CONTROL")) {
934 printk(KERN_ERR "failed to request gpio_host_vbus\n");
936 s3c_gpio_setpull(EXYNOS5_GPX2(6), S3C_GPIO_PULL_NONE);
937 gpio_free(EXYNOS5_GPX2(6));
943 * MAX77686 PMIC interrupt setup code
944 * TODO: Convert the device tree wakeup_int domain to support
947 s3c_gpio_setpull(EXYNOS5_GPX3(2), S3C_GPIO_PULL_NONE);
950 * BIG HACK: The wm8994 is not device tree enabled apparently, so
951 * needs to be added manually. ...but it's only on SMDK5250.
953 if (of_machine_is_compatible("samsung,smdk5250")) {
954 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
957 /* XCLKOUT needs to be moved over to the clock interface, but enable it
962 if (gpio_request_one(EXYNOS5_GPA2(5), GPIOF_OUT_INIT_HIGH, "SPI1_CS")) {
963 printk(KERN_ERR "Spidev ChipSelect unavailable\n");
965 s3c_gpio_cfgpin(EXYNOS5_GPA2(5), S3C_GPIO_SFN(0x1));
966 s3c_gpio_setpull(EXYNOS5_GPA2(5), S3C_GPIO_PULL_NONE);
967 s5p_gpio_set_drvstr(EXYNOS5_GPA2(5), S5P_GPIO_DRVSTR_LV4);
968 spi_register_board_info(spi1_board_info,
969 ARRAY_SIZE(spi1_board_info));
972 of_platform_populate(NULL, of_default_bus_match_table,
973 exynos5250_auxdata_lookup, NULL);
975 #ifdef CONFIG_DRM_EXYNOS_FIMD
976 if (of_machine_is_compatible("google,snow"))
977 exynos_dp_gpio_setup_24bpp();
979 exynos_fimd_gpio_setup_24bpp();
983 /* Enable power to ADC */
984 __raw_writel(0x1, S5P_ADC_PHY_CONTROL);
986 platform_add_devices(smdk5250_devices, ARRAY_SIZE(smdk5250_devices));
988 of_node_put(srom_np);
992 static char const *exynos5250_dt_compat[] __initdata = {
993 "samsung,exynos5250",
997 DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
998 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
999 .init_irq = exynos5_init_irq,
1000 .reserve = exynos5_reserve,
1001 .map_io = exynos5250_dt_map_io,
1002 .handle_irq = gic_handle_irq,
1003 .init_machine = exynos5250_dt_machine_init,
1004 .timer = &exynos4_timer,
1005 .dt_compat = exynos5250_dt_compat,
1006 .restart = exynos5_restart,