spi: spi-ti-qspi: clear wlen field while setting word length.
PATCH 1/1 spi: spi-ti-qspi: clear wlen field while setting word length.
When a word length of 1 byte is selected and writing data of length more than QSPI_WLEN_MAX_BYTES, first MAX_BYTES will be transfered and remaining will be transfered byte by byte. In that case wlen field should be cleared before setting.
--- drivers/spi/spi-ti-qspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-ti-qspi.c +2 -2
@@ -276,9 +276,9 @@ static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t, cmd |=QSPI_WLEN (QSPI_WLEN_MAX_BITS ); }else {writeb (*txbuf, qspi->base +QSPI_SPI_DATA_REG ); - cmd = qspi->cmd |QSPI_WR_SNGL ; xfer_len = wlen; - cmd |=QSPI_WLEN (wlen); + cmd = ((qspi->cmd & ~QSPI_WLEN_MASK ) | +QSPI_WLEN (wlen)); }break ;case 2 :
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Prahlad,
Quoted 15 lines · Prahlad V
When a word length of 1 byte is selected and writing data of length more than
QSPI_WLEN_MAX_BYTES, firstMAX_BYTESwill be transfered and remaining will be transfered byte by byte. In that case wlen field should be cleared before setting.Signed-off-by Prahlad V <[email protected]>--- drivers/spi/spi-ti-qspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/spi/spi-ti-qspi.c +0
-0
drivers/spi/spi-ti-qspi.c static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t, · line 279
Quoted 4 lines
drivers/spi/spi-ti-qspi.c +0
-1@@ -276,9 +276,9 @@ static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t, cmd |=QSPI_WLEN (QSPI_WLEN_MAX_BITS ); }else {writeb (*txbuf, qspi->base +QSPI_SPI_DATA_REG ); - cmd = qspi->cmd |QSPI_WR_SNGL ;
qspi->cmd always has WLEN field cleared and set to WLEN = 1 byte (see ti_qspi_start_transfer_one()). And hence variable 'cmd' will also have WLEN set to 1 byte.
drivers/spi/spi-ti-qspi.c static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t, · line 281
Quoted 4 lines
drivers/spi/spi-ti-qspi.c +2
-1xfer_len = wlen; - cmd |=QSPI_WLEN (wlen); + cmd = ((qspi->cmd & ~QSPI_WLEN_MASK ) | +QSPI_WLEN (wlen));
So, this won't be necessary.
Signature · 6 lines
Regards Vignesh -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 13 lines · Vignesh R
Hi Prahlad,
Quoted 10 lines · Prahlad V
When a word length of 1 byte is selected and writing data of length more than
QSPI_WLEN_MAX_BYTES, firstMAX_BYTESwill be transfered and remaining will be transfered byte by byte. In that case wlen field should be cleared before setting.Signed-off-by Prahlad V <[email protected]>--- drivers/spi/spi-ti-qspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 13 lines
drivers/spi/spi-ti-qspi.c static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t, · line 279
Quoted 9 lines
drivers/spi/spi-ti-qspi.c +0
-1@@ -276,9 +276,9 @@ static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t, cmd |=QSPI_WLEN (QSPI_WLEN_MAX_BITS ); }else {writeb (*txbuf, qspi->base +QSPI_SPI_DATA_REG ); - cmd = qspi->cmd |QSPI_WR_SNGL ;
qspi->cmdalways has WLEN field cleared and set to WLEN = 1 byte (seeti_qspi_start_transfer_one()). And hence variable 'cmd' will also have WLEN set to 1 byte.
Even though WLEN=1 is set in the ti_qspi_transfer_one, if we ask for a transfer of large data,
say 300 bytes in length, for attaining faster data rate WLEN 128 is selected for the first two
transactions and remaining 44 bytes will be transmitted with WLEN 1. During that case,
WLEN will be changed inside qspi_write_msg function itself and the field should be cleared
first while doing that.
Quoted 11 lines
drivers/spi/spi-ti-qspi.c static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t, · line 281
Quoted 5 lines
drivers/spi/spi-ti-qspi.c +2
-1xfer_len = wlen; - cmd |=QSPI_WLEN (wlen); + cmd = ((qspi->cmd & ~QSPI_WLEN_MASK ) | +QSPI_WLEN (wlen));So, this won't be necessary.
--
Regards
Vignesh
Signature · 3 lines
Regards, Prahlad. +91-9663742838
Quoted 14 lines · prahlad venkata
Quoted 13 lines · Vignesh R
Hi Prahlad,
Quoted 10 lines · Prahlad V
When a word length of 1 byte is selected and writing data of length more than
QSPI_WLEN_MAX_BYTES, firstMAX_BYTESwill be transfered and remaining will be transfered byte by byte. In that case wlen field should be cleared before setting.Signed-off-by Prahlad V <[email protected]>--- drivers/spi/spi-ti-qspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 9 lines
Quoted 9 lines
drivers/spi/spi-ti-qspi.c static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t, · line 279
Quoted 9 lines
drivers/spi/spi-ti-qspi.c +0
-1@@ -276,9 +276,9 @@ static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t, cmd |=QSPI_WLEN (QSPI_WLEN_MAX_BITS ); }else {writeb (*txbuf, qspi->base +QSPI_SPI_DATA_REG ); - cmd = qspi->cmd |QSPI_WR_SNGL ;
This is wrong. Deleting this line means QSPI_WR_SNGL is not set and no data is sent out on the wire.
Quoted 4 lines
Quoted 4 lines
qspi->cmdalways has WLEN field cleared and set to WLEN = 1 byte (seeti_qspi_start_transfer_one()). And hence variable 'cmd' will also have WLEN set to 1 byte.
Quoted 9 lines
Even though WLEN=1 is set in the
ti_qspi_transfer_one, if we ask for a transfer of large data,
say 300 bytes in length, for attaining faster data rate WLEN 128 is selected for the first two
transactions and remaining 44 bytes will be transmitted with WLEN 1. During that case,
WLEN will be changed insideqspi_write_msgfunction itself and the field should be cleared
first while doing that.
In qspi_write_msg(), qspi->cmd will always have WLEN set to QSPI_WLEN(t->bits_per_word) and qspi->cmd is never changed within this function.
It is the value of local variable 'cmd' that is changed to appropriate WLEN (128bit or 8bit) as necessary.
So, as per you example, for the first 18 transactions(16*18 = 288bytes) 'cmd' variable will have WLEN field set to 0x7F(128bit). But for the last 12 bytes, cmd is reinitialized to (that's the line being deleted above):
cmd = qspi->cmd | QSPI_WR_SNGL;
which means WLEN field is set 1 byte.
So the below change won't be necessary. Or am I missing something?
Quoted 14 lines
Quoted 11 lines
drivers/spi/spi-ti-qspi.c static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t, · line 281
Quoted 5 lines
drivers/spi/spi-ti-qspi.c +2
-1xfer_len = wlen; - cmd |=QSPI_WLEN (wlen); + cmd = ((qspi->cmd & ~QSPI_WLEN_MASK ) | +QSPI_WLEN (wlen));So, this won't be necessary.
--
Regards
Vignesh
Signature · 2 lines
Regards Vignesh
Quoted 17 lines · Vignesh R
Quoted 14 lines · prahlad venkata
Quoted 13 lines · Vignesh R
Hi Prahlad,
Quoted 10 lines · Prahlad V
When a word length of 1 byte is selected and writing data of length more than
QSPI_WLEN_MAX_BYTES, firstMAX_BYTESwill be transfered and remaining will be transfered byte by byte. In that case wlen field should be cleared before setting.Signed-off-by Prahlad V <[email protected]>--- drivers/spi/spi-ti-qspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 12 lines
Quoted 9 lines
Quoted 9 lines
drivers/spi/spi-ti-qspi.c static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t, · line 279
Quoted 9 lines
drivers/spi/spi-ti-qspi.c +0
-1@@ -276,9 +276,9 @@ static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t, cmd |=QSPI_WLEN (QSPI_WLEN_MAX_BITS ); }else {writeb (*txbuf, qspi->base +QSPI_SPI_DATA_REG ); - cmd = qspi->cmd |QSPI_WR_SNGL ;This is wrong. Deleting this line means
QSPI_WR_SNGLis not set and no data is sent out on the wire.
QSPI_WR_SNGL is already set as soon as we enter the function.
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
qspi->cmdalways has WLEN field cleared and set to WLEN = 1 byte (seeti_qspi_start_transfer_one()). And hence variable 'cmd' will also have WLEN set to 1 byte.Quoted 9 lines
Even though WLEN=1 is set in the
ti_qspi_transfer_one, if we ask for a transfer of large data,
say 300 bytes in length, for attaining faster data rate WLEN 128 is selected for the first two
transactions and remaining 44 bytes will be transmitted with WLEN 1. During that case,
WLEN will be changed insideqspi_write_msgfunction itself and the field should be cleared
first while doing that.
Quoted 9 lines
In
qspi_write_msg(),qspi->cmdwill always have WLEN set toQSPI_WLEN(t->bits_per_word)andqspi->cmdis never changed within this function.
It is the value of local variable 'cmd' that is changed to appropriate WLEN (128bit or 8bit) as necessary.
So, as per you example, for the first 18transactions(16*18 = 288bytes)'cmd' variable will have WLEN field set to 0x7F(128bit). But for the last 12 bytes, cmd is reinitialized to (that's the line being deleted above):
exactly.
Quoted 2 lines
cmd =
qspi->cmd|QSPI_WR_SNGL;
This will select single wire write operation, which is already done. WLEN field should be set back to 1 clearing 0x7f from the previous transaction.
Quoted 23 lines
which means WLEN field is set 1 byte.
So the below change won't be necessary. Or am I missing something?
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
drivers/spi/spi-ti-qspi.c +2
-1xfer_len = wlen; - cmd |=QSPI_WLEN (wlen); + cmd = ((qspi->cmd & ~QSPI_WLEN_MASK ) | +QSPI_WLEN (wlen));Quoted 8 lines
Quoted 5 lines
So, this won't be necessary.
--
Regards
Vignesh--
Regards
Vignesh
Signature · 7 lines
Regards, Prahlad. +91-9663742838 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 30 lines · prahlad venkata
Quoted 17 lines · Vignesh R
Quoted 14 lines · prahlad venkata
Quoted 13 lines · Vignesh R
Hi Prahlad,
Quoted 10 lines · Prahlad V
When a word length of 1 byte is selected and writing data of length more than
QSPI_WLEN_MAX_BYTES, firstMAX_BYTESwill be transfered and remaining will be transfered byte by byte. In that case wlen field should be cleared before setting.Signed-off-by Prahlad V <[email protected]>--- drivers/spi/spi-ti-qspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 12 lines
Quoted 9 lines
Quoted 9 lines
drivers/spi/spi-ti-qspi.c static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t, · line 279
Quoted 9 lines
drivers/spi/spi-ti-qspi.c +0
-1@@ -276,9 +276,9 @@ static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t, cmd |=QSPI_WLEN (QSPI_WLEN_MAX_BITS ); }else {writeb (*txbuf, qspi->base +QSPI_SPI_DATA_REG ); - cmd = qspi->cmd |QSPI_WR_SNGL ;This is wrong. Deleting this line means
QSPI_WR_SNGLis not set and no data is sent out on the wire.
Quoted 21 lines
QSPI_WR_SNGLis already set as soon as we enter the function.Quoted 20 lines
Quoted 5 lines
Quoted 5 lines
qspi->cmdalways has WLEN field cleared and set to WLEN = 1 byte (seeti_qspi_start_transfer_one()). And hence variable 'cmd' will also have WLEN set to 1 byte.Quoted 9 lines
Even though WLEN=1 is set in the
ti_qspi_transfer_one, if we ask for a transfer of large data,
say 300 bytes in length, for attaining faster data rate WLEN 128 is selected for the first two
transactions and remaining 44 bytes will be transmitted with WLEN 1. During that case,
WLEN will be changed insideqspi_write_msgfunction itself and the field should be cleared
first while doing that.In
qspi_write_msg(),qspi->cmdwill always have WLEN set toQSPI_WLEN(t->bits_per_word)andqspi->cmdis never changed within this function.
It is the value of local variable 'cmd' that is changed to appropriate WLEN (128bit or 8bit) as necessary.
'cmd' is written back to qspi->cmd for every transaction.
Quoted 39 lines
Quoted 4 lines
So, as per you example, for the first 18
transactions(16*18 = 288bytes)'cmd' variable will have WLEN field set to 0x7F(128bit). But for the last 12 bytes, cmd is reinitialized to (that's the line being deleted above):exactly.
Quoted 2 lines
cmd =
qspi->cmd|QSPI_WR_SNGL;This will select single wire write operation, which is already done. WLEN field should be set back to 1 clearing
0x7ffrom the previous transaction.Quoted 20 lines
which means WLEN field is set 1 byte.
So the below change won't be necessary. Or am I missing something?
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
drivers/spi/spi-ti-qspi.c +2
-1xfer_len = wlen; - cmd |=QSPI_WLEN (wlen); + cmd = ((qspi->cmd & ~QSPI_WLEN_MASK ) | +QSPI_WLEN (wlen));Quoted 8 lines
Quoted 5 lines
So, this won't be necessary.
--
Regards
VigneshQuoted 3 lines
--
Regards
Vignesh--
Regards,
Prahlad.
+91-9663742838
Signature · 3 lines
Regards, Prahlad. +91-9663742838
Quoted 47 lines · prahlad venkata
Quoted 46 lines · prahlad venkata
Quoted 17 lines · Vignesh R
Quoted 14 lines · prahlad venkata
Quoted 13 lines · Vignesh R
Hi Prahlad,
Quoted 10 lines · Prahlad V
When a word length of 1 byte is selected and writing data of length more than
QSPI_WLEN_MAX_BYTES, firstMAX_BYTESwill be transfered and remaining will be transfered byte by byte. In that case wlen field should be cleared before setting.Signed-off-by Prahlad V <[email protected]>--- drivers/spi/spi-ti-qspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 12 lines
Quoted 9 lines
Quoted 9 lines
drivers/spi/spi-ti-qspi.c static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t, · line 279
Quoted 9 lines
drivers/spi/spi-ti-qspi.c +0
-1@@ -276,9 +276,9 @@ static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t, cmd |=QSPI_WLEN (QSPI_WLEN_MAX_BITS ); }else {writeb (*txbuf, qspi->base +QSPI_SPI_DATA_REG ); - cmd = qspi->cmd |QSPI_WR_SNGL ;This is wrong. Deleting this line means
QSPI_WR_SNGLis not set and no data is sent out on the wire.
QSPI_WR_SNGLis already set as soon as we enter the function.Quoted 15 lines
Quoted 14 lines
Quoted 5 lines
qspi->cmdalways has WLEN field cleared and set to WLEN = 1 byte (seeti_qspi_start_transfer_one()). And hence variable 'cmd' will also have WLEN set to 1 byte.Even though WLEN=1 is set in the
ti_qspi_transfer_one, if we ask for a transfer of large data,
say 300 bytes in length, for attaining faster data rate WLEN 128 is selected for the first two
transactions and remaining 44 bytes will be transmitted with WLEN 1. During that case,
WLEN will be changed insideqspi_write_msgfunction itself and the field should be cleared
first while doing that.
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
In
qspi_write_msg(),qspi->cmdwill always have WLEN set toQSPI_WLEN(t->bits_per_word)andqspi->cmdis never changed within this function.
It is the value of local variable 'cmd' that is changed to appropriate WLEN (128bit or 8bit) as necessary.'cmd' is written back to
qspi->cmdfor every transaction.
You mean qspi->cmd = cmd ?
I don't see this happening anywhere in the driver. Can you point me to that line of code?
Signature · 6 lines
Regards Vignesh -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 56 lines · Vignesh R
Quoted 52 lines · prahlad venkata
Quoted 51 lines · prahlad venkata
Quoted 17 lines · Vignesh R
Quoted 14 lines · prahlad venkata
Quoted 13 lines · Vignesh R
Hi Prahlad,
Quoted 10 lines · Prahlad V
When a word length of 1 byte is selected and writing data of length more than
QSPI_WLEN_MAX_BYTES, firstMAX_BYTESwill be transfered and remaining will be transfered byte by byte. In that case wlen field should be cleared before setting.Signed-off-by Prahlad V <[email protected]>--- drivers/spi/spi-ti-qspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 12 lines
Quoted 9 lines
Quoted 9 lines
drivers/spi/spi-ti-qspi.c static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t, · line 279
Quoted 9 lines
drivers/spi/spi-ti-qspi.c +0
-1@@ -276,9 +276,9 @@ static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t, cmd |=QSPI_WLEN (QSPI_WLEN_MAX_BITS ); }else {writeb (*txbuf, qspi->base +QSPI_SPI_DATA_REG ); - cmd = qspi->cmd |QSPI_WR_SNGL ;This is wrong. Deleting this line means
QSPI_WR_SNGLis not set and no data is sent out on the wire.
QSPI_WR_SNGLis already set as soon as we enter the function.Quoted 20 lines
Quoted 5 lines
Quoted 5 lines
qspi->cmdalways has WLEN field cleared and set to WLEN = 1 byte (seeti_qspi_start_transfer_one()). And hence variable 'cmd' will also have WLEN set to 1 byte.Quoted 9 lines
Even though WLEN=1 is set in the
ti_qspi_transfer_one, if we ask for a transfer of large data,
say 300 bytes in length, for attaining faster data rate WLEN 128 is selected for the first two
transactions and remaining 44 bytes will be transmitted with WLEN 1. During that case,
WLEN will be changed insideqspi_write_msgfunction itself and the field should be cleared
first while doing that.In
qspi_write_msg(),qspi->cmdwill always have WLEN set toQSPI_WLEN(t->bits_per_word)andqspi->cmdis never changed within this function.
It is the value of local variable 'cmd' that is changed to appropriate WLEN (128bit or 8bit) as necessary.
Quoted 5 lines
Quoted 1 line
'cmd' is written back to
qspi->cmdfor every transaction.You mean
qspi->cmd= cmd ?
I don't see this happening anywhere in the driver. Can you point me to that line of code?
line 296:ti_qspi_write(qspi, cmd, QSPI_SPI_CMD_REG);
if (ti_qspi_poll_wc(qspi)) {
dev_err(qspi->dev, "write timed out\n");
return -ETIMEDOUT;}
Quoted 4 lines
--
Regards
Vignesh
Signature · 3 lines
Regards, Prahlad. +91-9663742838
Quoted 1 line · prahlad venkata
On Mon, Jul 11, 2016 at 2:45 PM, Vignesh R <[email protected]> wrote:
[...]
Quoted 34 lines
Quoted 34 lines
Quoted 33 lines
Quoted 33 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/spi/spi-ti-qspi.c +0
-0Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
drivers/spi/spi-ti-qspi.c static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t, · line 279
Quoted 5 lines
drivers/spi/spi-ti-qspi.c +0
-1@@ -276,9 +276,9 @@ static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t, cmd |=QSPI_WLEN (QSPI_WLEN_MAX_BITS ); }else {writeb (*txbuf, qspi->base +QSPI_SPI_DATA_REG ); - cmd = qspi->cmd |QSPI_WR_SNGL ;This is wrong. Deleting this line means
QSPI_WR_SNGLis not set and no data is sent out on the wire.
QSPI_WR_SNGLis already set as soon as we enter the function.Quoted 20 lines
Quoted 5 lines
Quoted 5 lines
qspi->cmdalways has WLEN field cleared and set to WLEN = 1 byte (seeti_qspi_start_transfer_one()). And hence variable 'cmd' will also have WLEN set to 1 byte.Quoted 9 lines
Even though WLEN=1 is set in the
ti_qspi_transfer_one, if we ask for a transfer of large data,
say 300 bytes in length, for attaining faster data rate WLEN 128 is selected for the first two
transactions and remaining 44 bytes will be transmitted with WLEN 1. During that case,
WLEN will be changed insideqspi_write_msgfunction itself and the field should be cleared
first while doing that.In
qspi_write_msg(),qspi->cmdwill always have WLEN set toQSPI_WLEN(t->bits_per_word)andqspi->cmdis never changed within this function.
It is the value of local variable 'cmd' that is changed to appropriate WLEN (128bit or 8bit) as necessary.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
'cmd' is written back to
qspi->cmdfor every transaction.You mean
qspi->cmd= cmd ?
I don't see this happening anywhere in the driver. Can you point me to that line of code?line 296:
ti_qspi_write(qspi, cmd, QSPI_SPI_CMD_REG);
Sorry, I don't understand. QSPI_SPI_CMD_REG and qspi->cmd are different. qspi->cmd does not represent the QSPI_SPI_CMD_REG register. qspi->cmd is just local driver data for book-keeping.
Please add some prints in driver to see how 'cmd' (and qspi->cmd) variable changes in case of 128bit mode and 8bit mode.
Regards
Vignesh
Signature · 2 lines
Regards Vignesh
Quoted 47 lines · Vignesh R
Quoted 1 line · prahlad venkata
On Mon, Jul 11, 2016 at 2:45 PM, Vignesh R <[email protected]> wrote:
[...]
Quoted 34 lines
Quoted 34 lines
Quoted 33 lines
Quoted 33 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/spi/spi-ti-qspi.c +0
-0Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
drivers/spi/spi-ti-qspi.c static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t, · line 279
Quoted 5 lines
drivers/spi/spi-ti-qspi.c +0
-1@@ -276,9 +276,9 @@ static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t, cmd |=QSPI_WLEN (QSPI_WLEN_MAX_BITS ); }else {writeb (*txbuf, qspi->base +QSPI_SPI_DATA_REG ); - cmd = qspi->cmd |QSPI_WR_SNGL ;This is wrong. Deleting this line means
QSPI_WR_SNGLis not set and no data is sent out on the wire.
QSPI_WR_SNGLis already set as soon as we enter the function.Quoted 20 lines
Quoted 5 lines
Quoted 5 lines
qspi->cmdalways has WLEN field cleared and set to WLEN = 1 byte (seeti_qspi_start_transfer_one()). And hence variable 'cmd' will also have WLEN set to 1 byte.Quoted 9 lines
Even though WLEN=1 is set in the
ti_qspi_transfer_one, if we ask for a transfer of large data,
say 300 bytes in length, for attaining faster data rate WLEN 128 is selected for the first two
transactions and remaining 44 bytes will be transmitted with WLEN 1. During that case,
WLEN will be changed insideqspi_write_msgfunction itself and the field should be cleared
first while doing that.In
qspi_write_msg(),qspi->cmdwill always have WLEN set toQSPI_WLEN(t->bits_per_word)andqspi->cmdis never changed within this function.
It is the value of local variable 'cmd' that is changed to appropriate WLEN (128bit or 8bit) as necessary.Quoted 7 lines
Quoted 5 lines
Quoted 1 line
'cmd' is written back to
qspi->cmdfor every transaction.You mean
qspi->cmd= cmd ?
I don't see this happening anywhere in the driver. Can you point me to that line of code?line 296:
ti_qspi_write(qspi, cmd, QSPI_SPI_CMD_REG);
Quoted 6 lines
Sorry, I don't understand.
QSPI_SPI_CMD_REGandqspi->cmdare different.qspi->cmddoes not represent theQSPI_SPI_CMD_REGregister.qspi->cmdis just local driver data for book-keeping.Please add some prints in driver to see how 'cmd' (and
qspi->cmd) variable changes in case of 128bit mode and 8bit mode.
I don't have hardware setup to verify this. Is there anyway to verify this without hardware?
Quoted 8 lines
Regards
Vignesh--
Regards
Vignesh
Signature · 2 lines
Regards, Prahlad.