svn commit: r331965 - head/sys/arm/mv
Marcin Wojtas
mw at FreeBSD.org
Tue Apr 3 23:29:35 UTC 2018
Author: mw
Date: Tue Apr 3 23:29:34 2018
New Revision: 331965
URL: https://svnweb.freebsd.org/changeset/base/331965
Log:
Split out delay code in Marvell timer driver for PLATFORM
The PLATFORM code will perform the software loop in the early boot,
so extract the actual delay code to handle situation, when
the timers are already initialized.
Obtained from: Semihalf
Sponsored by: Stormshield
Modified:
head/sys/arm/mv/timer.c
Modified: head/sys/arm/mv/timer.c
==============================================================================
--- head/sys/arm/mv/timer.c Tue Apr 3 23:27:07 2018 (r331964)
+++ head/sys/arm/mv/timer.c Tue Apr 3 23:29:34 2018 (r331965)
@@ -124,9 +124,7 @@ static void mv_watchdog_enable_armadaxp(void);
static void mv_watchdog_disable_armv5(void);
static void mv_watchdog_disable_armadaxp(void);
-#ifdef PLATFORM
-void mv_delay(int usec, void* arg);
-#endif
+static void mv_delay(int usec, void* arg);
static struct mv_timer_config timer_armadaxp_config =
{
@@ -300,25 +298,12 @@ mv_timer_get_timecount(struct timecounter *tc)
return (INITIAL_TIMECOUNTER - mv_get_timer(1));
}
-#ifdef PLATFORM
-void
+static void
mv_delay(int usec, void* arg)
-#else
-void
-DELAY(int usec)
-#endif
{
uint32_t val, val_temp;
int32_t nticks;
- if (!timers_initialized) {
- for (; usec > 0; usec--)
- for (val = 100; val > 0; val--)
- __asm __volatile("nop" ::: "memory");
- return;
- }
- TSENTER();
-
val = mv_get_timer(1);
nticks = ((timer_softc->config->clock_src / 1000000 + 1) * usec);
@@ -331,8 +316,25 @@ DELAY(int usec)
val = val_temp;
}
- TSEXIT();
}
+
+#ifndef PLATFORM
+void
+DELAY(int usec)
+{
+ uint32_t val;
+
+ if (!timers_initialized) {
+ for (; usec > 0; usec--)
+ for (val = 100; val > 0; val--)
+ __asm __volatile("nop" ::: "memory");
+ } else {
+ TSENTER();
+ mv_delay(usec, NULL);
+ TSEXIT();
+ }
+}
+#endif
static uint32_t
mv_get_timer_control(void)
More information about the svn-src-all
mailing list