summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorraj <raj@FreeBSD.org>2008-09-08 10:40:48 +0000
committerraj <raj@FreeBSD.org>2008-09-08 10:40:48 +0000
commitea53a51d65022e830919bd98b42fc1d91fdfd639 (patch)
tree13ed177c265282936cdef832a5684f9b38e748f4
parent169da45541ef18ce2faefe7b596d769300fe22b1 (diff)
downloadFreeBSD-src-ea53a51d65022e830919bd98b42fc1d91fdfd639.zip
FreeBSD-src-ea53a51d65022e830919bd98b42fc1d91fdfd639.tar.gz
ds133x: Introduce device_identify method; update NOTES.
Obtained from: Semihalf
-rw-r--r--sys/conf/NOTES8
-rw-r--r--sys/dev/iicbus/ds133x.c14
2 files changed, 21 insertions, 1 deletions
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index a042885..74a3ee6 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -2276,6 +2276,14 @@ device ic
device iic
device iicsmb # smb over i2c bridge
+# I2C peripheral devices
+#
+# ds133x Dallas Semiconductor DS1337, DS1338 and DS1339 RTC
+# ds1672 Dallas Semiconductor DS1672 RTC
+#
+device ds133x
+device ds1672
+
# Parallel-Port Bus
#
# Parallel port bus support is provided by the `ppbus' device.
diff --git a/sys/dev/iicbus/ds133x.c b/sys/dev/iicbus/ds133x.c
index 9b54615..eec4187 100644
--- a/sys/dev/iicbus/ds133x.c
+++ b/sys/dev/iicbus/ds133x.c
@@ -53,6 +53,8 @@ __FBSDID("$FreeBSD$");
#include "iicbus_if.h"
#include "clock_if.h"
+#define DS133X_DEVNAME "rtc"
+
#define DS133X_ADDR 0xd0 /* slave address */
#define DS133X_DATE_REG 0x0
#define DS133X_CTRL_REG 0x0e
@@ -217,6 +219,15 @@ ds133x_init(device_t dev, uint8_t cs_reg, uint8_t cs_bit, uint8_t osf_reg,
return (0);
}
+
+static void
+ds133x_identify(driver_t *driver, device_t parent)
+{
+
+ if (device_find_child(parent, DS133X_DEVNAME, -1) == NULL)
+ BUS_ADD_CHILD(parent, 0, DS133X_DEVNAME, -1);
+}
+
static int
ds133x_probe(device_t dev)
{
@@ -336,6 +347,7 @@ ds133x_settime(device_t dev, struct timespec *ts)
}
static device_method_t ds133x_methods[] = {
+ DEVMETHOD(device_identify, ds133x_identify),
DEVMETHOD(device_probe, ds133x_probe),
DEVMETHOD(device_attach, ds133x_attach),
@@ -346,7 +358,7 @@ static device_method_t ds133x_methods[] = {
};
static driver_t ds133x_driver = {
- "rtc",
+ DS133X_DEVNAME,
ds133x_methods,
sizeof(struct ds133x_softc),
};
OpenPOWER on IntegriCloud