ARM: EXYNOS5: Add mixer device DT support
[cascardo/linux.git] / arch / arm / mach-exynos / mach-exynos5-dt.c
1 /*
2  * SAMSUNG EXYNOS5250 Flattened Device Tree enabled machine
3  *
4  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5  *              http://www.samsung.com
6  *
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.
10 */
11
12 #include <linux/gpio.h>
13 #include <linux/of_platform.h>
14 #include <linux/platform_data/dwc3-exynos.h>
15 #include <linux/serial_core.h>
16 #include <linux/smsc911x.h>
17 #include <linux/delay.h>
18 #include <linux/i2c.h>
19 #include <linux/pwm_backlight.h>
20 #include <linux/mfd/wm8994/pdata.h>
21 #include <linux/regulator/machine.h>
22
23 #include <asm/mach/arch.h>
24 #include <asm/hardware/gic.h>
25 #include <mach/map.h>
26 #include <mach/ohci.h>
27 #include <mach/regs-pmu.h>
28 #include <mach/sysmmu.h>
29 #include <mach/ohci.h>
30 #include <mach/regs-audss.h>
31
32 #include <plat/audio.h>
33 #include <plat/cpu.h>
34 #include <plat/dsim.h>
35 #include <plat/fb.h>
36 #include <plat/mipi_dsi.h>
37 #include <plat/gpio-cfg.h>
38 #include <plat/regs-fb.h>
39 #include <plat/regs-serial.h>
40 #include <plat/regs-srom.h>
41 #include <plat/backlight.h>
42 #include <plat/devs.h>
43 #include <plat/usb-phy.h>
44 #include <plat/ehci.h>
45
46 #include <video/platform_lcd.h>
47
48 #include "drm/exynos_drm.h"
49 #include "common.h"
50
51 static void __init smsc911x_init(int ncs)
52 {
53         u32 data;
54
55         /* configure nCS1 width to 16 bits */
56         data = __raw_readl(S5P_SROM_BW) &
57                 ~(S5P_SROM_BW__CS_MASK << (ncs * 4));
58         data |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) |
59                 (1 << S5P_SROM_BW__WAITENABLE__SHIFT) |
60                 (1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) << (ncs * 4);
61         __raw_writel(data, S5P_SROM_BW);
62
63         /* set timing for nCS1 suitable for ethernet chip */
64         __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) |
65                 (0x9 << S5P_SROM_BCX__TACP__SHIFT) |
66                 (0xc << S5P_SROM_BCX__TCAH__SHIFT) |
67                 (0x1 << S5P_SROM_BCX__TCOH__SHIFT) |
68                 (0x6 << S5P_SROM_BCX__TACC__SHIFT) |
69                 (0x1 << S5P_SROM_BCX__TCOS__SHIFT) |
70                 (0x1 << S5P_SROM_BCX__TACS__SHIFT),
71                 S5P_SROM_BC0 + (ncs * 4));
72 }
73
74 static struct s3c_fb_pd_win smdk5250_fb_win0 = {
75         .win_mode = {
76                 .left_margin    = 4,
77                 .right_margin   = 4,
78                 .upper_margin   = 4,
79                 .lower_margin   = 4,
80                 .hsync_len      = 4,
81                 .vsync_len      = 4,
82                 .xres           = 1280,
83                 .yres           = 800,
84         },
85         .virtual_x              = 1280,
86         .virtual_y              = 800 * 2,
87         .width                  = 223,
88         .height                 = 125,
89         .max_bpp                = 32,
90         .default_bpp            = 24,
91 };
92
93 static struct s3c_fb_pd_win smdk5250_fb_win1 = {
94         .win_mode = {
95                 .left_margin    = 4,
96                 .right_margin   = 4,
97                 .upper_margin   = 4,
98                 .lower_margin   = 4,
99                 .hsync_len      = 4,
100                 .vsync_len      = 4,
101                 .xres           = 1280,
102                 .yres           = 800,
103         },
104         .virtual_x              = 1280,
105         .virtual_y              = 800 * 2,
106         .width                  = 223,
107         .height                 = 125,
108         .max_bpp                = 32,
109         .default_bpp            = 24,
110 };
111
112 static struct s3c_fb_pd_win smdk5250_fb_win2 = {
113         .win_mode = {
114                 .left_margin    = 0x4,
115                 .right_margin   = 0x4,
116                 .upper_margin   = 4,
117                 .lower_margin   = 4,
118                 .hsync_len      = 4,
119                 .vsync_len      = 4,
120                 .xres           = 1280,
121                 .yres           = 800,
122         },
123         .virtual_x              = 1280,
124         .virtual_y              = 800 * 2,
125         .width                  = 223,
126         .height                 = 125,
127         .max_bpp                = 32,
128         .default_bpp            = 24,
129 };
130
131 static void exynos_fimd_gpio_setup_24bpp(void)
132 {
133         unsigned int reg = 0;
134
135         /*
136          * Set DISP1BLK_CFG register for Display path selection
137          * FIMD of DISP1_BLK Bypass selection : DISP1BLK_CFG[15]
138          * ---------------------
139          * 0 | MIE/MDNIE
140          * 1 | FIMD : selected
141          */
142         reg = __raw_readl(S3C_VA_SYS + 0x0214);
143         reg &= ~(1 << 15);      /* To save other reset values */
144         reg |= (1 << 15);
145         __raw_writel(reg, S3C_VA_SYS + 0x0214);
146 }
147
148 static struct s3c_fb_platdata smdk5250_lcd1_pdata __initdata = {
149         .win[0]         = &smdk5250_fb_win0,
150         .win[1]         = &smdk5250_fb_win1,
151         .win[2]         = &smdk5250_fb_win2,
152         .default_win    = 0,
153         .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
154         .vidcon1        = VIDCON1_INV_VCLK,
155         .setup_gpio     = exynos_fimd_gpio_setup_24bpp,
156 };
157
158 static struct mipi_dsim_config dsim_info = {
159         .e_interface            = DSIM_VIDEO,
160         .e_pixel_format         = DSIM_24BPP_888,
161         /* main frame fifo auto flush at VSYNC pulse */
162         .auto_flush             = false,
163         .eot_disable            = false,
164         .auto_vertical_cnt      = false,
165         .hse                    = false,
166         .hfp                    = false,
167         .hbp                    = false,
168         .hsa                    = false,
169
170         .e_no_data_lane         = DSIM_DATA_LANE_4,
171         .e_byte_clk             = DSIM_PLL_OUT_DIV8,
172         .e_burst_mode           = DSIM_BURST,
173
174         .p                      = 3,
175         .m                      = 115,
176         .s                      = 1,
177
178         /* D-PHY PLL stable time spec :min = 200usec ~ max 400usec */
179         .pll_stable_time        = 500,
180
181         .esc_clk                = 0.4 * 1000000, /* escape clk : 10MHz */
182
183         /* stop state holding counter after bta change count 0 ~ 0xfff */
184         .stop_holding_cnt       = 0x0f,
185         .bta_timeout            = 0xff,         /* bta timeout 0 ~ 0xff */
186         .rx_timeout             = 0xffff,       /* lp rx timeout 0 ~ 0xffff */
187
188         .dsim_ddi_pd = &tc358764_mipi_lcd_driver,
189 };
190
191 static struct mipi_dsim_lcd_config dsim_lcd_info = {
192         .rgb_timing.left_margin         = 0x4,
193         .rgb_timing.right_margin        = 0x4,
194         .rgb_timing.upper_margin        = 0x4,
195         .rgb_timing.lower_margin        =  0x4,
196         .rgb_timing.hsync_len           = 0x4,
197         .rgb_timing.vsync_len           = 0x4,
198         .cpu_timing.cs_setup            = 0,
199         .cpu_timing.wr_setup            = 1,
200         .cpu_timing.wr_act              = 0,
201         .cpu_timing.wr_hold             = 0,
202         .lcd_size.width                 = 1280,
203         .lcd_size.height                = 800,
204 };
205
206 static struct s5p_platform_mipi_dsim dsim_platform_data = {
207         .clk_name               = "dsim0",
208         .dsim_config            = &dsim_info,
209         .dsim_lcd_config        = &dsim_lcd_info,
210
211         .part_reset             = s5p_dsim_part_reset,
212         .init_d_phy             = s5p_dsim_init_d_phy,
213         .get_fb_frame_done      = NULL,
214         .trigger                = NULL,
215
216         /*
217          * the stable time of needing to write data on SFR
218          * when the mipi mode becomes LP mode.
219          */
220         .delay_for_stabilization = 600,
221 };
222
223 static struct platform_device exynos_drm_device = {
224         .name           = "exynos-drm",
225         .dev = {
226                 .dma_mask = &exynos_drm_device.dev.coherent_dma_mask,
227                 .coherent_dma_mask = 0xffffffffUL,
228         }
229 };
230
231 static void lcd_set_power(struct plat_lcd_data *pd,
232                         unsigned int power)
233 {
234         /* reset */
235         gpio_request_one(EXYNOS5_GPX1(5), GPIOF_OUT_INIT_HIGH, "GPX1");
236
237         mdelay(20);
238         if (power) {
239                 /* fire nRESET on power up */
240                 gpio_set_value(EXYNOS5_GPX1(5), 0);
241                 mdelay(20);
242                 gpio_set_value(EXYNOS5_GPX1(5), 1);
243                 mdelay(20);
244                 gpio_free(EXYNOS5_GPX1(5));
245         } else {
246                 /* fire nRESET on power off */
247                 gpio_set_value(EXYNOS5_GPX1(5), 0);
248                 mdelay(20);
249                 gpio_set_value(EXYNOS5_GPX1(5), 1);
250                 mdelay(20);
251                 gpio_free(EXYNOS5_GPX1(5));
252         }
253         mdelay(20);
254         /*
255          * Request lcd_bl_en GPIO for smdk5250_bl_notify().
256          * TODO: Fix this so we are not at risk of requesting the GPIO
257          * multiple times, this should be done with device tree, and
258          * likely integrated into the plat-samsung/dev-backlight.c init.
259          */
260         gpio_request_one(EXYNOS5_GPX3(0), GPIOF_OUT_INIT_LOW, "GPX3");
261 }
262
263 static int smdk5250_match_fb(struct plat_lcd_data *pd, struct fb_info *info)
264 {
265         /* Don't call .set_power callback while unblanking */
266         return 0;
267 }
268
269 static struct plat_lcd_data smdk5250_lcd_data = {
270         .set_power      = lcd_set_power,
271         .match_fb       = smdk5250_match_fb,
272 };
273
274 static struct platform_device smdk5250_lcd = {
275         .name                   = "platform-lcd",
276         .dev.platform_data      = &smdk5250_lcd_data,
277 };
278
279 static int smdk5250_bl_notify(struct device *unused, int brightness)
280 {
281         /* manage lcd_bl_en signal */
282         if (brightness)
283                 gpio_set_value(EXYNOS5_GPX3(0), 1);
284         else
285                 gpio_set_value(EXYNOS5_GPX3(0), 0);
286
287         return brightness;
288 }
289
290 /* LCD Backlight data */
291 static struct samsung_bl_gpio_info smdk5250_bl_gpio_info = {
292         .no     = EXYNOS5_GPB2(0),
293         .func   = S3C_GPIO_SFN(2),
294 };
295
296 static struct platform_pwm_backlight_data smdk5250_bl_data = {
297         .pwm_period_ns  = 1000,
298         .notify         = smdk5250_bl_notify,
299 };
300
301 struct platform_device exynos_device_md0 = {
302         .name = "exynos-mdev",
303         .id = 0,
304 };
305
306 struct platform_device exynos_device_md1 = {
307         .name = "exynos-mdev",
308         .id = 1,
309 };
310
311 struct platform_device exynos_device_md2 = {
312         .name = "exynos-mdev",
313         .id = 2,
314 };
315
316 static struct regulator_consumer_supply wm8994_avdd1_supply =
317         REGULATOR_SUPPLY("AVDD1", "1-001a");
318
319 static struct regulator_consumer_supply wm8994_dcvdd_supply =
320         REGULATOR_SUPPLY("DCVDD", "1-001a");
321
322 static struct regulator_init_data wm8994_ldo1_data = {
323         .constraints    = {
324                 .name           = "AVDD1",
325         },
326         .num_consumer_supplies  = 1,
327         .consumer_supplies      = &wm8994_avdd1_supply,
328 };
329
330 static struct regulator_init_data wm8994_ldo2_data = {
331         .constraints    = {
332         .name                   = "DCVDD",
333                 },
334         .num_consumer_supplies  = 1,
335         .consumer_supplies      = &wm8994_dcvdd_supply,
336 };
337
338 static struct wm8994_pdata wm8994_platform_data = {
339         /* configure gpio1 function: 0x0001(Logic level input/output) */
340         .gpio_defaults[0] = 0x0001,
341         /* If the i2s0 and i2s2 is enabled simultaneously */
342         .gpio_defaults[7] = 0x8100, /* GPIO8  DACDAT3 in */
343         .gpio_defaults[8] = 0x0100, /* GPIO9  ADCDAT3 out */
344         .gpio_defaults[9] = 0x0100, /* GPIO10 LRCLK3  out */
345         .gpio_defaults[10] = 0x0100,/* GPIO11 BCLK3   out */
346         .ldo[0] = { 0, &wm8994_ldo1_data },
347         .ldo[1] = { 0, &wm8994_ldo2_data },
348 };
349
350 static struct i2c_board_info i2c_devs1[] __initdata = {
351         {
352                 I2C_BOARD_INFO("wm8994", 0x1a),
353                 .platform_data  = &wm8994_platform_data,
354         },
355 };
356
357 struct sysmmu_platform_data platdata_sysmmu_mfc_l = {
358         .dbgname = "mfc_l",
359         .clockname = "sysmmu",
360 };
361
362 struct sysmmu_platform_data platdata_sysmmu_mfc_r = {
363         .dbgname = "mfc_r",
364         .clockname = "sysmmu",
365 };
366
367 struct sysmmu_platform_data platdata_sysmmu_gsc = {
368         .dbgname = "gsc",
369         .clockname = "sysmmu",
370 };
371
372 struct sysmmu_platform_data platdata_sysmmu_g2d = {
373         .dbgname = "g2d",
374         .clockname = "sysmmu",
375 };
376
377 struct sysmmu_platform_data platdata_sysmmu_fimd = {
378         .dbgname = "fimd",
379         .clockname = "sysmmu",
380 };
381
382 struct sysmmu_platform_data platdata_sysmmu_tv = {
383         .dbgname = "tv",
384         .clockname = "sysmmu",
385 };
386
387 #ifdef CONFIG_VIDEO_FIMG2D4X
388 static struct fimg2d_platdata fimg2d_data __initdata = {
389         .hw_ver         = 0x42,
390         .gate_clkname   = "fimg2d",
391 };
392 #endif
393
394 static struct exynos4_ohci_platdata smdk5250_ohci_pdata = {
395         .phy_init = s5p_usb_phy_init,
396         .phy_exit = s5p_usb_phy_exit,
397 };
398
399 static struct s5p_ehci_platdata smdk5250_ehci_pdata = {
400         .phy_init = s5p_usb_phy_init,
401         .phy_exit = s5p_usb_phy_exit,
402 };
403
404 static struct dwc3_exynos_data smdk5250_xhci_pdata = {
405         .phy_type = S5P_USB_PHY_DRD,
406         .phy_init = s5p_usb_phy_init,
407         .phy_exit = s5p_usb_phy_exit,
408 };
409
410 struct exynos_gpio_cfg {
411         unsigned int    addr;
412         unsigned int    num;
413         unsigned int    bit;
414 };
415
416 static const char *rclksrc[] = {
417         [0] = "busclk",
418         [1] = "i2sclk",
419 };
420
421 static int exynos_cfg_i2s_gpio(struct platform_device *pdev)
422 {
423         int id;
424         /* configure GPIO for i2s port */
425         struct exynos_gpio_cfg exynos5_cfg[3] = {
426                 { EXYNOS5_GPZ(0),  7, S3C_GPIO_SFN(2) },
427                 { EXYNOS5_GPB0(0), 5, S3C_GPIO_SFN(2) },
428                 { EXYNOS5_GPB1(0), 5, S3C_GPIO_SFN(2) }
429         };
430
431         if (pdev->dev.of_node) {
432                 id = of_alias_get_id(pdev->dev.of_node, "i2s");
433                 if (id < 0)
434                         dev_err(&pdev->dev, "failed to get alias id:%d\n", id);
435         } else {
436                 id = pdev->id;
437         }
438
439         if (id < 0 || id > 2) {
440                 printk(KERN_ERR "Invalid Device %d\n", id);
441                 return -EINVAL;
442         }
443
444         s3c_gpio_cfgpin_range(exynos5_cfg[id].addr,
445                 exynos5_cfg[id].num, exynos5_cfg[id].bit);
446
447         return 0;
448 }
449
450 static struct s3c_audio_pdata i2sv5_pdata = {
451         .cfg_gpio = exynos_cfg_i2s_gpio,
452         .type = {
453                 .i2s = {
454                         .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI
455                                          | QUIRK_NEED_RSTCLR,
456                         .src_clk = rclksrc,
457                         .idma_addr = EXYNOS4_AUDSS_INT_MEM,
458                 },
459         },
460 };
461 /*
462  * The following lookup table is used to override device names when devices
463  * are registered from device tree. This is temporarily added to enable
464  * device tree support addition for the EXYNOS5 architecture.
465  *
466  * For drivers that require platform data to be provided from the machine
467  * file, a platform data pointer can also be supplied along with the
468  * devices names. Usually, the platform data elements that cannot be parsed
469  * from the device tree by the drivers (example: function pointers) are
470  * supplied. But it should be noted that this is a temporary mechanism and
471  * at some point, the drivers should be capable of parsing all the platform
472  * data from the device tree.
473  */
474 static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
475         OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART0,
476                                 "exynos4210-uart.0", NULL),
477         OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART1,
478                                 "exynos4210-uart.1", NULL),
479         OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART2,
480                                 "exynos4210-uart.2", NULL),
481         OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART3,
482                                 "exynos4210-uart.3", NULL),
483         OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(0),
484                                 "s3c2440-i2c.0", NULL),
485         OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(1),
486                                 "s3c2440-i2c.1", NULL),
487         OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(2),
488                                 "s3c2440-i2c.2", NULL),
489         OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(8),
490                                 "s3c2440-hdmiphy-i2c", NULL),
491         OF_DEV_AUXDATA("synopsis,dw-mshc-exynos5250", 0x12200000,
492                                 "dw_mmc.0", NULL),
493         OF_DEV_AUXDATA("synopsis,dw-mshc-exynos5250", 0x12210000,
494                                 "dw_mmc.1", NULL),
495         OF_DEV_AUXDATA("synopsis,dw-mshc-exynos5250", 0x12220000,
496                                 "dw_mmc.2", NULL),
497         OF_DEV_AUXDATA("synopsis,dw-mshc-exynos5250", 0x12230000,
498                                 "dw_mmc.3", NULL),
499         OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL),
500         OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL),
501         OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL),
502         OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x10A60000,
503                                 "s5p-sysmmu.2", &platdata_sysmmu_g2d),
504         OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x11210000,
505                                 "s5p-sysmmu.3", &platdata_sysmmu_mfc_l),
506         OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x11200000,
507                                 "s5p-sysmmu.4", &platdata_sysmmu_mfc_r),
508         OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x14640000,
509                                 "s5p-sysmmu.27", &platdata_sysmmu_fimd),
510         OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x14650000,
511                                 "s5p-sysmmu.28", &platdata_sysmmu_tv),
512         OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x13E80000,
513                                 "s5p-sysmmu.23", &platdata_sysmmu_gsc),
514         OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x13E90000,
515                                 "s5p-sysmmu.24", &platdata_sysmmu_gsc),
516         OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x13EA0000,
517                                 "s5p-sysmmu.25", &platdata_sysmmu_gsc),
518         OF_DEV_AUXDATA("samsung,s5p-sysmmu", 0x13EB0000,
519                                 "s5p-sysmmu.26", &platdata_sysmmu_gsc),
520         OF_DEV_AUXDATA("samsung,exynos5-fb", 0x14400000,
521                                 "exynos5-fb", &smdk5250_lcd1_pdata),
522         OF_DEV_AUXDATA("samsung,exynos5-mipi", 0x14500000,
523                                 "s5p-mipi-dsim", &dsim_platform_data),
524         OF_DEV_AUXDATA("samsung,s5p-mfc-v6", 0x11000000, "s5p-mfc-v6", NULL),
525         OF_DEV_AUXDATA("samsung,exynos-gsc", 0x13E00000,
526                                 "exynos-gsc.0", NULL),
527         OF_DEV_AUXDATA("samsung,exynos-gsc", 0x13E10000,
528                                 "exynos-gsc.1", NULL),
529         OF_DEV_AUXDATA("samsung,exynos-gsc", 0x13E20000,
530                                 "exynos-gsc.2", NULL),
531         OF_DEV_AUXDATA("samsung,exynos-gsc", 0x13E30000,
532                                 "exynos-gsc.3", NULL),
533 #ifdef CONFIG_VIDEO_FIMG2D4X
534         OF_DEV_AUXDATA("samsung,s5p-g2d", 0x10850000,
535                                 "s5p-g2d", &fimg2d_data),
536 #endif
537         OF_DEV_AUXDATA("samsung,exynos-ohci", 0x12120000,
538                                 "exynos-ohci", &smdk5250_ohci_pdata),
539         OF_DEV_AUXDATA("samsung,exynos-ehci", 0x12110000,
540                                 "s5p-ehci", &smdk5250_ehci_pdata),
541         OF_DEV_AUXDATA("samsung,exynos-xhci", 0x12000000,
542                                 "exynos-dwc3", &smdk5250_xhci_pdata),
543         OF_DEV_AUXDATA("samsung,i2s", 0x03830000,
544                                 "samsung-i2s.0", &i2sv5_pdata),
545         OF_DEV_AUXDATA("samsung,exynos5-hdmi", 0x14530000,
546                                 "exynos5-hdmi", NULL),
547         OF_DEV_AUXDATA("samsung,s5p-mixer", 0x14450000, "s5p-mixer", NULL),
548         {},
549 };
550
551 static struct platform_device *smdk5250_devices[] __initdata = {
552         &smdk5250_lcd, /* for platform_lcd device */
553         &exynos_device_md0, /* for media device framework */
554         &exynos_device_md1, /* for media device framework */
555         &exynos_device_md2, /* for media device framework */
556         &samsung_asoc_dma,  /* for audio dma interface device */
557         &exynos_drm_device,
558 };
559
560 static void __init exynos5250_dt_map_io(void)
561 {
562         exynos_init_io(NULL, 0);
563         s3c24xx_init_clocks(24000000);
564 }
565
566 static void __init exynos5_reserve(void)
567 {
568         /* required to have enough address range to remap the IOMMU
569          * allocated buffers */
570         init_consistent_dma_size(SZ_64M);
571 }
572
573 static void s5p_tv_setup(void)
574 {
575         /* direct HPD to HDMI chip */
576         gpio_request(EXYNOS5_GPX3(7), "hpd-plug");
577
578         gpio_direction_input(EXYNOS5_GPX3(7));
579         s3c_gpio_cfgpin(EXYNOS5_GPX3(7), S3C_GPIO_SFN(0x3));
580         s3c_gpio_setpull(EXYNOS5_GPX3(7), S3C_GPIO_PULL_NONE);
581 }
582
583 static void exynos5_i2c_setup(void)
584 {
585         /* Setup the low-speed i2c controller interrupts */
586         writel(0x0, EXYNOS5_SYS_I2C_CFG);
587 }
588
589 static void __init exynos5250_dt_machine_init(void)
590 {
591         if (of_machine_is_compatible("samsung,smdk5250"))
592                 smsc911x_init(1);
593         samsung_bl_set(&smdk5250_bl_gpio_info, &smdk5250_bl_data);
594
595         if (gpio_request_one(EXYNOS5_GPX2(6), GPIOF_OUT_INIT_HIGH,
596                 "HOST_VBUS_CONTROL")) {
597                 printk(KERN_ERR "failed to request gpio_host_vbus\n");
598         } else {
599                 s3c_gpio_setpull(EXYNOS5_GPX2(6), S3C_GPIO_PULL_NONE);
600                 gpio_free(EXYNOS5_GPX2(6));
601         }
602
603         exynos5_i2c_setup();
604
605         i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
606
607         of_platform_populate(NULL, of_default_bus_match_table,
608                                 exynos5250_auxdata_lookup, NULL);
609
610         s5p_tv_setup();
611
612         platform_add_devices(smdk5250_devices, ARRAY_SIZE(smdk5250_devices));
613 }
614
615 static char const *exynos5250_dt_compat[] __initdata = {
616         "samsung,exynos5250",
617         NULL
618 };
619
620 DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
621         /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
622         .init_irq       = exynos5_init_irq,
623         .reserve        = exynos5_reserve,
624         .map_io         = exynos5250_dt_map_io,
625         .handle_irq     = gic_handle_irq,
626         .init_machine   = exynos5250_dt_machine_init,
627         .timer          = &exynos4_timer,
628         .dt_compat      = exynos5250_dt_compat,
629         .restart        = exynos5_restart,
630 MACHINE_END