summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorjdc <jdc@NetBSD.org>2013-09-24 18:04:53 +0000
committerjdc <jdc@NetBSD.org>2013-09-24 18:04:53 +0000
commit0785abbbfd7d2e2da99f2d8d58a598d338a44ece (patch)
tree1b2d5cae379f0b77c73a24137a080e2bdf5cde95 /sys/dev
parent6a7ed08b0e7842a333fa3c1bab7e9f642e946630 (diff)
Add a property "i2c-indirect-config" to allow/disallow i2c indirect config.
If missing, "allowed" is assumed. Set it to false for OFW machines. Patch from martin@. Removes erroneous i2c probe messages that appeared with wildcard support.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/i2c/i2c.c15
-rw-r--r--sys/dev/ofw/ofw_subr.c6
2 files changed, 14 insertions, 7 deletions
diff --git a/sys/dev/i2c/i2c.c b/sys/dev/i2c/i2c.c
index 7c12b8f98d8..47cfdd37b91 100644
--- a/sys/dev/i2c/i2c.c
+++ b/sys/dev/i2c/i2c.c
@@ -1,4 +1,4 @@
-/* $NetBSD: i2c.c,v 1.41 2013/09/12 20:20:03 martin Exp $ */
+/* $NetBSD: i2c.c,v 1.42 2013/09/24 18:04:53 jdc Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.41 2013/09/12 20:20:03 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.42 2013/09/24 18:04:53 jdc Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -166,9 +166,11 @@ iic_attach(device_t parent, device_t self, void *aux)
struct iic_softc *sc = device_private(self);
struct i2cbus_attach_args *iba = aux;
prop_array_t child_devices;
+ prop_dictionary_t props;
char *buf;
i2c_tag_t ic;
int rv;
+ bool indirect_config;
aprint_naive("\n");
aprint_normal(": I2C bus\n");
@@ -190,8 +192,11 @@ iic_attach(device_t parent, device_t self, void *aux)
if (!pmf_device_register(self, NULL, NULL))
aprint_error_dev(self, "couldn't establish power handler\n");
- child_devices = prop_dictionary_get(device_properties(parent),
- "i2c-child-devices");
+ props = device_properties(parent);
+ if (!prop_dictionary_get_bool(props, "i2c-indirect-config",
+ &indirect_config))
+ indirect_config = true;
+ child_devices = prop_dictionary_get(props, "i2c-child-devices");
if (child_devices) {
unsigned int i, count;
prop_dictionary_t dev;
@@ -250,7 +255,7 @@ iic_attach(device_t parent, device_t self, void *aux)
if (buf)
free(buf, M_TEMP);
}
- } else {
+ } else if (indirect_config) {
/*
* Attach all i2c devices described in the kernel
* configuration file.
diff --git a/sys/dev/ofw/ofw_subr.c b/sys/dev/ofw/ofw_subr.c
index c36cdcf29f5..060a259488c 100644
--- a/sys/dev/ofw/ofw_subr.c
+++ b/sys/dev/ofw/ofw_subr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_subr.c,v 1.21 2013/02/08 15:17:00 jdc Exp $ */
+/* $NetBSD: ofw_subr.c,v 1.22 2013/09/24 18:04:53 jdc Exp $ */
/*
* Copyright 1998
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.21 2013/02/08 15:17:00 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.22 2013/09/24 18:04:53 jdc Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -393,4 +393,6 @@ of_enter_i2c_devs(prop_dictionary_t props, int ofnode, size_t cell_size)
prop_dictionary_set(props, "i2c-child-devices", array);
prop_object_release(array);
}
+
+ prop_dictionary_set_bool(props, "i2c-indirect-config", false);
}