1
0
Fork 0

MLK-19418-2: dmaengine: imx-sdma: make sure firmware loaded

request_firmware_nowait() is async so that can't make sure sdma firmware
loaded when sdma_resume return back. Add wait code to make sure firmware
ready.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
pull/10/head
Robin Gong 2018-09-06 23:41:43 +08:00 committed by Jason Liu
parent 07621cace3
commit 5481ee381e
1 changed files with 9 additions and 0 deletions

View File

@ -2530,6 +2530,7 @@ static int sdma_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct sdma_engine *sdma = platform_get_drvdata(pdev);
unsigned long timeout = jiffies + msecs_to_jiffies(2);
int i, ret;
/* Do nothing if not i.MX6SX or i.MX7D*/
@ -2575,6 +2576,14 @@ static int sdma_resume(struct device *dev)
dev_warn(&pdev->dev, "failed to get firware\n");
goto out;
}
/* wait firmware loaded */
do {
if (time_after(jiffies, timeout)) {
dev_warn(&pdev->dev, "failed to load firmware\n");
break;
}
usleep_range(50, 500);
} while (!sdma->fw_loaded);
ret = sdma_save_restore_context(sdma, false);
if (ret) {