mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sourav Poddar <sourav.poddar@ti.com>
To: <broonie@kernel.org>, <spi-devel-general@lists.sourceforge.net>,
	<grant.likely@linaro.org>
Cc: <balbi@ti.com>, <rnayak@ti.com>, <linux-omap@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	Sourav Poddar <sourav.poddar@ti.com>
Subject: [RFC/PATCHv2 3/3] driver: spi: Add quad spi read support
Date: Thu, 18 Jul 2013 15:31:27 +0530	[thread overview]
Message-ID: <1374141687-10790-4-git-send-email-sourav.poddar@ti.com> (raw)
In-Reply-To: <1374141687-10790-1-git-send-email-sourav.poddar@ti.com>

Since, qspi controller uses quad read.

Configuring the command register, if the transfer of data needs
dual or quad lines.

This patch has been done on top of the following patch[1], which is just the 
basic idea of adding dual/quad support in spi framework.  
$subject patch will undergo changes as the parent patch goes[1]

[1]: http://comments.gmane.org/gmane.linux.kernel.spi.devel/14047

Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
---
v1->v2
Added support for dual also.
 drivers/spi/spi-ti-qspi.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
index 3cae731..3a5c56d 100644
--- a/drivers/spi/spi-ti-qspi.c
+++ b/drivers/spi/spi-ti-qspi.c
@@ -86,6 +86,7 @@ struct ti_qspi {
 #define QSPI_3_PIN			(1 << 18)
 #define QSPI_RD_SNGL			(1 << 16)
 #define QSPI_WR_SNGL			(2 << 16)
+#define	QSPI_RD_DUAL			(3 << 16)
 #define QSPI_RD_QUAD			(7 << 16)
 #define QSPI_INVAL			(4 << 16)
 #define QSPI_WC_CMD_INT_EN			(1 << 14)
@@ -280,6 +281,7 @@ static void qspi_read_msg(struct ti_qspi *qspi, struct spi_transfer *t)
 {
 	u8 *rxbuf;
 	int wlen, count;
+	unsigned cmd = qspi->cmd;
 
 	count = t->len;
 	rxbuf = t->rx_buf;
@@ -289,8 +291,19 @@ static void qspi_read_msg(struct ti_qspi *qspi, struct spi_transfer *t)
 		dev_dbg(qspi->dev, "rx cmd %08x dc %08x\n",
 			qspi->cmd | QSPI_RD_SNGL, qspi->dc);
 		ti_qspi_writel(qspi, qspi->dc, QSPI_SPI_DC_REG);
-		ti_qspi_writel(qspi, qspi->cmd | QSPI_RD_SNGL,
-			QSPI_SPI_CMD_REG);
+		switch (t->bitwidth) {
+		case SPI_BITWIDTH_QUAD:
+			cmd |= QSPI_RD_QUAD;
+			break;
+		case SPI_BITWIDTH_DUAL:
+			cmd |= QSPI_RD_DUAL;
+			break;
+		case SPI_BITWIDTH_SINGLE:
+		default:
+			cmd |= QSPI_RD_SNGL;
+		}
+
+		ti_qspi_writel(qspi, cmd, QSPI_SPI_CMD_REG);
 		ti_qspi_writel(qspi, QSPI_WC_INT_EN, QSPI_INTR_ENABLE_SET_REG);
 		wait_for_completion(&qspi->transfer_complete);
 		*rxbuf++ = ti_qspi_readl_data(qspi, QSPI_SPI_DATA_REG, wlen);
-- 
1.7.1


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

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-18 10:01 [PATCH 0/3] spi changes and ti quad spi controller Sourav Poddar
2013-07-18 10:01 ` [RFC/PATCHv2 1/3] driver: spi: Modify core to compute the message length Sourav Poddar
2013-07-18 15:22   ` Mark Brown
2013-07-18 10:01 ` [PATCHv4 2/3] drivers: spi: Add qspi flash controller Sourav Poddar
2013-07-18 10:24   ` Felipe Balbi
2013-07-18 11:18     ` Sourav Poddar
2013-07-18 11:24       ` Felipe Balbi
2013-07-18 12:24         ` Sourav Poddar
2013-07-19 11:48         ` Sourav Poddar
2013-07-19 12:20           ` Felipe Balbi
2013-07-18 10:42   ` Mark Brown
2013-07-18 11:45     ` Sourav Poddar
2013-07-18 11:56       ` Felipe Balbi
2013-07-18 13:18       ` Mark Brown
2013-07-18 13:31         ` Felipe Balbi
2013-07-18 14:42           ` Mark Brown
2013-07-18 14:55             ` Sourav Poddar
2013-07-18 15:28               ` Mark Brown
2013-07-19 11:55     ` Sourav Poddar
2013-07-18 19:08   ` Trent Piepho
2013-07-18 20:39     ` Mark Brown
2013-07-18 20:59       ` Nishanth Menon
2013-07-19  5:02     ` Sourav Poddar
2013-07-18 10:01 ` Sourav Poddar [this message]
2013-07-18 10:44   ` [RFC/PATCHv2 3/3] driver: spi: Add quad spi read support Mark Brown
2013-07-18 11:52     ` 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=1374141687-10790-4-git-send-email-sourav.poddar@ti.com \
    --to=sourav.poddar@ti.com \
    --cc=balbi@ti.com \
    --cc=broonie@kernel.org \
    --cc=grant.likely@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=rnayak@ti.com \
    --cc=spi-devel-general@lists.sourceforge.net \
    /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

all inboxes | Powered by JetHome®