Skip to content
Snippets Groups Projects
Commit a33ddde3 authored by cinap_lenrek's avatar cinap_lenrek
Browse files

gracefully shut down lcdif and usb for reliable linux boot

The LCDIF needs to be shut down in a particular way.
Disable display clocks, reset and power down mipi dsi.
Disable pwm and edp bridge.
Also stop USB in any case.
parent e20721c4
No related branches found
No related tags found
No related merge requests found
Pipeline #837 failed
...@@ -988,11 +988,43 @@ out: ...@@ -988,11 +988,43 @@ out:
void void
video_hw_exit(void) video_hw_exit(void)
{ {
/* gracefully shut down lcdif */
wr(lcdif, LCDIF_CTRL_CLR, CTRL_DOTCLK_MODE);
while(rr(lcdif, LCDIF_CTRL) & CTRL_RUN)
;
lcdifreset(); lcdifreset();
/* assert the resets */
mr(resetc, SRC_MIPIPHY_RCR, 0, RCR_MIPI_DSI_RESET_N); mr(resetc, SRC_MIPIPHY_RCR, 0, RCR_MIPI_DSI_RESET_N);
mr(resetc, SRC_MIPIPHY_RCR, 0, RCR_MIPI_DSI_PCLK_RESET_N); mr(resetc, SRC_MIPIPHY_RCR, 0, RCR_MIPI_DSI_PCLK_RESET_N);
mr(resetc, SRC_MIPIPHY_RCR, 0, RCR_MIPI_DSI_ESC_RESET_N); mr(resetc, SRC_MIPIPHY_RCR, 0, RCR_MIPI_DSI_ESC_RESET_N);
mr(resetc, SRC_MIPIPHY_RCR, 0, RCR_MIPI_DSI_RESET_BYTE_N); mr(resetc, SRC_MIPIPHY_RCR, 0, RCR_MIPI_DSI_RESET_BYTE_N);
mr(resetc, SRC_MIPIPHY_RCR, 0, RCR_MIPI_DSI_DPI_RESET_N); mr(resetc, SRC_MIPIPHY_RCR, 0, RCR_MIPI_DSI_DPI_RESET_N);
/* power mipi dsi */
wr(gpc, GPC_PGC_CPU_0_1_MAPPING, 0x0000FFFF);
mr(gpc, GPC_PGC_PU_PGC_SW_PDN_REQ, 1, 1);
while(rr(gpc, GPC_PGC_PU_PGC_SW_PDN_REQ) & 1)
;
wr(gpc, GPC_PGC_CPU_0_1_MAPPING, 0);
/* disable display clocks */
clock_enable(CCGR_DISPLAY, 0);
clock_enable(CCGR_SIM_DISPLAY, 0);
clock_set_target_val(MIPI_DSI_CORE_CLK_ROOT, 0);
clock_set_target_val(MIPI_DSI_PHY_REF_CLK_ROOT, 0);
clock_set_target_val(LCDIF_PIXEL_CLK_ROOT, 0);
clock_set_target_val(DISPLAY_RTRM_CLK_ROOT, 0);
clock_set_target_val(DISPLAY_AXI_CLK_ROOT, 0);
/* turn off bridge */
gpio_direction_output(IMX_GPIO_NR(3, 20), 0);
/* turn off backlight pwm */
gpio_direction_output(IMX_GPIO_NR(1, 10), 0);
wr(pwm2, PWMCR, CR_SWR);
clock_enable(CCGR_PWM2, 0);
clock_set_target_val(PWM2_CLK_ROOT, 0);
} }
...@@ -397,6 +397,8 @@ board_quiesce_devices(void) ...@@ -397,6 +397,8 @@ board_quiesce_devices(void)
{ {
extern void video_hw_exit(void); /* lcdif.c */ extern void video_hw_exit(void); /* lcdif.c */
usb_stop();
/* /*
* Linux kermel mode setting seems to fail to * Linux kermel mode setting seems to fail to
* properly reset the mipi core, causing the * properly reset the mipi core, causing the
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment