| 248 | } |
| 249 | |
| 250 | static void |
| 251 | aw_rtc_install_clocks(struct aw_rtc_softc *sc, device_t dev) { |
| 252 | struct clkdom *clkdom; |
| 253 | const char **clknames; |
| 254 | phandle_t node; |
| 255 | int nclocks; |
| 256 | |
| 257 | node = ofw_bus_get_node(dev); |
| 258 | nclocks = ofw_bus_string_list_to_array(node, "clock-output-names", &clknames); |
| 259 | /* No clocks to export */ |
| 260 | if (nclocks <= 0) |
| 261 | return; |
| 262 | |
| 263 | if (nclocks != 3) { |
| 264 | device_printf(dev, "Having only %d clocks instead of 3, aborting\n", nclocks); |
| 265 | return; |
| 266 | } |
| 267 | |
| 268 | clkdom = clkdom_create(dev); |
| 269 | |
| 270 | aw_rtc_osc32k.clkdef.name = clknames[0]; |
| 271 | if (clknode_fixed_register(clkdom, &aw_rtc_osc32k) != 0) |
| 272 | device_printf(dev, "Cannot register osc32k clock\n"); |
| 273 | |
| 274 | aw_rtc_iosc.clkdef.name = clknames[2]; |
| 275 | aw_rtc_iosc.freq = sc->conf->iosc_freq; |
| 276 | if (clknode_fixed_register(clkdom, &aw_rtc_iosc) != 0) |
| 277 | device_printf(dev, "Cannot register iosc clock\n"); |
| 278 | |
| 279 | clkdom_finit(clkdom); |
| 280 | |
| 281 | if (bootverbose) |
| 282 | clkdom_dump(clkdom); |
| 283 | } |
| 284 | |
| 285 | static int |
| 286 | aw_rtc_gettime(device_t dev, struct timespec *ts) |
no test coverage detected