svn commit: r307944 - in head/sys/arm/ti: . am335x
Andrew Turner
andrew at FreeBSD.org
Tue Oct 25 18:01:21 UTC 2016
Author: andrew
Date: Tue Oct 25 18:01:19 2016
New Revision: 307944
URL: https://svnweb.freebsd.org/changeset/base/307944
Log:
Add MULTIDELAY support to the am335x dmtimer. This will be useful for
testing Cortex-A8 support in GENERIC.
Sponsored by: ABT Systems Ltd
Modified:
head/sys/arm/ti/am335x/am335x_dmtimer.c
head/sys/arm/ti/ti_machdep.c
Modified: head/sys/arm/ti/am335x/am335x_dmtimer.c
==============================================================================
--- head/sys/arm/ti/am335x/am335x_dmtimer.c Tue Oct 25 17:57:31 2016 (r307943)
+++ head/sys/arm/ti/am335x/am335x_dmtimer.c Tue Oct 25 18:01:19 2016 (r307944)
@@ -38,6 +38,10 @@ __FBSDID("$FreeBSD$");
#include <sys/timetc.h>
#include <machine/bus.h>
+#ifdef MULTIDELAY
+#include <machine/machdep.h> /* For arm_set_delay */
+#endif
+
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
@@ -67,6 +71,8 @@ struct am335x_dmtimer_softc {
static struct am335x_dmtimer_softc *am335x_dmtimer_et_sc = NULL;
static struct am335x_dmtimer_softc *am335x_dmtimer_tc_sc = NULL;
+static void am335x_dmtimer_delay(int, void *);
+
/*
* We use dmtimer2 for eventtimer and dmtimer3 for timecounter.
*/
@@ -235,6 +241,10 @@ am335x_dmtimer_tc_init(struct am335x_dmt
am335x_dmtimer_tc_sc = sc;
tc_init(&sc->func.tc);
+#ifdef MULTIDELAY
+ arm_set_delay(am335x_dmtimer_delay, sc);
+#endif
+
return (0);
}
@@ -328,23 +338,13 @@ static devclass_t am335x_dmtimer_devclas
DRIVER_MODULE(am335x_dmtimer, simplebus, am335x_dmtimer_driver, am335x_dmtimer_devclass, 0, 0);
MODULE_DEPEND(am335x_dmtimer, am335x_prcm, 1, 1, 1);
-void
-DELAY(int usec)
+static void
+am335x_dmtimer_delay(int usec, void *arg)
{
- struct am335x_dmtimer_softc *sc;
+ struct am335x_dmtimer_softc *sc = arg;
int32_t counts;
uint32_t first, last;
- sc = am335x_dmtimer_tc_sc;
-
- if (sc == NULL) {
- for (; usec > 0; usec--)
- for (counts = 200; counts > 0; counts--)
- /* Prevent gcc from optimizing out the loop */
- cpufunc_nullop();
- return;
- }
-
/* Get the number of times to count */
counts = (usec + 1) * (sc->sysclk_freq / 1000000);
@@ -361,3 +361,19 @@ DELAY(int usec)
}
}
+#ifndef MULTIDELAY
+void
+DELAY(int usec)
+{
+ int32_t counts;
+
+ if (am335x_dmtimer_tc_sc == NULL) {
+ for (; usec > 0; usec--)
+ for (counts = 200; counts > 0; counts--)
+ /* Prevent gcc from optimizing out the loop */
+ cpufunc_nullop();
+ return;
+ } else
+ am335x_dmtimer_delay(usec, am335x_dmtimer_tc_sc);
+}
+#endif
Modified: head/sys/arm/ti/ti_machdep.c
==============================================================================
--- head/sys/arm/ti/ti_machdep.c Tue Oct 25 17:57:31 2016 (r307943)
+++ head/sys/arm/ti/ti_machdep.c Tue Oct 25 18:01:19 2016 (r307944)
@@ -124,5 +124,5 @@ static platform_method_t am335x_methods[
PLATFORMMETHOD_END,
};
-FDT_PLATFORM_DEF(am335x, "am335x", 0, "ti,am335x", 0);
+FDT_PLATFORM_DEF(am335x, "am335x", 0, "ti,am335x", 200);
#endif
More information about the svn-src-all
mailing list