diff mbox series

[U-Boot,1/8] rockchip: spi: add debug message for delay in CS toggle

Message ID 1549207053-24190-2-git-send-email-philipp.tomsich@theobroma-systems.com
State Accepted
Commit f92cf0adcacf85622d9ce58647d8ce6a9b95d624
Delegated to: Philipp Tomsich
Headers show
Series rockchip: Improve SPI-NOR read performance for the RK3399-Q7 | expand

Commit Message

Philipp Tomsich Feb. 3, 2019, 3:17 p.m. UTC
In analysing delays introduced for large SPI reads, the absence of any
indication when a delay was inserted (to ensure the CS toggling is
observed by devices) became apparent.

Add an additional debug-only debug message to record the insertion and
duration of any delay (note that the debug-message will cause a delay
on-top of the delay-duration).

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
---

 drivers/spi/rk_spi.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Philipp Tomsich April 23, 2019, 2:31 p.m. UTC | #1
> In analysing delays introduced for large SPI reads, the absence of any
> indication when a delay was inserted (to ensure the CS toggling is
> observed by devices) became apparent.
> 
> Add an additional debug-only debug message to record the insertion and
> duration of any delay (note that the debug-message will cause a delay
> on-top of the delay-duration).
> 
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
> 
>  drivers/spi/rk_spi.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 

Applied to u-boot-rockchip, thanks!
diff mbox series

Patch

diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c
index 14437c0..4153240 100644
--- a/drivers/spi/rk_spi.c
+++ b/drivers/spi/rk_spi.c
@@ -130,8 +130,13 @@  static void spi_cs_activate(struct udevice *dev, uint cs)
 	if (plat->deactivate_delay_us && priv->last_transaction_us) {
 		ulong delay_us;		/* The delay completed so far */
 		delay_us = timer_get_us() - priv->last_transaction_us;
-		if (delay_us < plat->deactivate_delay_us)
-			udelay(plat->deactivate_delay_us - delay_us);
+		if (delay_us < plat->deactivate_delay_us) {
+			ulong additional_delay_us =
+				plat->deactivate_delay_us - delay_us;
+			debug("%s: delaying by %ld us\n",
+			      __func__, additional_delay_us);
+			udelay(additional_delay_us);
+		}
 	}
 
 	debug("activate cs%u\n", cs);