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>
28 #include <linux/err.h>
29 #include <linux/platform_data/ntc_thermistor.h>
31 #include <asm/mach/arch.h>
32 #include <asm/hardware/gic.h>
34 #include <mach/ppmu.h>
36 #include <mach/ohci.h>
37 #include <mach/regs-pmu.h>
38 #include <mach/sysmmu.h>
39 #include <mach/ohci.h>
40 #include <mach/regs-audss.h>
41 #include <mach/regs-pmu.h>
43 #include <plat/audio.h>
44 #include <plat/adc.h> /* for s3c_adc_register and friends */
46 #include <plat/dsim.h>
48 #include <plat/mipi_dsi.h>
49 #include <plat/gpio-cfg.h>
50 #include <plat/regs-fb.h>
51 #include <plat/regs-serial.h>
52 #include <plat/regs-srom.h>
53 #include <plat/backlight.h>
54 #include <plat/devs.h>
55 #include <plat/usb-phy.h>
56 #include <plat/ehci.h>
58 #include <plat/s3c64xx-spi.h>
60 #include <video/platform_lcd.h>
62 #include "drm/exynos_drm.h"
65 static void __init smsc911x_init(int ncs)
69 /* configure nCS1 width to 16 bits */
70 data = __raw_readl(S5P_SROM_BW) &
71 ~(S5P_SROM_BW__CS_MASK << (ncs * 4));
72 data |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) |
73 (1 << S5P_SROM_BW__WAITENABLE__SHIFT) |
74 (1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) << (ncs * 4);
75 __raw_writel(data, S5P_SROM_BW);
77 /* set timing for nCS1 suitable for ethernet chip */
78 __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) |
79 (0x9 << S5P_SROM_BCX__TACP__SHIFT) |
80 (0xc << S5P_SROM_BCX__TCAH__SHIFT) |
81 (0x1 << S5P_SROM_BCX__TCOH__SHIFT) |
82 (0x6 << S5P_SROM_BCX__TACC__SHIFT) |
83 (0x1 << S5P_SROM_BCX__TCOS__SHIFT) |
84 (0x1 << S5P_SROM_BCX__TACS__SHIFT),
85 S5P_SROM_BC0 + (ncs * 4));
88 #ifndef CONFIG_DRM_EXYNOS_FIMD
89 static struct s3c_fb_pd_win smdk5250_fb_win0 = {
101 .virtual_y = 800 * 2,
108 static struct s3c_fb_pd_win smdk5250_fb_win1 = {
120 .virtual_y = 800 * 2,
127 static struct s3c_fb_pd_win smdk5250_fb_win2 = {
139 .virtual_y = 800 * 2,
148 * - 70000000. / ((1366 + 34 + 34 + 32) * (768 + 10 + 12 + 6))
151 static struct fb_videomode snow_fb_window[] = {
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 */
180 __raw_writel(reg, S3C_VA_SYS + 0x0214);
183 static void exynos_dp_gpio_setup_24bpp(void)
185 exynos_fimd_gpio_setup_24bpp();
187 /* Set Hotplug detect for DP */
188 gpio_request(EXYNOS5_GPX0(7), "DP hotplug");
189 s3c_gpio_cfgpin(EXYNOS5_GPX0(7), S3C_GPIO_SFN(3));
192 #ifdef CONFIG_DRM_EXYNOS_HDMI
193 static struct platform_device exynos_drm_hdmi_device = {
194 .name = "exynos-drm-hdmi",
197 static struct exynos_drm_hdmi_pdata drm_mixer_pdata = {
209 static struct exynos_drm_hdmi_pdata drm_hdmi_pdata = {
222 #ifdef CONFIG_DRM_EXYNOS_FIMD
223 static struct exynos_drm_fimd_pdata smdk5250_lcd1_pdata = {
250 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
251 .vidcon1 = VIDCON1_INV_VCLK,
254 .clock_rate = 800 * 1000 * 1000,
257 static struct s3c_fb_platdata smdk5250_lcd1_pdata __initdata = {
258 .win[0] = &smdk5250_fb_win0,
259 .win[1] = &smdk5250_fb_win1,
260 .win[2] = &smdk5250_fb_win2,
262 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
263 .vidcon1 = VIDCON1_INV_VCLK,
264 .setup_gpio = exynos_fimd_gpio_setup_24bpp,
265 .clock_rate = 800 * 1000 * 1000,
269 static struct mipi_dsim_config dsim_info = {
270 .e_interface = DSIM_VIDEO,
271 .e_pixel_format = DSIM_24BPP_888,
272 /* main frame fifo auto flush at VSYNC pulse */
274 .eot_disable = false,
275 .auto_vertical_cnt = false,
281 .e_no_data_lane = DSIM_DATA_LANE_4,
282 .e_byte_clk = DSIM_PLL_OUT_DIV8,
283 .e_burst_mode = DSIM_BURST,
289 /* D-PHY PLL stable time spec :min = 200usec ~ max 400usec */
290 .pll_stable_time = 500,
292 .esc_clk = 0.4 * 1000000, /* escape clk : 10MHz */
294 /* stop state holding counter after bta change count 0 ~ 0xfff */
295 .stop_holding_cnt = 0x0f,
296 .bta_timeout = 0xff, /* bta timeout 0 ~ 0xff */
297 .rx_timeout = 0xffff, /* lp rx timeout 0 ~ 0xffff */
299 .dsim_ddi_pd = &tc358764_mipi_lcd_driver,
302 static struct mipi_dsim_lcd_config dsim_lcd_info = {
303 .rgb_timing.left_margin = 0x4,
304 .rgb_timing.right_margin = 0x4,
305 .rgb_timing.upper_margin = 0x4,
306 .rgb_timing.lower_margin = 0x4,
307 .rgb_timing.hsync_len = 0x4,
308 .rgb_timing.vsync_len = 0x4,
309 .cpu_timing.cs_setup = 0,
310 .cpu_timing.wr_setup = 1,
311 .cpu_timing.wr_act = 0,
312 .cpu_timing.wr_hold = 0,
313 .lcd_size.width = 1280,
314 .lcd_size.height = 800,
317 static struct s5p_platform_mipi_dsim dsim_platform_data = {
319 .dsim_config = &dsim_info,
320 .dsim_lcd_config = &dsim_lcd_info,
322 .part_reset = s5p_dsim_part_reset,
323 .init_d_phy = s5p_dsim_init_d_phy,
324 .get_fb_frame_done = NULL,
328 * the stable time of needing to write data on SFR
329 * when the mipi mode becomes LP mode.
331 .delay_for_stabilization = 600,
334 static struct platform_device exynos_drm_device = {
335 .name = "exynos-drm",
337 .dma_mask = &exynos_drm_device.dev.coherent_dma_mask,
338 .coherent_dma_mask = 0xffffffffUL,
342 static void exynos_wifi_bt_set_power(u32, u32); /* TODO(sleffler) hack */
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 */
392 exynos_wifi_bt_set_power(0, power); /* TODO(sleffler) hack */
395 static int smdk5250_match_fb(struct plat_lcd_data *pd, struct fb_info *info)
397 /* Don't call .set_power callback while unblanking */
401 static struct plat_lcd_data smdk5250_lcd_data = {
402 .set_power = lcd_set_power,
403 .match_fb = smdk5250_match_fb,
406 static struct platform_device smdk5250_lcd = {
407 .name = "platform-lcd",
408 .dev.platform_data = &smdk5250_lcd_data,
411 static int smdk5250_bl_notify(struct device *unused, int brightness)
413 /* manage lcd_bl_en signal */
415 gpio_set_value(EXYNOS5_GPX3(0), 1);
417 gpio_set_value(EXYNOS5_GPX3(0), 0);
422 /* LCD Backlight data */
423 static struct samsung_bl_gpio_info smdk5250_bl_gpio_info = {
424 .no = EXYNOS5_GPB2(0),
425 .func = S3C_GPIO_SFN(2),
428 static struct platform_pwm_backlight_data smdk5250_bl_data = {
429 .pwm_period_ns = 1000000,
430 .notify = smdk5250_bl_notify,
433 struct platform_device exynos_device_md0 = {
434 .name = "exynos-mdev",
438 struct platform_device exynos_device_md1 = {
439 .name = "exynos-mdev",
443 struct platform_device exynos_device_md2 = {
444 .name = "exynos-mdev",
448 static struct regulator_consumer_supply wm8994_avdd1_supply =
449 REGULATOR_SUPPLY("AVDD1", "1-001a");
451 static struct regulator_consumer_supply wm8994_dcvdd_supply =
452 REGULATOR_SUPPLY("DCVDD", "1-001a");
454 static struct regulator_init_data wm8994_ldo1_data = {
458 .num_consumer_supplies = 1,
459 .consumer_supplies = &wm8994_avdd1_supply,
462 static struct regulator_init_data wm8994_ldo2_data = {
466 .num_consumer_supplies = 1,
467 .consumer_supplies = &wm8994_dcvdd_supply,
470 static struct wm8994_pdata wm8994_platform_data = {
471 /* configure gpio1 function: 0x0001(Logic level input/output) */
472 .gpio_defaults[0] = 0x0001,
473 /* If the i2s0 and i2s2 is enabled simultaneously */
474 .gpio_defaults[7] = 0x8100, /* GPIO8 DACDAT3 in */
475 .gpio_defaults[8] = 0x0100, /* GPIO9 ADCDAT3 out */
476 .gpio_defaults[9] = 0x0100, /* GPIO10 LRCLK3 out */
477 .gpio_defaults[10] = 0x0100,/* GPIO11 BCLK3 out */
478 .ldo[0] = { 0, &wm8994_ldo1_data },
479 .ldo[1] = { 0, &wm8994_ldo2_data },
482 static struct i2c_board_info i2c_devs1[] __initdata = {
484 I2C_BOARD_INFO("wm8994", 0x1a),
485 .platform_data = &wm8994_platform_data,
489 static struct s3c64xx_spi_csinfo spi1_csi[] = {
491 .line = EXYNOS5_GPA2(5),
496 static struct spi_board_info spi1_board_info[] __initdata = {
498 .modalias = "spidev",
499 .platform_data = NULL,
500 .max_speed_hz = 10*1000*1000,
504 .controller_data = spi1_csi,
508 struct sysmmu_platform_data platdata_sysmmu_mfc_l = {
510 .clockname = "sysmmu",
513 struct sysmmu_platform_data platdata_sysmmu_mfc_r = {
515 .clockname = "sysmmu",
518 struct sysmmu_platform_data platdata_sysmmu_gsc = {
520 .clockname = "sysmmu",
523 struct sysmmu_platform_data platdata_sysmmu_g2d = {
525 .clockname = "sysmmu",
528 struct sysmmu_platform_data platdata_sysmmu_fimd = {
530 .clockname = "sysmmu",
533 struct sysmmu_platform_data platdata_sysmmu_tv = {
535 .clockname = "sysmmu",
538 #ifdef CONFIG_VIDEO_FIMG2D4X
539 static struct fimg2d_platdata fimg2d_data __initdata = {
541 .gate_clkname = "fimg2d",
545 static struct exynos4_ohci_platdata smdk5250_ohci_pdata = {
546 .phy_init = s5p_usb_phy_init,
547 .phy_exit = s5p_usb_phy_exit,
550 static struct s5p_ehci_platdata smdk5250_ehci_pdata = {
551 .phy_init = s5p_usb_phy_init,
552 .phy_exit = s5p_usb_phy_exit,
555 static struct dwc3_exynos_data smdk5250_xhci_pdata = {
556 .phy_type = S5P_USB_PHY_DRD,
557 .phy_init = s5p_usb_phy_init,
558 .phy_exit = s5p_usb_phy_exit,
559 .phyclk_switch = exynos5_dwc_phyclk_switch,
562 struct exynos_gpio_cfg {
568 static const char *rclksrc[] = {
573 static struct video_info smdk5250_dp_config = {
574 .name = "eDP-LVDS NXP PTN3460",
576 .h_sync_polarity = 0,
577 .v_sync_polarity = 0,
580 .color_space = COLOR_RGB,
581 .dynamic_range = VESA,
582 .ycbcr_coeff = COLOR_YCBCR601,
583 .color_depth = COLOR_8,
585 .link_rate = LINK_RATE_2_70GBPS,
586 .lane_count = LANE_COUNT2,
589 static struct exynos_dp_platdata smdk5250_dp_data = {
590 .video_info = &smdk5250_dp_config,
591 .training_type = SW_LINK_TRAINING,
592 .phy_init = s5p_dp_phy_init,
593 .phy_exit = s5p_dp_phy_exit,
596 #define S5P_PMU_DEBUG S5P_PMUREG(0x0A00)
597 /* PMU_DEBUG bits [12:8] = 0x10000 selects XXTI clock source */
598 #define PMU_DEBUG_XXTI (0x10 << 8)
599 /* Mask bit[12:8] for xxti clock selection */
600 #define PMU_DEBUG_CLKOUT_SEL_MASK 0x1f00
602 static void __init enable_xclkout(void)
606 tmp = readl(S5P_PMU_DEBUG);
607 tmp &= ~PMU_DEBUG_CLKOUT_SEL_MASK;
608 tmp |= PMU_DEBUG_XXTI;
609 writel(tmp, S5P_PMU_DEBUG);
612 static int exynos_cfg_i2s_gpio(struct platform_device *pdev)
615 /* configure GPIO for i2s port */
616 struct exynos_gpio_cfg exynos5_cfg[3] = {
617 { EXYNOS5_GPZ(0), 7, S3C_GPIO_SFN(2) },
618 { EXYNOS5_GPB0(0), 5, S3C_GPIO_SFN(2) },
619 { EXYNOS5_GPB1(0), 5, S3C_GPIO_SFN(2) }
622 if (pdev->dev.of_node) {
623 id = of_alias_get_id(pdev->dev.of_node, "i2s");
625 dev_err(&pdev->dev, "failed to get alias id:%d\n", id);
630 if (id < 0 || id > 2) {
631 printk(KERN_ERR "Invalid Device %d\n", id);
635 s3c_gpio_cfgpin_range(exynos5_cfg[id].addr,
636 exynos5_cfg[id].num, exynos5_cfg[id].bit);
641 static struct s3c_audio_pdata i2sv5_pdata = {
642 .cfg_gpio = exynos_cfg_i2s_gpio,
645 .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI
648 .idma_addr = EXYNOS4_AUDSS_INT_MEM,
654 * Hack to do power-on sequence after the 32khz SLP_CLK is
655 * running as doing this entirely in the DT is problematic.
656 * We attach an auxdata record to dw_mmc2 with a set_power
657 * method that frobs the regulators. This work is not board
658 * specific but must be done before the device is recognized
659 * so cannot go in the driver.
661 static bool enable_mwi87xx(void)
663 struct regulator *wifi_en, *wifi_rst;
666 wifi_en = regulator_get(NULL, "wifi-en");
667 wifi_rst = regulator_get(NULL, "wifi-rst-l");
668 ok = !IS_ERR(wifi_en) && !IS_ERR(wifi_rst);
671 * This assumes SLP_CLK is enabled and stable by the
672 * time we get here. Also any delay required between
673 * RESETn and PDn should be set in startup-delay-us
676 regulator_enable(wifi_rst);
677 regulator_enable(wifi_en);
680 if (!IS_ERR(wifi_rst))
681 regulator_put(wifi_rst);
682 if (!IS_ERR(wifi_en))
683 regulator_put(wifi_en);
687 static void exynos_wifi_bt_set_power(u32 slot_id, u32 volt)
689 if (volt == 0 || (!of_machine_is_compatible("google,snow") &&
690 !of_machine_is_compatible("google,daisy")))
692 if (!enable_mwi87xx())
693 pr_err("%s: problem enabling WiFi+BT\n", __func__);
694 /* NB: bt-reset-l is tied to wifi-rst-l so BT should be ready too */
698 /* NTC Thermistor. Attached to S3C-ADC in some Samsung SoC Devices */
699 struct s3c_adc_client *ntc_adc_clients[4];
700 struct mutex ntc_adc_locks[] = {
701 __MUTEX_INITIALIZER(ntc_adc_locks[0]),
702 __MUTEX_INITIALIZER(ntc_adc_locks[1]),
703 __MUTEX_INITIALIZER(ntc_adc_locks[2]),
704 __MUTEX_INITIALIZER(ntc_adc_locks[3]),
707 static int __init s3c_adc_ntc_init(struct platform_device *pdev)
709 struct s3c_adc_client *ntc_adc_client;
711 ntc_adc_client = s3c_adc_register(pdev, NULL, NULL, 0);
712 if (IS_ERR(ntc_adc_client))
713 return PTR_ERR(ntc_adc_client);
715 ntc_adc_clients[pdev->id] = ntc_adc_client;
721 * read_thermistor_uV: is a call back from ntc_thermistor driver.
722 * returns the temperature of the thermistor in celsius
724 static int read_thermistor_uV(struct platform_device *pdev)
726 static unsigned int ntc_adc_ports[] = {3, 4, 5, 6};
728 unsigned int port = ntc_adc_ports[pdev->id];
729 struct s3c_adc_client *client = ntc_adc_clients[pdev->id];
730 struct ntc_thermistor_platform_data *pdata = pdev->dev.platform_data;
731 struct mutex *lock = ntc_adc_locks + pdev->id;
734 /* Arrays are sized; make sure we haven't blown over */
735 BUG_ON(pdev->id >= ARRAY_SIZE(ntc_adc_locks));
738 * s3c_adc_read() assumes two processes aren't using the same client
739 * at the same time (yes, it's a bad design), so grab a per-client
740 * mutex to ensure this is OK.
743 ret = s3c_adc_read(client, port);
747 dev_warn(&pdev->dev, "Thermistor read err: 0x%08x\n", ret);
751 converted = pdata->pullup_uV * (s64) ret;
754 return (int) converted;
757 static struct ntc_thermistor_platform_data ntc_adc_pdata = {
758 .read_uV = read_thermistor_uV,
759 .pullup_uV = 1800000, /* voltage of vdd for ADC */
762 .connect = NTC_CONNECTED_GROUND,
765 struct platform_device s3c_device_adc_ntc_thermistor0 = {
766 .name = "ncp15wb473",
769 .platform_data = &ntc_adc_pdata,
773 struct platform_device s3c_device_adc_ntc_thermistor1 = {
774 .name = "ncp15wb473",
777 .platform_data = &ntc_adc_pdata,
781 struct platform_device s3c_device_adc_ntc_thermistor2 = {
782 .name = "ncp15wb473",
785 .platform_data = &ntc_adc_pdata,
789 struct platform_device s3c_device_adc_ntc_thermistor3 = {
790 .name = "ncp15wb473",
793 .platform_data = &ntc_adc_pdata,
798 * The following lookup table is used to override device names when devices
799 * are registered from device tree. This is temporarily added to enable
800 * device tree support addition for the EXYNOS5 architecture.
802 * For drivers that require platform data to be provided from the machine
803 * file, a platform data pointer can also be supplied along with the
804 * devices names. Usually, the platform data elements that cannot be parsed
805 * from the device tree by the drivers (example: function pointers) are
806 * supplied. But it should be noted that this is a temporary mechanism and
807 * at some point, the drivers should be capable of parsing all the platform
808 * data from the device tree.
810 static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
811 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART0,
812 "exynos4210-uart.0", NULL),
813 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART1,
814 "exynos4210-uart.1", NULL),
815 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART2,
816 "exynos4210-uart.2", NULL),
817 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART3,
818 "exynos4210-uart.3", NULL),
819 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(0),
820 "s3c2440-i2c.0", NULL),
821 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(1),
822 "s3c2440-i2c.1", NULL),
823 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(2),
824 "s3c2440-i2c.2", NULL),
825 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(3),
826 "s3c2440-i2c.3", NULL),
827 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(4),
828 "s3c2440-i2c.4", NULL),
829 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(5),
830 "s3c2440-i2c.5", NULL),
831 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(6),
832 "s3c2440-i2c.6", NULL),
833 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(7),
834 "s3c2440-i2c.7", NULL),
835 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(8),
836 "s3c2440-hdmiphy-i2c", NULL),
837 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI0,
838 "exynos4210-spi.0", NULL),
839 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI1,
840 "exynos4210-spi.1", NULL),
841 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI2,
842 "exynos4210-spi.2", NULL),
843 OF_DEV_AUXDATA("synopsis,dw-mshc-exynos5250", 0x12200000,
845 OF_DEV_AUXDATA("synopsis,dw-mshc-exynos5250", 0x12210000,
847 OF_DEV_AUXDATA("synopsis,dw-mshc-exynos5250", 0x12220000,
849 OF_DEV_AUXDATA("synopsis,dw-mshc-exynos5250", 0x12230000,
851 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL),
852 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL),
853 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL),
854 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x10A60000,
855 "s5p-sysmmu.2", &platdata_sysmmu_g2d),
856 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x11210000,
857 "s5p-sysmmu.3", &platdata_sysmmu_mfc_l),
858 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x11200000,
859 "s5p-sysmmu.4", &platdata_sysmmu_mfc_r),
860 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x14640000,
861 "s5p-sysmmu.27", &platdata_sysmmu_fimd),
862 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x14650000,
863 "s5p-sysmmu.28", &platdata_sysmmu_tv),
864 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x13E80000,
865 "s5p-sysmmu.23", &platdata_sysmmu_gsc),
866 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x13E90000,
867 "s5p-sysmmu.24", &platdata_sysmmu_gsc),
868 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x13EA0000,
869 "s5p-sysmmu.25", &platdata_sysmmu_gsc),
870 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x13EB0000,
871 "s5p-sysmmu.26", &platdata_sysmmu_gsc),
872 OF_DEV_AUXDATA("samsung,exynos5-fb", 0x14400000,
873 "exynos5-fb", &smdk5250_lcd1_pdata),
874 OF_DEV_AUXDATA("samsung,exynos5-mipi", 0x14500000,
875 "s5p-mipi-dsim", &dsim_platform_data),
876 OF_DEV_AUXDATA("samsung,exynos5-dp", 0x145B0000,
877 "s5p-dp", &smdk5250_dp_data),
878 OF_DEV_AUXDATA("samsung,s5p-mfc-v6", 0x11000000, "s5p-mfc-v6", NULL),
879 OF_DEV_AUXDATA("samsung,exynos-gsc", 0x13E00000,
880 "exynos-gsc.0", NULL),
881 OF_DEV_AUXDATA("samsung,exynos-gsc", 0x13E10000,
882 "exynos-gsc.1", NULL),
883 OF_DEV_AUXDATA("samsung,exynos-gsc", 0x13E20000,
884 "exynos-gsc.2", NULL),
885 OF_DEV_AUXDATA("samsung,exynos-gsc", 0x13E30000,
886 "exynos-gsc.3", NULL),
887 #ifdef CONFIG_VIDEO_FIMG2D4X
888 OF_DEV_AUXDATA("samsung,s5p-g2d", 0x10850000,
889 "s5p-g2d", &fimg2d_data),
891 OF_DEV_AUXDATA("samsung,exynos-ohci", 0x12120000,
892 "exynos-ohci", &smdk5250_ohci_pdata),
893 OF_DEV_AUXDATA("samsung,exynos-ehci", 0x12110000,
894 "s5p-ehci", &smdk5250_ehci_pdata),
895 OF_DEV_AUXDATA("samsung,exynos-xhci", 0x12000000,
896 "exynos-dwc3", &smdk5250_xhci_pdata),
897 OF_DEV_AUXDATA("samsung,i2s", 0x03830000,
898 "samsung-i2s.0", &i2sv5_pdata),
899 #ifdef CONFIG_DRM_EXYNOS_HDMI
900 OF_DEV_AUXDATA("samsung,exynos5-hdmi", 0x14530000,
901 "exynos5-hdmi", &drm_hdmi_pdata),
902 OF_DEV_AUXDATA("samsung,s5p-mixer", 0x14450000,
903 "s5p-mixer", &drm_mixer_pdata),
905 OF_DEV_AUXDATA("samsung,exynos5-hdmi", 0x14530000,
906 "exynos5-hdmi", NULL),
907 OF_DEV_AUXDATA("samsung,s5p-mixer", 0x14450000,
913 #ifdef CONFIG_BUSFREQ_OPP
914 /* BUSFREQ to control memory/bus*/
915 static struct device_domain busfreq;
917 static struct platform_device exynos5_busfreq = {
919 .name = "exynos-busfreq",
923 static struct platform_device *smdk5250_devices[] __initdata = {
924 &smdk5250_lcd, /* for platform_lcd device */
925 &exynos_device_md0, /* for media device framework */
926 &exynos_device_md1, /* for media device framework */
927 &exynos_device_md2, /* for media device framework */
928 &samsung_asoc_dma, /* for audio dma interface device */
930 #ifdef CONFIG_DRM_EXYNOS_HDMI
931 &exynos_drm_hdmi_device,
933 &s3c_device_adc_ntc_thermistor0,
934 &s3c_device_adc_ntc_thermistor1,
935 &s3c_device_adc_ntc_thermistor2,
936 &s3c_device_adc_ntc_thermistor3,
937 #ifdef CONFIG_BUSFREQ_OPP
942 static struct regulator_consumer_supply dummy_supplies[] = {
943 REGULATOR_SUPPLY("vddvario", "7000000.lan9215"),
944 REGULATOR_SUPPLY("vdd33a", "7000000.lan9215"),
947 static void __init exynos5250_dt_map_io(void)
949 exynos_init_io(NULL, 0);
950 s3c24xx_init_clocks(24000000);
953 static unsigned long ramoops_dt_start, ramoops_dt_size;
954 static int __init init_dt_scan_ramoops(unsigned long node, const char *uname,
955 int depth, void *data)
960 if (!of_flat_dt_is_compatible(node, "ramoops"))
963 reg = of_get_flat_dt_prop(node, "reg", &l);
966 endp = reg + (l / sizeof(__be32));
968 /* This architecture uses single cells for address and size.
969 * Other architectures may differ. */
970 ramoops_dt_start = be32_to_cpu(reg[0]);
971 ramoops_dt_size = be32_to_cpu(reg[1]);
975 static void __init exynos5_ramoops_reserve(void)
977 unsigned long start, size;
979 of_scan_flat_dt(init_dt_scan_ramoops, NULL);
981 /* If necessary, lower start and raise size to align to 1M. */
982 start = round_down(ramoops_dt_start, SZ_1M);
983 size = ramoops_dt_size + ramoops_dt_start - start;
984 size = round_up(size, SZ_1M);
986 if (memblock_remove(start, size)) {
987 pr_err("Failed to remove ramoops %08lx@%08lx from memory\n",
990 pr_info("Ramoops: %08lx - %08lx\n", start, start + size - 1);
994 static void __init exynos5_reserve(void)
996 /* required to have enough address range to remap the IOMMU
997 * allocated buffers */
998 init_consistent_dma_size(SZ_64M);
1000 exynos5_ramoops_reserve();
1003 static void s5p_tv_setup(void)
1005 /* direct HPD to HDMI chip */
1006 gpio_request(EXYNOS5_GPX3(7), "hpd-plug");
1008 gpio_direction_input(EXYNOS5_GPX3(7));
1009 s3c_gpio_cfgpin(EXYNOS5_GPX3(7), S3C_GPIO_SFN(0x3));
1010 s3c_gpio_setpull(EXYNOS5_GPX3(7), S3C_GPIO_PULL_NONE);
1013 static void exynos5_i2c_setup(void)
1015 /* Setup the low-speed i2c controller interrupts */
1016 writel(0x0, EXYNOS5_SYS_I2C_CFG);
1019 static void __init exynos5250_dt_machine_init(void)
1021 struct device_node *srom_np, *np;
1024 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
1026 /* Setup pins for any SMSC 911x controller on the SROMC bus */
1027 srom_np = of_find_node_by_path("/sromc-bus");
1029 printk(KERN_ERR "No /sromc-bus property.\n");
1032 for_each_child_of_node(srom_np, np) {
1033 if (of_device_is_compatible(np, "smsc,lan9115")) {
1035 of_property_read_u32(np, "reg", ®);
1041 * Request lcd_bl_en GPIO for smdk5250_bl_notify().
1042 * TODO: Fix this so we are not at risk of requesting the GPIO
1043 * multiple times, this should be done with device tree, and
1044 * likely integrated into the plat-samsung/dev-backlight.c init.
1046 gpio_request_one(EXYNOS5_GPX3(0), GPIOF_OUT_INIT_HIGH, "lcd_bl_en");
1048 samsung_bl_set(&smdk5250_bl_gpio_info, &smdk5250_bl_data);
1051 * HACK ALERT! TODO: FIXME!
1053 * We're going to hack in Daisy LCD info here for bringup purposes.
1054 * Lots of things wrong with what we're doing here, but it works for
1058 if (of_machine_is_compatible("google,daisy")) {
1059 #ifdef CONFIG_DRM_EXYNOS_FIMD
1060 smdk5250_lcd1_pdata.panel[0].timing.xres = 1366;
1061 smdk5250_lcd1_pdata.panel[0].timing.yres = 768;
1062 smdk5250_lcd1_pdata.panel[1].timing.xres = 1280;
1063 smdk5250_lcd1_pdata.panel[1].timing.yres = 720;
1064 smdk5250_lcd1_pdata.panel[2].timing.xres = -1;
1065 smdk5250_lcd1_pdata.panel[2].timing.yres = -1;
1066 smdk5250_lcd1_pdata.panel_type = MIPI_LCD;
1068 smdk5250_fb_win0.win_mode.xres = 1366;
1069 smdk5250_fb_win0.win_mode.yres = 768;
1070 smdk5250_fb_win0.virtual_x = 1366;
1071 smdk5250_fb_win0.virtual_y = 768 * 2;
1073 smdk5250_fb_win1.win_mode.xres = 1366;
1074 smdk5250_fb_win1.win_mode.yres = 768;
1075 smdk5250_fb_win1.virtual_x = 1366;
1076 smdk5250_fb_win1.virtual_y = 768 * 2;
1078 smdk5250_fb_win2.win_mode.xres = 1366;
1079 smdk5250_fb_win2.win_mode.yres = 768;
1080 smdk5250_fb_win2.virtual_x = 1366;
1081 smdk5250_fb_win2.virtual_y = 768 * 2;
1083 dsim_lcd_info.lcd_size.width = 1366;
1084 dsim_lcd_info.lcd_size.height = 768;
1085 } else if (of_machine_is_compatible("google,snow")) {
1086 #ifdef CONFIG_DRM_EXYNOS_FIMD
1087 for (i = 0;i < ARRAY_SIZE(snow_fb_window);i++)
1088 smdk5250_lcd1_pdata.panel[i].timing = snow_fb_window[i];
1090 smdk5250_lcd1_pdata.panel_type = DP_LCD;
1091 smdk5250_lcd1_pdata.clock_rate = 70000000;
1092 smdk5250_lcd1_pdata.vidcon1 = 0;
1096 if (gpio_request_one(EXYNOS5_GPX2(6), GPIOF_OUT_INIT_HIGH,
1097 "HOST_VBUS_CONTROL")) {
1098 printk(KERN_ERR "failed to request gpio_host_vbus\n");
1100 s3c_gpio_setpull(EXYNOS5_GPX2(6), S3C_GPIO_PULL_NONE);
1101 gpio_free(EXYNOS5_GPX2(6));
1104 exynos5_i2c_setup();
1107 * MAX77686 PMIC interrupt setup code
1108 * TODO: Convert the device tree wakeup_int domain to support
1111 s3c_gpio_setpull(EXYNOS5_GPX3(2), S3C_GPIO_PULL_NONE);
1114 * BIG HACK: The wm8994 is not device tree enabled apparently, so
1115 * needs to be added manually. ...but it's only on SMDK5250.
1117 if (of_machine_is_compatible("samsung,smdk5250")) {
1118 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
1121 /* XCLKOUT needs to be moved over to the clock interface, but enable it
1126 if (gpio_request_one(EXYNOS5_GPA2(5), GPIOF_OUT_INIT_HIGH, "SPI1_CS")) {
1127 printk(KERN_ERR "Spidev ChipSelect unavailable\n");
1129 s3c_gpio_cfgpin(EXYNOS5_GPA2(5), S3C_GPIO_SFN(0x1));
1130 s3c_gpio_setpull(EXYNOS5_GPA2(5), S3C_GPIO_PULL_NONE);
1131 s5p_gpio_set_drvstr(EXYNOS5_GPA2(5), S5P_GPIO_DRVSTR_LV4);
1132 spi_register_board_info(spi1_board_info,
1133 ARRAY_SIZE(spi1_board_info));
1136 of_platform_populate(NULL, of_default_bus_match_table,
1137 exynos5250_auxdata_lookup, NULL);
1139 #ifdef CONFIG_DRM_EXYNOS_FIMD
1140 if (of_machine_is_compatible("google,snow"))
1141 exynos_dp_gpio_setup_24bpp();
1143 exynos_fimd_gpio_setup_24bpp();
1147 /* Enable power to ADC */
1148 __raw_writel(0x1, S5P_ADC_PHY_CONTROL);
1150 s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor0);
1151 s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor1);
1152 s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor2);
1153 s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor3);
1155 #ifdef CONFIG_BUSFREQ_OPP
1156 dev_add(&busfreq, &exynos5_busfreq.dev);
1157 ppmu_init(&exynos_ppmu[PPMU_CPU], &exynos5_busfreq.dev);
1158 ppmu_init(&exynos_ppmu[PPMU_DDR_C], &exynos5_busfreq.dev);
1159 ppmu_init(&exynos_ppmu[PPMU_DDR_R1], &exynos5_busfreq.dev);
1160 ppmu_init(&exynos_ppmu[PPMU_DDR_L], &exynos5_busfreq.dev);
1161 ppmu_init(&exynos_ppmu[PPMU_RIGHT0_BUS], &exynos5_busfreq.dev);
1163 platform_add_devices(smdk5250_devices, ARRAY_SIZE(smdk5250_devices));
1165 of_node_put(srom_np);
1169 static char const *exynos5250_dt_compat[] __initdata = {
1170 "samsung,exynos5250",
1174 DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
1175 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
1176 .init_irq = exynos5_init_irq,
1177 .reserve = exynos5_reserve,
1178 .map_io = exynos5250_dt_map_io,
1179 .handle_irq = gic_handle_irq,
1180 .init_machine = exynos5250_dt_machine_init,
1181 .timer = &exynos4_timer,
1182 .dt_compat = exynos5250_dt_compat,
1183 .restart = exynos5_restart,