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.
This commit is contained in:
jdc 2013-09-24 18:04:53 +00:00
parent a4d690b0d1
commit a2f66b838f
2 changed files with 14 additions and 7 deletions

View File

@ -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.

View File

@ -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);
}