msm: qdss: perform manual flush when disabling ETB
To get the last waypoints out into the ETB buffer when disabling
trace, perform a manual flush when disabling ETB.
Change-Id: I3036913636fa657afb86938669e0959c186dbf68
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
diff --git a/arch/arm/mach-msm/qdss-etb.c b/arch/arm/mach-msm/qdss-etb.c
index c58c93e..252352c 100644
--- a/arch/arm/mach-msm/qdss-etb.c
+++ b/arch/arm/mach-msm/qdss-etb.c
@@ -110,10 +110,20 @@
static void __etb_disable(void)
{
int count;
+ uint32_t ffcr;
ETB_UNLOCK();
- etb_writel(etb, BIT(12) | BIT(13), ETB_FFCR);
+ ffcr = etb_readl(etb, ETB_FFCR);
+ ffcr |= (BIT(12) | BIT(6));
+ etb_writel(etb, ffcr, ETB_FFCR);
+
+ for (count = TIMEOUT_US; BVAL(etb_readl(etb, ETB_FFCR), 6) != 0
+ && count > 0; count--)
+ udelay(1);
+ WARN(count == 0, "timeout while flushing ETB, ETB_FFCR: %#x\n",
+ etb_readl(etb, ETB_FFCR));
+
etb_writel(etb, 0x0, ETB_CTL_REG);
for (count = TIMEOUT_US; BVAL(etb_readl(etb, ETB_FFSR), 1) != 1