]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/freescale/mx53loco/mx53loco_video.c
Merge remote-tracking branch 'mpc83xx/next'
[karo-tx-uboot.git] / board / freescale / mx53loco / mx53loco_video.c
1 /*
2  * Copyright (C) 2012 Freescale Semiconductor, Inc.
3  * Fabio Estevam <fabio.estevam@freescale.com>
4  *
5  * See file CREDITS for list of people who contributed to this
6  * project.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of
11  * the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21  * MA 02111-1307 USA
22  */
23
24 #include <common.h>
25 #include <linux/list.h>
26 #include <asm/gpio.h>
27 #include <asm/arch/iomux.h>
28 #include <linux/fb.h>
29 #include <ipu_pixfmt.h>
30
31 #define MX53LOCO_LCD_POWER              IMX_GPIO_NR(3, 24)
32
33 static struct fb_videomode const claa_wvga = {
34         .name           = "CLAA07LC0ACW",
35         .refresh        = 57,
36         .xres           = 800,
37         .yres           = 480,
38         .pixclock       = 37037,
39         .left_margin    = 40,
40         .right_margin   = 60,
41         .upper_margin   = 10,
42         .lower_margin   = 10,
43         .hsync_len      = 20,
44         .vsync_len      = 10,
45         .sync           = 0,
46         .vmode          = FB_VMODE_NONINTERLACED
47 };
48
49 static struct fb_videomode const seiko_wvga = {
50         .name           = "Seiko-43WVF1G",
51         .refresh        = 60,
52         .xres           = 800,
53         .yres           = 480,
54         .pixclock       = 29851, /* picosecond (33.5 MHz) */
55         .left_margin    = 89,
56         .right_margin   = 164,
57         .upper_margin   = 23,
58         .lower_margin   = 10,
59         .hsync_len      = 10,
60         .vsync_len      = 10,
61         .sync           = 0,
62 };
63
64 void setup_iomux_lcd(void)
65 {
66         mxc_request_iomux(MX53_PIN_DI0_DISP_CLK, IOMUX_CONFIG_ALT0);
67         mxc_request_iomux(MX53_PIN_DI0_PIN15, IOMUX_CONFIG_ALT0);
68         mxc_request_iomux(MX53_PIN_DI0_PIN2, IOMUX_CONFIG_ALT0);
69         mxc_request_iomux(MX53_PIN_DI0_PIN3, IOMUX_CONFIG_ALT0);
70         mxc_request_iomux(MX53_PIN_DISP0_DAT0, IOMUX_CONFIG_ALT0);
71         mxc_request_iomux(MX53_PIN_DISP0_DAT1, IOMUX_CONFIG_ALT0);
72         mxc_request_iomux(MX53_PIN_DISP0_DAT2, IOMUX_CONFIG_ALT0);
73         mxc_request_iomux(MX53_PIN_DISP0_DAT3, IOMUX_CONFIG_ALT0);
74         mxc_request_iomux(MX53_PIN_DISP0_DAT4, IOMUX_CONFIG_ALT0);
75         mxc_request_iomux(MX53_PIN_DISP0_DAT5, IOMUX_CONFIG_ALT0);
76         mxc_request_iomux(MX53_PIN_DISP0_DAT6, IOMUX_CONFIG_ALT0);
77         mxc_request_iomux(MX53_PIN_DISP0_DAT7, IOMUX_CONFIG_ALT0);
78         mxc_request_iomux(MX53_PIN_DISP0_DAT8, IOMUX_CONFIG_ALT0);
79         mxc_request_iomux(MX53_PIN_DISP0_DAT9, IOMUX_CONFIG_ALT0);
80         mxc_request_iomux(MX53_PIN_DISP0_DAT10, IOMUX_CONFIG_ALT0);
81         mxc_request_iomux(MX53_PIN_DISP0_DAT11, IOMUX_CONFIG_ALT0);
82         mxc_request_iomux(MX53_PIN_DISP0_DAT12, IOMUX_CONFIG_ALT0);
83         mxc_request_iomux(MX53_PIN_DISP0_DAT13, IOMUX_CONFIG_ALT0);
84         mxc_request_iomux(MX53_PIN_DISP0_DAT14, IOMUX_CONFIG_ALT0);
85         mxc_request_iomux(MX53_PIN_DISP0_DAT15, IOMUX_CONFIG_ALT0);
86         mxc_request_iomux(MX53_PIN_DISP0_DAT16, IOMUX_CONFIG_ALT0);
87         mxc_request_iomux(MX53_PIN_DISP0_DAT17, IOMUX_CONFIG_ALT0);
88         mxc_request_iomux(MX53_PIN_DISP0_DAT18, IOMUX_CONFIG_ALT0);
89         mxc_request_iomux(MX53_PIN_DISP0_DAT19, IOMUX_CONFIG_ALT0);
90         mxc_request_iomux(MX53_PIN_DISP0_DAT20, IOMUX_CONFIG_ALT0);
91         mxc_request_iomux(MX53_PIN_DISP0_DAT21, IOMUX_CONFIG_ALT0);
92         mxc_request_iomux(MX53_PIN_DISP0_DAT22, IOMUX_CONFIG_ALT0);
93         mxc_request_iomux(MX53_PIN_DISP0_DAT23, IOMUX_CONFIG_ALT0);
94
95         /* Turn on GPIO backlight */
96         mxc_request_iomux(MX53_PIN_EIM_D24, IOMUX_CONFIG_ALT1);
97         gpio_direction_output(MX53LOCO_LCD_POWER, 1);
98
99         /* Turn on display contrast */
100         mxc_request_iomux(MX53_PIN_GPIO_1, IOMUX_CONFIG_ALT1);
101         gpio_direction_output(IOMUX_TO_GPIO(MX53_PIN_GPIO_1), 1);
102 }
103
104 int board_video_skip(void)
105 {
106         int ret;
107         char const *e = getenv("panel");
108
109         if (e) {
110                 if (strcmp(e, "seiko") == 0) {
111                         ret = ipuv3_fb_init(&seiko_wvga, 0, IPU_PIX_FMT_RGB24);
112                         if (ret)
113                                 printf("Seiko cannot be configured: %d\n", ret);
114                         return ret;
115                 }
116         }
117
118         /*
119          * 'panel' env variable not found or has different value than 'seiko'
120          *  Defaulting to claa lcd.
121          */
122         ret = ipuv3_fb_init(&claa_wvga, 0, IPU_PIX_FMT_RGB565);
123         if (ret)
124                 printf("CLAA cannot be configured: %d\n", ret);
125         return ret;
126 }