Lines Matching refs:dev
49 #include <dev/ofw/ofw_bus.h>
58 #include <dev/mc146818/mc146818reg.h>
59 #include <dev/mc146818/mc146818var.h>
126 static u_int pc87317_getcent(device_t dev);
127 static void pc87317_setcent(device_t dev, u_int cent);
130 rtc_ebus_probe(device_t dev)
133 if (strcmp(ofw_bus_get_name(dev), "rtc") == 0) {
135 if (ofw_bus_get_compat(dev) != NULL &&
136 strcmp(ofw_bus_get_compat(dev), "bq4802") == 0)
138 device_set_desc(dev, RTC_DESC);
152 rtc_isa_probe(device_t dev)
155 if (ISA_PNP_PROBE(device_get_parent(dev), dev, rtc_isa_ids) == 0)
163 rtc_attach(device_t dev)
170 sc = device_get_softc(dev);
175 if (strcmp(device_get_name(device_get_parent(dev)), "ebus") == 0)
179 res = bus_alloc_resource_any(dev, ebus ? SYS_RES_MEMORY :
182 device_printf(dev, "cannot allocate resources\n");
203 RTC_WRITE(dev, MC_REGA, PC87317_APC);
204 RTC_WRITE(dev, PC87317_APC_CADDR, PC87317_APC_CADDR_BANK1 |
206 RTC_WRITE(dev, MC_REGA, PC87317_COMMON);
210 if ((error = mc146818_attach(dev)) != 0) {
211 device_printf(dev, "cannot attach time of day clock\n");
216 if (mc146818_gettime(dev, &ts) != 0)
217 device_printf(dev, "invalid time");
219 device_printf(dev, "current time: %ld.%09ld\n",
226 bus_release_resource(dev, ebus ? SYS_RES_MEMORY : SYS_RES_IOPORT, rid,
235 pc87317_getcent(device_t dev)
239 RTC_WRITE(dev, MC_REGA, PC87317_RTC);
240 cent = RTC_READ(dev, PC87317_RTC_CR);
241 RTC_WRITE(dev, MC_REGA, PC87317_COMMON);
246 pc87317_setcent(device_t dev, u_int cent)
249 RTC_WRITE(dev, MC_REGA, PC87317_RTC);
250 RTC_WRITE(dev, PC87317_RTC_CR, cent);
251 RTC_WRITE(dev, MC_REGA, PC87317_COMMON);