lkml.org 
[lkml]   [2018]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 6/6] spi: sun4i: add DMA transfers support
On Thu, Mar 29, 2018 at 09:59:07PM +0300, Sergey Suloev wrote:
> +static int sun4i_spi_dma_setup(struct device *dev,
> + struct resource *res)
> +{
> + struct spi_master *master = dev_get_drvdata(dev);
> + struct dma_slave_config dma_sconf;
> + int ret;
> +
> + master->dma_tx = dma_request_slave_channel_reason(dev, "tx");
> + if (IS_ERR(master->dma_tx)) {
> + dev_err(dev, "Unable to acquire DMA TX channel\n");
> + ret = PTR_ERR(master->dma_tx);
> + goto out;
> + }
> +
> + dma_sconf.direction = DMA_MEM_TO_DEV;
> + dma_sconf.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
> + dma_sconf.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;

I guess that would depend on the size of the transfer, right?

> + dma_sconf.dst_addr = res->start + SUN4I_TXDATA_REG;
> + dma_sconf.dst_maxburst = 1;
> + dma_sconf.src_maxburst = 1;

And a burst of 1 seems sub-optimal here.

> + ret = sun4i_spi_dma_setup(&pdev->dev, res);
> + if (ret) {
> + if (ret == -EPROBE_DEFER) {
> + /* wait for the dma driver to load */
> + goto err_free_master;
> + }
> + dev_warn(&pdev->dev, "DMA transfer not supported\n");

Saying why it's not supported would be great.

Maxime

--
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2018-04-03 10:18    [W:0.186 / U:0.400 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site