| 291 | |
| 292 | #if defined(__arm__) |
| 293 | static void |
| 294 | a10_timer_eventtimer_setup(struct a10_timer_softc *sc) |
| 295 | { |
| 296 | uint32_t val; |
| 297 | |
| 298 | /* Set clock source to OSC24M, 1 pre-division, continuous mode */ |
| 299 | val = timer_read_4(sc, TIMER_CTRL_REG(0)); |
| 300 | val &= ~TIMER_CTRL_PRESCALAR_MASK | ~TIMER_CTRL_MODE_MASK | ~TIMER_CTRL_CLKSRC_MASK; |
| 301 | val |= TIMER_CTRL_PRESCALAR(1) | TIMER_CTRL_OSC24M; |
| 302 | timer_write_4(sc, TIMER_CTRL_REG(0), val); |
| 303 | |
| 304 | /* Enable timer0 */ |
| 305 | val = timer_read_4(sc, TIMER_IRQ_EN_REG); |
| 306 | val |= TIMER_IRQ_ENABLE(0); |
| 307 | timer_write_4(sc, TIMER_IRQ_EN_REG, val); |
| 308 | |
| 309 | /* Set desired frequency in event timer and timecounter */ |
| 310 | sc->et.et_frequency = sc->timer0_freq; |
| 311 | sc->et.et_name = "a10_timer Eventtimer"; |
| 312 | sc->et.et_flags = ET_FLAGS_ONESHOT | ET_FLAGS_PERIODIC; |
| 313 | sc->et.et_quality = 1000; |
| 314 | sc->et.et_min_period = (0x00000005LLU << 32) / sc->et.et_frequency; |
| 315 | sc->et.et_max_period = (0xfffffffeLLU << 32) / sc->et.et_frequency; |
| 316 | sc->et.et_start = a10_timer_timer_start; |
| 317 | sc->et.et_stop = a10_timer_timer_stop; |
| 318 | sc->et.et_priv = sc; |
| 319 | et_register(&sc->et); |
| 320 | } |
| 321 | |
| 322 | static int |
| 323 | a10_timer_timer_start(struct eventtimer *et, sbintime_t first, |
no test coverage detected