Skip to contentSkip to conversation

: drivers: dspi: fsl: fix dspi transfer hang issue

linux-yocto New Zhantao Tang 2 participants 4 messages Jun 4, 2021 – Jun 8, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Bruce,

There is an patch to fix dspi hang issue.

Would you please help to merge this patch into linux-ycoto kernel, v5.10, branch is v5.10/standard/nxp-sdk-5.4/nxp-s32g2xx?

Thanks,
Zhantao

#1 lore raw

PATCH 1/1 drivers: dspi: fsl: fix dspi transfer hang issue

On NXP S32G RDB2, there is an sja1110 switch, which can be accessed using dspi interface, but if users use the following commands to test the switch, the board will hang there.

	$ echo 30 > /sys/class/gpio/export
	$ echo out > /sys/class/gpio/gpio30/direction
	$ echo 0 > /sys/class/gpio/gpio30/value
	$ echo -n -e '\x02\x00\x00\x00\x00\x00\x00\x00' | spi-pipe -d /dev/spidev5.1 -b 4 | hexdump -C

The reason is that, the dspi driver wrongly sets the HALT flag in the register, and the while loop will run forever, so the board hang there. This patch is to fix this issue.

---
 drivers/spi/spi-fsl-dspi.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/spi/spi-fsl-dspi.c +2 -8
index 063cf4a60ed3..c20cce466bf7 100644
@@ -965,10 +965,8 @@ static int dspi_transfer_one_message(struct spi_controller *ctlr,
 		dspi->progress = 0;
 
 		regmap_update_bits(dspi->regmap, SPI_MCR,
-				SPI_MCR_HALT, SPI_MCR_HALT);
-		while (regmap_read(dspi->regmap, SPI_SR, &val) >= 0 &&
-				val & SPI_SR_TXRXS)
-			;
+				   SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF,
+				   SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF);
 
 		spi_take_timestamp_pre(dspi->ctlr, dspi->cur_transfer,
 				       dspi->progress, !dspi->irq);
@@ -987,10 +985,6 @@ static int dspi_transfer_one_message(struct spi_controller *ctlr,
 				} while (status == -EINPROGRESS);
 			}
 		}
-		regmap_update_bits(dspi->regmap, SPI_MCR,
-				SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF |
-				SPI_MCR_HALT,
-				SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF);
 		if (status)
 			break;
 
Signature · 1 line
2.25.1
#2 lore raw
In reply to Zhantao Tang

In message: [linux-yocto] [linux-yocto v5.10/standard/nxp-sdk-5.4/nxp-s32g2xx]: drivers: dspi: fsl: fix dspi transfer hang issue

Quoted 7 lines · on 04/06/2021 Zhantao Tang wrote:

Hi Bruce,

There is an patch to fix dspi hang issue.

Would you please help to merge this patch into linux-ycoto kernel, v5.10, branch is v5.10/standard/nxp-sdk-5.4/nxp-s32g2xx?

This went to the wrong mailing list, but I did pick it up!

merged.

Bruce

Quoted 5 lines

Thanks,
Zhantao

#3 lore raw
Quoted 8 lines · Bruce Ashfield

[Please note: This e-mail is from an EXTERNAL e-mail address]

In message: [linux-yocto] [linux-yocto v5.10/standard/nxp-sdk-5.4/nxp-s32g2xx]: drivers: dspi: fsl: fix dspi transfer hang issue

Quoted 3 lines · on 04/06/2021 Zhantao Tang wrote:

Hi Bruce,

Quoted 6 lines
Quoted 3 lines

There is an patch to fix dspi hang issue.

Would you please help to merge this patch into linux-ycoto kernel, v5.10, branch is v5.10/standard/nxp-sdk-5.4/nxp-s32g2xx?

This went to the wrong mailing list, but I did pick it up!

merged.

Sorry for the wrong mailing list, I will be careful next time.

Thanks,

Zhantao

Quoted 7 lines

Bruce

Quoted 4 lines

Thanks,
Zhantao