MLK-24437-1 video: nw_dsi_imx: Fix initialization sequence
authorYe Li <ye.li@nxp.com>
Thu, 23 Jul 2020 02:48:07 +0000 (19:48 -0700)
committerYe Li <ye.li@nxp.com>
Thu, 29 Apr 2021 10:26:06 +0000 (03:26 -0700)
According to RM, doing initialization should assert the reset domain
signals first, then enable the DSI related clocks in SCG. However,
current implementation reverses the order and we found it will cause
the MIPI_DSI_HOST_APB_PKT_IF0_DSI_HOST_IRQ_STATUS not be cleared
completely after reset. Because the IRQ mask have been cleared during
reset, then a IRQ is rised and pend in GIC and finally cause kernel
panic issue.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 308870cac9db95fba2d20f0da7494d6a429e6644)
(cherry picked from commit 41884f0ea930ff8d6dea83e88c25830ff491be92)

drivers/video/imx/mipi_dsi_northwest.c
drivers/video/imx/nw_dsi_imx.c

index 7c76799..db05fa0 100644 (file)
@@ -26,7 +26,7 @@
 #include <dm/device_compat.h>
 #include <regmap.h>
 #include <syscon.h>
-
+#include <asm/arch/clock.h>
 
 #define MIPI_LCD_SLEEP_MODE_DELAY      (120)
 #define MIPI_FIFO_TIMEOUT              250000 /* 250ms */
@@ -722,6 +722,8 @@ static void mipi_dsi_shutdown(struct mipi_dsi_northwest_info *mipi_dsi)
        writel(0x1, mipi_dsi->mmio_base + DPHY_PD_PLL);
        writel(0x1, mipi_dsi->mmio_base + DPHY_PD_DPHY);
 
+       enable_mipi_dsi_clk(false);
+
        reset_dsi_domains(mipi_dsi, true);
 }
 
@@ -739,6 +741,9 @@ static int mipi_dsi_northwest_host_attach(struct mipi_dsi_host *host,
        /* Assert resets */
        reset_dsi_domains(mipi_dsi, true);
 
+       /* Enable mipi relevant clocks */
+       enable_mipi_dsi_clk(true);
+
        ret = mipi_dsi_dphy_init(mipi_dsi);
        if (ret < 0)
                return ret;
index 18cdf7b..5daf86d 100644 (file)
@@ -23,7 +23,6 @@
 #include <power/regulator.h>
 #include <regmap.h>
 #include <syscon.h>
-#include <asm/arch/clock.h>
 
 struct nw_dsi_imx_priv {
        struct mipi_dsi_device device;
@@ -108,8 +107,6 @@ static int nw_dsi_imx_probe(struct udevice *dev)
                return -EINVAL;
        }
 
-       enable_mipi_dsi_clk(true);
-
        return ret;
 }
 
@@ -127,8 +124,6 @@ static int nw_dsi_imx_remove(struct udevice *dev)
                return ret;
        }
 
-       enable_mipi_dsi_clk(false);
-
        return 0;
 }