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>
56 #include <video/platform_lcd.h>
58 #include "drm/exynos_drm.h"
61 static void __init smsc911x_init(int ncs)
65 /* configure nCS1 width to 16 bits */
66 data = __raw_readl(S5P_SROM_BW) &
67 ~(S5P_SROM_BW__CS_MASK << (ncs * 4));
68 data |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) |
69 (1 << S5P_SROM_BW__WAITENABLE__SHIFT) |
70 (1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) << (ncs * 4);
71 __raw_writel(data, S5P_SROM_BW);
73 /* set timing for nCS1 suitable for ethernet chip */
74 __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) |
75 (0x9 << S5P_SROM_BCX__TACP__SHIFT) |
76 (0xc << S5P_SROM_BCX__TCAH__SHIFT) |
77 (0x1 << S5P_SROM_BCX__TCOH__SHIFT) |
78 (0x6 << S5P_SROM_BCX__TACC__SHIFT) |
79 (0x1 << S5P_SROM_BCX__TCOS__SHIFT) |
80 (0x1 << S5P_SROM_BCX__TACS__SHIFT),
81 S5P_SROM_BC0 + (ncs * 4));
84 static struct s3c_fb_pd_win smdk5250_fb_win0 = {
103 static struct s3c_fb_pd_win smdk5250_fb_win1 = {
115 .virtual_y = 800 * 2,
122 static struct s3c_fb_pd_win smdk5250_fb_win2 = {
134 .virtual_y = 800 * 2,
141 static struct fb_videomode snow_fb_window[] = {
142 [0] = { /* Only LCD Connected */
152 [1] = { /* TV & LCD Connected */
168 static void exynos_fimd_gpio_setup_24bpp(void)
170 unsigned int reg = 0;
173 * Set DISP1BLK_CFG register for Display path selection
174 * FIMD of DISP1_BLK Bypass selection : DISP1BLK_CFG[15]
175 * ---------------------
177 * 1 | FIMD : selected
179 reg = __raw_readl(S3C_VA_SYS + 0x0214);
180 reg &= ~(1 << 15); /* To save other reset values */
182 __raw_writel(reg, S3C_VA_SYS + 0x0214);
185 static void exynos_dp_gpio_setup_24bpp(void)
187 exynos_fimd_gpio_setup_24bpp();
189 /* Set Hotplug detect for DP */
190 gpio_request(EXYNOS5_GPX0(7), "DP hotplug");
191 s3c_gpio_cfgpin(EXYNOS5_GPX0(7), S3C_GPIO_SFN(3));
194 #ifdef CONFIG_DRM_EXYNOS_HDMI
195 static struct platform_device exynos_drm_hdmi_device = {
196 .name = "exynos-drm-hdmi",
199 static struct exynos_drm_hdmi_pdata drm_mixer_pdata = {
211 static struct exynos_drm_hdmi_pdata drm_hdmi_pdata = {
224 #ifdef CONFIG_DRM_EXYNOS_FIMD
225 static struct exynos_drm_fimd_pdata smdk5250_lcd1_pdata = {
252 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
253 .vidcon1 = VIDCON1_INV_VCLK,
256 .clock_rate = 800 * 1000 * 1000,
259 static struct s3c_fb_platdata smdk5250_lcd1_pdata __initdata = {
260 .win[0] = &smdk5250_fb_win0,
261 .win[1] = &smdk5250_fb_win1,
262 .win[2] = &smdk5250_fb_win2,
264 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
265 .vidcon1 = VIDCON1_INV_VCLK,
266 .setup_gpio = exynos_fimd_gpio_setup_24bpp,
267 .clock_rate = 800 * 1000 * 1000,
271 static struct mipi_dsim_config dsim_info = {
272 .e_interface = DSIM_VIDEO,
273 .e_pixel_format = DSIM_24BPP_888,
274 /* main frame fifo auto flush at VSYNC pulse */
276 .eot_disable = false,
277 .auto_vertical_cnt = false,
283 .e_no_data_lane = DSIM_DATA_LANE_4,
284 .e_byte_clk = DSIM_PLL_OUT_DIV8,
285 .e_burst_mode = DSIM_BURST,
291 /* D-PHY PLL stable time spec :min = 200usec ~ max 400usec */
292 .pll_stable_time = 500,
294 .esc_clk = 0.4 * 1000000, /* escape clk : 10MHz */
296 /* stop state holding counter after bta change count 0 ~ 0xfff */
297 .stop_holding_cnt = 0x0f,
298 .bta_timeout = 0xff, /* bta timeout 0 ~ 0xff */
299 .rx_timeout = 0xffff, /* lp rx timeout 0 ~ 0xffff */
301 .dsim_ddi_pd = &tc358764_mipi_lcd_driver,
304 static struct mipi_dsim_lcd_config dsim_lcd_info = {
305 .rgb_timing.left_margin = 0x4,
306 .rgb_timing.right_margin = 0x4,
307 .rgb_timing.upper_margin = 0x4,
308 .rgb_timing.lower_margin = 0x4,
309 .rgb_timing.hsync_len = 0x4,
310 .rgb_timing.vsync_len = 0x4,
311 .cpu_timing.cs_setup = 0,
312 .cpu_timing.wr_setup = 1,
313 .cpu_timing.wr_act = 0,
314 .cpu_timing.wr_hold = 0,
315 .lcd_size.width = 1280,
316 .lcd_size.height = 800,
319 static struct s5p_platform_mipi_dsim dsim_platform_data = {
321 .dsim_config = &dsim_info,
322 .dsim_lcd_config = &dsim_lcd_info,
324 .part_reset = s5p_dsim_part_reset,
325 .init_d_phy = s5p_dsim_init_d_phy,
326 .get_fb_frame_done = NULL,
330 * the stable time of needing to write data on SFR
331 * when the mipi mode becomes LP mode.
333 .delay_for_stabilization = 600,
336 static struct platform_device exynos_drm_device = {
337 .name = "exynos-drm",
339 .dma_mask = &exynos_drm_device.dev.coherent_dma_mask,
340 .coherent_dma_mask = 0xffffffffUL,
344 static void lcd_set_power(struct plat_lcd_data *pd,
347 if (of_machine_is_compatible("google,daisy") ||
348 of_machine_is_compatible("google,snow")) {
349 struct regulator *lcd_fet;
351 lcd_fet = regulator_get(NULL, "lcd_vdd");
352 if (!IS_ERR(lcd_fet)) {
354 regulator_enable(lcd_fet);
356 regulator_disable(lcd_fet);
358 regulator_put(lcd_fet);
362 if (!of_machine_is_compatible("google,snow")) {
364 gpio_request_one(EXYNOS5_GPX1(5), GPIOF_OUT_INIT_HIGH, "GPX1");
366 gpio_set_value(EXYNOS5_GPX1(5), 0);
368 gpio_set_value(EXYNOS5_GPX1(5), 1);
370 gpio_free(EXYNOS5_GPX1(5));
375 /* Turn on regulator for backlight */
376 if (of_machine_is_compatible("google,daisy") ||
377 of_machine_is_compatible("google,snow")) {
378 struct regulator *backlight_fet;
380 backlight_fet = regulator_get(NULL, "vcd_led");
381 if (!IS_ERR(backlight_fet)) {
383 regulator_enable(backlight_fet);
385 regulator_disable(backlight_fet);
387 regulator_put(backlight_fet);
389 /* Wait 10 ms between regulator on and PWM start per spec */
394 static int smdk5250_match_fb(struct plat_lcd_data *pd, struct fb_info *info)
396 /* Don't call .set_power callback while unblanking */
400 static struct plat_lcd_data smdk5250_lcd_data = {
401 .set_power = lcd_set_power,
402 .match_fb = smdk5250_match_fb,
405 static struct platform_device smdk5250_lcd = {
406 .name = "platform-lcd",
407 .dev.platform_data = &smdk5250_lcd_data,
410 static int smdk5250_bl_notify(struct device *unused, int brightness)
412 /* manage lcd_bl_en signal */
414 gpio_set_value(EXYNOS5_GPX3(0), 1);
416 gpio_set_value(EXYNOS5_GPX3(0), 0);
421 /* LCD Backlight data */
422 static struct samsung_bl_gpio_info smdk5250_bl_gpio_info = {
423 .no = EXYNOS5_GPB2(0),
424 .func = S3C_GPIO_SFN(2),
427 static struct platform_pwm_backlight_data smdk5250_bl_data = {
428 .pwm_period_ns = 1000000,
429 .notify = smdk5250_bl_notify,
432 struct platform_device exynos_device_md0 = {
433 .name = "exynos-mdev",
437 struct platform_device exynos_device_md1 = {
438 .name = "exynos-mdev",
442 struct platform_device exynos_device_md2 = {
443 .name = "exynos-mdev",
447 static struct regulator_consumer_supply wm8994_avdd1_supply =
448 REGULATOR_SUPPLY("AVDD1", "1-001a");
450 static struct regulator_consumer_supply wm8994_dcvdd_supply =
451 REGULATOR_SUPPLY("DCVDD", "1-001a");
453 static struct regulator_init_data wm8994_ldo1_data = {
457 .num_consumer_supplies = 1,
458 .consumer_supplies = &wm8994_avdd1_supply,
461 static struct regulator_init_data wm8994_ldo2_data = {
465 .num_consumer_supplies = 1,
466 .consumer_supplies = &wm8994_dcvdd_supply,
469 static struct wm8994_pdata wm8994_platform_data = {
470 /* configure gpio1 function: 0x0001(Logic level input/output) */
471 .gpio_defaults[0] = 0x0001,
472 /* If the i2s0 and i2s2 is enabled simultaneously */
473 .gpio_defaults[7] = 0x8100, /* GPIO8 DACDAT3 in */
474 .gpio_defaults[8] = 0x0100, /* GPIO9 ADCDAT3 out */
475 .gpio_defaults[9] = 0x0100, /* GPIO10 LRCLK3 out */
476 .gpio_defaults[10] = 0x0100,/* GPIO11 BCLK3 out */
477 .ldo[0] = { 0, &wm8994_ldo1_data },
478 .ldo[1] = { 0, &wm8994_ldo2_data },
481 static struct i2c_board_info i2c_devs1[] __initdata = {
483 I2C_BOARD_INFO("wm8994", 0x1a),
484 .platform_data = &wm8994_platform_data,
488 static struct s3c64xx_spi_csinfo spi1_csi[] = {
490 .line = EXYNOS5_GPA2(5),
495 static struct spi_board_info spi1_board_info[] __initdata = {
497 .modalias = "spidev",
498 .platform_data = NULL,
499 .max_speed_hz = 10*1000*1000,
503 .controller_data = spi1_csi,
507 struct sysmmu_platform_data platdata_sysmmu_mfc_l = {
509 .clockname = "sysmmu",
512 struct sysmmu_platform_data platdata_sysmmu_mfc_r = {
514 .clockname = "sysmmu",
517 struct sysmmu_platform_data platdata_sysmmu_gsc = {
519 .clockname = "sysmmu",
522 struct sysmmu_platform_data platdata_sysmmu_g2d = {
524 .clockname = "sysmmu",
527 struct sysmmu_platform_data platdata_sysmmu_fimd = {
529 .clockname = "sysmmu",
532 struct sysmmu_platform_data platdata_sysmmu_tv = {
534 .clockname = "sysmmu",
537 #ifdef CONFIG_VIDEO_FIMG2D4X
538 static struct fimg2d_platdata fimg2d_data __initdata = {
540 .gate_clkname = "fimg2d",
544 static struct exynos4_ohci_platdata smdk5250_ohci_pdata = {
545 .phy_init = s5p_usb_phy_init,
546 .phy_exit = s5p_usb_phy_exit,
549 static struct s5p_ehci_platdata smdk5250_ehci_pdata = {
550 .phy_init = s5p_usb_phy_init,
551 .phy_exit = s5p_usb_phy_exit,
554 static struct dwc3_exynos_data smdk5250_xhci_pdata = {
555 .phy_type = S5P_USB_PHY_DRD,
556 .phy_init = s5p_usb_phy_init,
557 .phy_exit = s5p_usb_phy_exit,
560 struct exynos_gpio_cfg {
566 static const char *rclksrc[] = {
571 static struct video_info smdk5250_dp_config = {
572 .name = "eDP-LVDS NXP PTN3460",
574 .h_sync_polarity = 0,
575 .v_sync_polarity = 0,
578 .color_space = COLOR_RGB,
579 .dynamic_range = VESA,
580 .ycbcr_coeff = COLOR_YCBCR601,
581 .color_depth = COLOR_8,
583 .link_rate = LINK_RATE_2_70GBPS,
584 .lane_count = LANE_COUNT2,
587 static void get_dp_bridge_gpios(int *pd_n_gpio, int *rst_n_gpio)
589 struct device_node *np;
591 np = of_find_compatible_node(NULL, NULL, "nxp,ptn3460");
592 *pd_n_gpio = np ? of_get_named_gpio(np, "pd_n_gpio", 0) : -1;
593 *rst_n_gpio = np ? of_get_named_gpio(np, "rst_n_gpio", 0) : -1;
596 static void dp_phy_init(void)
598 int pd_n_gpio, rst_n_gpio;
600 get_dp_bridge_gpios(&pd_n_gpio, &rst_n_gpio);
602 gpio_set_value(pd_n_gpio, 1);
604 if (rst_n_gpio >= 0) {
605 gpio_set_value(rst_n_gpio, 0);
607 gpio_set_value(rst_n_gpio, 1);
610 /* This really sucks, but we can't trust HPD from the bridge */
617 static struct exynos_dp_platdata smdk5250_dp_data = {
618 .video_info = &smdk5250_dp_config,
619 .training_type = SW_LINK_TRAINING,
620 .phy_init = dp_phy_init,
621 .phy_exit = s5p_dp_phy_exit,
624 #define S5P_PMU_DEBUG S5P_PMUREG(0x0A00)
625 /* PMU_DEBUG bits [12:8] = 0x10000 selects XXTI clock source */
626 #define PMU_DEBUG_XXTI (0x10 << 8)
627 /* Mask bit[12:8] for xxti clock selection */
628 #define PMU_DEBUG_CLKOUT_SEL_MASK 0x1f00
630 static void __init enable_xclkout(void)
634 tmp = readl(S5P_PMU_DEBUG);
635 tmp &= ~PMU_DEBUG_CLKOUT_SEL_MASK;
636 tmp |= PMU_DEBUG_XXTI;
637 writel(tmp, S5P_PMU_DEBUG);
640 static int exynos_cfg_i2s_gpio(struct platform_device *pdev)
643 /* configure GPIO for i2s port */
644 struct exynos_gpio_cfg exynos5_cfg[3] = {
645 { EXYNOS5_GPZ(0), 7, S3C_GPIO_SFN(2) },
646 { EXYNOS5_GPB0(0), 5, S3C_GPIO_SFN(2) },
647 { EXYNOS5_GPB1(0), 5, S3C_GPIO_SFN(2) }
650 if (pdev->dev.of_node) {
651 id = of_alias_get_id(pdev->dev.of_node, "i2s");
653 dev_err(&pdev->dev, "failed to get alias id:%d\n", id);
658 if (id < 0 || id > 2) {
659 printk(KERN_ERR "Invalid Device %d\n", id);
663 s3c_gpio_cfgpin_range(exynos5_cfg[id].addr,
664 exynos5_cfg[id].num, exynos5_cfg[id].bit);
669 static struct s3c_audio_pdata i2sv5_pdata = {
670 .cfg_gpio = exynos_cfg_i2s_gpio,
673 .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI
676 .idma_addr = EXYNOS4_AUDSS_INT_MEM,
681 static struct resource exynos5_adc_resource[] = {
682 [0] = DEFINE_RES_MEM(EXYNOS5_PA_ADC, SZ_256),
683 [1] = DEFINE_RES_IRQ(EXYNOS5_IRQ_ADC0),
686 struct platform_device exynos5_device_adc = {
687 .name = "samsung-adc-v4",
689 .num_resources = ARRAY_SIZE(exynos5_adc_resource),
690 .resource = exynos5_adc_resource,
694 * The following lookup table is used to override device names when devices
695 * are registered from device tree. This is temporarily added to enable
696 * device tree support addition for the EXYNOS5 architecture.
698 * For drivers that require platform data to be provided from the machine
699 * file, a platform data pointer can also be supplied along with the
700 * devices names. Usually, the platform data elements that cannot be parsed
701 * from the device tree by the drivers (example: function pointers) are
702 * supplied. But it should be noted that this is a temporary mechanism and
703 * at some point, the drivers should be capable of parsing all the platform
704 * data from the device tree.
706 static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
707 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART0,
708 "exynos4210-uart.0", NULL),
709 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART1,
710 "exynos4210-uart.1", NULL),
711 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART2,
712 "exynos4210-uart.2", NULL),
713 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART3,
714 "exynos4210-uart.3", NULL),
715 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(0),
716 "s3c2440-i2c.0", NULL),
717 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(1),
718 "s3c2440-i2c.1", NULL),
719 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(2),
720 "s3c2440-i2c.2", NULL),
721 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(3),
722 "s3c2440-i2c.3", NULL),
723 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(4),
724 "s3c2440-i2c.4", NULL),
725 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(5),
726 "s3c2440-i2c.5", NULL),
727 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(6),
728 "s3c2440-i2c.6", NULL),
729 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(7),
730 "s3c2440-i2c.7", NULL),
731 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(8),
732 "s3c2440-hdmiphy-i2c", NULL),
733 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI0,
734 "exynos4210-spi.0", NULL),
735 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI1,
736 "exynos4210-spi.1", NULL),
737 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI2,
738 "exynos4210-spi.2", NULL),
739 OF_DEV_AUXDATA("synopsis,dw-mshc-exynos5250", 0x12200000,
741 OF_DEV_AUXDATA("synopsis,dw-mshc-exynos5250", 0x12210000,
743 OF_DEV_AUXDATA("synopsis,dw-mshc-exynos5250", 0x12220000,
745 OF_DEV_AUXDATA("synopsis,dw-mshc-exynos5250", 0x12230000,
747 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL),
748 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL),
749 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL),
750 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x10A60000,
751 "s5p-sysmmu.2", &platdata_sysmmu_g2d),
752 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x11210000,
753 "s5p-sysmmu.3", &platdata_sysmmu_mfc_l),
754 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x11200000,
755 "s5p-sysmmu.4", &platdata_sysmmu_mfc_r),
756 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x14640000,
757 "s5p-sysmmu.27", &platdata_sysmmu_fimd),
758 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x14650000,
759 "s5p-sysmmu.28", &platdata_sysmmu_tv),
760 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x13E80000,
761 "s5p-sysmmu.23", &platdata_sysmmu_gsc),
762 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x13E90000,
763 "s5p-sysmmu.24", &platdata_sysmmu_gsc),
764 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x13EA0000,
765 "s5p-sysmmu.25", &platdata_sysmmu_gsc),
766 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x13EB0000,
767 "s5p-sysmmu.26", &platdata_sysmmu_gsc),
768 OF_DEV_AUXDATA("samsung,exynos5-fb", 0x14400000,
769 "exynos5-fb", &smdk5250_lcd1_pdata),
770 OF_DEV_AUXDATA("samsung,exynos5-mipi", 0x14500000,
771 "s5p-mipi-dsim", &dsim_platform_data),
772 OF_DEV_AUXDATA("samsung,exynos5-dp", 0x145B0000,
773 "s5p-dp", &smdk5250_dp_data),
774 OF_DEV_AUXDATA("samsung,s5p-mfc-v6", 0x11000000, "s5p-mfc-v6", NULL),
775 OF_DEV_AUXDATA("samsung,exynos-gsc", 0x13E00000,
776 "exynos-gsc.0", NULL),
777 OF_DEV_AUXDATA("samsung,exynos-gsc", 0x13E10000,
778 "exynos-gsc.1", NULL),
779 OF_DEV_AUXDATA("samsung,exynos-gsc", 0x13E20000,
780 "exynos-gsc.2", NULL),
781 OF_DEV_AUXDATA("samsung,exynos-gsc", 0x13E30000,
782 "exynos-gsc.3", NULL),
783 #ifdef CONFIG_VIDEO_FIMG2D4X
784 OF_DEV_AUXDATA("samsung,s5p-g2d", 0x10850000,
785 "s5p-g2d", &fimg2d_data),
787 OF_DEV_AUXDATA("samsung,exynos-ohci", 0x12120000,
788 "exynos-ohci", &smdk5250_ohci_pdata),
789 OF_DEV_AUXDATA("samsung,exynos-ehci", 0x12110000,
790 "s5p-ehci", &smdk5250_ehci_pdata),
791 OF_DEV_AUXDATA("samsung,exynos-xhci", 0x12000000,
792 "exynos-dwc3", &smdk5250_xhci_pdata),
793 OF_DEV_AUXDATA("samsung,i2s", 0x03830000,
794 "samsung-i2s.0", &i2sv5_pdata),
795 #ifdef CONFIG_DRM_EXYNOS_HDMI
796 OF_DEV_AUXDATA("samsung,exynos5-hdmi", 0x14530000,
797 "exynos5-hdmi", &drm_hdmi_pdata),
798 OF_DEV_AUXDATA("samsung,s5p-mixer", 0x14450000,
799 "s5p-mixer", &drm_mixer_pdata),
801 OF_DEV_AUXDATA("samsung,exynos5-hdmi", 0x14530000,
802 "exynos5-hdmi", NULL),
803 OF_DEV_AUXDATA("samsung,s5p-mixer", 0x14450000,
809 static struct platform_device *smdk5250_devices[] __initdata = {
811 &smdk5250_lcd, /* for platform_lcd device */
812 &exynos_device_md0, /* for media device framework */
813 &exynos_device_md1, /* for media device framework */
814 &exynos_device_md2, /* for media device framework */
815 &samsung_asoc_dma, /* for audio dma interface device */
817 #ifdef CONFIG_DRM_EXYNOS_HDMI
818 &exynos_drm_hdmi_device,
822 static struct regulator_consumer_supply dummy_supplies[] = {
823 REGULATOR_SUPPLY("vddvario", "7000000.lan9215"),
824 REGULATOR_SUPPLY("vdd33a", "7000000.lan9215"),
827 static void __init exynos5250_dt_map_io(void)
829 exynos_init_io(NULL, 0);
830 s3c24xx_init_clocks(24000000);
833 static unsigned long ramoops_dt_start, ramoops_dt_size;
834 static int __init init_dt_scan_ramoops(unsigned long node, const char *uname,
835 int depth, void *data)
840 if (!of_flat_dt_is_compatible(node, "ramoops"))
843 reg = of_get_flat_dt_prop(node, "reg", &l);
846 endp = reg + (l / sizeof(__be32));
848 /* This architecture uses single cells for address and size.
849 * Other architectures may differ. */
850 ramoops_dt_start = be32_to_cpu(reg[0]);
851 ramoops_dt_size = be32_to_cpu(reg[1]);
855 static void __init exynos5_ramoops_reserve(void)
857 unsigned long start, size;
859 of_scan_flat_dt(init_dt_scan_ramoops, NULL);
861 /* If necessary, lower start and raise size to align to 1M. */
862 start = round_down(ramoops_dt_start, SZ_1M);
863 size = ramoops_dt_size + ramoops_dt_start - start;
864 size = round_up(size, SZ_1M);
866 if (memblock_remove(start, size)) {
867 pr_err("Failed to remove ramoops %08lx@%08lx from memory\n",
870 pr_info("Ramoops: %08lx - %08lx\n", start, start + size - 1);
874 static void __init exynos5_reserve(void)
876 /* required to have enough address range to remap the IOMMU
877 * allocated buffers */
878 init_consistent_dma_size(SZ_64M);
880 exynos5_ramoops_reserve();
883 static void s5p_tv_setup(void)
885 /* direct HPD to HDMI chip */
886 gpio_request(EXYNOS5_GPX3(7), "hpd-plug");
888 gpio_direction_input(EXYNOS5_GPX3(7));
889 s3c_gpio_cfgpin(EXYNOS5_GPX3(7), S3C_GPIO_SFN(0x3));
890 s3c_gpio_setpull(EXYNOS5_GPX3(7), S3C_GPIO_PULL_NONE);
893 static void exynos5_i2c_setup(void)
895 /* Setup the low-speed i2c controller interrupts */
896 writel(0x0, EXYNOS5_SYS_I2C_CFG);
899 static void __init exynos5250_dt_machine_init(void)
901 struct device_node *srom_np, *np;
904 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
906 /* Setup pins for any SMSC 911x controller on the SROMC bus */
907 srom_np = of_find_node_by_path("/sromc-bus");
909 printk(KERN_ERR "No /sromc-bus property.\n");
912 for_each_child_of_node(srom_np, np) {
913 if (of_device_is_compatible(np, "smsc,lan9115")) {
915 of_property_read_u32(np, "reg", ®);
921 * Request lcd_bl_en GPIO for smdk5250_bl_notify().
922 * TODO: Fix this so we are not at risk of requesting the GPIO
923 * multiple times, this should be done with device tree, and
924 * likely integrated into the plat-samsung/dev-backlight.c init.
926 gpio_request_one(EXYNOS5_GPX3(0), GPIOF_OUT_INIT_HIGH, "lcd_bl_en");
928 samsung_bl_set(&smdk5250_bl_gpio_info, &smdk5250_bl_data);
931 * HACK ALERT! TODO: FIXME!
933 * We're going to hack in Daisy LCD info here for bringup purposes.
934 * Lots of things wrong with what we're doing here, but it works for
938 if (of_machine_is_compatible("google,daisy")) {
939 #ifdef CONFIG_DRM_EXYNOS_FIMD
940 smdk5250_lcd1_pdata.panel[0].timing.xres = 1366;
941 smdk5250_lcd1_pdata.panel[0].timing.yres = 768;
942 smdk5250_lcd1_pdata.panel[1].timing.xres = 1280;
943 smdk5250_lcd1_pdata.panel[1].timing.yres = 720;
944 smdk5250_lcd1_pdata.panel[2].timing.xres = -1;
945 smdk5250_lcd1_pdata.panel[2].timing.yres = -1;
946 smdk5250_lcd1_pdata.panel_type = MIPI_LCD;
948 smdk5250_fb_win0.win_mode.xres = 1366;
949 smdk5250_fb_win0.win_mode.yres = 768;
950 smdk5250_fb_win0.virtual_x = 1366;
951 smdk5250_fb_win0.virtual_y = 768 * 2;
953 smdk5250_fb_win1.win_mode.xres = 1366;
954 smdk5250_fb_win1.win_mode.yres = 768;
955 smdk5250_fb_win1.virtual_x = 1366;
956 smdk5250_fb_win1.virtual_y = 768 * 2;
958 smdk5250_fb_win2.win_mode.xres = 1366;
959 smdk5250_fb_win2.win_mode.yres = 768;
960 smdk5250_fb_win2.virtual_x = 1366;
961 smdk5250_fb_win2.virtual_y = 768 * 2;
963 dsim_lcd_info.lcd_size.width = 1366;
964 dsim_lcd_info.lcd_size.height = 768;
965 } else if (of_machine_is_compatible("google,snow")) {
966 int pd_n_gpio, rst_n_gpio;
967 #ifdef CONFIG_DRM_EXYNOS_FIMD
968 for (i = 0;i < ARRAY_SIZE(snow_fb_window);i++)
969 smdk5250_lcd1_pdata.panel[i].timing = snow_fb_window[i];
971 smdk5250_lcd1_pdata.panel_type = DP_LCD;
972 smdk5250_lcd1_pdata.clock_rate = 267 * 1000 * 1000;
973 smdk5250_lcd1_pdata.vidcon1 = 0;
976 get_dp_bridge_gpios(&pd_n_gpio, &rst_n_gpio);
977 if (pd_n_gpio >= 0) {
978 ret = gpio_request_one(pd_n_gpio, GPIOF_OUT_INIT_HIGH,
982 if (rst_n_gpio >= 0) {
983 ret = gpio_request_one(rst_n_gpio, GPIOF_OUT_INIT_HIGH,
989 if (gpio_request_one(EXYNOS5_GPX2(6), GPIOF_OUT_INIT_HIGH,
990 "HOST_VBUS_CONTROL")) {
991 printk(KERN_ERR "failed to request gpio_host_vbus\n");
993 s3c_gpio_setpull(EXYNOS5_GPX2(6), S3C_GPIO_PULL_NONE);
994 gpio_free(EXYNOS5_GPX2(6));
1000 * MAX77686 PMIC interrupt setup code
1001 * TODO: Convert the device tree wakeup_int domain to support
1004 s3c_gpio_setpull(EXYNOS5_GPX3(2), S3C_GPIO_PULL_NONE);
1007 * BIG HACK: The wm8994 is not device tree enabled apparently, so
1008 * needs to be added manually. ...but it's only on SMDK5250.
1010 if (of_machine_is_compatible("samsung,smdk5250")) {
1011 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
1014 /* XCLKOUT needs to be moved over to the clock interface, but enable it
1019 if (gpio_request_one(EXYNOS5_GPA2(5), GPIOF_OUT_INIT_HIGH, "SPI1_CS")) {
1020 printk(KERN_ERR "Spidev ChipSelect unavailable\n");
1022 s3c_gpio_cfgpin(EXYNOS5_GPA2(5), S3C_GPIO_SFN(0x1));
1023 s3c_gpio_setpull(EXYNOS5_GPA2(5), S3C_GPIO_PULL_NONE);
1024 s5p_gpio_set_drvstr(EXYNOS5_GPA2(5), S5P_GPIO_DRVSTR_LV4);
1025 spi_register_board_info(spi1_board_info,
1026 ARRAY_SIZE(spi1_board_info));
1029 of_platform_populate(NULL, of_default_bus_match_table,
1030 exynos5250_auxdata_lookup, NULL);
1032 #ifdef CONFIG_DRM_EXYNOS_FIMD
1033 if (of_machine_is_compatible("google,snow"))
1034 exynos_dp_gpio_setup_24bpp();
1036 exynos_fimd_gpio_setup_24bpp();
1040 /* Enable power to ADC */
1041 __raw_writel(0x1, S5P_ADC_PHY_CONTROL);
1043 platform_add_devices(smdk5250_devices, ARRAY_SIZE(smdk5250_devices));
1045 of_node_put(srom_np);
1049 static char const *exynos5250_dt_compat[] __initdata = {
1050 "samsung,exynos5250",
1054 DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
1055 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
1056 .init_irq = exynos5_init_irq,
1057 .reserve = exynos5_reserve,
1058 .map_io = exynos5250_dt_map_io,
1059 .handle_irq = gic_handle_irq,
1060 .init_machine = exynos5250_dt_machine_init,
1061 .timer = &exynos4_timer,
1062 .dt_compat = exynos5250_dt_compat,
1063 .restart = exynos5_restart,