diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2011-08-25 05:03:37 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2011-08-29 10:38:53 -0400 |
commit | 7b4b88e067d37cbbafd856121767f7e154294eb2 (patch) | |
tree | 9c94c61f0a903ea8a08f6ca085ccca5b83a190b6 /drivers/dma/imx-sdma.c | |
parent | 36e2f21ab481b3d6bd31b99e1de669fbbac4bd0e (diff) |
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: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma/imx-sdma.c')
-rw-r--r-- | drivers/dma/imx-sdma.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 8abf8c190aad..b5cc27dc9a51 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c | |||
@@ -1143,18 +1143,17 @@ static void sdma_add_scripts(struct sdma_engine *sdma, | |||
1143 | saddr_arr[i] = addr_arr[i]; | 1143 | saddr_arr[i] = addr_arr[i]; |
1144 | } | 1144 | } |
1145 | 1145 | ||
1146 | static int __init sdma_get_firmware(struct sdma_engine *sdma, | 1146 | static void sdma_load_firmware(const struct firmware *fw, void *context) |
1147 | const char *fw_name) | ||
1148 | { | 1147 | { |
1149 | const struct firmware *fw; | 1148 | struct sdma_engine *sdma = context; |
1150 | const struct sdma_firmware_header *header; | 1149 | const struct sdma_firmware_header *header; |
1151 | int ret; | ||
1152 | const struct sdma_script_start_addrs *addr; | 1150 | const struct sdma_script_start_addrs *addr; |
1153 | unsigned short *ram_code; | 1151 | unsigned short *ram_code; |
1154 | 1152 | ||
1155 | ret = request_firmware(&fw, fw_name, sdma->dev); | 1153 | if (!fw) { |
1156 | if (ret) | 1154 | dev_err(sdma->dev, "firmware not found\n"); |
1157 | return ret; | 1155 | return; |
1156 | } | ||
1158 | 1157 | ||
1159 | if (fw->size < sizeof(*header)) | 1158 | if (fw->size < sizeof(*header)) |
1160 | goto err_firmware; | 1159 | goto err_firmware; |
@@ -1184,6 +1183,16 @@ static int __init sdma_get_firmware(struct sdma_engine *sdma, | |||
1184 | 1183 | ||
1185 | err_firmware: | 1184 | err_firmware: |
1186 | release_firmware(fw); | 1185 | release_firmware(fw); |
1186 | } | ||
1187 | |||
1188 | static int __init sdma_get_firmware(struct sdma_engine *sdma, | ||
1189 | const char *fw_name) | ||
1190 | { | ||
1191 | int ret; | ||
1192 | |||
1193 | ret = request_firmware_nowait(THIS_MODULE, | ||
1194 | FW_ACTION_HOTPLUG, fw_name, sdma->dev, | ||
1195 | GFP_KERNEL, sdma, sdma_load_firmware); | ||
1187 | 1196 | ||
1188 | return ret; | 1197 | return ret; |
1189 | } | 1198 | } |