diff mbox series

[2/4] spi: synquacer: wait until slave is deselected

Message ID 20220517084139.6986-3-masahisa.kojima@linaro.org
State Accepted
Commit 88d50ed8a15fc4a0df37e2a274607827a52a2217
Headers show
Series spi-synquacer fixes and improvement | expand

Commit Message

Masahisa Kojima May 17, 2022, 8:41 a.m. UTC
synquacer_cs_set() function does not wait the chip select
is deasserted when the driver sets the DMSTOP to deselect
the slave.
This commit checks the Slave Select Released(SRS) bit to wait
until the slave is deselected.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Signed-off-by: Satoru Okamoto <okamoto.satoru@socionext.com>
---
 drivers/spi/spi-synquacer.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Jassi Brar May 18, 2022, 3:42 a.m. UTC | #1
On Tue, 17 May 2022 at 03:41, Masahisa Kojima
<masahisa.kojima@linaro.org> wrote:
>
> synquacer_cs_set() function does not wait the chip select
> is deasserted when the driver sets the DMSTOP to deselect
> the slave.
> This commit checks the Slave Select Released(SRS) bit to wait
> until the slave is deselected.
>
> Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
> Signed-off-by: Satoru Okamoto <okamoto.satoru@socionext.com>
> ---
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Tom Rini June 10, 2022, 9:40 p.m. UTC | #2
On Tue, May 17, 2022 at 05:41:37PM +0900, Masahisa Kojima wrote:

> synquacer_cs_set() function does not wait the chip select
> is deasserted when the driver sets the DMSTOP to deselect
> the slave.
> This commit checks the Slave Select Released(SRS) bit to wait
> until the slave is deselected.
> 
> Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
> Signed-off-by: Satoru Okamoto <okamoto.satoru@socionext.com>
> Acked-by: Jassi Brar <jaswinder.singh@linaro.org>

Applied to u-boot/next, thanks!
diff mbox series

Patch

diff --git a/drivers/spi/spi-synquacer.c b/drivers/spi/spi-synquacer.c
index 62f85f0335..f1422cf893 100644
--- a/drivers/spi/spi-synquacer.c
+++ b/drivers/spi/spi-synquacer.c
@@ -46,7 +46,9 @@ 
 #define RXE		0x24
 #define RXC		0x28
 #define TFLETE		4
+#define TSSRS		6
 #define RFMTE		5
+#define RSSRS		6
 
 #define FAULTF		0x2c
 #define FAULTC		0x30
@@ -170,6 +172,11 @@  static void synquacer_cs_set(struct synquacer_spi_priv *priv, bool active)
 			priv->rx_words = 16;
 			read_fifo(priv);
 		}
+
+		/* wait until slave is deselected */
+		while (!(readl(priv->base + TXF) & BIT(TSSRS)) ||
+		       !(readl(priv->base + RXF) & BIT(RSSRS)))
+			;
 	}
 }