diff options
author | Nathan Whitehorn <nwhitehorn@FreeBSD.org> | 2009-03-02 15:22:01 +0000 |
---|---|---|
committer | Nathan Whitehorn <nwhitehorn@FreeBSD.org> | 2009-03-02 15:22:01 +0000 |
commit | e2c10e7d4a1c12a35664d16561eebfede3c6059e (patch) | |
tree | f20b4d18fb2f7386dbee4ef9b6a6263f11677f8b /sys/dev/ofw | |
parent | 06edd2f1e825e5a29a55208e4b35e75dc8a008e8 (diff) | |
download | src-e2c10e7d4a1c12a35664d16561eebfede3c6059e.tar.gz src-e2c10e7d4a1c12a35664d16561eebfede3c6059e.zip |
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
Notes
Notes:
svn path=/head/; revision=189280
Diffstat (limited to 'sys/dev/ofw')
-rw-r--r-- | sys/dev/ofw/ofw_iicbus.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/ofw/ofw_iicbus.c b/sys/dev/ofw/ofw_iicbus.c index fc752b67dd1b..e8effca14160 100644 --- a/sys/dev/ofw/ofw_iicbus.c +++ b/sys/dev/ofw/ofw_iicbus.c @@ -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 |