Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/cortex detach and re-attach timecounter when up...
details: https://anonhg.NetBSD.org/src/rev/44eb692f5c58
branches: trunk
changeset: 335319:44eb692f5c58
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Fri Jan 02 23:19:28 2015 +0000
description:
detach and re-attach timecounter when updating freq, and reinit timer on each cpu
diffstat:
sys/arch/arm/cortex/a9tmr.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
diffs (58 lines):
diff -r 555f5df4af26 -r 44eb692f5c58 sys/arch/arm/cortex/a9tmr.c
--- a/sys/arch/arm/cortex/a9tmr.c Fri Jan 02 22:00:02 2015 +0000
+++ b/sys/arch/arm/cortex/a9tmr.c Fri Jan 02 23:19:28 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: a9tmr.c,v 1.8 2015/01/02 21:58:03 jmcneill Exp $ */
+/* $NetBSD: a9tmr.c,v 1.9 2015/01/02 23:19:28 jmcneill Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: a9tmr.c,v 1.8 2015/01/02 21:58:03 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: a9tmr.c,v 1.9 2015/01/02 23:19:28 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -40,6 +40,7 @@
#include <sys/proc.h>
#include <sys/systm.h>
#include <sys/timetc.h>
+#include <sys/xcall.h>
#include <prop/proplib.h>
@@ -248,17 +249,31 @@
tc_init(&a9tmr_timecounter);
}
+static void
+a9tmr_update_freq_cb(void *arg1, void *arg2)
+{
+ a9tmr_init_cpu_clock(curcpu());
+}
+
void
a9tmr_update_freq(uint32_t freq)
{
struct a9tmr_softc * const sc = &a9tmr_sc;
+ uint64_t xc;
KASSERT(sc->sc_dev != NULL);
KASSERT(freq != 0);
+ tc_detach(&a9tmr_timecounter);
+
sc->sc_freq = freq;
sc->sc_autoinc = sc->sc_freq / hz;
+
+ xc = xc_broadcast(0, a9tmr_update_freq_cb, NULL, NULL);
+ xc_wait(xc);
+
a9tmr_timecounter.tc_frequency = sc->sc_freq;
+ tc_init(&a9tmr_timecounter);
}
void
Home |
Main Index |
Thread Index |
Old Index