Lines Matching +full:snvs +full:- +full:rtc

1 /*-
29 * Driver for imx6 Secure Non-Volatile Storage system, which really means "all
31 * realtime clock, tamper monitor, and power-management functions. Currently
52 #define LPCR_SRTC_ENV (1u << 0) /* RTC enabled/valid */
60 * The RTC is a 47-bit counter clocked at 32KHz and organized as a 32.15
61 * fixed-point binary value. Shifting by SBT_LSB bits translates between
66 #define SBT_LSB (SBT_BITS - RTC_BITS)
75 {"fsl,sec-v4.0-mon-rtc-lp", true},
83 return (SYSCON_READ_4(sc->syscon, offset)); in RD4()
90 SYSCON_WRITE_4(sc->syscon, offset, value); in WR4()
99 sc->lpcr |= LPCR_SRTC_ENV; in snvs_rtc_enable()
101 sc->lpcr &= ~LPCR_SRTC_ENV; in snvs_rtc_enable()
102 WR4(sc, SNVS_LPCR, sc->lpcr); in snvs_rtc_enable()
105 enbit = sc->lpcr & LPCR_SRTC_ENV; in snvs_rtc_enable()
126 * The counter is 47 bits, organized as a 32.15 binary fixed-point in snvs_gettime()
127 * value. If we shift it up to the high order part of a 64-bit word it in snvs_gettime()
139 clock_dbgprint_ts(sc->dev, CLOCK_DBG_READ, ts); in snvs_gettime()
165 clock_dbgprint_ts(sc->dev, CLOCK_DBG_WRITE, ts); in snvs_settime()
177 if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) in snvs_probe()
180 device_set_desc(dev, "i.MX6 SNVS RTC"); in snvs_probe()
190 sc->dev = dev; in snvs_attach()
192 if (syscon_get_handle_default(sc->dev, &sc->syscon) != 0) { in snvs_attach()
193 device_printf(sc->dev, "Cannot get syscon handle\n"); in snvs_attach()
197 clock_register(sc->dev, RTC_RESOLUTION_US); in snvs_attach()
208 clock_unregister(sc->dev); in snvs_detach()
225 "snvs",
230 DRIVER_MODULE(snvs, simplebus, snvs_driver, 0, 0);