LF-4858: dmaengine: imx-sdma: retry load sdma firmware fail
authorJoy Zou <joy.zou@nxp.com>
Thu, 23 Dec 2021 06:44:51 +0000 (14:44 +0800)
committerJosep Orga <jorga@somdevices.com>
Tue, 27 Jun 2023 14:03:17 +0000 (16:03 +0200)
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 <joy.zou@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
drivers/dma/imx-sdma.c

index 8e53c19..3e89663 100644 (file)
@@ -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,