Move the simple armv6 only timer drivers to require MULTIDELAY to help
move all armv6 configs it.
This commit is contained in:
parent
1963b0270d
commit
5ee2236838
@ -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
|
||||
|
@ -70,6 +70,7 @@ device random # Entropy device
|
||||
|
||||
options INTRNG
|
||||
options PLATFORM
|
||||
options MULTIDELAY
|
||||
|
||||
# Flattened Device Tree
|
||||
options FDT # Configure using FDT/DTB data
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user