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/PATCH 2/2] driver: spi: Add quad spi read support
Date: Thu, 1 Aug 2013 19:30:02 +0530 [thread overview]
Message-ID: <1375365602-31321-3-git-send-email-sourav.poddar@ti.com> (raw)
In-Reply-To: <1375365602-31321-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 once the ongoing discussion in the
community is freezed.
This patch is posted to demonstrate how patch 1 of the series will support
quad read.
[1]: http://comments.gmane.org/gmane.linux.kernel.spi.devel/14047
Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
---
drivers/spi/spi-ti-qspi.c | 22 ++++++++++++++++------
1 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
index 73a1675..fac1722 100644
--- a/drivers/spi/spi-ti-qspi.c
+++ b/drivers/spi/spi-ti-qspi.c
@@ -265,18 +265,30 @@ static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t)
static int qspi_read_msg(struct ti_qspi *qspi, struct spi_transfer *t)
{
int wlen, count, ret;
+ unsigned cmd = qspi->cmd;
count = t->len;
wlen = t->bits_per_word;
+ 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;
+ }
+
if (wlen == 8) {
u8 *rxbuf;
rxbuf = t->rx_buf;
do {
dev_dbg(qspi->dev, "rx cmd %08x dc %08x\n",
qspi->cmd | QSPI_RD_SNGL, qspi->dc);
- ti_qspi_write(qspi, qspi->cmd | QSPI_RD_SNGL,
- QSPI_SPI_CMD_REG);
+ ti_qspi_write(qspi, cmd, QSPI_SPI_CMD_REG);
ret = wait_for_completion_timeout(&qspi->transfer_complete,
QSPI_COMPLETION_TIMEOUT);
if (ret == 0) {
@@ -294,8 +306,7 @@ static int qspi_read_msg(struct ti_qspi *qspi, struct spi_transfer *t)
do {
dev_dbg(qspi->dev, "rx cmd %08x dc %08x\n",
qspi->cmd | QSPI_RD_SNGL, qspi->dc);
- ti_qspi_write(qspi, qspi->cmd | QSPI_RD_SNGL,
- QSPI_SPI_CMD_REG);
+ ti_qspi_write(qspi, cmd, QSPI_SPI_CMD_REG);
ret = wait_for_completion_timeout(&qspi->transfer_complete,
QSPI_COMPLETION_TIMEOUT);
if (ret == 0) {
@@ -313,8 +324,7 @@ static int qspi_read_msg(struct ti_qspi *qspi, struct spi_transfer *t)
do {
dev_dbg(qspi->dev, "rx cmd %08x dc %08x\n",
qspi->cmd | QSPI_RD_SNGL, qspi->dc);
- ti_qspi_write(qspi, qspi->cmd | QSPI_RD_SNGL,
- QSPI_SPI_CMD_REG);
+ ti_qspi_write(qspi, cmd, QSPI_SPI_CMD_REG);
ret = wait_for_completion_timeout(&qspi->transfer_complete,
QSPI_COMPLETION_TIMEOUT);
if (ret == 0) {
--
1.7.1
next prev parent reply other threads:[~2013-08-01 14:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-01 14:00 [PATCHv8 0/2] Add ti qspi controller Sourav Poddar
[not found] ` <1375365602-31321-1-git-send-email-sourav.poddar-l0cyMroinI0@public.gmane.org>
2013-08-01 14:00 ` [PATCHv8 1/2] drivers: spi: Add qspi flash controller Sourav Poddar
2013-08-01 14:07 ` Felipe Balbi
2013-08-01 14:00 ` Sourav Poddar [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-08-04 8:58 [PATCHv9 0/2] Add ti qspi controller Sourav Poddar
2013-08-04 8:58 ` [RFC/PATCH 2/2] driver: spi: Add quad spi read support Sourav Poddar
2013-07-31 5:47 [PATCHv7 0/2] Add ti qspi controller Sourav Poddar
2013-07-31 5:47 ` [RFC/PATCH 2/2] driver: spi: Add quad spi read support Sourav Poddar
2013-07-29 7:22 [PATCHv6 0/2] Add ti qspi controller Sourav Poddar
2013-07-29 7:22 ` [RFC/PATCH 2/2] driver: spi: Add quad spi read support Sourav Poddar
2013-07-29 9:32 ` Felipe Balbi
2013-07-29 9:43 ` Sourav Poddar
2013-07-29 9:59 ` Felipe Balbi
2013-07-26 17:15 [PATCHv5 0/2] Add qspi controller Sourav Poddar
[not found] ` <1374858922-14637-1-git-send-email-sourav.poddar-l0cyMroinI0@public.gmane.org>
2013-07-26 17:15 ` [RFC/PATCH 2/2] driver: spi: Add quad spi read support 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=1375365602-31321-3-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;
as well as URLs for NNTP newsgroup(s).