diff options
author | gonzo <gonzo@FreeBSD.org> | 2018-04-03 06:06:39 +0000 |
---|---|---|
committer | gonzo <gonzo@FreeBSD.org> | 2018-04-03 06:06:39 +0000 |
commit | 593dbcba21f3480cfe2f116e7e0fad55073c7d10 (patch) | |
tree | e785682e3ddc9e55f8c8f96a1f7b6894e041cc6b /sys/arm | |
parent | 018de3d268ab6c7f80d5913ee5a050ba8b1b93df (diff) | |
download | FreeBSD-src-593dbcba21f3480cfe2f116e7e0fad55073c7d10.zip FreeBSD-src-593dbcba21f3480cfe2f116e7e0fad55073c7d10.tar.gz |
MFC r307943-r307944, r308698
r307943 by andrew:
Remove the need for the delay to be zero when MULTIDELAY is undefined,
it may be useful to only enable this in some configs.
Sponsored by: ABT Systems Ltd
r307944 by andrew:
Add MULTIDELAY support to the am335x dmtimer. This will be useful for
testing Cortex-A8 support in GENERIC.
Sponsored by: ABT Systems Ltd
r308698 by loos:
After r308533, the platform compatible string must be an exact match.
Use "ti,am33xx" instead of "ti,am335x", which gives an exact match in every
DTS we support.
This fixes the boot on TI SoCs after r308533.
Suggested by: gonzo
Sponsored by: Rubicon Communications, LLC (Netgate)
Diffstat (limited to 'sys/arm')
-rw-r--r-- | sys/arm/include/platformvar.h | 2 | ||||
-rw-r--r-- | sys/arm/ti/am335x/am335x_dmtimer.c | 42 | ||||
-rw-r--r-- | sys/arm/ti/ti_machdep.c | 2 |
3 files changed, 31 insertions, 15 deletions
diff --git a/sys/arm/include/platformvar.h b/sys/arm/include/platformvar.h index 1199dfa..be2fa33 100644 --- a/sys/arm/include/platformvar.h +++ b/sys/arm/include/platformvar.h @@ -97,7 +97,7 @@ extern platform_method_t fdt_platform_methods[]; #ifdef MULTIDELAY #define FDT_PLATFORM_CTASSERT(delay) CTASSERT(delay > 0) #else -#define FDT_PLATFORM_CTASSERT(delay) CTASSERT(delay == 0) +#define FDT_PLATFORM_CTASSERT(delay) #endif #define PLATFORM_DATA(NAME, delay) \ diff --git a/sys/arm/ti/am335x/am335x_dmtimer.c b/sys/arm/ti/am335x/am335x_dmtimer.c index dd286cf..9d28565 100644 --- a/sys/arm/ti/am335x/am335x_dmtimer.c +++ b/sys/arm/ti/am335x/am335x_dmtimer.c @@ -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_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); } @@ -328,23 +338,13 @@ static devclass_t am335x_dmtimer_devclass; 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 diff --git a/sys/arm/ti/ti_machdep.c b/sys/arm/ti/ti_machdep.c index 0e10f76..1d4e200 100644 --- a/sys/arm/ti/ti_machdep.c +++ b/sys/arm/ti/ti_machdep.c @@ -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,am33xx", 200); #endif |