blob: 160af1ef0df3f7bb095f33d92e245583206601ae [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Vikram Narayanan30ea4be2012-11-10 02:32:46 +00002/*
3 * Copyright (C) 2012 Freescale Semiconductor, Inc.
4 * Fabio Estevam <fabio.estevam@freescale.com>
Vikram Narayanan30ea4be2012-11-10 02:32:46 +00005 */
6
7#include <common.h>
8#include <linux/list.h>
9#include <asm/gpio.h>
Benoît Thébaudeau721d0b02013-05-03 10:32:34 +000010#include <asm/arch/iomux-mx53.h>
Vikram Narayanan30ea4be2012-11-10 02:32:46 +000011#include <linux/fb.h>
12#include <ipu_pixfmt.h>
13
14#define MX53LOCO_LCD_POWER IMX_GPIO_NR(3, 24)
15
16static struct fb_videomode const claa_wvga = {
17 .name = "CLAA07LC0ACW",
18 .refresh = 57,
19 .xres = 800,
20 .yres = 480,
21 .pixclock = 37037,
22 .left_margin = 40,
23 .right_margin = 60,
24 .upper_margin = 10,
25 .lower_margin = 10,
26 .hsync_len = 20,
27 .vsync_len = 10,
28 .sync = 0,
29 .vmode = FB_VMODE_NONINTERLACED
30};
31
Fabio Estevam17c5ef22013-01-09 05:10:16 +000032static struct fb_videomode const seiko_wvga = {
33 .name = "Seiko-43WVF1G",
34 .refresh = 60,
35 .xres = 800,
36 .yres = 480,
37 .pixclock = 29851, /* picosecond (33.5 MHz) */
38 .left_margin = 89,
39 .right_margin = 164,
40 .upper_margin = 23,
41 .lower_margin = 10,
42 .hsync_len = 10,
43 .vsync_len = 10,
44 .sync = 0,
45};
46
Vikram Narayanan30ea4be2012-11-10 02:32:46 +000047void setup_iomux_lcd(void)
48{
Benoît Thébaudeau721d0b02013-05-03 10:32:34 +000049 static const iomux_v3_cfg_t lcd_pads[] = {
50 MX53_PAD_DI0_DISP_CLK__IPU_DI0_DISP_CLK,
51 MX53_PAD_DI0_PIN15__IPU_DI0_PIN15,
52 MX53_PAD_DI0_PIN2__IPU_DI0_PIN2,
53 MX53_PAD_DI0_PIN3__IPU_DI0_PIN3,
54 MX53_PAD_DISP0_DAT0__IPU_DISP0_DAT_0,
55 MX53_PAD_DISP0_DAT1__IPU_DISP0_DAT_1,
56 MX53_PAD_DISP0_DAT2__IPU_DISP0_DAT_2,
57 MX53_PAD_DISP0_DAT3__IPU_DISP0_DAT_3,
58 MX53_PAD_DISP0_DAT4__IPU_DISP0_DAT_4,
59 MX53_PAD_DISP0_DAT5__IPU_DISP0_DAT_5,
60 MX53_PAD_DISP0_DAT6__IPU_DISP0_DAT_6,
61 MX53_PAD_DISP0_DAT7__IPU_DISP0_DAT_7,
62 MX53_PAD_DISP0_DAT8__IPU_DISP0_DAT_8,
63 MX53_PAD_DISP0_DAT9__IPU_DISP0_DAT_9,
64 MX53_PAD_DISP0_DAT10__IPU_DISP0_DAT_10,
65 MX53_PAD_DISP0_DAT11__IPU_DISP0_DAT_11,
66 MX53_PAD_DISP0_DAT12__IPU_DISP0_DAT_12,
67 MX53_PAD_DISP0_DAT13__IPU_DISP0_DAT_13,
68 MX53_PAD_DISP0_DAT14__IPU_DISP0_DAT_14,
69 MX53_PAD_DISP0_DAT15__IPU_DISP0_DAT_15,
70 MX53_PAD_DISP0_DAT16__IPU_DISP0_DAT_16,
71 MX53_PAD_DISP0_DAT17__IPU_DISP0_DAT_17,
72 MX53_PAD_DISP0_DAT18__IPU_DISP0_DAT_18,
73 MX53_PAD_DISP0_DAT19__IPU_DISP0_DAT_19,
74 MX53_PAD_DISP0_DAT20__IPU_DISP0_DAT_20,
75 MX53_PAD_DISP0_DAT21__IPU_DISP0_DAT_21,
76 MX53_PAD_DISP0_DAT22__IPU_DISP0_DAT_22,
77 MX53_PAD_DISP0_DAT23__IPU_DISP0_DAT_23,
78 };
79
80 imx_iomux_v3_setup_multiple_pads(lcd_pads, ARRAY_SIZE(lcd_pads));
Vikram Narayanan30ea4be2012-11-10 02:32:46 +000081
82 /* Turn on GPIO backlight */
Benoît Thébaudeau721d0b02013-05-03 10:32:34 +000083 imx_iomux_v3_setup_pad(MX53_PAD_EIM_D24__GPIO3_24);
Vikram Narayanan30ea4be2012-11-10 02:32:46 +000084 gpio_direction_output(MX53LOCO_LCD_POWER, 1);
85
86 /* Turn on display contrast */
Benoît Thébaudeau721d0b02013-05-03 10:32:34 +000087 imx_iomux_v3_setup_pad(MX53_PAD_GPIO_1__GPIO1_1);
88 gpio_direction_output(IMX_GPIO_NR(1, 1), 1);
Vikram Narayanan30ea4be2012-11-10 02:32:46 +000089}
90
Fabio Estevam17c5ef22013-01-09 05:10:16 +000091int board_video_skip(void)
Vikram Narayanan30ea4be2012-11-10 02:32:46 +000092{
Fabio Estevam17c5ef22013-01-09 05:10:16 +000093 int ret;
Simon Glass00caae62017-08-03 12:22:12 -060094 char const *e = env_get("panel");
Fabio Estevam17c5ef22013-01-09 05:10:16 +000095
96 if (e) {
97 if (strcmp(e, "seiko") == 0) {
98 ret = ipuv3_fb_init(&seiko_wvga, 0, IPU_PIX_FMT_RGB24);
99 if (ret)
100 printf("Seiko cannot be configured: %d\n", ret);
101 return ret;
102 }
103 }
104
105 /*
106 * 'panel' env variable not found or has different value than 'seiko'
107 * Defaulting to claa lcd.
108 */
109 ret = ipuv3_fb_init(&claa_wvga, 0, IPU_PIX_FMT_RGB565);
Vikram Narayanan30ea4be2012-11-10 02:32:46 +0000110 if (ret)
Fabio Estevam17c5ef22013-01-09 05:10:16 +0000111 printf("CLAA cannot be configured: %d\n", ret);
112 return ret;
Vikram Narayanan30ea4be2012-11-10 02:32:46 +0000113}