Skip to content

Commit 5b3a23a

Browse files
oleremWolfram Sang
authored andcommitted
i2c: imx: notify about real errors on dma i2c_imx_dma_request
At least on i.MX5x, the DMA events for I2C and SDHC use the same channel and there can only be a single user. So in this case there should be no message emitted that looks like an error if the I2C device doesn't have an assigned DMA channel. In contrast real problems that were only emitted at debug level before should be described at a higher level to be better visible and so understandable. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
1 parent 18569fa commit 5b3a23a

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

drivers/i2c/busses/i2c-imx.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,11 @@ static void i2c_imx_dma_request(struct imx_i2c_struct *i2c_imx,
285285
if (!dma)
286286
return;
287287

288-
dma->chan_tx = dma_request_slave_channel(dev, "tx");
289-
if (!dma->chan_tx) {
290-
dev_dbg(dev, "can't request DMA tx channel\n");
288+
dma->chan_tx = dma_request_chan(dev, "tx");
289+
if (IS_ERR(dma->chan_tx)) {
290+
ret = PTR_ERR(dma->chan_rx);
291+
if (ret != -ENODEV && ret != -EPROBE_DEFER)
292+
dev_err(dev, "can't request DMA tx channel (%d)\n", ret);
291293
goto fail_al;
292294
}
293295

@@ -298,13 +300,15 @@ static void i2c_imx_dma_request(struct imx_i2c_struct *i2c_imx,
298300
dma_sconfig.direction = DMA_MEM_TO_DEV;
299301
ret = dmaengine_slave_config(dma->chan_tx, &dma_sconfig);
300302
if (ret < 0) {
301-
dev_dbg(dev, "can't configure tx channel\n");
303+
dev_err(dev, "can't configure tx channel (%d)\n", ret);
302304
goto fail_tx;
303305
}
304306

305-
dma->chan_rx = dma_request_slave_channel(dev, "rx");
306-
if (!dma->chan_rx) {
307-
dev_dbg(dev, "can't request DMA rx channel\n");
307+
dma->chan_rx = dma_request_chan(dev, "rx");
308+
if (IS_ERR(dma->chan_rx)) {
309+
ret = PTR_ERR(dma->chan_rx);
310+
if (ret != -ENODEV && ret != -EPROBE_DEFER)
311+
dev_err(dev, "can't request DMA rx channel (%d)\n", ret);
308312
goto fail_tx;
309313
}
310314

@@ -315,7 +319,7 @@ static void i2c_imx_dma_request(struct imx_i2c_struct *i2c_imx,
315319
dma_sconfig.direction = DMA_DEV_TO_MEM;
316320
ret = dmaengine_slave_config(dma->chan_rx, &dma_sconfig);
317321
if (ret < 0) {
318-
dev_dbg(dev, "can't configure rx channel\n");
322+
dev_err(dev, "can't configure rx channel (%d)\n", ret);
319323
goto fail_rx;
320324
}
321325

@@ -332,7 +336,6 @@ static void i2c_imx_dma_request(struct imx_i2c_struct *i2c_imx,
332336
dma_release_channel(dma->chan_tx);
333337
fail_al:
334338
devm_kfree(dev, dma);
335-
dev_info(dev, "can't use DMA, using PIO instead.\n");
336339
}
337340

338341
static void i2c_imx_dma_callback(void *arg)

0 commit comments

Comments
 (0)