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>
33 #include <mach/bitfix-snow.h>
35 #include <mach/ppmu.h>
37 #include <mach/ohci.h>
38 #include <mach/regs-pmu.h>
39 #include <mach/sysmmu.h>
40 #include <mach/ohci.h>
41 #include <mach/regs-audss.h>
42 #include <mach/regs-pmu.h>
44 #include <plat/audio.h>
45 #include <plat/adc.h> /* for s3c_adc_register and friends */
47 #include <plat/dsim.h>
49 #include <plat/mipi_dsi.h>
50 #include <plat/gpio-cfg.h>
51 #include <plat/regs-fb.h>
52 #include <plat/regs-serial.h>
53 #include <plat/regs-srom.h>
54 #include <plat/backlight.h>
55 #include <plat/devs.h>
56 #include <plat/usb-phy.h>
57 #include <plat/ehci.h>
59 #include <plat/s3c64xx-spi.h>
61 #include <video/platform_lcd.h>
63 #include "drm/exynos_drm.h"
66 static void __init smsc911x_init(int ncs)
70 /* configure nCS1 width to 16 bits */
71 data = __raw_readl(S5P_SROM_BW) &
72 ~(S5P_SROM_BW__CS_MASK << (ncs * 4));
73 data |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) |
74 (1 << S5P_SROM_BW__WAITENABLE__SHIFT) |
75 (1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) << (ncs * 4);
76 __raw_writel(data, S5P_SROM_BW);
78 /* set timing for nCS1 suitable for ethernet chip */
79 __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) |
80 (0x9 << S5P_SROM_BCX__TACP__SHIFT) |
81 (0xc << S5P_SROM_BCX__TCAH__SHIFT) |
82 (0x1 << S5P_SROM_BCX__TCOH__SHIFT) |
83 (0x6 << S5P_SROM_BCX__TACC__SHIFT) |
84 (0x1 << S5P_SROM_BCX__TCOS__SHIFT) |
85 (0x1 << S5P_SROM_BCX__TACS__SHIFT),
86 S5P_SROM_BC0 + (ncs * 4));
89 #ifndef CONFIG_DRM_EXYNOS_FIMD
90 static struct s3c_fb_pd_win smdk5250_fb_win0 = {
102 .virtual_y = 800 * 2,
109 static struct s3c_fb_pd_win smdk5250_fb_win1 = {
121 .virtual_y = 800 * 2,
128 static struct s3c_fb_pd_win smdk5250_fb_win2 = {
140 .virtual_y = 800 * 2,
149 * - 70250000. / ((1366 + 40 + 40 + 32) * (768 + 10 + 10 + 5))
150 * - 59.93751141159025
151 * - 70500000. / ((1366 + 40 + 40 + 32) * (768 + 10 + 10 + 5))
152 * - 60.150812163944664
153 * - 70500000. / ((1366 + 40 + 40 + 32) * (768 + 10 + 12 + 6))
156 static struct fb_videomode snow_fb_window = {
166 .pixclock = 70500000,
169 static void exynos_fimd_gpio_setup_24bpp(void)
171 unsigned int reg = 0;
174 * Set DISP1BLK_CFG register for Display path selection
175 * FIMD of DISP1_BLK Bypass selection : DISP1BLK_CFG[15]
176 * ---------------------
178 * 1 | FIMD : selected
180 reg = __raw_readl(S3C_VA_SYS + 0x0214);
181 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 = {
239 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
240 .vidcon1 = VIDCON1_INV_VCLK,
243 .clock_rate = 800 * 1000 * 1000,
246 static struct s3c_fb_platdata smdk5250_lcd1_pdata __initdata = {
247 .win[0] = &smdk5250_fb_win0,
248 .win[1] = &smdk5250_fb_win1,
249 .win[2] = &smdk5250_fb_win2,
251 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
252 .vidcon1 = VIDCON1_INV_VCLK,
253 .setup_gpio = exynos_fimd_gpio_setup_24bpp,
254 .clock_rate = 800 * 1000 * 1000,
258 static struct mipi_dsim_config dsim_info = {
259 .e_interface = DSIM_VIDEO,
260 .e_pixel_format = DSIM_24BPP_888,
261 /* main frame fifo auto flush at VSYNC pulse */
263 .eot_disable = false,
264 .auto_vertical_cnt = false,
270 .e_no_data_lane = DSIM_DATA_LANE_4,
271 .e_byte_clk = DSIM_PLL_OUT_DIV8,
272 .e_burst_mode = DSIM_BURST,
278 /* D-PHY PLL stable time spec :min = 200usec ~ max 400usec */
279 .pll_stable_time = 500,
281 .esc_clk = 0.4 * 1000000, /* escape clk : 10MHz */
283 /* stop state holding counter after bta change count 0 ~ 0xfff */
284 .stop_holding_cnt = 0x0f,
285 .bta_timeout = 0xff, /* bta timeout 0 ~ 0xff */
286 .rx_timeout = 0xffff, /* lp rx timeout 0 ~ 0xffff */
288 .dsim_ddi_pd = &tc358764_mipi_lcd_driver,
291 static struct mipi_dsim_lcd_config dsim_lcd_info = {
292 .rgb_timing.left_margin = 0x4,
293 .rgb_timing.right_margin = 0x4,
294 .rgb_timing.upper_margin = 0x4,
295 .rgb_timing.lower_margin = 0x4,
296 .rgb_timing.hsync_len = 0x4,
297 .rgb_timing.vsync_len = 0x4,
298 .cpu_timing.cs_setup = 0,
299 .cpu_timing.wr_setup = 1,
300 .cpu_timing.wr_act = 0,
301 .cpu_timing.wr_hold = 0,
302 .lcd_size.width = 1280,
303 .lcd_size.height = 800,
306 static struct s5p_platform_mipi_dsim dsim_platform_data = {
308 .dsim_config = &dsim_info,
309 .dsim_lcd_config = &dsim_lcd_info,
311 .part_reset = s5p_dsim_part_reset,
312 .init_d_phy = s5p_dsim_init_d_phy,
313 .get_fb_frame_done = NULL,
317 * the stable time of needing to write data on SFR
318 * when the mipi mode becomes LP mode.
320 .delay_for_stabilization = 600,
323 static struct platform_device exynos_drm_device = {
324 .name = "exynos-drm",
326 .dma_mask = &exynos_drm_device.dev.coherent_dma_mask,
327 .coherent_dma_mask = 0xffffffffUL,
331 static void exynos_wifi_bt_set_power(u32, u32); /* TODO(sleffler) hack */
333 static void lcd_set_power(struct plat_lcd_data *pd,
336 if (of_machine_is_compatible("google,daisy") ||
337 of_machine_is_compatible("google,snow")) {
338 struct regulator *lcd_fet;
340 lcd_fet = regulator_get(NULL, "lcd_vdd");
341 if (!IS_ERR(lcd_fet)) {
343 regulator_enable(lcd_fet);
345 regulator_disable(lcd_fet);
347 regulator_put(lcd_fet);
351 if (!of_machine_is_compatible("google,snow")) {
353 gpio_request_one(EXYNOS5_GPX1(5), GPIOF_OUT_INIT_HIGH, "GPX1");
355 gpio_set_value(EXYNOS5_GPX1(5), 0);
357 gpio_set_value(EXYNOS5_GPX1(5), 1);
359 gpio_free(EXYNOS5_GPX1(5));
364 /* Turn on regulator for backlight */
365 if (of_machine_is_compatible("google,daisy") ||
366 of_machine_is_compatible("google,snow")) {
367 struct regulator *backlight_fet;
369 backlight_fet = regulator_get(NULL, "vcd_led");
370 if (!IS_ERR(backlight_fet)) {
372 regulator_enable(backlight_fet);
374 regulator_disable(backlight_fet);
376 regulator_put(backlight_fet);
378 /* Wait 10 ms between regulator on and PWM start per spec */
381 exynos_wifi_bt_set_power(0, power); /* TODO(sleffler) hack */
384 static int smdk5250_match_fb(struct plat_lcd_data *pd, struct fb_info *info)
386 /* Don't call .set_power callback while unblanking */
390 static struct plat_lcd_data smdk5250_lcd_data = {
391 .set_power = lcd_set_power,
392 .match_fb = smdk5250_match_fb,
395 static struct platform_device smdk5250_lcd = {
396 .name = "platform-lcd",
397 .dev.platform_data = &smdk5250_lcd_data,
400 static int smdk5250_bl_notify(struct device *unused, int brightness)
402 /* manage lcd_bl_en signal */
404 gpio_set_value(EXYNOS5_GPX3(0), 1);
406 gpio_set_value(EXYNOS5_GPX3(0), 0);
411 /* LCD Backlight data */
412 static struct samsung_bl_gpio_info smdk5250_bl_gpio_info = {
413 .no = EXYNOS5_GPB2(0),
414 .func = S3C_GPIO_SFN(2),
417 static struct platform_pwm_backlight_data smdk5250_bl_data = {
418 .pwm_period_ns = 1000000,
419 .notify = smdk5250_bl_notify,
422 struct platform_device exynos_device_md0 = {
423 .name = "exynos-mdev",
427 struct platform_device exynos_device_md1 = {
428 .name = "exynos-mdev",
432 struct platform_device exynos_device_md2 = {
433 .name = "exynos-mdev",
437 static struct regulator_consumer_supply wm8994_avdd1_supply =
438 REGULATOR_SUPPLY("AVDD1", "1-001a");
440 static struct regulator_consumer_supply wm8994_dcvdd_supply =
441 REGULATOR_SUPPLY("DCVDD", "1-001a");
443 static struct regulator_init_data wm8994_ldo1_data = {
447 .num_consumer_supplies = 1,
448 .consumer_supplies = &wm8994_avdd1_supply,
451 static struct regulator_init_data wm8994_ldo2_data = {
455 .num_consumer_supplies = 1,
456 .consumer_supplies = &wm8994_dcvdd_supply,
459 static struct wm8994_pdata wm8994_platform_data = {
460 /* configure gpio1 function: 0x0001(Logic level input/output) */
461 .gpio_defaults[0] = 0x0001,
462 /* If the i2s0 and i2s2 is enabled simultaneously */
463 .gpio_defaults[7] = 0x8100, /* GPIO8 DACDAT3 in */
464 .gpio_defaults[8] = 0x0100, /* GPIO9 ADCDAT3 out */
465 .gpio_defaults[9] = 0x0100, /* GPIO10 LRCLK3 out */
466 .gpio_defaults[10] = 0x0100,/* GPIO11 BCLK3 out */
467 .ldo[0] = { 0, &wm8994_ldo1_data },
468 .ldo[1] = { 0, &wm8994_ldo2_data },
471 static struct i2c_board_info i2c_devs1[] __initdata = {
473 I2C_BOARD_INFO("wm8994", 0x1a),
474 .platform_data = &wm8994_platform_data,
478 static struct s3c64xx_spi_csinfo spi1_csi[] = {
480 .line = EXYNOS5_GPA2(5),
485 static struct spi_board_info spi1_board_info[] __initdata = {
487 .modalias = "spidev",
488 .platform_data = NULL,
489 .max_speed_hz = 10*1000*1000,
493 .controller_data = spi1_csi,
497 struct sysmmu_platform_data platdata_sysmmu_mfc_l = {
499 .clockname = "sysmmu",
502 struct sysmmu_platform_data platdata_sysmmu_mfc_r = {
504 .clockname = "sysmmu",
507 struct sysmmu_platform_data platdata_sysmmu_gsc = {
509 .clockname = "sysmmu",
512 struct sysmmu_platform_data platdata_sysmmu_g2d = {
514 .clockname = "sysmmu",
517 struct sysmmu_platform_data platdata_sysmmu_fimd = {
519 .clockname = "sysmmu",
522 struct sysmmu_platform_data platdata_sysmmu_tv = {
524 .clockname = "sysmmu",
527 #ifdef CONFIG_VIDEO_FIMG2D4X
528 static struct fimg2d_platdata fimg2d_data __initdata = {
530 .gate_clkname = "fimg2d",
534 static struct exynos4_ohci_platdata smdk5250_ohci_pdata = {
535 .phy_init = s5p_usb_phy_init,
536 .phy_exit = s5p_usb_phy_exit,
539 static struct s5p_ehci_platdata smdk5250_ehci_pdata = {
540 .phy_init = s5p_usb_phy_init,
541 .phy_exit = s5p_usb_phy_exit,
544 static struct dwc3_exynos_data smdk5250_xhci_pdata = {
545 .phy_type = S5P_USB_PHY_DRD,
546 .phy_init = s5p_usb_phy_init,
547 .phy_exit = s5p_usb_phy_exit,
548 .phyclk_switch = exynos5_dwc_phyclk_switch,
549 .use_ext_clk = s5p_usb_phy_use_ext_clk,
552 struct exynos_gpio_cfg {
558 static const char *rclksrc[] = {
563 static struct video_info ptn3460_dp_config = {
564 .name = "eDP-LVDS NXP PTN3460",
566 .h_sync_polarity = 0,
567 .v_sync_polarity = 0,
570 .color_space = COLOR_RGB,
571 .dynamic_range = VESA,
572 .ycbcr_coeff = COLOR_YCBCR601,
573 .color_depth = COLOR_8,
575 .link_rate = LINK_RATE_2_70GBPS,
576 .lane_count = LANE_COUNT2,
579 static struct video_info ps8622_dp_config = {
580 .name = "eDP-LVDS Parade PS8622",
582 .h_sync_polarity = 0,
583 .v_sync_polarity = 0,
586 .color_space = COLOR_RGB,
587 .dynamic_range = VESA,
588 .ycbcr_coeff = COLOR_YCBCR601,
589 .color_depth = COLOR_8,
591 .link_rate = LINK_RATE_2_70GBPS,
592 .lane_count = LANE_COUNT1,
595 static struct exynos_dp_platdata smdk5250_dp_data = {
596 .video_info = &ptn3460_dp_config,
597 .training_type = SW_LINK_TRAINING,
599 .force_connected = true,
600 .phy_init = s5p_dp_phy_init,
601 .phy_exit = s5p_dp_phy_exit,
604 #define S5P_PMU_DEBUG S5P_PMUREG(0x0A00)
605 /* PMU_DEBUG bits [12:8] = 0x10000 selects XXTI clock source */
606 #define PMU_DEBUG_XXTI (0x10 << 8)
607 /* Mask bit[12:8] for xxti clock selection */
608 #define PMU_DEBUG_CLKOUT_SEL_MASK 0x1f00
610 static void __init enable_xclkout(void)
614 tmp = readl(S5P_PMU_DEBUG);
615 tmp &= ~PMU_DEBUG_CLKOUT_SEL_MASK;
616 tmp |= PMU_DEBUG_XXTI;
617 writel(tmp, S5P_PMU_DEBUG);
620 static int exynos_cfg_i2s_gpio(struct platform_device *pdev)
623 /* configure GPIO for i2s port */
624 struct exynos_gpio_cfg exynos5_cfg[3] = {
625 { EXYNOS5_GPZ(0), 7, S3C_GPIO_SFN(2) },
626 { EXYNOS5_GPB0(0), 5, S3C_GPIO_SFN(2) },
627 { EXYNOS5_GPB1(0), 5, S3C_GPIO_SFN(2) }
630 if (pdev->dev.of_node) {
631 id = of_alias_get_id(pdev->dev.of_node, "i2s");
633 dev_err(&pdev->dev, "failed to get alias id:%d\n", id);
638 if (id < 0 || id > 2) {
639 printk(KERN_ERR "Invalid Device %d\n", id);
643 s3c_gpio_cfgpin_range(exynos5_cfg[id].addr,
644 exynos5_cfg[id].num, exynos5_cfg[id].bit);
649 static struct s3c_audio_pdata i2sv5_pdata = {
650 .cfg_gpio = exynos_cfg_i2s_gpio,
653 .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI
656 .idma_addr = EXYNOS4_AUDSS_INT_MEM,
662 * Hack to do power-on sequence after the 32khz SLP_CLK is
663 * running as doing this entirely in the DT is problematic.
664 * We attach an auxdata record to dw_mmc2 with a set_power
665 * method that frobs the regulators. This work is not board
666 * specific but must be done before the device is recognized
667 * so cannot go in the driver.
669 static bool enable_mwi87xx(void)
671 struct regulator *wifi_en, *wifi_rst;
674 wifi_en = regulator_get(NULL, "wifi-en");
675 wifi_rst = regulator_get(NULL, "wifi-rst-l");
676 ok = !IS_ERR(wifi_en) && !IS_ERR(wifi_rst);
679 * This assumes SLP_CLK is enabled and stable by the
680 * time we get here. Also any delay required between
681 * RESETn and PDn should be set in startup-delay-us
684 regulator_enable(wifi_rst);
685 regulator_enable(wifi_en);
688 if (!IS_ERR(wifi_rst))
689 regulator_put(wifi_rst);
690 if (!IS_ERR(wifi_en))
691 regulator_put(wifi_en);
695 static void exynos_wifi_bt_set_power(u32 slot_id, u32 volt)
697 if (volt == 0 || (!of_machine_is_compatible("google,snow") &&
698 !of_machine_is_compatible("google,spring") &&
699 !of_machine_is_compatible("google,daisy")))
701 if (!enable_mwi87xx())
702 pr_err("%s: problem enabling WiFi+BT\n", __func__);
703 /* NB: bt-reset-l is tied to wifi-rst-l so BT should be ready too */
707 /* NTC Thermistor. Attached to S3C-ADC in some Samsung SoC Devices */
708 struct s3c_adc_client *ntc_adc_clients[4];
709 struct mutex ntc_adc_locks[] = {
710 __MUTEX_INITIALIZER(ntc_adc_locks[0]),
711 __MUTEX_INITIALIZER(ntc_adc_locks[1]),
712 __MUTEX_INITIALIZER(ntc_adc_locks[2]),
713 __MUTEX_INITIALIZER(ntc_adc_locks[3]),
716 static int __init s3c_adc_ntc_init(struct platform_device *pdev)
718 struct s3c_adc_client *ntc_adc_client;
720 ntc_adc_client = s3c_adc_register(pdev, NULL, NULL, 0);
721 if (IS_ERR(ntc_adc_client))
722 return PTR_ERR(ntc_adc_client);
724 ntc_adc_clients[pdev->id] = ntc_adc_client;
730 * read_thermistor_uV: is a call back from ntc_thermistor driver.
731 * returns the temperature of the thermistor in celsius
733 static int read_thermistor_uV(struct platform_device *pdev)
735 static unsigned int ntc_adc_ports[] = {3, 4, 5, 6};
737 unsigned int port = ntc_adc_ports[pdev->id];
738 struct s3c_adc_client *client = ntc_adc_clients[pdev->id];
739 struct ntc_thermistor_platform_data *pdata = pdev->dev.platform_data;
740 struct mutex *lock = ntc_adc_locks + pdev->id;
743 /* Arrays are sized; make sure we haven't blown over */
744 BUG_ON(pdev->id >= ARRAY_SIZE(ntc_adc_locks));
747 * s3c_adc_read() assumes two processes aren't using the same client
748 * at the same time (yes, it's a bad design), so grab a per-client
749 * mutex to ensure this is OK.
752 ret = s3c_adc_read(client, port);
756 dev_warn(&pdev->dev, "Thermistor read err: 0x%08x\n", ret);
760 converted = pdata->pullup_uV * (s64) ret;
763 return (int) converted;
766 static struct ntc_thermistor_platform_data ntc_adc_pdata = {
767 .read_uV = read_thermistor_uV,
768 .pullup_uV = 1800000, /* voltage of vdd for ADC */
771 .connect = NTC_CONNECTED_GROUND,
774 struct platform_device s3c_device_adc_ntc_thermistor0 = {
775 .name = "ncp15wb473",
778 .platform_data = &ntc_adc_pdata,
782 struct platform_device s3c_device_adc_ntc_thermistor1 = {
783 .name = "ncp15wb473",
786 .platform_data = &ntc_adc_pdata,
790 struct platform_device s3c_device_adc_ntc_thermistor2 = {
791 .name = "ncp15wb473",
794 .platform_data = &ntc_adc_pdata,
798 struct platform_device s3c_device_adc_ntc_thermistor3 = {
799 .name = "ncp15wb473",
802 .platform_data = &ntc_adc_pdata,
807 * The following lookup table is used to override device names when devices
808 * are registered from device tree. This is temporarily added to enable
809 * device tree support addition for the EXYNOS5 architecture.
811 * For drivers that require platform data to be provided from the machine
812 * file, a platform data pointer can also be supplied along with the
813 * devices names. Usually, the platform data elements that cannot be parsed
814 * from the device tree by the drivers (example: function pointers) are
815 * supplied. But it should be noted that this is a temporary mechanism and
816 * at some point, the drivers should be capable of parsing all the platform
817 * data from the device tree.
819 static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
820 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART0,
821 "exynos4210-uart.0", NULL),
822 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART1,
823 "exynos4210-uart.1", NULL),
824 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART2,
825 "exynos4210-uart.2", NULL),
826 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART3,
827 "exynos4210-uart.3", NULL),
828 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(0),
829 "s3c2440-i2c.0", NULL),
830 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(1),
831 "s3c2440-i2c.1", NULL),
832 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(2),
833 "s3c2440-i2c.2", NULL),
834 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(3),
835 "s3c2440-i2c.3", NULL),
836 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(4),
837 "s3c2440-i2c.4", NULL),
838 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(5),
839 "s3c2440-i2c.5", NULL),
840 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(6),
841 "s3c2440-i2c.6", NULL),
842 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(7),
843 "s3c2440-i2c.7", NULL),
844 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(8),
845 "s3c2440-hdmiphy-i2c", NULL),
846 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI0,
847 "exynos4210-spi.0", NULL),
848 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI1,
849 "exynos4210-spi.1", NULL),
850 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI2,
851 "exynos4210-spi.2", NULL),
852 OF_DEV_AUXDATA("synopsis,dw-mshc-exynos5250", 0x12200000,
854 OF_DEV_AUXDATA("synopsis,dw-mshc-exynos5250", 0x12210000,
856 OF_DEV_AUXDATA("synopsis,dw-mshc-exynos5250", 0x12220000,
858 OF_DEV_AUXDATA("synopsis,dw-mshc-exynos5250", 0x12230000,
860 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL),
861 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL),
862 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL),
863 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x10A60000,
864 "s5p-sysmmu.2", &platdata_sysmmu_g2d),
865 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x11210000,
866 "s5p-sysmmu.3", &platdata_sysmmu_mfc_l),
867 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x11200000,
868 "s5p-sysmmu.4", &platdata_sysmmu_mfc_r),
869 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x14640000,
870 "s5p-sysmmu.27", &platdata_sysmmu_fimd),
871 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x14650000,
872 "s5p-sysmmu.28", &platdata_sysmmu_tv),
873 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x13E80000,
874 "s5p-sysmmu.23", &platdata_sysmmu_gsc),
875 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x13E90000,
876 "s5p-sysmmu.24", &platdata_sysmmu_gsc),
877 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x13EA0000,
878 "s5p-sysmmu.25", &platdata_sysmmu_gsc),
879 OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x13EB0000,
880 "s5p-sysmmu.26", &platdata_sysmmu_gsc),
881 OF_DEV_AUXDATA("samsung,exynos5-fb", 0x14400000,
882 "exynos5-fb", &smdk5250_lcd1_pdata),
883 OF_DEV_AUXDATA("samsung,exynos5-mipi", 0x14500000,
884 "s5p-mipi-dsim", &dsim_platform_data),
885 OF_DEV_AUXDATA("samsung,exynos5-dp", 0x145B0000,
886 "s5p-dp", &smdk5250_dp_data),
887 OF_DEV_AUXDATA("samsung,s5p-mfc-v6", 0x11000000, "s5p-mfc-v6", NULL),
888 OF_DEV_AUXDATA("samsung,exynos-gsc", 0x13E00000,
889 "exynos-gsc.0", NULL),
890 OF_DEV_AUXDATA("samsung,exynos-gsc", 0x13E10000,
891 "exynos-gsc.1", NULL),
892 OF_DEV_AUXDATA("samsung,exynos-gsc", 0x13E20000,
893 "exynos-gsc.2", NULL),
894 OF_DEV_AUXDATA("samsung,exynos-gsc", 0x13E30000,
895 "exynos-gsc.3", NULL),
896 #ifdef CONFIG_VIDEO_FIMG2D4X
897 OF_DEV_AUXDATA("samsung,s5p-g2d", 0x10850000,
898 "s5p-g2d", &fimg2d_data),
900 OF_DEV_AUXDATA("samsung,exynos-ohci", 0x12120000,
901 "exynos-ohci", &smdk5250_ohci_pdata),
902 OF_DEV_AUXDATA("samsung,exynos-ehci", 0x12110000,
903 "s5p-ehci", &smdk5250_ehci_pdata),
904 OF_DEV_AUXDATA("samsung,exynos-xhci", 0x12000000,
905 "exynos-dwc3", &smdk5250_xhci_pdata),
906 OF_DEV_AUXDATA("samsung,i2s", 0x03830000,
907 "samsung-i2s.0", &i2sv5_pdata),
908 #ifdef CONFIG_DRM_EXYNOS_HDMI
909 OF_DEV_AUXDATA("samsung,exynos5-hdmi", 0x14530000,
910 "exynos5-hdmi", &drm_hdmi_pdata),
911 OF_DEV_AUXDATA("samsung,s5p-mixer", 0x14450000,
912 "s5p-mixer", &drm_mixer_pdata),
914 OF_DEV_AUXDATA("samsung,exynos5-hdmi", 0x14530000,
915 "exynos5-hdmi", NULL),
916 OF_DEV_AUXDATA("samsung,s5p-mixer", 0x14450000,
922 #ifdef CONFIG_BUSFREQ_OPP
923 /* BUSFREQ to control memory/bus*/
924 static struct device_domain busfreq;
926 static struct platform_device exynos5_busfreq = {
928 .name = "exynos-busfreq",
932 static struct platform_device *smdk5250_devices[] __initdata = {
933 &smdk5250_lcd, /* for platform_lcd device */
934 &exynos_device_md0, /* for media device framework */
935 &exynos_device_md1, /* for media device framework */
936 &exynos_device_md2, /* for media device framework */
937 &samsung_asoc_dma, /* for audio dma interface device */
939 #ifdef CONFIG_DRM_EXYNOS_HDMI
940 &exynos_drm_hdmi_device,
942 #ifdef CONFIG_BUSFREQ_OPP
947 static struct platform_device *thermistor_devices[] __initdata = {
948 &s3c_device_adc_ntc_thermistor0,
949 &s3c_device_adc_ntc_thermistor1,
950 &s3c_device_adc_ntc_thermistor2,
951 &s3c_device_adc_ntc_thermistor3,
954 static struct regulator_consumer_supply dummy_supplies[] = {
955 REGULATOR_SUPPLY("vddvario", "7000000.lan9215"),
956 REGULATOR_SUPPLY("vdd33a", "7000000.lan9215"),
959 static void __init exynos5250_dt_map_io(void)
961 exynos_init_io(NULL, 0);
962 s3c24xx_init_clocks(24000000);
965 static unsigned long ramoops_dt_start, ramoops_dt_size;
966 static int __init init_dt_scan_ramoops(unsigned long node, const char *uname,
967 int depth, void *data)
972 if (!of_flat_dt_is_compatible(node, "ramoops"))
975 reg = of_get_flat_dt_prop(node, "reg", &l);
978 endp = reg + (l / sizeof(__be32));
980 /* This architecture uses single cells for address and size.
981 * Other architectures may differ. */
982 ramoops_dt_start = be32_to_cpu(reg[0]);
983 ramoops_dt_size = be32_to_cpu(reg[1]);
987 static void __init exynos5_ramoops_reserve(void)
989 unsigned long start, size;
991 of_scan_flat_dt(init_dt_scan_ramoops, NULL);
993 /* If necessary, lower start and raise size to align to 1M. */
994 start = round_down(ramoops_dt_start, SZ_1M);
995 size = ramoops_dt_size + ramoops_dt_start - start;
996 size = round_up(size, SZ_1M);
998 if (memblock_remove(start, size)) {
999 pr_err("Failed to remove ramoops %08lx@%08lx from memory\n",
1002 pr_info("Ramoops: %08lx - %08lx\n", start, start + size - 1);
1006 static void __init exynos5_reserve(void)
1008 /* required to have enough address range to remap the IOMMU
1009 * allocated buffers */
1010 init_consistent_dma_size(SZ_64M);
1012 exynos5_ramoops_reserve();
1016 static void s5p_tv_setup(void)
1018 /* direct HPD to HDMI chip */
1019 gpio_request(EXYNOS5_GPX3(7), "hpd-plug");
1021 gpio_direction_input(EXYNOS5_GPX3(7));
1022 s3c_gpio_cfgpin(EXYNOS5_GPX3(7), S3C_GPIO_SFN(0x3));
1023 s3c_gpio_setpull(EXYNOS5_GPX3(7), S3C_GPIO_PULL_NONE);
1026 static void exynos5_i2c_setup(void)
1028 /* Setup the low-speed i2c controller interrupts */
1029 writel(0x0, EXYNOS5_SYS_I2C_CFG);
1032 static void __init exynos5250_dt_machine_init(void)
1034 struct device_node *srom_np, *np;
1036 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
1038 /* Setup pins for any SMSC 911x controller on the SROMC bus */
1039 srom_np = of_find_node_by_path("/sromc-bus");
1041 printk(KERN_ERR "No /sromc-bus property.\n");
1044 for_each_child_of_node(srom_np, np) {
1045 if (of_device_is_compatible(np, "smsc,lan9115")) {
1047 of_property_read_u32(np, "reg", ®);
1053 * Set the backlight on LCD_PWM pin only for boards not using the
1054 * Parade eDP bridge which has an internal PWN for the backlight.
1056 if (!of_find_compatible_node(NULL, NULL, "parade,ps8622")) {
1057 if (of_machine_is_compatible("google,snow")) {
1058 smdk5250_bl_data.max_brightness = 2800;
1059 smdk5250_bl_data.dft_brightness = 2800;
1063 * Request lcd_bl_en GPIO for smdk5250_bl_notify().
1064 * TODO: Fix this so we are not at risk of requesting the GPIO
1065 * multiple times, this should be done with device tree, and
1066 * likely integrated into the plat-samsung/dev-backlight.c init.
1068 gpio_request_one(EXYNOS5_GPX3(0), GPIOF_OUT_INIT_HIGH,
1071 samsung_bl_set(&smdk5250_bl_gpio_info, &smdk5250_bl_data);
1075 * HACK ALERT! TODO: FIXME!
1077 * We're going to hack in Daisy LCD info here for bringup purposes.
1078 * Lots of things wrong with what we're doing here, but it works for
1082 if (of_machine_is_compatible("google,daisy")) {
1083 #ifdef CONFIG_DRM_EXYNOS_FIMD
1084 smdk5250_lcd1_pdata.panel.timing.xres = 1366;
1085 smdk5250_lcd1_pdata.panel.timing.yres = 768;
1086 smdk5250_lcd1_pdata.panel_type = MIPI_LCD;
1088 smdk5250_fb_win0.win_mode.xres = 1366;
1089 smdk5250_fb_win0.win_mode.yres = 768;
1090 smdk5250_fb_win0.virtual_x = 1366;
1091 smdk5250_fb_win0.virtual_y = 768 * 2;
1093 smdk5250_fb_win1.win_mode.xres = 1366;
1094 smdk5250_fb_win1.win_mode.yres = 768;
1095 smdk5250_fb_win1.virtual_x = 1366;
1096 smdk5250_fb_win1.virtual_y = 768 * 2;
1098 smdk5250_fb_win2.win_mode.xres = 1366;
1099 smdk5250_fb_win2.win_mode.yres = 768;
1100 smdk5250_fb_win2.virtual_x = 1366;
1101 smdk5250_fb_win2.virtual_y = 768 * 2;
1103 dsim_lcd_info.lcd_size.width = 1366;
1104 dsim_lcd_info.lcd_size.height = 768;
1105 } else if ((of_machine_is_compatible("google,snow")) ||
1106 (of_machine_is_compatible("google,spring"))) {
1107 #ifdef CONFIG_DRM_EXYNOS_FIMD
1108 smdk5250_lcd1_pdata.panel.timing = snow_fb_window;
1110 smdk5250_lcd1_pdata.panel_type = DP_LCD;
1111 smdk5250_lcd1_pdata.vidcon1 = 0;
1112 smdk5250_lcd1_pdata.clock_rate =
1113 smdk5250_lcd1_pdata.panel.timing.pixclock;
1117 /* put the DP output configuration matching the eDP-LVDS bridge */
1118 if (of_find_compatible_node(NULL, NULL, "nxp,ptn3460")) {
1119 smdk5250_dp_data.video_info = &ptn3460_dp_config;
1121 struct device_node *node =
1122 of_find_compatible_node(NULL, NULL, "parade,ps8622");
1124 smdk5250_dp_data.video_info = &ps8622_dp_config;
1125 smdk5250_dp_data.hpd_gpio =
1126 of_get_named_gpio(node, "hpd-gpio", 0);
1130 if (gpio_request_one(EXYNOS5_GPX2(6), GPIOF_OUT_INIT_HIGH,
1131 "HOST_VBUS_CONTROL")) {
1132 printk(KERN_ERR "failed to request gpio_host_vbus\n");
1134 s3c_gpio_setpull(EXYNOS5_GPX2(6), S3C_GPIO_PULL_NONE);
1135 gpio_free(EXYNOS5_GPX2(6));
1138 exynos5_i2c_setup();
1141 * MAX77686 PMIC interrupt setup code
1142 * TODO: Convert the device tree wakeup_int domain to support
1145 s3c_gpio_setpull(EXYNOS5_GPX3(2), S3C_GPIO_PULL_NONE);
1148 * BIG HACK: The wm8994 is not device tree enabled apparently, so
1149 * needs to be added manually. ...but it's only on SMDK5250.
1151 if (of_machine_is_compatible("samsung,smdk5250")) {
1152 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
1155 /* XCLKOUT needs to be moved over to the clock interface, but enable it
1160 if (gpio_request_one(EXYNOS5_GPA2(5), GPIOF_OUT_INIT_HIGH, "SPI1_CS")) {
1161 printk(KERN_ERR "Spidev ChipSelect unavailable\n");
1163 s3c_gpio_cfgpin(EXYNOS5_GPA2(5), S3C_GPIO_SFN(0x1));
1164 s3c_gpio_setpull(EXYNOS5_GPA2(5), S3C_GPIO_PULL_NONE);
1165 s5p_gpio_set_drvstr(EXYNOS5_GPA2(5), S5P_GPIO_DRVSTR_LV4);
1166 spi_register_board_info(spi1_board_info,
1167 ARRAY_SIZE(spi1_board_info));
1170 of_platform_populate(NULL, of_default_bus_match_table,
1171 exynos5250_auxdata_lookup, NULL);
1173 #ifdef CONFIG_DRM_EXYNOS_FIMD
1174 if (of_machine_is_compatible("google,snow"))
1175 exynos_dp_gpio_setup_24bpp();
1177 exynos_fimd_gpio_setup_24bpp();
1181 np = of_find_compatible_node(NULL, NULL, "samsung,exynos5-adc");
1182 if (np && of_device_is_available(np)) {
1183 /* Enable power to ADC */
1184 __raw_writel(0x1, S5P_ADC_PHY_CONTROL);
1186 s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor0);
1187 s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor1);
1188 s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor2);
1189 s3c_adc_ntc_init(&s3c_device_adc_ntc_thermistor3);
1191 platform_add_devices(thermistor_devices,
1192 ARRAY_SIZE(thermistor_devices));
1195 #ifdef CONFIG_BUSFREQ_OPP
1196 dev_add(&busfreq, &exynos5_busfreq.dev);
1197 ppmu_init(&exynos_ppmu[PPMU_CPU], &exynos5_busfreq.dev);
1198 ppmu_init(&exynos_ppmu[PPMU_DDR_C], &exynos5_busfreq.dev);
1199 ppmu_init(&exynos_ppmu[PPMU_DDR_R1], &exynos5_busfreq.dev);
1200 ppmu_init(&exynos_ppmu[PPMU_DDR_L], &exynos5_busfreq.dev);
1201 ppmu_init(&exynos_ppmu[PPMU_RIGHT0_BUS], &exynos5_busfreq.dev);
1203 platform_add_devices(smdk5250_devices, ARRAY_SIZE(smdk5250_devices));
1205 of_node_put(srom_np);
1209 static char const *exynos5250_dt_compat[] __initdata = {
1210 "samsung,exynos5250",
1214 DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
1215 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
1216 .init_irq = exynos5_init_irq,
1217 .reserve = exynos5_reserve,
1218 .map_io = exynos5250_dt_map_io,
1219 .handle_irq = gic_handle_irq,
1220 .init_machine = exynos5250_dt_machine_init,
1221 .timer = &exynos4_timer,
1222 .dt_compat = exynos5250_dt_compat,
1223 .restart = exynos5_restart,