All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sourav Poddar <sourav.poddar@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [UBOOT][PATCHv6 3/6] sf: Add memory mapped read support
Date: Mon, 7 Oct 2013 15:53:01 +0530	[thread overview]
Message-ID: <1381141384-32706-4-git-send-email-sourav.poddar@ti.com> (raw)
In-Reply-To: <1381141384-32706-1-git-send-email-sourav.poddar@ti.com>

Qspi controller can have a memory mapped port which can be used for
data read. Added support to enable memory mapped port read.

This patch enables the following:
- It enables exchange of memory map address between mtd and qspi
through the introduction of "memory_map" flag.
- Add support to communicate to the driver that memory mapped
 transfer is to be started through introduction of new flags like
"SPI_XFER_MEM_MAP" and "SPI_XFER_MEM_MAP_END".

This will enable the spi controller to do memory mapped configurations
if required.

Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
---
v5->v6:
Add proper tab space
 drivers/mtd/spi/sf_ops.c   |    2 ++
 drivers/mtd/spi/sf_probe.c |    1 +
 include/spi.h              |    3 +++
 3 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/spi/sf_ops.c b/drivers/mtd/spi/sf_ops.c
index c009af5..2396e22 100644
--- a/drivers/mtd/spi/sf_ops.c
+++ b/drivers/mtd/spi/sf_ops.c
@@ -269,7 +269,9 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
 
 	/* Handle memory-mapped SPI */
 	if (flash->memory_map) {
+		spi_xfer(flash->spi, 0, NULL, NULL, SPI_XFER_MMAP);
 		memcpy(data, flash->memory_map + offset, len);
+		spi_xfer(flash->spi, 0, NULL, NULL, SPI_XFER_MMAP_END);
 		return 0;
 	}
 
diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
index 1525636..6aa7086 100644
--- a/drivers/mtd/spi/sf_probe.c
+++ b/drivers/mtd/spi/sf_probe.c
@@ -203,6 +203,7 @@ struct spi_flash *spi_flash_validate_params(struct spi_slave *spi, u8 *idcode)
 	flash->page_size = (ext_jedec == 0x4d00) ? 512 : 256;
 	flash->sector_size = params->sector_size;
 	flash->size = flash->sector_size * params->nr_sectors;
+	flash->memory_map = spi->memory_map;
 
 	/* Compute erase sector and command */
 	if (params->flags & SECT_4K) {
diff --git a/include/spi.h b/include/spi.h
index c44ebe8..c2086fc 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -27,6 +27,8 @@
 /* SPI transfer flags */
 #define SPI_XFER_BEGIN	0x01			/* Assert CS before transfer */
 #define SPI_XFER_END	0x02			/* Deassert CS after transfer */
+#define SPI_XFER_MMAP	0x08			/* Memory Mapped start */
+#define SPI_XFER_MMAP_END	0x10		/* Memory Mapped End */
 
 /* Header byte that marks the start of the message */
 #define SPI_PREAMBLE_END_BYTE		0xec
@@ -46,6 +48,7 @@ struct spi_slave {
 	unsigned int bus;
 	unsigned int cs;
 	unsigned int max_write_size;
+	void *memory_map;
 };
 
 /**
-- 
1.7.1

  parent reply	other threads:[~2013-10-07 10:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-07 10:22 [U-Boot] [UBOOT][PATCHv6 0/6] Add TI qspi controller with memory mapped support Sourav Poddar
2013-10-07 10:22 ` [U-Boot] [UBOOT][PATCHv6 1/6] omap5: add qspi support Sourav Poddar
2013-10-07 10:23 ` [U-Boot] [UBOOT][PATCHv6 2/6] armv7: hw_data: change clock divider setting Sourav Poddar
2013-10-07 10:23 ` Sourav Poddar [this message]
2013-10-07 10:23 ` [U-Boot] [UBOOT][PATCHv6 4/6] spi: add TI QSPI driver Sourav Poddar
2013-10-07 10:23 ` [U-Boot] [UBOOT][PATCHv6 5/6] dra7xx_evm: add SPL API, QSPI, and serial flash support Sourav Poddar
2013-10-07 10:23 ` [U-Boot] [UBOOT][PATCHv6 6/6] README: qspi usecase and testing documentation Sourav Poddar
2013-10-07 14:31 ` [U-Boot] [UBOOT][PATCHv6 0/6] Add TI qspi controller with memory mapped support Jagan Teki
2013-10-07 15:17   ` Sourav Poddar

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=1381141384-32706-4-git-send-email-sourav.poddar@ti.com \
    --to=sourav.poddar@ti.com \
    --cc=u-boot@lists.denx.de \
    /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.