Skip to contentSkip to conversation

spi: fsl_qspi: Copy 16 byte aligned data in TX FIFO

PATCH New Suresh Gupta 2 participants 4 messages Jun 5, 2017 – Sep 25, 2017 1 message not in the archive SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: fsl_qspi: Copy 16 byte aligned data in TX FIFO

In some of the QSPI controller version, there must be atleast 128bit data available in TX FIFO for any pop operation otherwise error bit will be set. The code will not make any behavior change for previous controller as the transfer data size in ipcr register is still the same.

Patch is tested on LS1046A which do not require 16 bytes aligned and LS1088A which require 16 bytes aligned data in TX FIFO

---
 drivers/spi/fsl_qspi.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
drivers/spi/fsl_qspi.c +8 -10
index e61c67b..d596377 100644
@@ -659,22 +659,20 @@ static void qspi_op_write(struct fsl_qspi_priv *priv, u8 *txbuf, u32 len)
 	tx_size = (len > TX_BUFFER_SIZE) ?
 		TX_BUFFER_SIZE : len;
 
-	size = tx_size / 4;
-	for (i = 0; i < size; i++) {
+	size = tx_size / 16;
+	/*
+	 * There must be atleast 128bit data
+	 * available in TX FIFO for any pop operation
+	 */
+	if (tx_size % 16)
+		size++;
+	for (i = 0; i < size * 4; i++) {
 		memcpy(&data, txbuf, 4);
 		data = qspi_endian_xchg(data);
 		qspi_write32(priv->flags, &regs->tbdr, data);
 		txbuf += 4;
 	}
 
-	size = tx_size % 4;
-	if (size) {
-		data = 0;
-		memcpy(&data, txbuf, size);
-		data = qspi_endian_xchg(data);
-		qspi_write32(priv->flags, &regs->tbdr, data);
-	}
-
 	qspi_write32(priv->flags, &regs->ipcr,
 		     (seqid << QSPI_IPCR_SEQID_SHIFT) | tx_size);
 	while (qspi_read32(priv->flags, &regs->sr) & QSPI_SR_BUSY_MASK)
Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/1 spi: fsl_qspi: Copy 16 byte aligned data in TX FIFO

Quoted 11 lines · Suresh Gupta

In some of the QSPI controller version, there must be atleast 128bit data available in TX FIFO for any pop operation otherwise error bit will be set. The code will not make any behavior change for previous controller as the transfer data size in ipcr register is still the same.

Patch is tested on LS1046A which do not require 16 bytes aligned and LS1088A which require 16 bytes aligned data in TX FIFO

Can some one Tested and verified the result?

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.

A message that is not in the archive (sent off-list or not yet received): DB5PR04MB13509E7C70014C59173D2CFD808E0@DB5PR04MB1350.eurprd04.prod.outlook.com

#3 lore raw

PATCH 1/1 spi: fsl_qspi: Copy 16 byte aligned data in TX FIFO

Hi Jagan,

Quoted 18 lines
Quoted 11 lines

-----Original Message-----
From: Jagan Teki [mailto:jagannadh.teki at gmail.com]
Sent: Friday, August 11, 2017 4:44 PM
To: Suresh Gupta <[email protected]>
Cc: u-boot at lists.denx.de; Jagan Teki <[email protected]>; yorksun at freescale.com; Anupam Kumar <[email protected]>
Subject: Re: [PATCH] spi: fsl_qspi: Copy 16 byte aligned data in TX FIFO

On Mon, Jun 5, 2017 at 2:37 PM, Suresh Gupta <[email protected]>

Quoted 6 lines · wrote:
Quoted 6 lines

In some of the QSPI controller version, there must be atleast 128bit data available in TX FIFO for any pop operation otherwise error bit will be set. The code will not make any behavior change for previous controller as the transfer data size in ipcr register is still the same.

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

Patch is tested on LS1046A which do not require 16 bytes aligned and LS1088A which require 16 bytes aligned data in TX FIFO

Can some one Tested and verified the result?

Please pick this patch, we have the same patch in our SDK from last 2 months and do not face any issue.

Quoted 6 lines
Quoted 6 lines

thanks!
--
Jagan Teki
Free Software Engineer | www.openedev.com U-Boot, Linux | Upstream Maintainer Hyderabad, India.

#4 lore raw

PATCH 1/1 spi: fsl_qspi: Copy 16 byte aligned data in TX FIFO

In reply to Suresh Gupta
Quoted 11 lines · Suresh Gupta

In some of the QSPI controller version, there must be atleast 128bit data available in TX FIFO for any pop operation otherwise error bit will be set. The code will not make any behavior change for previous controller as the transfer data size in ipcr register is still the same.

Patch is tested on LS1046A which do not require 16 bytes aligned and LS1088A which require 16 bytes aligned data in TX FIFO

Applied to u-boot-spi//master

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.