From: Mark Brown <broonie@kernel.org> To: Vladimir Oltean <vladimir.oltean@nxp.com> Cc: andrew.smirnov@gmail.com, angelo@sysam.it, broonie@kernel.org, eha@deif.com, gustavo@embeddedor.com, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, Mark Brown <broonie@kernel.org>, mhosny@nvidia.com, weic@nvidia.com Subject: Applied "spi: spi-fsl-dspi: Take software timestamp in dspi_fifo_write" to the spi tree Date: Thu, 05 Mar 2020 14:37:13 +0000 [thread overview] Message-ID: <applied-20200304220044.11193-13-olteanv@gmail.com> (raw) In-Reply-To: <20200304220044.11193-13-olteanv@gmail.com> The patch spi: spi-fsl-dspi: Take software timestamp in dspi_fifo_write has been applied to the spi tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From e9bac90036d394b01cc7d5297a11d33b8ab92a91 Mon Sep 17 00:00:00 2001 From: Vladimir Oltean <vladimir.oltean@nxp.com> Date: Thu, 5 Mar 2020 00:00:44 +0200 Subject: [PATCH] spi: spi-fsl-dspi: Take software timestamp in dspi_fifo_write Although the SPI system timestamps are supposed to reflect the moment that the peripheral has received a word rather than the moment when the CPU has enqueued that word to the FIFO, in practice it is easier to just record the latter time than the former (with a smaller error). With the recent migration of TCFQ users from poll back to interrupt mode (this time for XSPI FIFO), it's wiser to keep the interrupt latency outside of the measurement of the PTP system timestamp itself. If there proves to be any constant offset that requires static compensation, that can always be added later. So far that does not appear to be the case at least on the LS1021A-TSN board, where testing shows that the phc2sys offset is able to remain within +/- 200 ns even after 68 hours of testing. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Link: https://lore.kernel.org/r/20200304220044.11193-13-olteanv@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org> --- drivers/spi/spi-fsl-dspi.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index d5983be32180..b5ab0afbfa26 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -838,19 +838,18 @@ static void dspi_setup_accel(struct fsl_dspi *dspi) static void dspi_fifo_write(struct fsl_dspi *dspi) { + struct spi_transfer *xfer = dspi->cur_transfer; + struct spi_message *msg = dspi->cur_msg; + int bytes_sent; + dspi_setup_accel(dspi); + spi_take_timestamp_pre(dspi->ctlr, xfer, dspi->progress, !dspi->irq); + if (dspi->devtype_data->trans_mode == DSPI_EOQ_MODE) dspi_eoq_fifo_write(dspi); else dspi_xspi_fifo_write(dspi); -} - -static int dspi_rxtx(struct fsl_dspi *dspi) -{ - struct spi_transfer *xfer = dspi->cur_transfer; - struct spi_message *msg = dspi->cur_msg; - int bytes_sent; /* Update total number of bytes that were transferred */ bytes_sent = dspi->words_in_flight * dspi->oper_word_size; @@ -859,16 +858,16 @@ static int dspi_rxtx(struct fsl_dspi *dspi) spi_take_timestamp_post(dspi->ctlr, dspi->cur_transfer, dspi->progress, !dspi->irq); +} +static int dspi_rxtx(struct fsl_dspi *dspi) +{ dspi_fifo_read(dspi); if (!dspi->len) /* Success! */ return 0; - spi_take_timestamp_pre(dspi->ctlr, dspi->cur_transfer, - dspi->progress, !dspi->irq); - dspi_fifo_write(dspi); return -EINPROGRESS; -- 2.20.1
WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> To: Vladimir Oltean <vladimir.oltean-3arQi8VN3Tc@public.gmane.org> Cc: andrew.smirnov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, angelo-BIYBQhTR83Y@public.gmane.org, broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, eha-/iRVSOupHO4@public.gmane.org, gustavo-L1vi/lXTdts+Va1GwOuvDg@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>, mhosny-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org, weic-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org Subject: Applied "spi: spi-fsl-dspi: Take software timestamp in dspi_fifo_write" to the spi tree Date: Thu, 05 Mar 2020 14:37:13 +0000 [thread overview] Message-ID: <applied-20200304220044.11193-13-olteanv@gmail.com> (raw) In-Reply-To: <20200304220044.11193-13-olteanv-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> The patch spi: spi-fsl-dspi: Take software timestamp in dspi_fifo_write has been applied to the spi tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From e9bac90036d394b01cc7d5297a11d33b8ab92a91 Mon Sep 17 00:00:00 2001 From: Vladimir Oltean <vladimir.oltean-3arQi8VN3Tc@public.gmane.org> Date: Thu, 5 Mar 2020 00:00:44 +0200 Subject: [PATCH] spi: spi-fsl-dspi: Take software timestamp in dspi_fifo_write Although the SPI system timestamps are supposed to reflect the moment that the peripheral has received a word rather than the moment when the CPU has enqueued that word to the FIFO, in practice it is easier to just record the latter time than the former (with a smaller error). With the recent migration of TCFQ users from poll back to interrupt mode (this time for XSPI FIFO), it's wiser to keep the interrupt latency outside of the measurement of the PTP system timestamp itself. If there proves to be any constant offset that requires static compensation, that can always be added later. So far that does not appear to be the case at least on the LS1021A-TSN board, where testing shows that the phc2sys offset is able to remain within +/- 200 ns even after 68 hours of testing. Signed-off-by: Vladimir Oltean <vladimir.oltean-3arQi8VN3Tc@public.gmane.org> Link: https://lore.kernel.org/r/20200304220044.11193-13-olteanv-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Signed-off-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> --- drivers/spi/spi-fsl-dspi.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index d5983be32180..b5ab0afbfa26 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -838,19 +838,18 @@ static void dspi_setup_accel(struct fsl_dspi *dspi) static void dspi_fifo_write(struct fsl_dspi *dspi) { + struct spi_transfer *xfer = dspi->cur_transfer; + struct spi_message *msg = dspi->cur_msg; + int bytes_sent; + dspi_setup_accel(dspi); + spi_take_timestamp_pre(dspi->ctlr, xfer, dspi->progress, !dspi->irq); + if (dspi->devtype_data->trans_mode == DSPI_EOQ_MODE) dspi_eoq_fifo_write(dspi); else dspi_xspi_fifo_write(dspi); -} - -static int dspi_rxtx(struct fsl_dspi *dspi) -{ - struct spi_transfer *xfer = dspi->cur_transfer; - struct spi_message *msg = dspi->cur_msg; - int bytes_sent; /* Update total number of bytes that were transferred */ bytes_sent = dspi->words_in_flight * dspi->oper_word_size; @@ -859,16 +858,16 @@ static int dspi_rxtx(struct fsl_dspi *dspi) spi_take_timestamp_post(dspi->ctlr, dspi->cur_transfer, dspi->progress, !dspi->irq); +} +static int dspi_rxtx(struct fsl_dspi *dspi) +{ dspi_fifo_read(dspi); if (!dspi->len) /* Success! */ return 0; - spi_take_timestamp_pre(dspi->ctlr, dspi->cur_transfer, - dspi->progress, !dspi->irq); - dspi_fifo_write(dspi); return -EINPROGRESS; -- 2.20.1
next prev parent reply other threads:[~2020-03-05 14:37 UTC|newest] Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-03-04 22:00 [PATCH 00/12] TCFQ to XSPI migration for NXP DSPI driver Vladimir Oltean 2020-03-04 22:00 ` Vladimir Oltean 2020-03-04 22:00 ` [PATCH 01/12] spi: spi-fsl-dspi: Simplify bytes_per_word gymnastics Vladimir Oltean 2020-03-05 14:38 ` Applied "spi: spi-fsl-dspi: Simplify bytes_per_word gymnastics" to the spi tree Mark Brown 2020-03-05 14:38 ` Mark Brown 2020-03-04 22:00 ` [PATCH 02/12] spi: spi-fsl-dspi: Remove unused chip->void_write_data Vladimir Oltean 2020-03-05 14:37 ` Applied "spi: spi-fsl-dspi: Remove unused chip->void_write_data" to the spi tree Mark Brown 2020-03-05 14:37 ` Mark Brown 2020-03-04 22:00 ` [PATCH 03/12] spi: spi-fsl-dspi: Don't mask off undefined bits Vladimir Oltean 2020-03-05 14:37 ` Applied "spi: spi-fsl-dspi: Don't mask off undefined bits" to the spi tree Mark Brown 2020-03-05 14:37 ` Mark Brown 2020-03-04 22:00 ` [PATCH 04/12] spi: spi-fsl-dspi: Add comments around dspi_pop_tx and dspi_push_rx functions Vladimir Oltean 2020-03-05 14:37 ` Applied "spi: spi-fsl-dspi: Add comments around dspi_pop_tx and dspi_push_rx functions" to the spi tree Mark Brown 2020-03-05 14:37 ` Mark Brown 2020-03-04 22:00 ` [PATCH 05/12] spi: spi-fsl-dspi: Rename fifo_{read,write} and {tx,cmd}_fifo_write Vladimir Oltean 2020-03-05 14:37 ` Applied "spi: spi-fsl-dspi: Rename fifo_{read,write} and {tx,cmd}_fifo_write" to the spi tree Mark Brown 2020-03-05 14:37 ` Mark Brown 2020-03-04 22:00 ` [PATCH 06/12] spi: spi-fsl-dspi: Implement .max_message_size method for EOQ mode Vladimir Oltean 2020-03-05 14:37 ` Applied "spi: spi-fsl-dspi: Implement .max_message_size method for EOQ mode" to the spi tree Mark Brown 2020-03-05 14:37 ` Mark Brown 2020-03-04 22:00 ` [PATCH 07/12] spi: Do spi_take_timestamp_pre for as many times as necessary Vladimir Oltean 2020-03-05 12:12 ` Mark Brown 2020-03-05 12:12 ` Mark Brown 2020-03-05 13:00 ` Vladimir Oltean 2020-03-05 13:04 ` Mark Brown 2020-03-05 13:04 ` Mark Brown 2020-03-05 13:13 ` Vladimir Oltean 2020-03-05 13:13 ` Vladimir Oltean 2020-03-05 13:16 ` Mark Brown 2020-03-05 13:16 ` Mark Brown 2020-03-05 14:37 ` Applied "spi: Do spi_take_timestamp_pre for as many times as necessary" to the spi tree Mark Brown 2020-03-05 14:37 ` Mark Brown 2020-03-04 22:00 ` [PATCH 08/12] spi: spi-fsl-dspi: Convert TCFQ users to XSPI FIFO mode Vladimir Oltean 2020-03-05 14:37 ` Applied "spi: spi-fsl-dspi: Convert TCFQ users to XSPI FIFO mode" to the spi tree Mark Brown 2020-03-05 14:37 ` Mark Brown 2020-03-04 22:00 ` [PATCH 09/12] spi: spi-fsl-dspi: Accelerate transfers using larger word size if possible Vladimir Oltean 2020-03-05 14:37 ` Applied "spi: spi-fsl-dspi: Accelerate transfers using larger word size if possible" to the spi tree Mark Brown 2020-03-05 14:37 ` Mark Brown 2020-03-04 22:00 ` [PATCH 10/12] spi: spi-fsl-dspi: Optimize dspi_setup_accel for lowest interrupt count Vladimir Oltean 2020-03-05 14:37 ` Applied "spi: spi-fsl-dspi: Optimize dspi_setup_accel for lowest interrupt count" to the spi tree Mark Brown 2020-03-05 14:37 ` Mark Brown 2020-03-04 22:00 ` [PATCH 11/12] spi: spi-fsl-dspi: Use EOQ for last word in buffer even for XSPI mode Vladimir Oltean 2020-03-04 22:00 ` Vladimir Oltean 2020-03-05 14:37 ` Applied "spi: spi-fsl-dspi: Use EOQ for last word in buffer even for XSPI mode" to the spi tree Mark Brown 2020-03-05 14:37 ` Mark Brown 2020-03-04 22:00 ` [PATCH 12/12] spi: spi-fsl-dspi: Take software timestamp in dspi_fifo_write Vladimir Oltean 2020-03-04 22:00 ` Vladimir Oltean 2020-03-05 14:37 ` Mark Brown [this message] 2020-03-05 14:37 ` Applied "spi: spi-fsl-dspi: Take software timestamp in dspi_fifo_write" to the spi tree Mark Brown
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=applied-20200304220044.11193-13-olteanv@gmail.com \ --to=broonie@kernel.org \ --cc=andrew.smirnov@gmail.com \ --cc=angelo@sysam.it \ --cc=eha@deif.com \ --cc=gustavo@embeddedor.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-spi@vger.kernel.org \ --cc=mhosny@nvidia.com \ --cc=vladimir.oltean@nxp.com \ --cc=weic@nvidia.com \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.