aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2017-09-28 09:41:21 -0400
committerLucas Stach <l.stach@pengutronix.de>2017-10-10 05:45:06 -0400
commit6eb3ecc33a6aaedda5ceb0824cafe34c47af2f55 (patch)
treed37b4f6248078ec1a691c6c6b1ead5c956a0fa0a
parentb670908384bda92c42076cf36614ee4f97763253 (diff)
drm/etnaviv: rework clock initialization
The reset path wants to initialize the clock control register regardless of the DYNAMIC_FREQUENCY_SCALING feature, so don't call clock update, but explicitly load the register. Also disabling of the debug registers is moved into the reset function, so we always get to the same state after a GPU reset. This means the clock update function should not touch the bits already set in the clock control register, but instead only update the scaling bits. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_gpu.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index fc9a6a83dfc7..de34e221c2fe 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -420,9 +420,10 @@ static void etnaviv_gpu_update_clock(struct etnaviv_gpu *gpu)
420 gpu->base_rate_shader >> gpu->freq_scale); 420 gpu->base_rate_shader >> gpu->freq_scale);
421 } else { 421 } else {
422 unsigned int fscale = 1 << (6 - gpu->freq_scale); 422 unsigned int fscale = 1 << (6 - gpu->freq_scale);
423 u32 clock = VIVS_HI_CLOCK_CONTROL_DISABLE_DEBUG_REGISTERS | 423 u32 clock = gpu_read(gpu, VIVS_HI_CLOCK_CONTROL);
424 VIVS_HI_CLOCK_CONTROL_FSCALE_VAL(fscale);
425 424
425 clock &= ~VIVS_HI_CLOCK_CONTROL_FSCALE_VAL__MASK;
426 clock |= VIVS_HI_CLOCK_CONTROL_FSCALE_VAL(fscale);
426 etnaviv_gpu_load_clock(gpu, clock); 427 etnaviv_gpu_load_clock(gpu, clock);
427 } 428 }
428} 429}
@@ -445,9 +446,9 @@ static int etnaviv_hw_reset(struct etnaviv_gpu *gpu)
445 446
446 while (time_is_after_jiffies(timeout)) { 447 while (time_is_after_jiffies(timeout)) {
447 /* enable clock */ 448 /* enable clock */
448 etnaviv_gpu_update_clock(gpu); 449 unsigned int fscale = 1 << (6 - gpu->freq_scale);
449 450 control = VIVS_HI_CLOCK_CONTROL_FSCALE_VAL(fscale);
450 control = gpu_read(gpu, VIVS_HI_CLOCK_CONTROL); 451 etnaviv_gpu_load_clock(gpu, control);
451 452
452 /* Wait for stable clock. Vivante's code waited for 1ms */ 453 /* Wait for stable clock. Vivante's code waited for 1ms */
453 usleep_range(1000, 10000); 454 usleep_range(1000, 10000);
@@ -490,6 +491,10 @@ static int etnaviv_hw_reset(struct etnaviv_gpu *gpu)
490 continue; 491 continue;
491 } 492 }
492 493
494 /* disable debug registers, as they are not normally needed */
495 control |= VIVS_HI_CLOCK_CONTROL_DISABLE_DEBUG_REGISTERS;
496 gpu_write(gpu, VIVS_HI_CLOCK_CONTROL, control);
497
493 failed = false; 498 failed = false;
494 break; 499 break;
495 } 500 }