linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Serge Semin <fancer.lancer@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	linux-spi <linux-spi@vger.kernel.org>
Subject: Re: [RFC] spi: dw: Test the last revision of the DMA module
Date: Fri, 26 Jun 2020 01:55:53 +0300	[thread overview]
Message-ID: <CAHp75VfF3GhjNEgHaQWn+LqbVZVOn3_mORSompexxxRnmiAFcg@mail.gmail.com> (raw)
In-Reply-To: <20200625220808.hac4egxalgn3pcqk@mobilestation>

On Fri, Jun 26, 2020 at 1:08 AM Serge Semin
<Sergey.Semin@baikalelectronics.ru> wrote:

> Have you tested the recent revision of the DW APB SSI driver with DMA
> enabled? I am particularly concerned about the next fix in the driver:

Yes.

> > +     dw_writel(dws, DW_SPI_DMATDLR, dws->fifo_len - dws->txburst);

Yes, this line is problematic.
However we have experiencing another issue with Tx underrun, that's
why below has not been shared.

> Generally speaking it must work (even DW APB SSI/DMA databook suggests to have
> such DMATDLR setting), but in our case of a relatively slow DMA engine (it's
> clocked with just twice higher frequency with respect to the max SPI bus
> speed) sometimes SPI Rx FIFO gets overflown when SPI bus is configured to work
> with maximum speed (there are multiple reasons why this happens, but generally
> speaking all of them matter only due to the relatively slow DMA engine). The
> problem is fixed by reducing a value written into the DMATDLR register.
>
> I am wondering whether you've tested the last revision of the driver and it
> worked for your version of the DW APB SSI + DW DMAC IPs. AFAIU DMA engine on
> your devices is faster than on ours and has LLPs supported. So if you haven't
> noticed any problem in the recent driver, then I'll send a fixup for our version
> of the DW APB SSI block only (I'll have to introduce a new compatible string).
> Otherwise I could get back a setting of dws->txburst into the DW_SPI_DMATDLR
> register, which isn't that optimal as the current DMATDLR setting
> of (fifo_len - txburst), but at least will make things working for all DMAs.

That's what I have locally.

commit 43d9abb2711f5096e969adcf1a2fb6456fa6e275 (HEAD -> topic/ehl-dma)
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date:   Tue Jun 2 15:53:03 2020 +0300

    DEBUG SPI dw (burst fix?)

    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

diff --git a/drivers/spi/spi-dw-dma.c b/drivers/spi/spi-dw-dma.c
index 5986c520b196..79342528b1f4 100644
--- a/drivers/spi/spi-dw-dma.c
+++ b/drivers/spi/spi-dw-dma.c
@@ -373,7 +373,7 @@ static int dw_spi_dma_setup(struct dw_spi *dws,
struct spi_transfer *xfer)
        u16 imr = 0, dma_ctrl = 0;

        dw_writel(dws, DW_SPI_DMARDLR, dws->rxburst - 1);
-       dw_writel(dws, DW_SPI_DMATDLR, dws->fifo_len - dws->txburst);
+       dw_writel(dws, DW_SPI_DMATDLR, dws->txburst);



-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2020-06-25 22:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-25 22:08 [RFC] spi: dw: Test the last revision of the DMA module Serge Semin
2020-06-25 22:55 ` Andy Shevchenko [this message]
2020-06-26 13:29   ` Serge Semin
2020-07-20 10:51     ` Andy Shevchenko
2020-07-20 21:02       ` Serge Semin
2020-07-21  6:38         ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHp75VfF3GhjNEgHaQWn+LqbVZVOn3_mORSompexxxRnmiAFcg@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=Sergey.Semin@baikalelectronics.ru \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=fancer.lancer@gmail.com \
    --cc=linux-spi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).