]> git.sur5r.net Git - u-boot/commitdiff
rockchip: spi: Honour the deactivation delay
authorSimon Glass <sjg@chromium.org>
Sun, 13 Nov 2016 21:22:03 +0000 (14:22 -0700)
committerSimon Glass <sjg@chromium.org>
Sat, 26 Nov 2016 00:59:30 +0000 (17:59 -0700)
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>
drivers/spi/rk_spi.c

index 8d64249385380ac7e3edf1ba2b40b28957d9ff5f..15cf0bda202a72b7257e27a5eff97bdd8250485f 100644 (file)
@@ -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)