[yocto] [PATCH] drivers: dspi: fsl: fix dspi transfer hang issue

2021-06-03 Thread Zhantao Tang
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.

Signed-off-by: Zhantao Tang 
---
 drivers/spi/spi-fsl-dspi.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
index 063cf4a60ed3..c20cce466bf7 100644
--- a/drivers/spi/spi-fsl-dspi.c
+++ b/drivers/spi/spi-fsl-dspi.c
@@ -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;
 
-- 
2.25.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#53745): https://lists.yoctoproject.org/g/yocto/message/53745
Mute This Topic: https://lists.yoctoproject.org/mt/83302369/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



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

2021-06-03 Thread Zhantao Tang

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


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#53746): https://lists.yoctoproject.org/g/yocto/message/53746
Mute This Topic: https://lists.yoctoproject.org/mt/83302370/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



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

2021-06-07 Thread Zhantao Tang

On 2021/6/7 上午11:06, Bruce Ashfield wrote:

[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
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.


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


Thanks,

Zhantao



Bruce



Thanks,
Zhantao




-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#53782): https://lists.yoctoproject.org/g/yocto/message/53782
Mute This Topic: https://lists.yoctoproject.org/mt/83302370/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-