1 /*
2  * Copyright (C) 2015  Beckhoff Automation GmbH & Co. KG
3  * Patrick Bruenn <p.bruenn@beckhoff.com>
4  *
5  * Based on <u-boot>/board/freescale/mx53loco/mx53loco_video.c
6  * Copyright (C) 2012 Freescale Semiconductor, Inc.
7  *
8  * SPDX-License-Identifier:	GPL-2.0+
9  */
10 
11 #include <common.h>
12 #include <linux/list.h>
13 #include <asm/gpio.h>
14 #include <asm/arch/iomux-mx53.h>
15 #include <linux/fb.h>
16 #include <ipu_pixfmt.h>
17 
18 #define CX9020_DVI_PWD	IMX_GPIO_NR(6, 1)
19 
20 static struct fb_videomode const vga_640x480 = {
21 	.name = "VESA_VGA_640x480",
22 	.refresh = 60,
23 	.xres = 640,
24 	.yres = 480,
25 	.pixclock = 39721,	/* picosecond (25.175 MHz) */
26 	.left_margin = 40,
27 	.right_margin = 60,
28 	.upper_margin = 10,
29 	.lower_margin = 10,
30 	.hsync_len = 20,
31 	.vsync_len = 10,
32 	.sync = 0,
33 	.vmode = FB_VMODE_NONINTERLACED
34 };
35 
36 void setup_iomux_lcd(void)
37 {
38 	/* Turn on DVI_PWD */
39 	imx_iomux_v3_setup_pad(MX53_PAD_CSI0_DAT15__GPIO6_1);
40 	gpio_direction_output(CX9020_DVI_PWD, 1);
41 }
42 
43 int board_video_skip(void)
44 {
45 	const int ret = ipuv3_fb_init(&vga_640x480, 0, IPU_PIX_FMT_RGB24);
46 	if (ret)
47 		printf("VESA VG 640x480 cannot be configured: %d\n", ret);
48 	return ret;
49 }
50