From 0785abbbfd7d2e2da99f2d8d58a598d338a44ece Mon Sep 17 00:00:00 2001 From: jdc Date: Tue, 24 Sep 2013 18:04:53 +0000 Subject: 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. --- sys/dev/i2c/i2c.c | 15 ++++++++++----- sys/dev/ofw/ofw_subr.c | 6 ++++-- 2 files changed, 14 insertions(+), 7 deletions(-) (limited to 'sys/dev') 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 -__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 #include @@ -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 -__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 #include @@ -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); } -- cgit