LF-5352: dmaengine: imx-sdma: fix the potential access registers without clock
The issue can be triggered with the sdma pm_runtime false.
If the dma client try to use sdma in boot phase, it may cause
system hang. The sdma driver really enable clk after sdma load
firmware, the clk_disable_unused will disable the SDMA1_ROOT_CLK
before the sdma driver enable clk. This issue will comes if access
the sdma register when the SDMA1_ROOT_CLK is disable.
This issue is very easy to reproduce with hdmi connected displayer
on imx7d-sbd board which the i2c will use sdma early before sdma
firmware loaded and clock enabled.
The client i2c calls dmaengine_prep_slave_single->device_prep_slave_sg
->sdma_prep_slave_sg->sdma_config_write->sdma_config_channel to get
descriptor in boot phase. Then, the function sdma_config_channel will
access sdma registers. If clk is disable will cause system hang.
This patch adds clk_enable and clk_disable to make sure the clk
enable before access sdma hardware.
Signed-off-by: Joy Zou <joy.zou@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>