[PATCH v2] arm/tegra: use APB DMA for accessing APB devices
From: Olof Johansson <hidden>
Date: 2012-01-06 01:22:27
Also in:
linux-tegra
From: Olof Johansson <hidden>
Date: 2012-01-06 01:22:27
Also in:
linux-tegra
On Thu, Jan 5, 2012 at 2:07 PM, Stephen Warren [off-list ref] wrote:
Olof Johansson wrote at Wednesday, January 04, 2012 10:49 PM:quoted
Tegra2 hangs if APB registers are accessed from the cpu during an apb dma operation. The workaround is to use apb dma to read/write the registers instead....quoted
diff --git a/arch/arm/mach-tegra/apbio.c b/arch/arm/mach-tegra/apbio.c...quoted
+u32 tegra_apb_readl(unsigned long offset)...quoted
+ ? ? INIT_COMPLETION(tegra_apb_wait); + + ? ? tegra_dma_enqueue_req(tegra_apb_dma, &req); + + ? ? ret = wait_for_completion_timeout(&tegra_apb_wait, + ? ? ? ? ? ? msecs_to_jiffies(50)); + + ? ? if (WARN(ret == 0, "apb read dma timed out")) { + ? ? ? ? ? ? *(u32 *)tegra_apb_bb = 0; + ? ? ? ? ? ? tegra_dma_dequeue_req(tegra_apb_dma, &req);I think you need to swap those last two lines to make absolutely sure that the timeout handling doesn't race with an actual DMA completion.
Ah, of course. Fixing that without reposting.
Acked-by: Stephen Warren <redacted>
Thanks! -Olof