diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2010-03-23 03:14:44 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2010-03-23 03:14:44 +0000 |
commit | bbf5ab2a3952a5c4354849865f12845751a696fd (patch) | |
tree | ed01872a037bb02b93fe09e25506a6a9bb3aa2e3 /sys/powerpc/aim/nexus.c | |
parent | a4998a854d601c5a59c9f51479188de6d29c8919 (diff) | |
download | FreeBSD-src-bbf5ab2a3952a5c4354849865f12845751a696fd.zip FreeBSD-src-bbf5ab2a3952a5c4354849865f12845751a696fd.tar.gz |
Get nexus(4) out of the RTC business. The interface used by nexus(4)
in Open Firmware was Apple-specific, and we have complete coverage of Apple
system controllers, so move RTC responsibilities into the system controller
drivers. This avoids interesting problems from manipulating these devices
through Open Firmware behind the backs of their drivers.
Obtained from: NetBSD
MFC after: 2 weeks
Diffstat (limited to 'sys/powerpc/aim/nexus.c')
-rw-r--r-- | sys/powerpc/aim/nexus.c | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/sys/powerpc/aim/nexus.c b/sys/powerpc/aim/nexus.c index d92090b..54567b1 100644 --- a/sys/powerpc/aim/nexus.c +++ b/sys/powerpc/aim/nexus.c @@ -60,7 +60,6 @@ #include <sys/systm.h> #include <sys/module.h> #include <sys/bus.h> -#include <sys/clock.h> #include <sys/cons.h> #include <sys/kernel.h> #include <sys/malloc.h> @@ -74,7 +73,6 @@ #include <sys/rman.h> -#include "clock_if.h" #include "ofw_bus_if.h" #include "pic_if.h" @@ -143,12 +141,6 @@ static const char *nexus_ofw_get_type(device_t, device_t); static const char *nexus_ofw_get_compat(device_t, device_t); /* - * Clock interface. - */ -static int nexus_gettime(device_t, struct timespec *); -static int nexus_settime(device_t, struct timespec *); - -/* * Local routines */ static device_t nexus_device_from_node(device_t, phandle_t); @@ -181,10 +173,6 @@ static device_method_t nexus_methods[] = { DEVMETHOD(ofw_bus_get_type, nexus_ofw_get_type), DEVMETHOD(ofw_bus_get_compat, nexus_ofw_get_compat), - /* Clock interface */ - DEVMETHOD(clock_gettime, nexus_gettime), - DEVMETHOD(clock_settime, nexus_settime), - { 0, 0 } }; @@ -240,7 +228,6 @@ nexus_attach(device_t dev) } - clock_register(dev, 1000); return (bus_generic_attach(dev)); } @@ -512,50 +499,3 @@ nexus_ofw_get_compat(device_t bus, device_t dev) return (dinfo->ndi_compatible); } -#define DIFF19041970 2082844800 - -static int -nexus_gettime(device_t dev, struct timespec *ts) -{ - char path[128]; - ihandle_t ih; - phandle_t ph; - u_int rtc; - - ph = OF_finddevice("rtc"); - if (ph == -1) - return (ENOENT); - - OF_package_to_path(ph, path, sizeof(path)); - ih = OF_open(path); - if (ih == -1) - return (ENXIO); - - if (OF_call_method("read-rtc", ih, 0, 1, &rtc)) - return (EIO); - - ts->tv_sec = rtc - DIFF19041970; - ts->tv_nsec = 0; - return (0); -} - -static int -nexus_settime(device_t dev, struct timespec *ts) -{ - char path[128]; - ihandle_t ih; - phandle_t ph; - u_int rtc; - - ph = OF_finddevice("rtc"); - if (ph == -1) - return (ENOENT); - - OF_package_to_path(ph, path, sizeof(path)); - ih = OF_open(path); - if (ih == -1) - return (ENXIO); - - rtc = ts->tv_sec + DIFF19041970; - return ((OF_call_method("write-rtc", ih, 1, 0, rtc) != 0) ? EIO : 0); -} |