-/* $OpenBSD: acrtc.c,v 1.5 2021/10/24 17:52:26 mpi Exp $ */
+/* $OpenBSD: acrtc.c,v 1.6 2022/10/17 19:09:46 kettenis Exp $ */
/*
* Copyright (c) 2017 Mark Kettenis <kettenis@openbsd.org>
*
#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
-extern todr_chip_handle_t todr_handle;
-
#define CK32K_OUT_CTRL1 0xc1
#define CK32K_OUT_CTRL_PRE_DIV_MASK (0x7 << 5)
#define CK32K_OUT_CTRL_PRE_DIV_32K (0x7 << 5)
sc->sc_todr.cookie = sc;
sc->sc_todr.todr_gettime = acrtc_gettime;
sc->sc_todr.todr_settime = acrtc_settime;
- todr_handle = &sc->sc_todr;
+ sc->sc_todr.todr_quality = 1000;
+ todr_attach(&sc->sc_todr);
node = OF_getnodebyname(ra->ra_node, "rtc");
if (node == 0)
-/* $OpenBSD: exrtc.c,v 1.4 2021/10/24 17:52:26 mpi Exp $ */
+/* $OpenBSD: exrtc.c,v 1.5 2022/10/17 19:09:46 kettenis Exp $ */
/*
* Copyright (c) 2017 Mark Kettenis <kettenis@openbsd.org>
*
#include <dev/clock_subr.h>
-extern todr_chip_handle_t todr_handle;
-
#define RTCCTRL 0x40
#define RTCCTRL_RTCEN (1 << 0)
sc->sc_todr.cookie = sc;
sc->sc_todr.todr_gettime = exrtc_gettime;
sc->sc_todr.todr_settime = exrtc_settime;
- todr_handle = &sc->sc_todr;
+ sc->sc_todr.todr_quality = 0;
+ todr_attach(&sc->sc_todr);
}
int
-/* $OpenBSD: gfrtc.c,v 1.2 2022/04/06 18:59:28 naddy Exp $ */
+/* $OpenBSD: gfrtc.c,v 1.3 2022/10/17 19:09:46 kettenis Exp $ */
/*
* Copyright (c) 2021 Jonathan Gray <jsg@openbsd.org>
#define ALARM_LOW 0x0c
#define CLEAR_INTERRUPT 0x10
-extern todr_chip_handle_t todr_handle;
-
struct gfrtc_softc {
struct device sc_dev;
bus_space_tag_t sc_iot;
sc->sc_todr.cookie = sc;
sc->sc_todr.todr_gettime = gfrtc_gettime;
sc->sc_todr.todr_settime = gfrtc_settime;
- todr_handle = &sc->sc_todr;
+ sc->sc_todr.todr_quality = 1000;
+ todr_attach(&sc->sc_todr);
printf("\n");
}
-/* $OpenBSD: imxrtc.c,v 1.2 2021/10/24 17:52:26 mpi Exp $ */
+/* $OpenBSD: imxrtc.c,v 1.3 2022/10/17 19:09:46 kettenis Exp $ */
/*
* Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org>
*
#include <dev/clock_subr.h>
-extern todr_chip_handle_t todr_handle;
-
/* Registers. */
#define LPCR 0x38
#define LPCR_SRTC_ENV (1 << 0)
sc->sc_todr.cookie = sc;
sc->sc_todr.todr_gettime = imxrtc_gettime;
sc->sc_todr.todr_settime = imxrtc_settime;
- todr_handle = &sc->sc_todr;
+ sc->sc_todr.todr_quality = 0;
+ todr_attach(&sc->sc_todr);
}
int
-/* $OpenBSD: mvrtc.c,v 1.2 2021/10/24 17:52:26 mpi Exp $ */
+/* $OpenBSD: mvrtc.c,v 1.3 2022/10/17 19:09:46 kettenis Exp $ */
/*
* Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org>
*
#include <dev/clock_subr.h>
-extern todr_chip_handle_t todr_handle;
-
/* Registers. */
#define RTC_STATUS 0x0000
#define RTC_TIME 0x000c
sc->sc_todr.cookie = sc;
sc->sc_todr.todr_gettime = mvrtc_gettime;
sc->sc_todr.todr_settime = mvrtc_settime;
- todr_handle = &sc->sc_todr;
+ sc->sc_todr.todr_quality = 0;
+ todr_attach(&sc->sc_todr);
}
int
-/* $OpenBSD: plrtc.c,v 1.3 2022/10/12 13:39:50 kettenis Exp $ */
+/* $OpenBSD: plrtc.c,v 1.4 2022/10/17 19:09:46 kettenis Exp $ */
/*
* Copyright (c) 2015 Jonathan Gray <jsg@openbsd.org>
#define RTCCR_START (1 << 0)
-extern todr_chip_handle_t todr_handle;
-
struct plrtc_softc {
struct device sc_dev;
bus_space_tag_t sc_iot;
handle->todr_gettime = plrtc_gettime;
handle->todr_settime = plrtc_settime;
handle->todr_quality = 0;
- todr_handle = handle;
+ todr_attach(handle);
/* enable the rtc */
bus_space_write_4(sc->sc_iot, sc->sc_ioh, RTCCR, RTCCR_START);
-/* $OpenBSD: sxirtc.c,v 1.7 2022/10/12 13:39:50 kettenis Exp $ */
+/* $OpenBSD: sxirtc.c,v 1.8 2022/10/17 19:09:46 kettenis Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis
* Copyright (c) 2013 Artturi Alm
(y) % 100 != 0) || \
(y) % 400 == 0)
-
-extern todr_chip_handle_t todr_handle;
-
struct sxirtc_softc {
struct device sc_dev;
bus_space_tag_t sc_iot;
handle->bus_cookie = NULL;
handle->todr_setwen = NULL;
handle->todr_quality = 0;
- todr_handle = handle;
+ todr_attach(handle);
printf("\n");
}