[PATCH 30/34] bsp/leon3: Enable up-counter conditionally

Sebastian Huber sebastian.huber at embedded-brains.de
Wed May 31 16:31:05 UTC 2023


---
 bsps/sparc/leon3/clock/ckinit.c     | 5 +++--
 bsps/sparc/leon3/start/cpucounter.c | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/bsps/sparc/leon3/clock/ckinit.c b/bsps/sparc/leon3/clock/ckinit.c
index 93826416c0..4767d57347 100644
--- a/bsps/sparc/leon3/clock/ckinit.c
+++ b/bsps/sparc/leon3/clock/ckinit.c
@@ -287,12 +287,13 @@ static void leon3_clock_initialize(void)
   tc->tc_counter_mask = 0xffffffff;
   tc->tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER;
 
-  leon3_up_counter_enable();
-
 #if defined(LEON3_HAS_ASR_22_23_UP_COUNTER)
+  leon3_up_counter_enable();
   leon3_clock_use_up_counter(tc);
 #else /* LEON3_HAS_ASR_22_23_UP_COUNTER */
 #if defined(LEON3_PROBE_ASR_22_23_UP_COUNTER)
+  leon3_up_counter_enable();
+
   if (leon3_up_counter_is_available()) {
     /* Use the LEON4 up-counter if available */
     leon3_clock_use_up_counter(tc);
diff --git a/bsps/sparc/leon3/start/cpucounter.c b/bsps/sparc/leon3/start/cpucounter.c
index 05ac62ace8..6af91f75e5 100644
--- a/bsps/sparc/leon3/start/cpucounter.c
+++ b/bsps/sparc/leon3/start/cpucounter.c
@@ -106,12 +106,13 @@ static void leon3_counter_initialize(void)
 
   counter = &_SPARC_Counter_mutable;
 
-  leon3_up_counter_enable();
-
 #if defined(LEON3_HAS_ASR_22_23_UP_COUNTER)
+  leon3_up_counter_enable();
   leon3_counter_use_up_counter(counter);
 #else /* LEON3_HAS_ASR_22_23_UP_COUNTER */
 #if defined(LEON3_PROBE_ASR_22_23_UP_COUNTER)
+  leon3_up_counter_enable();
+
   if (leon3_up_counter_is_available()) {
     /* Use the LEON4 up-counter if available */
     leon3_counter_use_up_counter(counter);
-- 
2.35.3



More information about the devel mailing list