Commit 7b4b88e0 authored by Sascha Hauer's avatar Sascha Hauer Committed by Vinod Koul

dmaengine i.MX SDMA: use request_firmware_nowait

The firmware blob may not be available when the driver
probes. Instead of blocking the whole kernel use
request_firmware_nowait() and continue without firmware.
The ROM scripts can already be used then if available.
For the devicetree case the ROM scripts are not available,
still the probe function should not block. The driver
will be unusable in this case, but we have no way of
detecting this properly. The configuration of the dma
channels will fail, so nothing bad should happen.
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent 36e2f21a
...@@ -1143,18 +1143,17 @@ static void sdma_add_scripts(struct sdma_engine *sdma, ...@@ -1143,18 +1143,17 @@ static void sdma_add_scripts(struct sdma_engine *sdma,
saddr_arr[i] = addr_arr[i]; saddr_arr[i] = addr_arr[i];
} }
static int __init sdma_get_firmware(struct sdma_engine *sdma, static void sdma_load_firmware(const struct firmware *fw, void *context)
const char *fw_name)
{ {
const struct firmware *fw; struct sdma_engine *sdma = context;
const struct sdma_firmware_header *header; const struct sdma_firmware_header *header;
int ret;
const struct sdma_script_start_addrs *addr; const struct sdma_script_start_addrs *addr;
unsigned short *ram_code; unsigned short *ram_code;
ret = request_firmware(&fw, fw_name, sdma->dev); if (!fw) {
if (ret) dev_err(sdma->dev, "firmware not found\n");
return ret; return;
}
if (fw->size < sizeof(*header)) if (fw->size < sizeof(*header))
goto err_firmware; goto err_firmware;
...@@ -1184,6 +1183,16 @@ static int __init sdma_get_firmware(struct sdma_engine *sdma, ...@@ -1184,6 +1183,16 @@ static int __init sdma_get_firmware(struct sdma_engine *sdma,
err_firmware: err_firmware:
release_firmware(fw); release_firmware(fw);
}
static int __init sdma_get_firmware(struct sdma_engine *sdma,
const char *fw_name)
{
int ret;
ret = request_firmware_nowait(THIS_MODULE,
FW_ACTION_HOTPLUG, fw_name, sdma->dev,
GFP_KERNEL, sdma, sdma_load_firmware);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment