Lines Matching +full:conf +full:- +full:clk
1 /*-
44 #include <dev/clk/clk_fixed.h>
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 },
145 struct aw_rtc_conf *conf; member
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()
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()
319 uint32_t clk, rdate, rtime; in aw_rtc_settime() local
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()
333 for (clk = 0; RTC_READ(sc, LOSC_CTRL_REG) & LOSC_BUSY_MASK; clk++) { in aw_rtc_settime()
334 if (clk > RTC_TIMEOUT) { 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()
350 for (clk = 0; RTC_READ(sc, LOSC_CTRL_REG) & LOSC_BUSY_MASK; clk++) { in aw_rtc_settime()
351 if (clk > RTC_TIMEOUT) { in aw_rtc_settime()
357 RTC_WRITE(sc, sc->conf->rtc_date, rdate); in aw_rtc_settime()
359 for (clk = 0; RTC_READ(sc, LOSC_CTRL_REG) & LOSC_BUSY_MASK; clk++) { in aw_rtc_settime()
360 if (clk > RTC_TIMEOUT) { in aw_rtc_settime()
366 RTC_WRITE(sc, sc->conf->rtc_time, rtime); in aw_rtc_settime()