Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolin Chen <nicoleotsuka@gmail.com>
To: Caleb Crome <caleb@crome.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	Markus Pargmann <mpa@pengutronix.de>,
	"arnaud.mouiche@invoxia.com" <arnaud.mouiche@invoxia.com>,
	Roberto Fichera <kernel@tekno-soft.it>,
	"shawn.guo@linaro.org" <shawn.guo@linaro.org>
Subject: Re: fsl_ssi.c: Getting channel slips with fsl_ssi.c in TDM (network) mode.
Date: Thu, 29 Oct 2015 18:29:35 -0700	[thread overview]
Message-ID: <20151030012934.GA5456@Asurada-GSX> (raw)
In-Reply-To: <CAG5mAdwnjLdxNNgC3go_NDERUSDxem9ZQFigyF5yaEWuXV2r4g@mail.gmail.com>

On Thu, Oct 29, 2015 at 04:33:26PM -0700, Caleb Crome wrote:

> > A little difference between your point and mine is that you think
> > DMA request only starts when SSIE and TDMAE both get set while I
> > only think about TDMAE. It's hard to say which one is correct as
> > it depends on the design of IP wrapper but you can fairly test it
> > with your change below: Mask both TE with SSIE and set them after
> > the delay. If it doesn't work, yours is the correct one.
> 
> Ah, that's one thing that's very clear in the FSL datasheet:  the
> FIFOs are ZEROED if SSIE is 0.  This means that even if the DMA were
> trying to dump data in before SSIE is enabled, the data would go to
> bit heaven.
> 
> The docs for TE say, "The normal transmit enable sequence is to write
> data to the STX register(s) and then set the TE bit." (page 5145 of
> IMX6SDLRM.pdf)
> 
> So in the DMA + fifo case the words, "write data to the STX
> register(s)" imply that it's actually DMA writing to FIFOs, which then
> write the STX register.  So, the sequence must be:  enable SSIE &
> TDMAE to allow DMA to write to the fifo, then later enable TE, right?

You have the point. If SSIEN is being treated as the reset signal
internally, any write enable signal could be ignored.

> > I encourage you to try to follow one of patches I gave you that
> > sets TDMAE/RDMAE at the beginning of the trigger(). Surely you may
> > change it to TDMAE | SSIE after you find out that SSIE is indeed
> > required. If you are still having trouble, adding a delay would
> > be nice for you but it may be hard for me to ack it if you want
> > to merge it in the driver.
> 
> I now I see your patch!  Okay, I'll give that a go, but it's still
> just a race condition between the regmap_update_bits with TDMAE (your
> patch) verses the regmap_update_bits from fsl_ssi_config. You're just
> hoping that a DMA write happens between TDMAE and the end of
> fsl_ssi_config where TE is enabled.

DMA transaction will be issued once BD is ready (in SDMA driver)
and SSI sends a DMA request. So I'm hoping that the context
latency between the regmap_update_bits() and TE setting should be
enough for DMA to fill the FIFO.

> Now I think I get it though.  We do TMDAE + SSIEN like your patch,
> then a short while loop on SFCSR.TFCNT0.  After the first word gets
> written to the fifo, TFCNT0 should go > 0, and then we can release TE.
> 
> There may be a better status register to wait on but TFCNT0 seems like
> it will do the trick.

Waiting for TFCNT0 sounds reasonable to me as long as the code is
well commented.

  reply	other threads:[~2015-10-30  1:29 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-19 15:55 fsl_ssi.c: Getting channel slips with fsl_ssi.c in TDM (network) mode Caleb Crome
2015-10-20  7:36 ` arnaud.mouiche
2015-10-20 17:43   ` Caleb Crome
2015-10-21  7:32     ` arnaud.mouiche
2015-10-21 19:37       ` Caleb Crome
2015-10-26 17:31         ` Caleb Crome
2015-10-27  7:13           ` Markus Pargmann
2015-10-27  9:41             ` Fabio Estevam
2015-10-27 16:02               ` Caleb Crome
2015-10-27 16:10                 ` Fabio Estevam
2015-10-27 16:42                   ` Caleb Crome
2015-10-27 16:45                     ` Fabio Estevam
2015-10-27 18:57                       ` Fabio Estevam
2015-10-28  8:11                         ` Roberto Fichera
2015-10-28 13:59                           ` Caleb Crome
2015-10-28 14:05                             ` Roberto Fichera
2015-10-28 14:24                               ` Caleb Crome
2015-10-28 14:48                                 ` Roberto Fichera
2015-10-28 22:09                             ` Caleb Crome
2015-10-29  8:04                               ` Roberto Fichera
2015-10-29 23:04                           ` Nicolin Chen
2015-10-30 11:42                             ` Roberto Fichera
2015-10-30 17:21                               ` Nicolin Chen
2015-10-28 13:53                       ` Caleb Crome
2015-10-27 20:11             ` Nicolin Chen
2015-10-28  8:23               ` Roberto Fichera
2015-10-29 23:05                 ` Nicolin Chen
2015-10-28 22:06               ` Caleb Crome
2015-10-29  4:53                 ` Nicolin Chen
2015-10-29 13:44                   ` Caleb Crome
2015-10-29 14:55                     ` Caleb Crome
2015-10-29 15:37                       ` Roberto Fichera
2015-10-29 15:54                         ` Caleb Crome
2015-10-29 16:02                           ` Roberto Fichera
2015-10-29 16:19                             ` Caleb Crome
2015-10-29 16:34                             ` Roberto Fichera
2015-10-29 16:39                               ` Caleb Crome
2015-10-29 16:59                                 ` Roberto Fichera
2015-10-29 18:36                           ` Nicolin Chen
2015-10-29 19:08                             ` Caleb Crome
2015-10-29 23:22                         ` Nicolin Chen
2015-10-29 18:11                       ` Nicolin Chen
2015-10-29 17:19                     ` Nicolin Chen
2015-10-29 19:06                       ` Caleb Crome
2015-10-29 19:28                         ` Nicolin Chen
2015-10-29 22:23                           ` Caleb Crome
2015-10-29 22:47                             ` Nicolin Chen
2015-10-29 23:33                               ` Caleb Crome
2015-10-30  1:29                                 ` Nicolin Chen [this message]
2015-10-30  8:29                                   ` arnaud.mouiche
2015-10-30  8:45                                     ` arnaud.mouiche
2015-10-30 16:07                                       ` Nicolin Chen
2015-10-30 15:49                                     ` Nicolin Chen
2015-10-30 18:10                                       ` Caleb Crome
2015-10-30 22:04                                   ` Caleb Crome
2015-10-30 22:35                                     ` Caleb Crome
2015-10-31  1:32                                       ` Nicolin Chen
2015-10-31 16:12                                         ` Caleb Crome
2015-10-31  1:48                                     ` Nicolin Chen
2015-10-31 16:22                                       ` Caleb Crome
2015-11-02 17:22                                         ` Nicolin Chen

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=20151030012934.GA5456@Asurada-GSX \
    --to=nicoleotsuka@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnaud.mouiche@invoxia.com \
    --cc=caleb@crome.org \
    --cc=fabio.estevam@freescale.com \
    --cc=kernel@tekno-soft.it \
    --cc=mpa@pengutronix.de \
    --cc=shawn.guo@linaro.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