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