diff mbox

[RFC/PATCH,2/2] driver: spi: Add quad spi read support

Message ID 1375082550-30544-3-git-send-email-sourav.poddar@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Poddar, Sourav July 29, 2013, 7:22 a.m. UTC
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 with the ongoing discussion in the
community.

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 |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

Comments

Felipe Balbi July 29, 2013, 9:32 a.m. UTC | #1
On Mon, Jul 29, 2013 at 12:52:30PM +0530, Sourav Poddar wrote:
> 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 with the ongoing discussion in the
> community.
> 
> 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 |   16 ++++++++++++++--
>  1 files changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
> index 51fe95f..8a32b1c 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)

so RD_QUAD is defined in previous patch but not RD_DUAL ? What gives ?

IMHO, just merge this patch with previous and make the entire driver
depend on the other patch.
Poddar, Sourav July 29, 2013, 9:43 a.m. UTC | #2
On Monday 29 July 2013 03:02 PM, Felipe Balbi wrote:
> On Mon, Jul 29, 2013 at 12:52:30PM +0530, Sourav Poddar wrote:
>> 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 with the ongoing discussion in the
>> community.
>>
>> 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 |   16 ++++++++++++++--
>>   1 files changed, 14 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
>> index 51fe95f..8a32b1c 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)
> so RD_QUAD is defined in previous patch but not RD_DUAL ? What gives ?
>
I think I will define RD_DUAL in the previous patch...
> IMHO, just merge this patch with previous and make the entire driver
> depend on the other patch.
>
but I was thinking of keeping rest of the $subject patch seperate, since the
idea of implementing dual/quad read in spi framework is still under 
discussion.
and this patch will change.

So, it would be good if we can get the basic previous patch in, and then 
when the
other discussion is sorted out, we can get this in?

~Sourav

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Felipe Balbi July 29, 2013, 9:59 a.m. UTC | #3
On Mon, Jul 29, 2013 at 03:13:07PM +0530, Sourav Poddar wrote:
> On Monday 29 July 2013 03:02 PM, Felipe Balbi wrote:
> >On Mon, Jul 29, 2013 at 12:52:30PM +0530, Sourav Poddar wrote:
> >>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 with the ongoing discussion in the
> >>community.
> >>
> >>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 |   16 ++++++++++++++--
> >>  1 files changed, 14 insertions(+), 2 deletions(-)
> >>
> >>diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
> >>index 51fe95f..8a32b1c 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)
> >so RD_QUAD is defined in previous patch but not RD_DUAL ? What gives ?
> >
> I think I will define RD_DUAL in the previous patch...
> >IMHO, just merge this patch with previous and make the entire driver
> >depend on the other patch.
> >
> but I was thinking of keeping rest of the $subject patch seperate, since the
> idea of implementing dual/quad read in spi framework is still under
> discussion.
> and this patch will change.
> 
> So, it would be good if we can get the basic previous patch in, and
> then when the
> other discussion is sorted out, we can get this in?

alright, in that case it makes sense.
diff mbox

Patch

diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
index 51fe95f..8a32b1c 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)
@@ -264,6 +265,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;
@@ -273,8 +275,18 @@  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_write(qspi, qspi->dc, QSPI_SPI_DC_REG);
-		ti_qspi_write(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_write(qspi, QSPI_WC_INT_EN, QSPI_INTR_ENABLE_SET_REG);
 		wait_for_completion(&qspi->transfer_complete);
 		ti_qspi_read_data(qspi, QSPI_SPI_DATA_REG, wlen, &rxbuf);