From: Mark Brown <broonie@kernel.org>
To: Boris Brezillon <boris.brezillon@bootlin.com>
Cc: "Yogesh Gaur" <yogeshnarayan.gaur@nxp.com>,
"Vignesh R" <vigneshr@ti.com>,
"Kamal Dasu" <kdasu.kdev@gmail.com>,
"Richard Weinberger" <richard@nod.at>,
"Miquel Raynal" <miquel.raynal@bootlin.com>,
linux-spi@vger.kernel.org, "Peter Pan" <peterpansjtu@gmail.com>,
"Marek Vasut" <marek.vasut@gmail.com>,
"Frieder Schrempf" <frieder.schrempf@exceet.de>,
"Mark Brown" <broonie@kernel.org>,
linux-mtd@lists.infradead.org,
"Cyrille Pitchen" <cyrille.pitchen@wedev4u.fr>,
"Rafał Miłecki" <rafal@milecki.pl>,
"Maxime Chevallier" <maxime.chevallier@bootlin.com>,
"Brian Norris" <computersforpeace@gmail.com>,
"David Woodhouse" <dwmw2@infradead.org>
Subject: Applied "spi: Add an helper to flush the message queue" to the spi tree
Date: Mon, 23 Apr 2018 19:05:27 +0100 [thread overview]
Message-ID: <E1fAfqB-0004Jh-F7@debutante> (raw)
In-Reply-To: <20180422183522.11118-3-boris.brezillon@bootlin.com>
The patch
spi: Add an helper to flush the message queue
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 988f259b46646934003ff8ae4966f7233691d1ad Mon Sep 17 00:00:00 2001
From: Boris Brezillon <boris.brezillon@bootlin.com>
Date: Sun, 22 Apr 2018 20:35:15 +0200
Subject: [PATCH] spi: Add an helper to flush the message queue
This is needed by the spi-mem logic to force all messages that have been
queued before a memory operation to be sent before we start the memory
operation. We do that in order to guarantee that spi-mem operations do
not preempt regular SPI transfers.
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
drivers/spi/internals.h | 2 ++
drivers/spi/spi.c | 16 ++++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/drivers/spi/internals.h b/drivers/spi/internals.h
index dbe56c77b464..4a28a8395552 100644
--- a/drivers/spi/internals.h
+++ b/drivers/spi/internals.h
@@ -17,6 +17,8 @@
#include <linux/scatterlist.h>
#include <linux/spi/spi.h>
+void spi_flush_queue(struct spi_controller *ctrl);
+
#ifdef CONFIG_HAS_DMA
int spi_map_buf(struct spi_controller *ctlr, struct device *dev,
struct sg_table *sgt, void *buf, size_t len,
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 86b778d8563e..3f4666365678 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1522,6 +1522,22 @@ static int spi_controller_initialize_queue(struct spi_controller *ctlr)
return ret;
}
+/**
+ * spi_flush_queue - Send all pending messages in the queue from the callers'
+ * context
+ * @ctlr: controller to process queue for
+ *
+ * This should be used when one wants to ensure all pending messages have been
+ * sent before doing something. Is used by the spi-mem code to make sure SPI
+ * memory operations do not preempt regular SPI transfers that have been queued
+ * before the spi-mem operation.
+ */
+void spi_flush_queue(struct spi_controller *ctlr)
+{
+ if (ctlr->transfer == spi_queued_transfer)
+ __spi_pump_messages(ctlr, false);
+}
+
/*-------------------------------------------------------------------------*/
#if defined(CONFIG_OF)
--
2.17.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2018-04-23 18:05 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-22 18:35 [PATCH v3 0/9] spi: Extend the framework to generically support memory devices Boris Brezillon
2018-04-22 18:35 ` [PATCH v3 1/9] spi: Expose spi_{map,unmap}_buf() for internal use Boris Brezillon
2018-04-23 18:05 ` Applied "spi: Expose spi_{map, unmap}_buf() for internal use" to the spi tree Mark Brown
2018-04-22 18:35 ` [PATCH v3 2/9] spi: Add an helper to flush the message queue Boris Brezillon
2018-04-23 18:05 ` Mark Brown [this message]
2018-04-22 18:35 ` [PATCH v3 3/9] spi: Extend the core to ease integration of SPI memory controllers Boris Brezillon
2018-04-23 21:53 ` Andy Shevchenko
2018-04-23 22:10 ` Boris Brezillon
2018-04-24 10:47 ` Mark Brown
2018-05-11 2:58 ` Applied "spi: Extend the core to ease integration of SPI memory controllers" to the spi tree Mark Brown
2018-04-22 18:35 ` [PATCH v3 4/9] spi: Make support for regular transfers optional when ->mem_ops != NULL Boris Brezillon
2018-04-22 18:35 ` [PATCH v3 5/9] spi: bcm-qspi: Implement the spi_mem interface Boris Brezillon
2018-04-24 15:19 ` Kamal Dasu
2018-04-22 18:35 ` [PATCH v3 6/9] spi: bcm53xx: " Boris Brezillon
2018-04-22 18:35 ` [PATCH v3 7/9] spi: ti-qspi: " Boris Brezillon
2018-04-26 9:10 ` Vignesh R
2018-04-26 9:28 ` Boris Brezillon
2018-04-22 18:35 ` [PATCH v3 8/9] mtd: spi-nor: Use the spi_mem_xx() API Boris Brezillon
2018-04-22 18:35 ` [PATCH v3 9/9] spi: Get rid of the spi_flash_read() API Boris Brezillon
2018-05-11 9:24 ` Boris Brezillon
2018-04-26 9:07 ` [PATCH v3 0/9] spi: Extend the framework to generically support memory devices Vignesh R
2018-04-26 9:27 ` Boris Brezillon
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=E1fAfqB-0004Jh-F7@debutante \
--to=broonie@kernel.org \
--cc=boris.brezillon@bootlin.com \
--cc=computersforpeace@gmail.com \
--cc=cyrille.pitchen@wedev4u.fr \
--cc=dwmw2@infradead.org \
--cc=frieder.schrempf@exceet.de \
--cc=kdasu.kdev@gmail.com \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=marek.vasut@gmail.com \
--cc=maxime.chevallier@bootlin.com \
--cc=miquel.raynal@bootlin.com \
--cc=peterpansjtu@gmail.com \
--cc=rafal@milecki.pl \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
--cc=yogeshnarayan.gaur@nxp.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: 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