Lines Matching +full:write +full:- +full:access +full:- +full:delay
1 /*-
69 #define MV_RTC_LOCK(sc) mtx_lock_spin(&(sc)->mutex)
70 #define MV_RTC_UNLOCK(sc) mtx_unlock_spin(&(sc)->mutex)
98 { -1, 0 }
143 {"marvell,armada-380-rtc", RTC_A38X},
144 {"marvell,armada-8k-rtc", RTC_A8K},
159 DELAY(500000); in mv_rtc_reset()
163 DELAY(62); in mv_rtc_reset()
167 DELAY(62); in mv_rtc_reset()
175 /* Setup nominal register access timing */ in mv_rtc_reset()
180 DELAY(10); in mv_rtc_reset()
184 DELAY(50); in mv_rtc_reset()
194 if (!ofw_bus_search_compatible(dev, mv_rtc_compat)->ocd_data) in mv_rtc_probe()
209 sc->dev = dev; in mv_rtc_attach()
210 sc->rtc_type = ofw_bus_search_compatible(dev, mv_rtc_compat)->ocd_data; in mv_rtc_attach()
212 mtx_init(&sc->mutex, device_get_nameunit(dev), NULL, MTX_SPIN); in mv_rtc_attach()
214 ret = bus_alloc_resources(dev, res_spec, sc->res); in mv_rtc_attach()
217 mtx_destroy(&sc->mutex); in mv_rtc_attach()
221 switch (sc->rtc_type) { in mv_rtc_attach()
229 panic("Unknown RTC type: %d", sc->rtc_type); in mv_rtc_attach()
243 mtx_destroy(&sc->mutex); in mv_rtc_detach()
245 bus_release_resources(dev, res_spec, sc->res); in mv_rtc_detach()
266 DELAY(100); in mv_rtc_gettime()
268 } while ((val_check - val) > 1); in mv_rtc_gettime()
272 ts->tv_sec = val_check; in mv_rtc_gettime()
274 ts->tv_nsec = 0; in mv_rtc_gettime()
287 if (ts->tv_nsec >= HALF_OF_SEC_NS) in mv_rtc_settime()
288 ts->tv_sec++; in mv_rtc_settime()
289 ts->tv_nsec = 0; in mv_rtc_settime()
300 * According to errata FE-3124064, Write to RTC TIME register in mv_rtc_settime()
302 * issue a dummy write of 0x0 twice to RTC Status register. in mv_rtc_settime()
306 mv_rtc_reg_write(sc, RTC_TIME, ts->tv_sec); in mv_rtc_settime()
316 return (bus_read_4(sc->res[RTC_RES], off)); in mv_rtc_reg_read()
321 * register write to the RTC hard macro so that the required update
328 bus_write_4(sc->res[RTC_RES], off, val); in mv_rtc_reg_write()
329 DELAY(5); in mv_rtc_reg_write()
339 val = bus_read_4(sc->res[RTC_SOC_RES], A38X_RTC_BRIDGE_TIMING_CTRL); in mv_rtc_configure_bus_a38x()
343 bus_write_4(sc->res[RTC_SOC_RES], A38X_RTC_BRIDGE_TIMING_CTRL, val); in mv_rtc_configure_bus_a38x()
351 val = bus_read_4(sc->res[RTC_SOC_RES], A8K_RTC_BRIDGE_TIMING_CTRL0); in mv_rtc_configure_bus_a8k()
355 bus_write_4(sc->res[RTC_SOC_RES], A8K_RTC_BRIDGE_TIMING_CTRL1, val); in mv_rtc_configure_bus_a8k()
357 val = bus_read_4(sc->res[RTC_SOC_RES], A8K_RTC_BRIDGE_TIMING_CTRL0); in mv_rtc_configure_bus_a8k()
360 bus_write_4(sc->res[RTC_SOC_RES], A8K_RTC_BRIDGE_TIMING_CTRL1, val); in mv_rtc_configure_bus_a8k()