Lines Matching +full:sun4i +full:- +full:a10 +full:- +full:ts
1 /*-
65 #define IS_SUN7I (sc->conf->is_a20 == true)
92 #define RTC_READ(sc, reg) bus_read_4((sc)->res, (reg))
93 #define RTC_WRITE(sc, reg, val) bus_write_4((sc)->res, (reg), (val))
133 { "allwinner,sun4i-a10-rtc", (uintptr_t) &a10_conf },
134 { "allwinner,sun7i-a20-rtc", (uintptr_t) &a20_conf },
135 { "allwinner,sun6i-a31-rtc", (uintptr_t) &a31_conf },
136 { "allwinner,sun8i-h3-rtc", (uintptr_t) &h3_conf },
137 { "allwinner,sun20i-d1-rtc", (uintptr_t) &h3_conf },
138 { "allwinner,sun50i-h5-rtc", (uintptr_t) &h3_conf },
139 { "allwinner,sun50i-h6-rtc", (uintptr_t) &h3_conf },
166 static int aw_rtc_gettime(device_t dev, struct timespec *ts);
167 static int aw_rtc_settime(device_t dev, struct timespec *ts);
197 if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) in aw_rtc_probe()
212 sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); in aw_rtc_attach()
213 if (!sc->res) { in aw_rtc_attach()
218 sc->conf = (struct aw_rtc_conf *)ofw_bus_search_compatible(dev, compat_data)->ocd_data; in aw_rtc_attach()
227 val = RTC_READ(sc, sc->conf->rtc_losc_sta); in aw_rtc_attach()
260 nclocks = ofw_bus_string_list_to_array(node, "clock-output-names", &clknames); in aw_rtc_install_clocks()
278 aw_rtc_iosc.freq = sc->conf->iosc_freq; in aw_rtc_install_clocks()
289 aw_rtc_gettime(device_t dev, struct timespec *ts) in aw_rtc_gettime() argument
295 rdate = RTC_READ(sc, sc->conf->rtc_date); in aw_rtc_gettime()
296 rtime = RTC_READ(sc, sc->conf->rtc_time); in aw_rtc_gettime()
299 rdate = RTC_READ(sc, sc->conf->rtc_date); in aw_rtc_gettime()
307 ct.dow = -1; in aw_rtc_gettime()
311 return (clock_ct_to_ts(&ct, ts)); in aw_rtc_gettime()
315 aw_rtc_settime(device_t dev, struct timespec *ts) in aw_rtc_settime() argument
322 if (ts->tv_nsec >= HALF_OF_SEC_NS) in aw_rtc_settime()
323 ts->tv_sec++; in aw_rtc_settime()
324 ts->tv_nsec = 0; in aw_rtc_settime()
326 clock_ts_to_ct(ts, &ct); in aw_rtc_settime()
341 RTC_WRITE(sc, sc->conf->rtc_time, 0); in aw_rtc_settime()
344 SET_YEAR_VALUE(ct.year - YEAR_OFFSET) | in aw_rtc_settime()
357 RTC_WRITE(sc, sc->conf->rtc_date, rdate); in aw_rtc_settime()
366 RTC_WRITE(sc, sc->conf->rtc_time, rtime); in aw_rtc_settime()