From: Joy Zou Date: Thu, 23 Dec 2021 06:44:51 +0000 (+0800) Subject: LF-4858: dmaengine: imx-sdma: retry load sdma firmware fail X-Git-Tag: rel_imx_5.10.35_2.0.0-somdevices.2~6 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=b451fb778373bf85f84324138a748c8c6c95035b;p=linux.git LF-4858: dmaengine: imx-sdma: retry load sdma firmware fail If there is more than one sdma controller, the first controller load sdma firmware using fallback failed in first time, it will retry load sdma firmware again. But the second sdma controller error state clean up may be still not finished (the firmware request priv data has not been released). So the retry will fail immediately due to get the old firmware priv data. The fail log as follow: [ 62.505753] imx-sdma 30e10000.dma-controller: external firmware not found, using ROM firmware [ 62.599868] imx-sdma 30bd0000.dma-controller: firmware found. [ 62.605808] imx-sdma 30bd0000.dma-controller: loaded firmware 4.6 This patch adds a bit delay to wait for the second controller firmware priv data released. This issue is very hard to reproduce with yocto rootfs. The 20ms delay is tested value with ubuntu rootfs which is more easy to reproduce. Signed-off-by: Joy Zou Reviewed-by: Dong Aisheng Acked-by: Jason Liu --- diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 8e53c1949bdf..3e89663802a8 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -2211,6 +2211,8 @@ static void sdma_load_firmware(const struct firmware *fw, void *context) if (sdma->fw_fail) dev_info(sdma->dev, "external firmware not found, using ROM firmware\n"); else { + /*add a bit delay to wait for firmware priv released */ + msleep(20); request_firmware_nowait(THIS_MODULE, FW_ACTION_HOTPLUG, sdma->fw_name, sdma->dev, GFP_KERNEL, sdma,