arm: dra7xx: Fix error path in iodelay recalibration
authorLokesh Vutla <lokeshvutla@ti.com>
Tue, 1 Oct 2019 05:11:00 +0000 (10:41 +0530)
committerTom Rini <trini@konsulko.com>
Fri, 11 Oct 2019 17:32:39 +0000 (13:32 -0400)
When an error is reported in __recalibrate_iodelay_start(), de-isolation
of IO doesn't happen. Because of this, undefined behaviour is observed
on many peripherals without any error. So make sure io is out of isolation
at the end of iodelay recalibration.

Reported-by: Richard Woodruff <r-woodruff2@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
arch/arm/mach-omap2/omap5/dra7xx_iodelay.c

index e2abb7d058e347a129f39a542e8a94ee2c761aac..9bd7051786e6651771961af76dcf5b794e236963 100644 (file)
@@ -202,8 +202,9 @@ void __recalibrate_iodelay_end(int ret)
                return;
        }
 
-       if (!ret)
-               ret = isolate_io(DEISOLATE_IO);
+       /* Deisolate IO if it is already isolated */
+       if (readl((*ctrl)->ctrl_core_sma_sw_0) & CTRL_ISOLATE_MASK)
+               isolate_io(DEISOLATE_IO);
 
        /* lock IODELAY CONFIG registers */
        writel(CFG_IODELAY_LOCK_KEY, (*ctrl)->iodelay_config_base +