Date: Tue, 3 Apr 2018 23:29:34 +0000 (UTC) From: Marcin Wojtas <mw@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331965 - head/sys/arm/mv Message-ID: <201804032329.w33NTY4C015668@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804032329.w33NTY4C015668>