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,sun50i-h5-rtc", (uintptr_t) &h3_conf },
138 { "allwinner,sun50i-h6-rtc", (uintptr_t) &h3_conf },
163 static int aw_rtc_gettime(device_t dev, struct timespec *ts);
164 static int aw_rtc_settime(device_t dev, struct timespec *ts);
194 if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) in aw_rtc_probe()
209 sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); in aw_rtc_attach()
210 if (!sc->res) { in aw_rtc_attach()
215 sc->conf = (struct aw_rtc_conf *)ofw_bus_search_compatible(dev, compat_data)->ocd_data; in aw_rtc_attach()
224 val = RTC_READ(sc, sc->conf->rtc_losc_sta); in aw_rtc_attach()
253 nclocks = ofw_bus_string_list_to_array(node, "clock-output-names", &clknames); in aw_rtc_install_clocks()
270 aw_rtc_iosc.freq = sc->conf->iosc_freq; in aw_rtc_install_clocks()
281 aw_rtc_gettime(device_t dev, struct timespec *ts) in aw_rtc_gettime() argument
287 rdate = RTC_READ(sc, sc->conf->rtc_date); in aw_rtc_gettime()
288 rtime = RTC_READ(sc, sc->conf->rtc_time); in aw_rtc_gettime()
291 rdate = RTC_READ(sc, sc->conf->rtc_date); in aw_rtc_gettime()
299 ct.dow = -1; in aw_rtc_gettime()
303 return (clock_ct_to_ts(&ct, ts)); in aw_rtc_gettime()
307 aw_rtc_settime(device_t dev, struct timespec *ts) in aw_rtc_settime() argument
314 if (ts->tv_nsec >= HALF_OF_SEC_NS) in aw_rtc_settime()
315 ts->tv_sec++; in aw_rtc_settime()
316 ts->tv_nsec = 0; in aw_rtc_settime()
318 clock_ts_to_ct(ts, &ct); in aw_rtc_settime()
333 RTC_WRITE(sc, sc->conf->rtc_time, 0); in aw_rtc_settime()
336 SET_YEAR_VALUE(ct.year - YEAR_OFFSET) | in aw_rtc_settime()
349 RTC_WRITE(sc, sc->conf->rtc_date, rdate); in aw_rtc_settime()
358 RTC_WRITE(sc, sc->conf->rtc_time, rtime); in aw_rtc_settime()