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 add a helper to update a9tmr frequency



details:   https://anonhg.NetBSD.org/src/rev/d50038834fa8
branches:  trunk
changeset: 805458:d50038834fa8
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Jan 02 21:58:03 2015 +0000

description:
add a helper to update a9tmr frequency

diffstat:

 sys/arch/arm/cortex/a9tmr.c     |  17 +++++++++++++++--
 sys/arch/arm/cortex/a9tmr_var.h |   3 ++-
 2 files changed, 17 insertions(+), 3 deletions(-)

diffs (55 lines):

diff -r 283a82df459d -r d50038834fa8 sys/arch/arm/cortex/a9tmr.c
--- a/sys/arch/arm/cortex/a9tmr.c       Fri Jan 02 21:55:31 2015 +0000
+++ b/sys/arch/arm/cortex/a9tmr.c       Fri Jan 02 21:58:03 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: a9tmr.c,v 1.7 2014/03/28 21:57:22 matt Exp $   */
+/*     $NetBSD: a9tmr.c,v 1.8 2015/01/02 21:58:03 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.7 2014/03/28 21:57:22 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: a9tmr.c,v 1.8 2015/01/02 21:58:03 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -249,6 +249,19 @@
 }
 
 void
+a9tmr_update_freq(uint32_t freq)
+{
+       struct a9tmr_softc * const sc = &a9tmr_sc;
+
+       KASSERT(sc->sc_dev != NULL);
+       KASSERT(freq != 0);
+
+       sc->sc_freq = freq;
+       sc->sc_autoinc = sc->sc_freq / hz;
+       a9tmr_timecounter.tc_frequency = sc->sc_freq;
+}
+
+void
 a9tmr_delay(unsigned int n)
 {
        struct a9tmr_softc * const sc = &a9tmr_sc;
diff -r 283a82df459d -r d50038834fa8 sys/arch/arm/cortex/a9tmr_var.h
--- a/sys/arch/arm/cortex/a9tmr_var.h   Fri Jan 02 21:55:31 2015 +0000
+++ b/sys/arch/arm/cortex/a9tmr_var.h   Fri Jan 02 21:58:03 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: a9tmr_var.h,v 1.3 2013/06/20 05:30:21 matt Exp $ */
+/* $NetBSD: a9tmr_var.h,v 1.4 2015/01/02 21:58:03 jmcneill Exp $ */
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -47,6 +47,7 @@
 #ifdef _KERNEL
 struct cpu_info;
 void   a9tmr_init_cpu_clock(struct cpu_info *);
+void   a9tmr_update_freq(uint32_t);
 void   a9tmr_delay(unsigned int n);
 #endif
 



Home | Main Index | Thread Index | Old Index