Changeset View
Changeset View
Standalone View
Standalone View
sys/arm/versatile/sp804.c
Show First 20 Lines • Show All 96 Lines • ▼ Show 20 Lines | struct sp804_timer_softc { | ||||
bus_space_tag_t bst; | bus_space_tag_t bst; | ||||
bus_space_handle_t bsh; | bus_space_handle_t bsh; | ||||
struct timecounter tc; | struct timecounter tc; | ||||
bool et_enabled; | bool et_enabled; | ||||
struct eventtimer et; | struct eventtimer et; | ||||
int timer_initialized; | int timer_initialized; | ||||
}; | }; | ||||
static struct ofw_compat_data compat_data[] = { | |||||
{"arm,sp804", 1}, | |||||
}; | |||||
/* Read/Write macros for Timer used as timecounter */ | /* Read/Write macros for Timer used as timecounter */ | ||||
#define sp804_timer_tc_read_4(reg) \ | #define sp804_timer_tc_read_4(reg) \ | ||||
bus_space_read_4(sc->bst, sc->bsh, reg) | bus_space_read_4(sc->bst, sc->bsh, reg) | ||||
#define sp804_timer_tc_write_4(reg, val) \ | #define sp804_timer_tc_write_4(reg, val) \ | ||||
bus_space_write_4(sc->bst, sc->bsh, reg, val) | bus_space_write_4(sc->bst, sc->bsh, reg, val) | ||||
static unsigned sp804_timer_tc_get_timecount(struct timecounter *); | static unsigned sp804_timer_tc_get_timecount(struct timecounter *); | ||||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
sp804_timer_probe(device_t dev) | sp804_timer_probe(device_t dev) | ||||
{ | { | ||||
if (!ofw_bus_status_okay(dev)) | if (!ofw_bus_status_okay(dev)) | ||||
return (ENXIO); | return (ENXIO); | ||||
if (ofw_bus_is_compatible(dev, "arm,sp804")) { | if (ofw_bus_compatible_lookup(dev, compat_data)) { | ||||
device_set_desc(dev, "SP804 System Timer"); | device_set_desc(dev, "SP804 System Timer"); | ||||
return (BUS_PROBE_DEFAULT); | return (BUS_PROBE_DEFAULT); | ||||
} | } | ||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
static int | static int | ||||
▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | static driver_t sp804_timer_driver = { | ||||
"timer", | "timer", | ||||
sp804_timer_methods, | sp804_timer_methods, | ||||
sizeof(struct sp804_timer_softc), | sizeof(struct sp804_timer_softc), | ||||
}; | }; | ||||
static devclass_t sp804_timer_devclass; | static devclass_t sp804_timer_devclass; | ||||
DRIVER_MODULE(sp804_timer, simplebus, sp804_timer_driver, sp804_timer_devclass, 0, 0); | DRIVER_MODULE(sp804_timer, simplebus, sp804_timer_driver, sp804_timer_devclass, 0, 0); | ||||
SIMPLEBUS_PNP_INFO(compat_data); | |||||
void | void | ||||
DELAY(int usec) | DELAY(int usec) | ||||
{ | { | ||||
int32_t counts; | int32_t counts; | ||||
uint32_t first, last; | uint32_t first, last; | ||||
device_t timer_dev; | device_t timer_dev; | ||||
struct sp804_timer_softc *sc; | struct sp804_timer_softc *sc; | ||||
Show All 39 Lines |