From 8e53d790902b8a40098a5851584ae7ba58b357b6 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Mon, 19 Dec 2016 15:23:01 -0800 Subject: gpu: nvgpu: Use timer API in gm20b code Use the timer API instead of Linux specific APIs for handling timeouts. Also, lower the L2 timeout from 1 second (absurdly long) to 5ms. Bug 1799159 Change-Id: I27dbc35b12e9bc22ff2207bb87543f76203e20f1 Signed-off-by: Alex Waterman Reviewed-on: http://git-master/r/1273825 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gm20b/pmu_gm20b.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'drivers/gpu/nvgpu/gm20b/pmu_gm20b.c') diff --git a/drivers/gpu/nvgpu/gm20b/pmu_gm20b.c b/drivers/gpu/nvgpu/gm20b/pmu_gm20b.c index 2e568e83..4b87b877 100644 --- a/drivers/gpu/nvgpu/gm20b/pmu_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/pmu_gm20b.c @@ -22,6 +22,8 @@ #include "acr_gm20b.h" #include "pmu_gm20b.h" +#include + #include #include #include @@ -173,21 +175,24 @@ void pmu_handle_fecs_boot_acr_msg(struct gk20a *g, struct pmu_msg *msg, gk20a_dbg_fn("done"); } -static int pmu_gm20b_ctx_wait_lsf_ready(struct gk20a *g, u32 timeout, u32 val) +static int pmu_gm20b_ctx_wait_lsf_ready(struct gk20a *g, u32 timeout_ms, + u32 val) { - unsigned long end_jiffies = jiffies + msecs_to_jiffies(timeout); unsigned long delay = GR_FECS_POLL_INTERVAL; u32 reg; + struct nvgpu_timeout timeout; gk20a_dbg_fn(""); reg = gk20a_readl(g, gr_fecs_ctxsw_mailbox_r(0)); + + nvgpu_timeout_init(g, &timeout, (int)timeout_ms, NVGPU_TIMER_CPU_TIMER); + do { reg = gk20a_readl(g, gr_fecs_ctxsw_mailbox_r(0)); if (reg == val) return 0; udelay(delay); - } while (time_before(jiffies, end_jiffies) || - !tegra_platform_is_silicon()); + } while (!nvgpu_timeout_expired(&timeout)); return -ETIMEDOUT; } -- cgit v1.2.2