aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Turner <andrew@FreeBSD.org>2017-07-04 18:07:09 +0000
committerAndrew Turner <andrew@FreeBSD.org>2017-07-04 18:07:09 +0000
commit89ea89de85f5ff18d21c521be2004a8a50a108da (patch)
tree217c8969d5aa3c3725549e195483b098cd7f6eac
parentafffa1a9adda37ad4a11c247d6530c0ac57220c9 (diff)
downloadsrc-89ea89de85f5ff18d21c521be2004a8a50a108da.tar.gz
src-89ea89de85f5ff18d21c521be2004a8a50a108da.zip
Move the simple armv6 only timer drivers to require MULTIDELAY to help
move all armv6 configs it.
Notes
Notes: svn path=/head/; revision=320651
-rw-r--r--sys/arm/conf/ALPINE1
-rw-r--r--sys/arm/conf/VERSATILEPB1
-rw-r--r--sys/arm/freescale/imx/imx_epit.c39
-rw-r--r--sys/arm/freescale/imx/imx_gpt.c38
-rw-r--r--sys/arm/ti/am335x/am335x_dmtimer.c21
-rw-r--r--sys/arm/versatile/sp804.c38
6 files changed, 4 insertions, 134 deletions
diff --git a/sys/arm/conf/ALPINE b/sys/arm/conf/ALPINE
index bb64740b56f9..401b4d38a0a1 100644
--- a/sys/arm/conf/ALPINE
+++ b/sys/arm/conf/ALPINE
@@ -28,6 +28,7 @@ makeoptions WERROR="-Werror"
options SCHED_4BSD # 4BSD scheduler
options SMP # Enable multiple cores
options PLATFORM
+options MULTIDELAY
# Interrupt controller
device gic
diff --git a/sys/arm/conf/VERSATILEPB b/sys/arm/conf/VERSATILEPB
index 10686ea8b6c3..1585586feafb 100644
--- a/sys/arm/conf/VERSATILEPB
+++ b/sys/arm/conf/VERSATILEPB
@@ -70,6 +70,7 @@ device random # Entropy device
options INTRNG
options PLATFORM
+options MULTIDELAY
# Flattened Device Tree
options FDT # Configure using FDT/DTB data
diff --git a/sys/arm/freescale/imx/imx_epit.c b/sys/arm/freescale/imx/imx_epit.c
index 3731ed9f83df..1295bc75c783 100644
--- a/sys/arm/freescale/imx/imx_epit.c
+++ b/sys/arm/freescale/imx/imx_epit.c
@@ -106,11 +106,6 @@ struct epit_softc {
bool oneshot;
};
-#ifndef MULTIDELAY
-/* Global softc pointer for use in DELAY(). */
-static struct epit_softc *epit_sc;
-#endif
-
/*
* Probe data. For some reason, the standard linux dts files don't have
* compatible properties on the epit devices (other properties are missing too,
@@ -218,11 +213,8 @@ epit_tc_attach(struct epit_softc *sc)
tc_init(&sc->tc);
/* We are the DELAY() implementation. */
-#ifdef MULTIDELAY
arm_set_delay(epit_do_delay, sc);
-#else
- epit_sc = sc;
-#endif
+
return (0);
}
@@ -497,32 +489,3 @@ static devclass_t epit_devclass;
EARLY_DRIVER_MODULE(imx_epit, simplebus, epit_driver, epit_devclass, 0,
0, BUS_PASS_TIMER);
-
-#ifndef MULTIDELAY
-
-/*
- * Hand-calibrated delay-loop counter. This was calibrated on an i.MX6 running
- * at 792mhz. It will delay a bit too long on slower processors -- that's
- * better than not delaying long enough. In practice this is unlikely to get
- * used much since the clock driver is one of the first to start up, and once
- * we're attached the delay loop switches to using the timer hardware.
- */
-static const int epit_delay_count = 78;
-
-void
-DELAY(int usec)
-{
- uint64_t ticks;
-
- /* If the timer hardware is not accessible, just use a loop. */
- if (epit_sc == NULL) {
- while (usec-- > 0)
- for (ticks = 0; ticks < epit_delay_count; ++ticks)
- cpufunc_nullop();
- return;
- } else {
- epit_do_delay(usec, epit_sc);
- }
-}
-
-#endif
diff --git a/sys/arm/freescale/imx/imx_gpt.c b/sys/arm/freescale/imx/imx_gpt.c
index 48fb1152e233..2f62db5dd313 100644
--- a/sys/arm/freescale/imx/imx_gpt.c
+++ b/sys/arm/freescale/imx/imx_gpt.c
@@ -40,9 +40,7 @@ __FBSDID("$FreeBSD$");
#include <sys/timetc.h>
#include <machine/bus.h>
#include <machine/intr.h>
-#ifdef MULTIDELAY
#include <machine/machdep.h> /* For arm_set_delay */
-#endif
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
@@ -92,20 +90,6 @@ struct imx_gpt_softc {
struct eventtimer et;
};
-#ifndef MULTIDELAY
-/* Global softc pointer for use in DELAY(). */
-static struct imx_gpt_softc *imx_gpt_sc;
-
-/*
- * Hand-calibrated delay-loop counter. This was calibrated on an i.MX6 running
- * at 792mhz. It will delay a bit too long on slower processors -- that's
- * better than not delaying long enough. In practice this is unlikely to get
- * used much since the clock driver is one of the first to start up, and once
- * we're attached the delay loop switches to using the timer hardware.
- */
-static const int imx_gpt_delay_count = 78;
-#endif
-
/* Try to divide down an available fast clock to this frequency. */
#define TARGET_FREQUENCY 1000000000
@@ -293,11 +277,7 @@ imx_gpt_attach(device_t dev)
/* If this is the first unit, store the softc for use in DELAY. */
if (device_get_unit(dev) == 0) {
-#ifdef MULTIDELAY
arm_set_delay(imx_gpt_do_delay, sc);
-#else
- imx_gpt_sc = sc;
-#endif
}
return (0);
@@ -441,21 +421,3 @@ imx_gpt_do_delay(int usec, void *arg)
curcnt += 1ULL << 32;
}
}
-
-#ifndef MULTIDELAY
-void
-DELAY(int usec)
-{
- uint64_t ticks;
-
- /* If the timer hardware is not accessible, just use a loop. */
- if (imx_gpt_sc == NULL) {
- while (usec-- > 0)
- for (ticks = 0; ticks < imx_gpt_delay_count; ++ticks)
- cpufunc_nullop();
- return;
- } else
- imx_gpt_do_delay(usec, imx_gpt_sc);
-
-}
-#endif
diff --git a/sys/arm/ti/am335x/am335x_dmtimer.c b/sys/arm/ti/am335x/am335x_dmtimer.c
index 9d28565fa1f3..a7572afedbc4 100644
--- a/sys/arm/ti/am335x/am335x_dmtimer.c
+++ b/sys/arm/ti/am335x/am335x_dmtimer.c
@@ -38,9 +38,7 @@ __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>
@@ -241,9 +239,7 @@ am335x_dmtimer_tc_init(struct am335x_dmtimer_softc *sc)
am335x_dmtimer_tc_sc = sc;
tc_init(&sc->func.tc);
-#ifdef MULTIDELAY
arm_set_delay(am335x_dmtimer_delay, sc);
-#endif
return (0);
}
@@ -360,20 +356,3 @@ am335x_dmtimer_delay(int usec, void *arg)
first = last;
}
}
-
-#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
diff --git a/sys/arm/versatile/sp804.c b/sys/arm/versatile/sp804.c
index ecc3b7cba8ff..d0efb448750e 100644
--- a/sys/arm/versatile/sp804.c
+++ b/sys/arm/versatile/sp804.c
@@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/malloc.h>
-#include <sys/rman.h>
+
#include <sys/timeet.h>
#include <sys/timetc.h>
#include <sys/watchdog.h>
@@ -42,9 +42,7 @@ __FBSDID("$FreeBSD$");
#include <machine/cpu.h>
#include <machine/intr.h>
-#ifdef MULTIDELAY
#include <machine/machdep.h> /* For arm_set_delay */
-#endif
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
@@ -292,9 +290,7 @@ sp804_timer_attach(device_t dev)
(sp804_timer_tc_read_4(SP804_PRIMECELL_ID0 + i*4) & 0xff);
}
-#ifdef MULTIDELAY
arm_set_delay(sp804_timer_delay, sc);
-#endif
device_printf(dev, "PrimeCell ID: %08x\n", id);
@@ -343,35 +339,3 @@ sp804_timer_delay(int usec, void *arg)
first = last;
}
}
-
-#ifndef MULTIDELAY
-void
-DELAY(int usec)
-{
- int32_t counts;
- device_t timer_dev;
- struct sp804_timer_softc *sc;
- int timer_initialized = 0;
-
- timer_dev = devclass_get_device(sp804_timer_devclass, 0);
-
- if (timer_dev) {
- sc = device_get_softc(timer_dev);
-
- if (sc)
- timer_initialized = sc->timer_initialized;
- }
-
- if (!timer_initialized) {
- /*
- * Timer is not initialized yet
- */
- for (; usec > 0; usec--)
- for (counts = 200; counts > 0; counts--)
- /* Prevent gcc from optimizing out the loop */
- cpufunc_nullop();
- } else {
- sp804_timer_delay(usec, sc);
- }
-}
-#endif