Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Sébastien Szymanski | a7762e4 | 2017-03-07 14:33:25 +0100 | [diff] [blame] | 2 | /* |
Sébastien Szymanski | 1f29ce5 | 2018-04-17 17:29:31 +0200 | [diff] [blame] | 3 | * Copyright (C) 2018 Armadeus Systems |
Sébastien Szymanski | a7762e4 | 2017-03-07 14:33:25 +0100 | [diff] [blame] | 4 | */ |
| 5 | |
Sébastien Szymanski | a7762e4 | 2017-03-07 14:33:25 +0100 | [diff] [blame] | 6 | #include <asm/arch/mx6-pins.h> |
Sébastien Szymanski | a7762e4 | 2017-03-07 14:33:25 +0100 | [diff] [blame] | 7 | #include <asm/arch/sys_proto.h> |
| 8 | #include <asm/gpio.h> |
Stefano Babic | 33731bc | 2017-06-29 10:16:06 +0200 | [diff] [blame] | 9 | #include <asm/mach-imx/iomux-v3.h> |
Sébastien Szymanski | a7762e4 | 2017-03-07 14:33:25 +0100 | [diff] [blame] | 10 | #include <asm/io.h> |
| 11 | #include <common.h> |
| 12 | |
Sébastien Szymanski | a7762e4 | 2017-03-07 14:33:25 +0100 | [diff] [blame] | 13 | #ifdef CONFIG_VIDEO_MXS |
| 14 | #define LCD_PAD_CTRL ( \ |
| 15 | PAD_CTL_HYS | PAD_CTL_PUS_100K_UP | PAD_CTL_PUE | \ |
| 16 | PAD_CTL_PKE | PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm \ |
| 17 | ) |
| 18 | |
| 19 | static iomux_v3_cfg_t const lcd_pads[] = { |
| 20 | MX6_PAD_LCD_CLK__LCDIF_CLK | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 21 | MX6_PAD_LCD_ENABLE__LCDIF_ENABLE | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 22 | MX6_PAD_LCD_HSYNC__LCDIF_HSYNC | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 23 | MX6_PAD_LCD_VSYNC__LCDIF_VSYNC | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 24 | MX6_PAD_LCD_DATA00__LCDIF_DATA00 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 25 | MX6_PAD_LCD_DATA01__LCDIF_DATA01 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 26 | MX6_PAD_LCD_DATA02__LCDIF_DATA02 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 27 | MX6_PAD_LCD_DATA03__LCDIF_DATA03 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 28 | MX6_PAD_LCD_DATA04__LCDIF_DATA04 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 29 | MX6_PAD_LCD_DATA05__LCDIF_DATA05 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 30 | MX6_PAD_LCD_DATA06__LCDIF_DATA06 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 31 | MX6_PAD_LCD_DATA07__LCDIF_DATA07 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 32 | MX6_PAD_LCD_DATA08__LCDIF_DATA08 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 33 | MX6_PAD_LCD_DATA09__LCDIF_DATA09 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 34 | MX6_PAD_LCD_DATA10__LCDIF_DATA10 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 35 | MX6_PAD_LCD_DATA11__LCDIF_DATA11 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 36 | MX6_PAD_LCD_DATA12__LCDIF_DATA12 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 37 | MX6_PAD_LCD_DATA13__LCDIF_DATA13 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 38 | MX6_PAD_LCD_DATA14__LCDIF_DATA14 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 39 | MX6_PAD_LCD_DATA15__LCDIF_DATA15 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 40 | MX6_PAD_LCD_DATA16__LCDIF_DATA16 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 41 | MX6_PAD_LCD_DATA17__LCDIF_DATA17 | MUX_PAD_CTRL(LCD_PAD_CTRL), |
| 42 | |
| 43 | MX6_PAD_NAND_ALE__GPIO4_IO10 | MUX_PAD_CTRL(NO_PAD_CTRL) |
| 44 | }; |
| 45 | |
| 46 | int setup_lcd(void) |
| 47 | { |
| 48 | struct gpio_desc backlight; |
| 49 | int ret; |
| 50 | |
Sébastien Szymanski | a7762e4 | 2017-03-07 14:33:25 +0100 | [diff] [blame] | 51 | imx_iomux_v3_setup_multiple_pads(lcd_pads, ARRAY_SIZE(lcd_pads)); |
| 52 | |
| 53 | /* Set Brightness to high */ |
| 54 | ret = dm_gpio_lookup_name("GPIO4_10", &backlight); |
| 55 | if (ret) { |
| 56 | printf("Cannot get GPIO4_10\n"); |
| 57 | return ret; |
| 58 | } |
| 59 | |
| 60 | ret = dm_gpio_request(&backlight, "backlight"); |
| 61 | if (ret) { |
| 62 | printf("Cannot request GPIO4_10\n"); |
| 63 | return ret; |
| 64 | } |
| 65 | |
| 66 | dm_gpio_set_dir_flags(&backlight, GPIOD_IS_OUT); |
| 67 | dm_gpio_set_value(&backlight, 1); |
| 68 | |
| 69 | return 0; |
| 70 | } |
| 71 | #endif |
| 72 | |
Sébastien Szymanski | a7762e4 | 2017-03-07 14:33:25 +0100 | [diff] [blame] | 73 | int opos6ul_board_late_init(void) |
| 74 | { |
| 75 | #ifdef CONFIG_VIDEO_MXS |
| 76 | setup_lcd(); |
| 77 | #endif |
| 78 | |
| 79 | return 0; |
| 80 | } |