aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-exynos/mach-exynos5-dt.c
blob: fdfe8c6c5616ce8a85e9172008a9c4be7eb59c5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
/*
 * SAMSUNG EXYNOS5250 Flattened Device Tree enabled machine
 *
 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
 *		http://www.samsung.com
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
*/

#define EXYNOS_MIPI_DRIVER
#define TC358764_PANEL  0
#define SE68AA0_PANEL   !TC358764_PANEL

#include <linux/of_platform.h>
#include <linux/of_fdt.h>
#include <linux/serial_core.h>
#include <linux/memblock.h>
#include <linux/of_fdt.h>
#include <linux/io.h>
#include <linux/pwm_backlight.h>
#include <linux/gpio.h>

#include <asm/mach/arch.h>
#include <asm/hardware/gic.h>
#include <mach/map.h>
#include <mach/regs-pmu.h>

#ifdef EXYNOS_MIPI_DRIVER
#include <video/exynos_mipi_dsim.h>
#else
#include <plat/dsim.h>
#endif
#include <plat/cpu.h>
#include <plat/regs-serial.h>
#include <plat/mfc.h>
#include <plat/backlight.h>
#include <plat/gpio-cfg.h>
#include <plat/fb.h>

#ifdef EXYNOS_MIPI_DRIVER
#include <linux/lcd.h>
#else
 #include <video/platform_lcd.h>
#endif

#include "common.h"

#if TC358764_PANEL
static struct mipi_dsim_config dsim_info = {
	.e_interface		= DSIM_VIDEO,
	.e_pixel_format		= DSIM_24BPP_888,
	/* main frame fifo auto flush at VSYNC pulse */
	.auto_flush		= false,
	.eot_disable		= false,
	.auto_vertical_cnt	= false,
	.hse			= false,
	.hfp			= false,
	.hbp			= false,
	.hsa			= false,

	.e_no_data_lane		= DSIM_DATA_LANE_4,
	.e_byte_clk		= DSIM_PLL_OUT_DIV8,
	.e_burst_mode		= DSIM_BURST,

	.p			= 3,
	.m			= 115,
	.s			= 1,

	/* D-PHY PLL stable time spec :min = 200usec ~ max 400usec */
	.pll_stable_time	= 500,

	.esc_clk		= 0.4 * 1000000, /* escape clk : 10MHz */

	/* stop state holding counter after bta change count 0 ~ 0xfff */
	.stop_holding_cnt	= 0x0f,
	.bta_timeout		= 0xff,		/* bta timeout 0 ~ 0xff */
	.rx_timeout		= 0xffff,	/* lp rx timeout 0 ~ 0xffff */
#ifdef EXYNOS_MIPI_DRIVER
        .e_virtual_ch           = DSIM_VIRTUAL_CH_0, /* :SAB */
        .cmd_allow              = 0xf,  /* :SAB */
#else
 	.dsim_ddi_pd = &tc358764_mipi_lcd_driver,
#endif
};
#else
static struct mipi_dsim_config dsim_info = {
	.e_interface		= DSIM_VIDEO,
	.e_pixel_format		= DSIM_24BPP_888,
	/* main frame fifo auto flush at VSYNC pulse */
	.auto_flush		= false,
	.eot_disable		= false,
	.auto_vertical_cnt	= true,
	.hse			= false,
	.hfp			= false,
	.hbp			= false,
	.hsa			= false,

	.e_no_data_lane		= DSIM_DATA_LANE_4,
	.e_byte_clk		= DSIM_PLL_OUT_DIV8,
	.e_burst_mode		= DSIM_BURST,

	.p			= 3,
	.m			= 115,
	.s			= 1,

	/* D-PHY PLL stable time spec :min = 200usec ~ max 400usec */
	.pll_stable_time	= 500,

	.esc_clk		= 7 * 1000000, /* escape clk : 10MHz */

	/* stop state holding counter after bta change count 0 ~ 0xfff */
	.stop_holding_cnt	= 0x0fff,
	.bta_timeout		= 0xff,		/* bta timeout 0 ~ 0xff */
	.rx_timeout		= 0xffff,	/* lp rx timeout 0 ~ 0xffff */
#ifdef EXYNOS_MIPI_DRIVER
        .e_virtual_ch           = DSIM_VIRTUAL_CH_0, /* :SAB */
        .cmd_allow              = 0xf,  /* :SAB */
#else
 	.dsim_ddi_pd = &tc358764_mipi_lcd_driver,
#endif
};

#endif

#if TC358764_PANEL
static struct fb_videomode tc358764_lcd_panel_info = {
        .left_margin    = 0x4,
        .right_margin   = 0x4,
        .upper_margin   = 0x4,
        .lower_margin   = 0x4,
        .hsync_len      = 0x4,
        .vsync_len      = 0x4,
        .xres           = 1280,
        .yres           = 800,
};
#elif SE68AA0_PANEL
static struct fb_videomode s6e8ax0_lcd_panel_info = {
        .left_margin    = 11,
        .right_margin   = 11,
        .upper_margin   = 3,
        .lower_margin   = 3,
        .hsync_len      = 2,
        .vsync_len      = 2,
        .xres           = 800,
        .yres           = 1280,
};
#endif

static int exynos_dsim_enable_d_phy(struct platform_device *pdev, bool enable)
{
        unsigned int reg;
#if defined(CONFIG_ARCH_EXYNOS5)
        reg = readl(S5P_MIPI_DPHY_CONTROL(1)) & ~(1 << 0);
        reg |= (enable << 0);
        writel(reg, S5P_MIPI_DPHY_CONTROL(1));
#else
        reg = readl(S5P_MIPI_DPHY_CONTROL(0)) & ~(1 << 0);
        reg |= (enable << 0);
        writel(reg, S5P_MIPI_DPHY_CONTROL(0));
#endif
        return 0;
}

static int exynos_dsim_enable_dsi_master(struct platform_device *pdev, bool enable)
{
        unsigned int reg;
#if defined(CONFIG_ARCH_EXYNOS5)
        reg = readl(S5P_MIPI_DPHY_CONTROL(1)) & ~(1 << 2);
        reg |= (enable << 2);
        writel(reg, S5P_MIPI_DPHY_CONTROL(1));
#else
        reg = readl(S5P_MIPI_DPHY_CONTROL(0)) & ~(1 << 2);
        reg |= (enable << 2);
        writel(reg, S5P_MIPI_DPHY_CONTROL(0));
#endif
        return 0;
}

int exynos_dsim_init_d_phy(struct platform_device *pdev, bool enable)
{
        /**
         * DPHY and aster block must be enabled at the system initialization
         * step before data access from/to DPHY begins.
         */
        exynos_dsim_enable_d_phy(pdev, enable);
        exynos_dsim_enable_dsi_master(pdev, enable);

        return 0;
}

#ifdef EXYNOS_MIPI_DRIVER
static int panel_set_power(struct lcd_device *ld, int power)
#else
static void panel_set_power(struct plat_lcd_data *pd,
 			unsigned int power)
#endif
{
	static int bPowerOn;

	if (power == bPowerOn)
		return 0;

	bPowerOn = power;

		/* reset */
		gpio_request_one(EXYNOS5_GPX1(5), GPIOF_OUT_INIT_HIGH, "GPX1");
		mdelay(20);
		gpio_set_value(EXYNOS5_GPX1(5), 0);
		mdelay(20);
		gpio_set_value(EXYNOS5_GPX1(5), 1);
		mdelay(20);
		gpio_free(EXYNOS5_GPX1(5));
		mdelay(20);

        return 0;

}
#if TC358764_PANEL
static struct mipi_dsim_platform_data tc358764_mipi_dsim_platform_data = {
        .lcd_panel_name = "tc358764",
        .dsim_config = &dsim_info,
        .enabled = 0,
        .lcd_panel_info = &tc358764_lcd_panel_info,
        .phy_enable = s5p_dsim_init_d_phy,
};
#elif SE68AA0_PANEL
static struct mipi_dsim_platform_data tc358764_mipi_dsim_platform_data = {
        .lcd_panel_name = "s6e8ax0",
        .dsim_config = &dsim_info,
        .enabled = 0,
        .lcd_panel_info = &s6e8ax0_lcd_panel_info,
        .phy_enable = exynos_dsim_init_d_phy,
};
#endif
static int dummy_lcd_reset(struct lcd_device *ld)
{
        return 1;
}

/* toshiba LVDS-MIPI */
#if TC358764_PANEL
static struct lcd_platform_data tc358764_lcd_platform_data = {
        .reset                  = dummy_lcd_reset,
        .power_on               = panel_set_power,
        .lcd_enabled            = 1,
        .reset_delay            = 120,  /* 120ms */
        .power_on_delay         = 25,   /* 25ms */
        .power_off_delay        = 200,  /* 200ms */
};

static struct mipi_dsim_lcd_device tc358764_mipi_dsim_lcd_device = {
       .name   = "tc358764",
       .id     = -1,
       .bus_id = 0,
       .platform_data  = (void *)&tc358764_lcd_platform_data,
};

#elif SE68AA0_PANEL
static void mipi_lcd_set_power(struct lcd_device *ld, unsigned int power)
{
	if (0/*samsung_rev() >= EXYNOS5250_REV_1_0*/) {
		if (!gpio_request(EXYNOS5_GPD1(5), "GPD1")) {
			s3c_gpio_cfgpin(EXYNOS5_GPD1(5), S3C_GPIO_SFN(1));
			gpio_direction_output(EXYNOS5_GPD1(5), 0);
			gpio_direction_output(EXYNOS5_GPD1(5), 1);
			gpio_free(EXYNOS5_GPD1(5));
		}
	}
	/* reset */
	gpio_request_one(EXYNOS5_GPX1(5), GPIOF_OUT_INIT_HIGH, "GPX1");

	msleep(20);
	if (power) {
		/* fire nRESET on power up */
		gpio_set_value(EXYNOS5_GPX1(5), 0);
		msleep(20);
		gpio_set_value(EXYNOS5_GPX1(5), 1);
		msleep(20);
		gpio_free(EXYNOS5_GPX1(5));
	} else {
		/* fire nRESET on power off */
		gpio_set_value(EXYNOS5_GPX1(5), 0);
		msleep(20);
		gpio_set_value(EXYNOS5_GPX1(5), 1);
		msleep(20);
		gpio_free(EXYNOS5_GPX1(5));
	}
	msleep(20);
	/* power */
	gpio_request_one(EXYNOS5_GPX3(0), GPIOF_OUT_INIT_LOW, "GPX3");
	if (power) {
		/* fire nRESET on power up */
		gpio_set_value(EXYNOS5_GPX3(0), 1);
		gpio_free(EXYNOS5_GPX3(0));
	} else {
		/* fire nRESET on power off */
		gpio_set_value(EXYNOS5_GPX3(0), 0);
		gpio_free(EXYNOS5_GPX3(0));
	}

#ifndef CONFIG_BACKLIGHT_PWM
	/* backlight */
	gpio_request_one(EXYNOS5_GPB2(0), GPIOF_OUT_INIT_LOW, "GPB2");
	if (power) {
		/* fire nRESET on power up */
		gpio_set_value(EXYNOS5_GPB2(0), 1);
		gpio_free(EXYNOS5_GPB2(0));
	} else {
		/* fire nRESET on power off */
		gpio_set_value(EXYNOS5_GPB2(0), 0);
		gpio_free(EXYNOS5_GPB2(0));
	}
#endif /* CONFIG_BACKLIGHT_PWM */
}

static struct lcd_platform_data s6e8ax0_lcd_platform_data = {
        .reset                  = dummy_lcd_reset,
        .power_on               = mipi_lcd_set_power,
        .lcd_enabled            = 1,
        .reset_delay            = 120,  /* 120ms */
        .power_on_delay         = 25,   /* 25ms */
        .power_off_delay        = 200,  /* 200ms */
};

static struct mipi_dsim_lcd_device s6e8ax0_mipi_dsim_lcd_device = {
       .name   = "s6e8ax0",
       .id     = -1,
       .bus_id = 0,
       .platform_data  = (void *)&s6e8ax0_lcd_platform_data,
};

#endif


#if 0
static int smdk5250_match_fb(struct plat_lcd_data *pd, struct fb_info *info)
{
	/* Don't call .set_power callback while unblanking */
	return 0;
}
static struct plat_lcd_data smdk5250_lcd_data = {
	.set_power	= __lcd_set_power,
	.match_fb	= smdk5250_match_fb,
};

static struct platform_device smdk5250_lcd = {
	.name			= "platform-lcd",
	.dev.platform_data	= &smdk5250_lcd_data,
};
#endif
static struct resource exynos_dsim_resource[] = {
	[0] = {
		.start = 0x14500000,
		.end   = 0x14500000 + 0x10000 - 1,
		.flags = IORESOURCE_MEM,
	},
	[1] = {
		.start = 82,
		.end   = 82,
		.flags = IORESOURCE_IRQ,
	},
};

struct platform_device exynos_device_mipi_dsim = {
	.name			= "exynos-mipi-dsim",
	.id			= 0,
	.num_resources		= ARRAY_SIZE(exynos_dsim_resource),
	.resource		= exynos_dsim_resource,
	.dev			= {
		.platform_data	= &tc358764_mipi_dsim_platform_data,
	},
};


static int smdk5250_bl_notify(struct device *unused, int brightness)
{
	/* manage lcd_bl_en signal */
	if (brightness)
		gpio_set_value(EXYNOS5_GPX3(0), 1);
	else
		gpio_set_value(EXYNOS5_GPX3(0), 0);

	return brightness;
}

/* LCD Backlight data */
static struct samsung_bl_gpio_info smdk5250_bl_gpio_info = {
	.no	= EXYNOS5_GPB2(0),
	.func	= S3C_GPIO_SFN(2),
};

static struct platform_pwm_backlight_data smdk5250_bl_data = {
	.pwm_period_ns	= 1000000,
	.notify		= smdk5250_bl_notify,
};
/*
 * The following lookup table is used to override device names when devices
 * are registered from device tree. This is temporarily added to enable
 * device tree support addition for the EXYNOS5 architecture.
 *
 * For drivers that require platform data to be provided from the machine
 * file, a platform data pointer can also be supplied along with the
 * devices names. Usually, the platform data elements that cannot be parsed
 * from the device tree by the drivers (example: function pointers) are
 * supplied. But it should be noted that this is a temporary mechanism and
 * at some point, the drivers should be capable of parsing all the platform
 * data from the device tree.
 */
static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
	OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART0,
				"exynos4210-uart.0", NULL),
	OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART1,
				"exynos4210-uart.1", NULL),
	OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART2,
				"exynos4210-uart.2", NULL),
	OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART3,
				"exynos4210-uart.3", NULL),
	OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(0),
				"s3c2440-i2c.0", NULL),
	OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(1),
				"s3c2440-i2c.1", NULL),
	OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(2),
				"s3c2440-i2c.2", NULL),
	OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(3),
				"s3c2440-i2c.3", NULL),
	OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(4),
				"s3c2440-i2c.4", NULL),
	OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(5),
				"s3c2440-i2c.5", NULL),
	OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(6),
				"s3c2440-i2c.6", NULL),
	OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(7),
				"s3c2440-i2c.7", NULL),
	OF_DEV_AUXDATA("samsung,s3c2440-hdmiphy-i2c", EXYNOS5_PA_IIC(8),
				"s3c2440-hdmiphy-i2c", NULL),
	OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI0,
				"dw_mmc.0", NULL),
	OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI1,
				"dw_mmc.1", NULL),
	OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI2,
				"dw_mmc.2", NULL),
	OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI3,
				"dw_mmc.3", NULL),
	OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI0,
				"exynos4210-spi.0", NULL),
	OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI1,
				"exynos4210-spi.1", NULL),
	OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI2,
				"exynos4210-spi.2", NULL),
	OF_DEV_AUXDATA("samsung,exynos5-sata-ahci", 0x122F0000,
				"exynos5-sata", NULL),
	OF_DEV_AUXDATA("samsung,exynos5-sata-phy", 0x12170000,
				"exynos5-sata-phy", NULL),
	OF_DEV_AUXDATA("samsung,exynos5-sata-phy-i2c", 0x121D0000,
				"exynos5-sata-phy-i2c", NULL),
	OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL),
	OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL),
	OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL),
	OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC0,
				"exynos-gsc.0", NULL),
	OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC1,
				"exynos-gsc.1", NULL),
	OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC2,
				"exynos-gsc.2", NULL),
	OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC3,
				"exynos-gsc.3", NULL),
	OF_DEV_AUXDATA("samsung,exynos5-hdmi", 0x14530000,
				"exynos5-hdmi", NULL),
	OF_DEV_AUXDATA("samsung,exynos5-mixer", 0x14450000,
				"exynos5-mixer", NULL),
	OF_DEV_AUXDATA("samsung,exynos5-fimd", EXYNOS5_PA_FIMD1,
				"exynos5-fb.1", NULL),

	OF_DEV_AUXDATA("samsung,exynos5-mipi", 0x14500000,
					"exynos-mipi-dsim", &tc358764_mipi_dsim_platform_data),

	OF_DEV_AUXDATA("samsung,exynos5-dp", EXYNOS5_PA_DP, "exynos-dp", NULL),
	OF_DEV_AUXDATA("samsung,mfc-v6", 0x11000000, "s5p-mfc-v6", NULL),
	OF_DEV_AUXDATA("samsung,exynos5250-tmu", 0x10060000,
				"exynos-tmu", NULL),
	OF_DEV_AUXDATA("samsung,samsung-i2s", 0x03830000,
				"samsung-i2s.0", NULL),
	OF_DEV_AUXDATA("samsung,samsung-i2s", 0x12D60000,
				"samsung-i2s.1", NULL),
	OF_DEV_AUXDATA("samsung,samsung-i2s", 0x12D70000,
				"samsung-i2s.2", NULL),
	OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11210000,
			"exynos-sysmmu.0", "mfc"), /* MFC_L */
	OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11200000,
			"exynos-sysmmu.1", "mfc"), /* MFC_R */
	OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x14650000,
			"exynos-sysmmu.2", NULL), /* TV */
	OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11F20000,
			"exynos-sysmmu.3", "jpeg"), /* JPEG */
	OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x11D40000,
			"exynos-sysmmu.4", NULL), /* ROTATOR */
	OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13E80000,
			"exynos-sysmmu.5", "gscl"), /* GSCL0 */
	OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13E90000,
			"exynos-sysmmu.6", "gscl"), /* GSCL1 */
	OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13EA0000,
			"exynos-sysmmu.7", "gscl"), /* GSCL2 */
	OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13EB0000,
			"exynos-sysmmu.8", "gscl"), /* GSCL3 */
	OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13260000,
			"exynos-sysmmu.9", NULL), /* FIMC-IS0 */
	OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x132C0000,
			"exynos-sysmmu.10", NULL), /* FIMC-IS1 */
	OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x14640000,
			"exynos-sysmmu.11", NULL), /* FIMD1 */
	OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13C40000,
			"exynos-sysmmu.12", NULL), /* FIMC-LITE0 */
	OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x13C50000,
			"exynos-sysmmu.13", NULL), /* FIMC-LITE1 */
	OF_DEV_AUXDATA("samsung,exynos-sysmmu", 0x10A60000,
			"exynos-sysmmu.14", NULL), /* G2D */
	{},
};

static const struct of_dev_auxdata exynos5440_auxdata_lookup[] __initconst = {
	OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5440_PA_UART0,
				"exynos4210-uart.0", NULL),
	{},
};

static void __init exynos5_dt_map_io(void)
{
	unsigned long root = of_get_flat_dt_root();

	exynos_init_io(NULL, 0);

	if (of_flat_dt_is_compatible(root, "samsung,exynos5250"))
		s3c24xx_init_clocks(24000000);
}

static void __init exynos5_dt_machine_init(void)
{
	struct device_node *i2c_np;
	const char *i2c_compat = "samsung,s3c2440-i2c";
	unsigned int tmp;

	/*
	 * Exynos5's legacy i2c controller and new high speed i2c
	 * controller have muxed interrupt sources. By default the
	 * interrupts for 4-channel HS-I2C controller are enabled.
	 * If node for first four channels of legacy i2c controller
	 * are available then re-configure the interrupts via the
	 * system register.
	 */
	for_each_compatible_node(i2c_np, NULL, i2c_compat) {
		if (of_device_is_available(i2c_np)) {
			if (of_alias_get_id(i2c_np, "i2c") < 4) {
				tmp = readl(EXYNOS5_SYS_I2C_CFG);
				writel(tmp & ~(0x1 << of_alias_get_id(i2c_np, "i2c")),
						EXYNOS5_SYS_I2C_CFG);
			}
		}
	}

	if (of_machine_is_compatible("samsung,exynos5250")) {
		gpio_request_one(EXYNOS5_GPX3(0), GPIOF_OUT_INIT_HIGH,
								"lcd_bl_en");
		samsung_bl_set(&smdk5250_bl_gpio_info, &smdk5250_bl_data);
		of_platform_populate(NULL, of_default_bus_match_table,
				     exynos5250_auxdata_lookup, NULL);
		exynos5_fimd1_gpio_setup_24bpp();
	}
	else if (of_machine_is_compatible("samsung,exynos5440"))
		of_platform_populate(NULL, of_default_bus_match_table,
				     exynos5440_auxdata_lookup, NULL);


#ifdef EXYNOS_MIPI_DRIVER
#if TC358764_PANEL
        pr_err("v  MIPI:SAB exynos_mipi_dsi_register_lcd_device from exynos5_dt.c file ");
        pr_err("v MIPI:SAB register_ldc_device_name: %s", tc358764_mipi_dsim_lcd_device.name);
        exynos_mipi_dsi_register_lcd_device(&tc358764_mipi_dsim_lcd_device);
#else
	pr_err("v  MIPI:SAB exynos_mipi_dsi_register_lcd_device from exynos5_dt.c file ");
        pr_err("v  MIPI:SAB register_ldc_device_name: %s", s6e8ax0_mipi_dsim_lcd_device.name);
        exynos_mipi_dsi_register_lcd_device(&s6e8ax0_mipi_dsim_lcd_device);
#endif
#endif
}

static char const *exynos5_dt_compat[] __initdata = {
	"samsung,exynos5250",
	"samsung,exynos5440",
	NULL
};

static void __init exynos5_reserve(void)
{
	struct s5p_mfc_dt_meminfo mfc_mem;

	/* Reserve memory for MFC only if it's available */
	mfc_mem.compatible = "samsung,mfc-v6";
	if (of_scan_flat_dt(s5p_fdt_find_mfc_mem, &mfc_mem))
		s5p_mfc_reserve_mem(mfc_mem.roff, mfc_mem.rsize, mfc_mem.loff,
				mfc_mem.lsize);
}

DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
	/* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
	.init_irq	= exynos5_init_irq,
	.smp		= smp_ops(exynos_smp_ops),
	.map_io		= exynos5_dt_map_io,
	.handle_irq	= gic_handle_irq,
	.init_machine	= exynos5_dt_machine_init,
	.init_late	= exynos_init_late,
	.timer		= &exynos4_timer,
	.dt_compat	= exynos5_dt_compat,
	.restart        = exynos5_restart,
	.reserve	= exynos5_reserve,
MACHINE_END