| 277 | } |
| 278 | |
| 279 | static int |
| 280 | attach_tc(struct arm_tmr_softc *sc) |
| 281 | { |
| 282 | int rid; |
| 283 | |
| 284 | if (arm_tmr_tc != NULL) |
| 285 | return (EBUSY); |
| 286 | |
| 287 | rid = sc->memrid; |
| 288 | sc->gbl_mem = bus_alloc_resource_any(sc->dev, SYS_RES_MEMORY, &rid, |
| 289 | RF_ACTIVE); |
| 290 | if (sc->gbl_mem == NULL) { |
| 291 | device_printf(sc->dev, "could not allocate gbl mem resources\n"); |
| 292 | return (ENXIO); |
| 293 | } |
| 294 | tmr_gbl_write_4(sc, GBL_TIMER_CTRL, 0x00000000); |
| 295 | |
| 296 | arm_tmr_timecount.tc_frequency = sc->clkfreq; |
| 297 | arm_tmr_timecount.tc_priv = sc; |
| 298 | tc_init(&arm_tmr_timecount); |
| 299 | arm_tmr_tc = &arm_tmr_timecount; |
| 300 | |
| 301 | tmr_gbl_write_4(sc, GBL_TIMER_CTRL, GBL_TIMER_CTRL_TIMER_ENABLE); |
| 302 | |
| 303 | return (0); |
| 304 | } |
| 305 | |
| 306 | static int |
| 307 | attach_et(struct arm_tmr_softc *sc) |
no test coverage detected