From owner-svn-src-all@FreeBSD.ORG Mon Mar 2 15:22:01 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B62C1106566B; Mon, 2 Mar 2009 15:22:01 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A3A228FC08; Mon, 2 Mar 2009 15:22:01 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n22FM16P079404; Mon, 2 Mar 2009 15:22:01 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n22FM1mI079403; Mon, 2 Mar 2009 15:22:01 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200903021522.n22FM1mI079403@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 2 Mar 2009 15:22:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189280 - head/sys/dev/ofw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Mar 2009 15:22:02 -0000 Author: nwhitehorn Date: Mon Mar 2 15:22:01 2009 New Revision: 189280 URL: http://svn.freebsd.org/changeset/base/189280 Log: Some Apple I2C buses give the device's I2C address in a property with the name i2c-address instead of reg. Change the OFW I2C probe to check both locations for the address. Submitted by: Marco Trillo Reported by: Justin Hibbits Modified: head/sys/dev/ofw/ofw_iicbus.c Modified: head/sys/dev/ofw/ofw_iicbus.c ============================================================================== --- head/sys/dev/ofw/ofw_iicbus.c Mon Mar 2 13:29:18 2009 (r189279) +++ head/sys/dev/ofw/ofw_iicbus.c Mon Mar 2 15:22:01 2009 (r189280) @@ -118,8 +118,15 @@ ofw_iicbus_attach(device_t dev) node = ofw_bus_get_node(dev); for (child = OF_child(node); child != 0; child = OF_peer(child)) { - if (OF_getprop(child, "reg", &addr, sizeof(addr)) == -1) - continue; + /* + * Try to get the I2C address first from the i2c-address + * property, then try the reg property. It moves around + * on different systems. + */ + + if (OF_getprop(child, "i2c-address", &addr, sizeof(addr)) == -1) + if (OF_getprop(child, "reg", &addr, sizeof(addr)) == -1) + continue; /* * Now set up the I2C and OFW bus layer devinfo and add it