From ec3dcea7447031463643c33143b3a5f027f0b54d Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Fri, 1 Nov 2019 09:25:21 -0300 Subject: [PATCH 1/2] video: mxsfb: Configure the clock after eLCDIF reset Running stress reboot test on a i.MX6ULL evk board with a custom LCD can lead to splash screen failure (black screen). After comparing the eLCDIF initialization with the Linux kernel driver, it was noticed that the eLCDIF reset is the first operation that needs to be done. So do like the eLCDIF Linux driver and move the eLCDIF clock frequency configuration after the eLCDIF reset and just prior to setting the RUN bit. With this change applied, no more black screen issues has been found during overnight reboot stress tests. Signed-off-by: Fabio Estevam --- drivers/video/mxsfb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index c52981053e..d73a8bac99 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/mxsfb.c @@ -57,9 +57,6 @@ static void mxs_lcd_init(u32 fb_addr, struct ctfb_res_modes *mode, int bpp) uint32_t word_len = 0, bus_width = 0; uint8_t valid_data = 0; - /* Kick in the LCDIF clock */ - mxs_set_lcdclk(MXS_LCDIF_BASE, PS2KHZ(mode->pixclock)); - /* Restart the LCDIF block */ mxs_reset_block(®s->hw_lcdif_ctrl_reg); @@ -130,6 +127,9 @@ static void mxs_lcd_init(u32 fb_addr, struct ctfb_res_modes *mode, int bpp) /* FIFO cleared */ writel(LCDIF_CTRL1_FIFO_CLEAR, ®s->hw_lcdif_ctrl1_clr); + /* Kick in the LCDIF clock */ + mxs_set_lcdclk(MXS_LCDIF_BASE, PS2KHZ(mode->pixclock)); + /* RUN! */ writel(LCDIF_CTRL_RUN, ®s->hw_lcdif_ctrl_set); } From 754815b854258abf08f50e757599e8d15c9a85bd Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Tue, 12 Nov 2019 15:39:58 +0100 Subject: [PATCH 2/2] video: stm32: remove the compatible "synopsys, dw-mipi-dsi" support Remove the compatible "synopsys,dw-mipi-dsi" added in U-Boot (it don't exist in Linux kernel binding); it is only used to bind the generic synopsys UCLASS_DSI_HOST "dw_mipi_dsi" to the driver "stm32-display-dsi" UCLASS_VIDEO_BRIDGE This binding is done in Linux kernel drivers without compatible (dw_mipi_dsi_bind() is called in bind of driver, for example in drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c). This patch does the same in U-Boot driver, the STM32 driver calls during its bind the function device_bind_driver_to_node to bind the generic driver "dw_mipi_dsi" at the same address. This patch reduces the device tree differences between Linux kernel and U-Boot for stm32mp1 platform. Tested with v2020.01-rc1 on STM32MP157C-EV1 and STM32MP157C-DK2. The dependency of driver is clearer and the probe order is guaranteed. STM32MP> dm tree Class Index Probed Driver Name ----------------------------------------------------------- root 0 [ + ] root_driver root_driver sysreset 0 [ ] syscon_reboot |-- reboot simple_bus 0 [ + ] generic_simple_bus |-- soc serial 0 [ + ] serial_stm32 | |-- serial@40010000 ... video_brid 0 [ + ] stm32-display-dsi | |-- dsi@5a000000 dsi_host 0 [ + ] dw_mipi_dsi | | |-- dsihost panel 0 [ + ] rm68200_panel | | `-- panel-dsi@0 ... Signed-off-by: Patrick Delaunay --- arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi | 7 ------- arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi | 5 ----- drivers/video/dw_mipi_dsi.c | 6 ------ drivers/video/stm32/stm32_dsi.c | 15 ++++++++++++++- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi b/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi index cd9947f166..18ac1e3cb2 100644 --- a/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi @@ -5,13 +5,6 @@ #include "stm32mp157a-dk1-u-boot.dtsi" -/ { - dsi_host: dsi_host { - compatible = "synopsys,dw-mipi-dsi"; - status = "okay"; - }; -}; - &i2c1 { hdmi-transmitter@39 { reset-gpios = <&gpioa 10 GPIO_ACTIVE_LOW>; diff --git a/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi b/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi index af5945d20b..ec60486f41 100644 --- a/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi +++ b/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi @@ -14,11 +14,6 @@ spi0 = &qspi; usb0 = &usbotg_hs; }; - - dsi_host: dsi_host { - compatible = "synopsys,dw-mipi-dsi"; - status = "okay"; - }; }; &flash0 { diff --git a/drivers/video/dw_mipi_dsi.c b/drivers/video/dw_mipi_dsi.c index 04b07e3a2c..83d7c7b2c0 100644 --- a/drivers/video/dw_mipi_dsi.c +++ b/drivers/video/dw_mipi_dsi.c @@ -816,15 +816,9 @@ static int dw_mipi_dsi_probe(struct udevice *dev) return 0; } -static const struct udevice_id dw_mipi_dsi_ids[] = { - { .compatible = "synopsys,dw-mipi-dsi" }, - { } -}; - U_BOOT_DRIVER(dw_mipi_dsi) = { .name = "dw_mipi_dsi", .id = UCLASS_DSI_HOST, - .of_match = dw_mipi_dsi_ids, .probe = dw_mipi_dsi_probe, .ops = &dw_mipi_dsi_ops, .priv_auto_alloc_size = sizeof(struct dw_mipi_dsi), diff --git a/drivers/video/stm32/stm32_dsi.c b/drivers/video/stm32/stm32_dsi.c index cb89576e1d..12895a8f5d 100644 --- a/drivers/video/stm32/stm32_dsi.c +++ b/drivers/video/stm32/stm32_dsi.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -399,6 +400,18 @@ static int stm32_dsi_set_backlight(struct udevice *dev, int percent) return 0; } +static int stm32_dsi_bind(struct udevice *dev) +{ + int ret; + + ret = device_bind_driver_to_node(dev, "dw_mipi_dsi", "dsihost", + dev_ofnode(dev), NULL); + if (ret) + return ret; + + return dm_scan_fdt_dev(dev); +} + static int stm32_dsi_probe(struct udevice *dev) { struct stm32_dsi_priv *priv = dev_get_priv(dev); @@ -483,7 +496,7 @@ U_BOOT_DRIVER(stm32_dsi) = { .name = "stm32-display-dsi", .id = UCLASS_VIDEO_BRIDGE, .of_match = stm32_dsi_ids, - .bind = dm_scan_fdt_dev, + .bind = stm32_dsi_bind, .probe = stm32_dsi_probe, .ops = &stm32_dsi_ops, .priv_auto_alloc_size = sizeof(struct stm32_dsi_priv),