summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hellstrom <daniel@gaisler.com>2019-10-29 15:17:57 +0100
committerDaniel Hellstrom <daniel@gaisler.com>2021-03-11 17:35:27 +0100
commitdfe7901c7fd5526c6f488df71f1072f867904534 (patch)
tree63d73cfa3b05190376fe40926114c773d716146f
parent9c00cc130128a32655b4bc109f4c3e124605c260 (diff)
leon: restart and load timer counter at initialization
Without this smp05 and smpthreadlife01 tests may fail depending on how the boot loader initialized the GPTIMER. Before the time counter stopped counting when reaching zero, but tests could work since it could take 2^32 us before stopping. The timer driver will potentially overwrite this, but it happens later due to the initialization order having RTEMS_SYSINIT_CPU_COUNTER very early.
-rw-r--r--bsps/sparc/leon3/start/cpucounter.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bsps/sparc/leon3/start/cpucounter.c b/bsps/sparc/leon3/start/cpucounter.c
index 1d96e3b221..068c631af1 100644
--- a/bsps/sparc/leon3/start/cpucounter.c
+++ b/bsps/sparc/leon3/start/cpucounter.c
@@ -60,7 +60,10 @@ static void leon3_counter_initialize(void)
counter->counter_register = &gpt->timer[LEON3_COUNTER_GPTIMER_INDEX].value;
/* Enable timer just in case no clock driver is configured */
- gpt->timer[LEON3_COUNTER_GPTIMER_INDEX].ctrl |= GPTIMER_TIMER_CTRL_EN;
+ gpt->timer[LEON3_COUNTER_GPTIMER_INDEX].reload = 0xffffffff;
+ gpt->timer[LEON3_COUNTER_GPTIMER_INDEX].ctrl |= GPTIMER_TIMER_CTRL_EN |
+ GPTIMER_TIMER_CTRL_RS |
+ GPTIMER_TIMER_CTRL_LD;
leon3_counter_frequency = ambapp_freq_get(&ambapp_plb, LEON3_Timer_Adev) /
(gpt->scaler_reload + 1);