lkml.org 
[lkml]   [2014]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5] spi: spi-imx: add DMA support
On Wed, Sep 10, 2014 at 11:21:05AM +0100, Mark Brown wrote:
> On Wed, Sep 10, 2014 at 09:30:04AM +0800, Robin Gong wrote:
>
> > +static bool spi_imx_can_dma(struct spi_master *master, struct spi_device *spi,
> > + struct spi_transfer *transfer)
> > +{
> > + struct spi_imx_data *spi_imx = spi_master_get_devdata(master);
> > +
> > + if (spi_imx->dma_is_inited && (transfer->len > spi_imx->rx_wml)
> > + && (transfer->len > spi_imx->tx_wml))
> > + spi_imx->usedma = true;
> > + else
> > + spi_imx->usedma = false;
> > +
> > + return spi_imx->usedma;
> > +}
>
> This isn't going to work, anything that looks at the usedma flag will
> see the result of the last thing that was checked which may or may not
> be the transfer that it's handling. The driver should check to see if
> the core mapped the transfer for DMA.
Yes, you're right. I should use "transfer->tx_sg->sgl == NULL" or
"transfer->rx_sg->sgl == NULL" instead of usedma flag in driver, right?



\
 
 \ /
  Last update: 2014-09-10 13:21    [W:0.072 / U:0.812 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site