linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vignesh R <vigneshr@ti.com>
To: Tony Lindgren <tony@atomide.com>,
	Brian Norris <computersforpeace@gmail.com>,
	Mark Brown <broonie@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>,
	Russell King <linux@arm.linux.org.uk>, <hramrach@gmail.com>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-omap@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mtd@lists.infradead.org>, <linux-spi@vger.kernel.org>,
	Vignesh R <vigneshr@ti.com>
Subject: [PATCH v5 3/5] mtd: devices: m25p80: add support for mmap read request
Date: Fri, 11 Dec 2015 09:39:58 +0530	[thread overview]
Message-ID: <1449807000-6457-4-git-send-email-vigneshr@ti.com> (raw)
In-Reply-To: <1449807000-6457-1-git-send-email-vigneshr@ti.com>

Certain spi controllers may provide accelerated interface to read from
m25p80 type flash devices. This interface provides better read
performance than regular SPI interface.
Call spi_flash_read(), if supported, to make use of such interface.

Signed-off-by: Vignesh R <vigneshr@ti.com>
---

v5: No changes

 drivers/mtd/devices/m25p80.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index fe9ceb7b5405..00094a668c62 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -131,6 +131,26 @@ static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
 	/* convert the dummy cycles to the number of bytes */
 	dummy /= 8;
 
+	if (spi_flash_read_supported(spi)) {
+		struct spi_flash_read_message msg;
+		int ret;
+
+		msg.buf = buf;
+		msg.from = from;
+		msg.len = len;
+		msg.read_opcode = nor->read_opcode;
+		msg.addr_width = nor->addr_width;
+		msg.dummy_bytes = dummy;
+		/* TODO: Support other combinations */
+		msg.opcode_nbits = SPI_NBITS_SINGLE;
+		msg.addr_nbits = SPI_NBITS_SINGLE;
+		msg.data_nbits = m25p80_rx_nbits(nor);
+
+		ret = spi_flash_read(spi, &msg);
+		*retlen = msg.retlen;
+		return ret;
+	}
+
 	spi_message_init(&m);
 	memset(t, 0, (sizeof t));
 
-- 
2.6.3


  parent reply	other threads:[~2015-12-11  4:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-11  4:09 [PATCH v5 0/5] Add memory mapped read support for ti-qspi Vignesh R
2015-12-11  4:09 ` [PATCH v5 1/5] spi: introduce accelerated read support for spi flash devices Vignesh R
2015-12-11  4:09 ` [PATCH v5 2/5] spi: spi-ti-qspi: add mmap mode read support Vignesh R
2015-12-11  4:09 ` Vignesh R [this message]
2016-02-09 19:36   ` [PATCH v5 3/5] mtd: devices: m25p80: add support for mmap read request Mark Brown
2016-02-11  5:33     ` Vignesh R
2016-02-12 22:37       ` Mark Brown
2016-02-16  8:00         ` Vignesh R
2016-02-16 12:38           ` Mark Brown
2016-02-17 16:11             ` R, Vignesh
2016-02-24 12:21               ` Vignesh R
2015-12-11  4:09 ` [PATCH v5 4/5] ARM: dts: DRA7: add entry for qspi mmap region Vignesh R
2015-12-11 15:09   ` Rob Herring
2015-12-17 18:45     ` Tony Lindgren
2015-12-18  5:50       ` Vignesh R
2015-12-18 16:42         ` Tony Lindgren
2015-12-11  4:10 ` [PATCH v5 5/5] ARM: dts: AM4372: " Vignesh R
2015-12-21 12:03 ` [PATCH v5 0/5] Add memory mapped read support for ti-qspi Vignesh R
2016-01-05  5:20 ` Vignesh R
2016-01-05 18:19   ` 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=1449807000-6457-4-git-send-email-vigneshr@ti.com \
    --to=vigneshr@ti.com \
    --cc=broonie@kernel.org \
    --cc=computersforpeace@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hramrach@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=robh+dt@kernel.org \
    --cc=tony@atomide.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;
as well as URLs for NNTP newsgroup(s).