Module Name: src
Committed By: matt
Date: Fri Mar 28 21:41:46 UTC 2014
Modified Files:
src/sys/arch/arm/cortex: gtmr.c gtmr_var.h
Log Message:
Add gtmr_bootdelay. rename clockhandler to gtmr_intr
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/cortex/gtmr.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/cortex/gtmr_var.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/arm/cortex/gtmr.c
diff -u src/sys/arch/arm/cortex/gtmr.c:1.5 src/sys/arch/arm/cortex/gtmr.c:1.6
--- src/sys/arch/arm/cortex/gtmr.c:1.5 Tue Dec 17 13:11:18 2013
+++ src/sys/arch/arm/cortex/gtmr.c Fri Mar 28 21:41:46 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: gtmr.c,v 1.5 2013/12/17 13:11:18 joerg Exp $ */
+/* $NetBSD: gtmr.c,v 1.6 2014/03/28 21:41:46 matt Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.5 2013/12/17 13:11:18 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.6 2014/03/28 21:41:46 matt Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -51,7 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.5
static int gtmr_match(device_t, cfdata_t, void *);
static void gtmr_attach(device_t, device_t, void *);
-static int clockhandler(void *);
+static int gtmr_intr(void *);
static u_int gtmr_get_timecount(struct timecounter *);
@@ -125,7 +125,7 @@ gtmr_attach(device_t parent, device_t se
device_xname(self), "missing interrupts");
sc->sc_global_ih = intr_establish(IRQ_GTMR_PPI_VTIMER, IPL_CLOCK,
- IST_EDGE, clockhandler, NULL);
+ IST_EDGE | IST_MPSAFE, gtmr_intr, NULL);
if (sc->sc_global_ih == NULL)
panic("%s: unable to register timer interrupt", __func__);
aprint_normal_dev(self, "interrupting on irq %d\n",
@@ -241,13 +241,30 @@ gtmr_delay(unsigned int n)
}
}
+void
+gtmr_bootdelay(unsigned int ticks)
+{
+ const uint32_t ctl = armreg_cntv_ctl_read();
+ armreg_cntv_ctl_write(ctl | ARM_CNTCTL_ENABLE | ARM_CNTCTL_IMASK);
+
+ /* Write Timer/Value to set new compare time */
+ armreg_cntv_tval_write(ticks);
+
+ /* Spin until compare time is hit */
+ while ((armreg_cntv_ctl_read() & ARM_CNTCTL_ISTATUS) == 0) {
+ /* spin */
+ }
+
+ armreg_cntv_ctl_write(ctl);
+}
+
/*
- * clockhandler:
+ * gtmr_intr:
*
* Handle the hardclock interrupt.
*/
static int
-clockhandler(void *arg)
+gtmr_intr(void *arg)
{
const uint64_t now = armreg_cntv_ct_read();
struct cpu_info * const ci = curcpu();
Index: src/sys/arch/arm/cortex/gtmr_var.h
diff -u src/sys/arch/arm/cortex/gtmr_var.h:1.3 src/sys/arch/arm/cortex/gtmr_var.h:1.4
--- src/sys/arch/arm/cortex/gtmr_var.h:1.3 Thu Sep 12 15:38:04 2013
+++ src/sys/arch/arm/cortex/gtmr_var.h Fri Mar 28 21:41:46 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: gtmr_var.h,v 1.3 2013/09/12 15:38:04 matt Exp $ */
+/* $NetBSD: gtmr_var.h,v 1.4 2014/03/28 21:41:46 matt Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -46,6 +46,7 @@ struct gtmr_softc {
struct cpu_info;
void gtmr_init_cpu_clock(struct cpu_info *);
void gtmr_delay(unsigned int n);
+void gtmr_bootdelay(unsigned int n);
#endif
#endif /* _ARM_CORTEX_GTMR_VAR_ */