Vikram Narayanan | 30ea4be | 2012-11-10 02:32:46 +0000 | [diff] [blame] | 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 | void setup_iomux_lcd(void) |
| 50 | { |
| 51 | mxc_request_iomux(MX53_PIN_DI0_DISP_CLK, IOMUX_CONFIG_ALT0); |
| 52 | mxc_request_iomux(MX53_PIN_DI0_PIN15, IOMUX_CONFIG_ALT0); |
| 53 | mxc_request_iomux(MX53_PIN_DI0_PIN2, IOMUX_CONFIG_ALT0); |
| 54 | mxc_request_iomux(MX53_PIN_DI0_PIN3, IOMUX_CONFIG_ALT0); |
| 55 | mxc_request_iomux(MX53_PIN_DISP0_DAT0, IOMUX_CONFIG_ALT0); |
| 56 | mxc_request_iomux(MX53_PIN_DISP0_DAT1, IOMUX_CONFIG_ALT0); |
| 57 | mxc_request_iomux(MX53_PIN_DISP0_DAT2, IOMUX_CONFIG_ALT0); |
| 58 | mxc_request_iomux(MX53_PIN_DISP0_DAT3, IOMUX_CONFIG_ALT0); |
| 59 | mxc_request_iomux(MX53_PIN_DISP0_DAT4, IOMUX_CONFIG_ALT0); |
| 60 | mxc_request_iomux(MX53_PIN_DISP0_DAT5, IOMUX_CONFIG_ALT0); |
| 61 | mxc_request_iomux(MX53_PIN_DISP0_DAT6, IOMUX_CONFIG_ALT0); |
| 62 | mxc_request_iomux(MX53_PIN_DISP0_DAT7, IOMUX_CONFIG_ALT0); |
| 63 | mxc_request_iomux(MX53_PIN_DISP0_DAT8, IOMUX_CONFIG_ALT0); |
| 64 | mxc_request_iomux(MX53_PIN_DISP0_DAT9, IOMUX_CONFIG_ALT0); |
| 65 | mxc_request_iomux(MX53_PIN_DISP0_DAT10, IOMUX_CONFIG_ALT0); |
| 66 | mxc_request_iomux(MX53_PIN_DISP0_DAT11, IOMUX_CONFIG_ALT0); |
| 67 | mxc_request_iomux(MX53_PIN_DISP0_DAT12, IOMUX_CONFIG_ALT0); |
| 68 | mxc_request_iomux(MX53_PIN_DISP0_DAT13, IOMUX_CONFIG_ALT0); |
| 69 | mxc_request_iomux(MX53_PIN_DISP0_DAT14, IOMUX_CONFIG_ALT0); |
| 70 | mxc_request_iomux(MX53_PIN_DISP0_DAT15, IOMUX_CONFIG_ALT0); |
| 71 | mxc_request_iomux(MX53_PIN_DISP0_DAT16, IOMUX_CONFIG_ALT0); |
| 72 | mxc_request_iomux(MX53_PIN_DISP0_DAT17, IOMUX_CONFIG_ALT0); |
| 73 | mxc_request_iomux(MX53_PIN_DISP0_DAT18, IOMUX_CONFIG_ALT0); |
| 74 | mxc_request_iomux(MX53_PIN_DISP0_DAT19, IOMUX_CONFIG_ALT0); |
| 75 | mxc_request_iomux(MX53_PIN_DISP0_DAT20, IOMUX_CONFIG_ALT0); |
| 76 | mxc_request_iomux(MX53_PIN_DISP0_DAT21, IOMUX_CONFIG_ALT0); |
| 77 | mxc_request_iomux(MX53_PIN_DISP0_DAT22, IOMUX_CONFIG_ALT0); |
| 78 | mxc_request_iomux(MX53_PIN_DISP0_DAT23, IOMUX_CONFIG_ALT0); |
| 79 | |
| 80 | /* Turn on GPIO backlight */ |
| 81 | mxc_request_iomux(MX53_PIN_EIM_D24, IOMUX_CONFIG_ALT1); |
| 82 | gpio_direction_output(MX53LOCO_LCD_POWER, 1); |
| 83 | |
| 84 | /* Turn on display contrast */ |
| 85 | mxc_request_iomux(MX53_PIN_GPIO_1, IOMUX_CONFIG_ALT1); |
| 86 | gpio_direction_output(IOMUX_TO_GPIO(MX53_PIN_GPIO_1), 1); |
| 87 | } |
| 88 | |
| 89 | void lcd_enable(void) |
| 90 | { |
| 91 | int ret = ipuv3_fb_init(&claa_wvga, 0, IPU_PIX_FMT_RGB565); |
| 92 | if (ret) |
| 93 | printf("LCD cannot be configured: %d\n", ret); |
| 94 | } |