drm/tegra: falcon: Wait for memory scrubbing to complete
authorThierry Reding <treding@nvidia.com>
Fri, 23 Nov 2018 12:06:39 +0000 (13:06 +0100)
committerThierry Reding <treding@nvidia.com>
Thu, 29 Nov 2018 16:11:49 +0000 (17:11 +0100)
Before booting the Falcon processor, make sure to wait for memory
scrubbing to complete.

Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/tegra/falcon.c

index 78c7a0156601e6a9bdebf38b76493e981cae088b..352d05feabb09507db689f8106fcef00705c76c3 100644 (file)
@@ -197,11 +197,19 @@ void falcon_exit(struct falcon *falcon)
 int falcon_boot(struct falcon *falcon)
 {
        unsigned long offset;
+       u32 value;
        int err;
 
        if (!falcon->firmware.vaddr)
                return -EINVAL;
 
+       err = readl_poll_timeout(falcon->regs + FALCON_DMACTL, value,
+                                (value & (FALCON_DMACTL_IMEM_SCRUBBING |
+                                          FALCON_DMACTL_DMEM_SCRUBBING)) == 0,
+                                10, 10000);
+       if (err < 0)
+               return err;
+
        falcon_writel(falcon, 0, FALCON_DMACTL);
 
        /* setup the address of the binary data so Falcon can access it later */