All of lore.kernel.org
 help / color / mirror / Atom feed
From: Meghana Madhyastha <meghana.madhyastha@gmail.com>
To: "Mark Brown" <broonie@kernel.org>,
	"Daniel Vetter" <daniel.vetter@intel.com>,
	linux-spi@vger.kernel.org, "Noralf Trønnes" <noralf@tronnes.org>,
	"Sean Paul" <seanpaul@chromium.org>,
	dri-devel@lists.freedesktop.org
Subject: [PATCH v2 1/2] spi: Split spi message into chunks of <65535 in the spi subsystem
Date: Sat, 10 Mar 2018 15:51:31 +0000	[thread overview]
Message-ID: <26064ccd4a898549fcdecbd5d0a3f32fb0a3ba55.1520691344.git.meghana.madhyastha@gmail.com> (raw)
In-Reply-To: <cover.1520691344.git.meghana.madhyastha@gmail.com>

Split spi messages into chunks of <65535 in the spi subsystem and remove the message
length warning in bcm2835_spi_can_dma. This is so that the messages can be transferred
via dma and that the tinydrm drivers need not split it.

Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
---
 drivers/spi/spi-bcm2835.c | 13 -------------
 drivers/spi/spi.c         |  8 ++++++++
 2 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c
index f35cc10772f6..0dcc45f158b8 100644
--- a/drivers/spi/spi-bcm2835.c
+++ b/drivers/spi/spi-bcm2835.c
@@ -365,19 +365,6 @@ static bool bcm2835_spi_can_dma(struct spi_master *master,
 	if (tfr->len < BCM2835_SPI_DMA_MIN_LENGTH)
 		return false;
 
-	/* BCM2835_SPI_DLEN has defined a max transfer size as
-	 * 16 bit, so max is 65535
-	 * we can revisit this by using an alternative transfer
-	 * method - ideally this would get done without any more
-	 * interaction...
-	 */
-	if (tfr->len > 65535) {
-		dev_warn_once(&spi->dev,
-			      "transfer size of %d too big for dma-transfer\n",
-			      tfr->len);
-		return false;
-	}
-
 	/* if we run rx/tx_buf with word aligned addresses then we are OK */
 	if ((((size_t)tfr->rx_buf & 3) == 0) &&
 	    (((size_t)tfr->tx_buf & 3) == 0))
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index b33a727a0158..e8e2c366a93b 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1242,6 +1242,14 @@ static void __spi_pump_messages(struct spi_controller *ctlr, bool in_kthread)
 	trace_spi_message_start(ctlr->cur_msg);
 
 	if (ctlr->prepare_message) {
+		gfp_t gfp_flags = GFP_KERNEL | GFP_DMA;
+		size_t max_transfer_size = 32000;
+		ret = spi_split_transfers_maxsize(ctlr, ctlr->cur_msg, max_transfer_size, gfp_flags);
+		if (ret) {
+			dev_err(&ctlr->dev,
+				"failed to split message\n");
+			goto out;
+		}
 		ret = ctlr->prepare_message(ctlr, ctlr->cur_msg);
 		if (ret) {
 			dev_err(&ctlr->dev, "failed to prepare message: %d\n",
-- 
2.11.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-03-10 15:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-10 15:50 [PATCH v2 0/2] Chunk splitting of spi transfers Meghana Madhyastha
2018-03-10 15:51 ` Meghana Madhyastha [this message]
2018-03-10 19:12   ` [PATCH v2 1/2] spi: Split spi message into chunks of <65535 in the spi subsystem Geert Uytterhoeven
2018-03-11 13:33   ` Noralf Trønnes
2018-03-10 15:52 ` [PATCH v2 2/2] drm/tinydrm: Remove chunk splitting in tinydrm_spi_transfer Meghana Madhyastha
2018-03-11 13:35   ` Noralf Trønnes

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=26064ccd4a898549fcdecbd5d0a3f32fb0a3ba55.1520691344.git.meghana.madhyastha@gmail.com \
    --to=meghana.madhyastha@gmail.com \
    --cc=broonie@kernel.org \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=noralf@tronnes.org \
    --cc=seanpaul@chromium.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 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.