summaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-11-13 14:22:03 -0700
committerSimon Glass <sjg@chromium.org>2016-11-25 17:59:30 -0700
commitb42524744d3c7ca015ec7702f3420104539491ac (patch)
tree88c5b68e6f36504f864372a5d7a1982744250058 /drivers/spi
parent6e019c4f288c269c492d732b6b101bde2ca9cc44 (diff)
downloadu-boot-imx-b42524744d3c7ca015ec7702f3420104539491ac.zip
u-boot-imx-b42524744d3c7ca015ec7702f3420104539491ac.tar.gz
u-boot-imx-b42524744d3c7ca015ec7702f3420104539491ac.tar.bz2
rockchip: spi: Honour the deactivation delay
This is not currently implemented. Add support for this so that the Chrome OS EC can be used on jerry. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/rk_spi.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c
index 8d64249..15cf0bd 100644
--- a/drivers/spi/rk_spi.c
+++ b/drivers/spi/rk_spi.c
@@ -110,6 +110,14 @@ static void spi_cs_activate(struct udevice *dev, uint cs)
struct rockchip_spi_priv *priv = dev_get_priv(bus);
struct rockchip_spi *regs = priv->regs;
+ /* If it's too soon to do another transaction, wait */
+ 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);
+ }
+
debug("activate cs%u\n", cs);
writel(1 << cs, &regs->ser);
if (plat->activate_delay_us)