Commit 625d8936 authored by Sascha Hauer's avatar Sascha Hauer Committed by Mark Brown

dmaengine: imx-sdma: error out on unsupported transfer types

The i.MX SDMA driver currently silently ignores unsupported transfer
types. These transfer types are specified in the dma channel description
in the device tree, so they should really be checked.
Issue a message and error out when we hit unsupported transfer types.
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
Acked-By: default avatarVinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/20220414162249.3934543-11-s.hauer@pengutronix.deSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent c6547c2e
...@@ -940,7 +940,7 @@ static irqreturn_t sdma_int_handler(int irq, void *dev_id) ...@@ -940,7 +940,7 @@ static irqreturn_t sdma_int_handler(int irq, void *dev_id)
/* /*
* sets the pc of SDMA script according to the peripheral type * sets the pc of SDMA script according to the peripheral type
*/ */
static void sdma_get_pc(struct sdma_channel *sdmac, static int sdma_get_pc(struct sdma_channel *sdmac,
enum sdma_peripheral_type peripheral_type) enum sdma_peripheral_type peripheral_type)
{ {
struct sdma_engine *sdma = sdmac->sdma; struct sdma_engine *sdma = sdmac->sdma;
...@@ -1039,13 +1039,17 @@ static void sdma_get_pc(struct sdma_channel *sdmac, ...@@ -1039,13 +1039,17 @@ static void sdma_get_pc(struct sdma_channel *sdmac,
emi_2_per = sdma->script_addrs->ext_mem_2_ipu_addr; emi_2_per = sdma->script_addrs->ext_mem_2_ipu_addr;
break; break;
default: default:
break; dev_err(sdma->dev, "Unsupported transfer type %d\n",
peripheral_type);
return -EINVAL;
} }
sdmac->pc_from_device = per_2_emi; sdmac->pc_from_device = per_2_emi;
sdmac->pc_to_device = emi_2_per; sdmac->pc_to_device = emi_2_per;
sdmac->device_to_device = per_2_per; sdmac->device_to_device = per_2_per;
sdmac->pc_to_pc = emi_2_emi; sdmac->pc_to_pc = emi_2_emi;
return 0;
} }
static int sdma_load_context(struct sdma_channel *sdmac) static int sdma_load_context(struct sdma_channel *sdmac)
...@@ -1213,6 +1217,7 @@ static void sdma_set_watermarklevel_for_p2p(struct sdma_channel *sdmac) ...@@ -1213,6 +1217,7 @@ static void sdma_set_watermarklevel_for_p2p(struct sdma_channel *sdmac)
static int sdma_config_channel(struct dma_chan *chan) static int sdma_config_channel(struct dma_chan *chan)
{ {
struct sdma_channel *sdmac = to_sdma_chan(chan); struct sdma_channel *sdmac = to_sdma_chan(chan);
int ret;
sdma_disable_channel(chan); sdma_disable_channel(chan);
...@@ -1233,7 +1238,9 @@ static int sdma_config_channel(struct dma_chan *chan) ...@@ -1233,7 +1238,9 @@ static int sdma_config_channel(struct dma_chan *chan)
break; break;
} }
sdma_get_pc(sdmac, sdmac->peripheral_type); ret = sdma_get_pc(sdmac, sdmac->peripheral_type);
if (ret)
return ret;
if ((sdmac->peripheral_type != IMX_DMATYPE_MEMORY) && if ((sdmac->peripheral_type != IMX_DMATYPE_MEMORY) &&
(sdmac->peripheral_type != IMX_DMATYPE_DSP)) { (sdmac->peripheral_type != IMX_DMATYPE_DSP)) {
...@@ -1349,7 +1356,9 @@ static int sdma_alloc_chan_resources(struct dma_chan *chan) ...@@ -1349,7 +1356,9 @@ static int sdma_alloc_chan_resources(struct dma_chan *chan)
mem_data.dma_request2 = 0; mem_data.dma_request2 = 0;
data = &mem_data; data = &mem_data;
sdma_get_pc(sdmac, IMX_DMATYPE_MEMORY); ret = sdma_get_pc(sdmac, IMX_DMATYPE_MEMORY);
if (ret)
return ret;
} }
switch (data->priority) { switch (data->priority) {
......
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