blob: bc5e8a9d3e0f63de4f983086550a4a2b483d5199 [file] [log] [blame]
Vikram Narayanan8bb48d62012-11-10 02:32:46 +00001/*
2 * Copyright (C) 2012 Freescale Semiconductor, Inc.
3 * Fabio Estevam <fabio.estevam@freescale.com>
4 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Vikram Narayanan8bb48d62012-11-10 02:32:46 +00006 */
7
8#include <common.h>
9#include <linux/list.h>
10#include <asm/gpio.h>
Benoît Thébaudeaub66011e2013-05-03 10:32:34 +000011#include <asm/arch/iomux-mx53.h>
Vikram Narayanan8bb48d62012-11-10 02:32:46 +000012#include <linux/fb.h>
13#include <ipu_pixfmt.h>
14
15#define MX53LOCO_LCD_POWER IMX_GPIO_NR(3, 24)
16
17static struct fb_videomode const claa_wvga = {
18 .name = "CLAA07LC0ACW",
19 .refresh = 57,
20 .xres = 800,
21 .yres = 480,
22 .pixclock = 37037,
23 .left_margin = 40,
24 .right_margin = 60,
25 .upper_margin = 10,
26 .lower_margin = 10,
27 .hsync_len = 20,
28 .vsync_len = 10,
29 .sync = 0,
30 .vmode = FB_VMODE_NONINTERLACED
31};
32
Fabio Estevamc50cf402013-01-09 05:10:16 +000033static struct fb_videomode const seiko_wvga = {
34 .name = "Seiko-43WVF1G",
35 .refresh = 60,
36 .xres = 800,
37 .yres = 480,
38 .pixclock = 29851, /* picosecond (33.5 MHz) */
39 .left_margin = 89,
40 .right_margin = 164,
41 .upper_margin = 23,
42 .lower_margin = 10,
43 .hsync_len = 10,
44 .vsync_len = 10,
45 .sync = 0,
46};
47
Vikram Narayanan8bb48d62012-11-10 02:32:46 +000048void setup_iomux_lcd(void)
49{
Benoît Thébaudeaub66011e2013-05-03 10:32:34 +000050 static const iomux_v3_cfg_t lcd_pads[] = {
51 MX53_PAD_DI0_DISP_CLK__IPU_DI0_DISP_CLK,
52 MX53_PAD_DI0_PIN15__IPU_DI0_PIN15,
53 MX53_PAD_DI0_PIN2__IPU_DI0_PIN2,
54 MX53_PAD_DI0_PIN3__IPU_DI0_PIN3,
55 MX53_PAD_DISP0_DAT0__IPU_DISP0_DAT_0,
56 MX53_PAD_DISP0_DAT1__IPU_DISP0_DAT_1,
57 MX53_PAD_DISP0_DAT2__IPU_DISP0_DAT_2,
58 MX53_PAD_DISP0_DAT3__IPU_DISP0_DAT_3,
59 MX53_PAD_DISP0_DAT4__IPU_DISP0_DAT_4,
60 MX53_PAD_DISP0_DAT5__IPU_DISP0_DAT_5,
61 MX53_PAD_DISP0_DAT6__IPU_DISP0_DAT_6,
62 MX53_PAD_DISP0_DAT7__IPU_DISP0_DAT_7,
63 MX53_PAD_DISP0_DAT8__IPU_DISP0_DAT_8,
64 MX53_PAD_DISP0_DAT9__IPU_DISP0_DAT_9,
65 MX53_PAD_DISP0_DAT10__IPU_DISP0_DAT_10,
66 MX53_PAD_DISP0_DAT11__IPU_DISP0_DAT_11,
67 MX53_PAD_DISP0_DAT12__IPU_DISP0_DAT_12,
68 MX53_PAD_DISP0_DAT13__IPU_DISP0_DAT_13,
69 MX53_PAD_DISP0_DAT14__IPU_DISP0_DAT_14,
70 MX53_PAD_DISP0_DAT15__IPU_DISP0_DAT_15,
71 MX53_PAD_DISP0_DAT16__IPU_DISP0_DAT_16,
72 MX53_PAD_DISP0_DAT17__IPU_DISP0_DAT_17,
73 MX53_PAD_DISP0_DAT18__IPU_DISP0_DAT_18,
74 MX53_PAD_DISP0_DAT19__IPU_DISP0_DAT_19,
75 MX53_PAD_DISP0_DAT20__IPU_DISP0_DAT_20,
76 MX53_PAD_DISP0_DAT21__IPU_DISP0_DAT_21,
77 MX53_PAD_DISP0_DAT22__IPU_DISP0_DAT_22,
78 MX53_PAD_DISP0_DAT23__IPU_DISP0_DAT_23,
79 };
80
81 imx_iomux_v3_setup_multiple_pads(lcd_pads, ARRAY_SIZE(lcd_pads));
Vikram Narayanan8bb48d62012-11-10 02:32:46 +000082
83 /* Turn on GPIO backlight */
Benoît Thébaudeaub66011e2013-05-03 10:32:34 +000084 imx_iomux_v3_setup_pad(MX53_PAD_EIM_D24__GPIO3_24);
Vikram Narayanan8bb48d62012-11-10 02:32:46 +000085 gpio_direction_output(MX53LOCO_LCD_POWER, 1);
86
87 /* Turn on display contrast */
Benoît Thébaudeaub66011e2013-05-03 10:32:34 +000088 imx_iomux_v3_setup_pad(MX53_PAD_GPIO_1__GPIO1_1);
89 gpio_direction_output(IMX_GPIO_NR(1, 1), 1);
Vikram Narayanan8bb48d62012-11-10 02:32:46 +000090}
91
Fabio Estevamc50cf402013-01-09 05:10:16 +000092int board_video_skip(void)
Vikram Narayanan8bb48d62012-11-10 02:32:46 +000093{
Fabio Estevamc50cf402013-01-09 05:10:16 +000094 int ret;
95 char const *e = getenv("panel");
96
97 if (e) {
98 if (strcmp(e, "seiko") == 0) {
99 ret = ipuv3_fb_init(&seiko_wvga, 0, IPU_PIX_FMT_RGB24);
100 if (ret)
101 printf("Seiko cannot be configured: %d\n", ret);
102 return ret;
103 }
104 }
105
106 /*
107 * 'panel' env variable not found or has different value than 'seiko'
108 * Defaulting to claa lcd.
109 */
110 ret = ipuv3_fb_init(&claa_wvga, 0, IPU_PIX_FMT_RGB565);
Vikram Narayanan8bb48d62012-11-10 02:32:46 +0000111 if (ret)
Fabio Estevamc50cf402013-01-09 05:10:16 +0000112 printf("CLAA cannot be configured: %d\n", ret);
113 return ret;
Vikram Narayanan8bb48d62012-11-10 02:32:46 +0000114}