1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2017 General Electric Company
5 * Based on board/freescale/mx53loco/mx53loco_video.c:
7 * Copyright (C) 2012 Freescale Semiconductor, Inc.
8 * Fabio Estevam <fabio.estevam@freescale.com>
12 #include <linux/list.h>
13 #include <asm/arch/iomux-mx53.h>
14 #include <asm/mach-imx/video.h>
16 #include <ipu_pixfmt.h>
17 #include <asm/arch/crm_regs.h>
18 #include <asm/arch/imx-regs.h>
22 static int detect_lcd(struct display_info_t const *dev)
27 static void lcd_enable(void)
29 struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
30 struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
32 /* Set LDB_DI0 as clock source for IPU_DI0 */
33 clrsetbits_le32(&mxc_ccm->cscmr2,
34 MXC_CCM_CSCMR2_DI0_CLK_SEL_MASK,
35 MXC_CCM_CSCMR2_DI0_CLK_SEL(
36 MXC_CCM_CSCMR2_DI0_CLK_SEL_LDB_DI0_CLK));
38 /* Turn on IPU LDB DI0 clocks */
39 setbits_le32(&mxc_ccm->CCGR6, MXC_CCM_CCGR6_LDB_DI0(3));
41 /* Turn on IPU DI0 clocks */
42 setbits_le32(&mxc_ccm->CCGR6, MXC_CCM_CCGR6_IPU_DI0(3));
45 writel(IOMUXC_GPR2_BIT_MAPPING_CH0_SPWG |
46 IOMUXC_GPR2_DATA_WIDTH_CH0_24BIT |
47 IOMUXC_GPR2_LVDS_CH0_MODE_ENABLED_DI0,
51 static void do_enable_backlight(struct display_info_t const *dev)
53 struct udevice *panel;
58 ret = uclass_get_device(UCLASS_PANEL, 0, &panel);
60 printf("Could not find panel: %d\n", ret);
64 panel_set_backlight(panel, 100);
65 panel_enable_backlight(panel);
68 struct display_info_t const displays[] = {
72 .pixfmt = IPU_PIX_FMT_RGB24,
74 .enable = do_enable_backlight,
76 .name = "NV-SPWGRGB888",
88 .vmode = FB_VMODE_NONINTERLACED
93 size_t display_count = ARRAY_SIZE(displays);