Module Name: src
Committed By: jdc
Date: Sun Feb 3 17:41:02 UTC 2013
Modified Files:
src/sys/dev/ofw: ofw_subr.c
Log Message:
The i2c bus number (0 or 1) is encoded in bit 33 of the register for a node,
but we encode it in bit 8 of i2c_addr_t. If bit 33 is set, unset it and
set bit 9 instead (we later shift by one bit).
To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ofw/ofw_subr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/ofw/ofw_subr.c
diff -u src/sys/dev/ofw/ofw_subr.c:1.19 src/sys/dev/ofw/ofw_subr.c:1.20
--- src/sys/dev/ofw/ofw_subr.c:1.19 Fri Nov 2 15:44:07 2012
+++ src/sys/dev/ofw/ofw_subr.c Sun Feb 3 17:41:02 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_subr.c,v 1.19 2012/11/02 15:44:07 jdc Exp $ */
+/* $NetBSD: ofw_subr.c,v 1.20 2013/02/03 17:41:02 jdc Exp $ */
/*
* Copyright 1998
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.19 2012/11/02 15:44:07 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.20 2013/02/03 17:41:02 jdc Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -353,6 +353,13 @@ of_enter_i2c_devs(prop_dictionary_t prop
< sizeof(reg64))
continue;
addr = reg64;
+ /*
+ * The i2c bus number (0 or 1) is encoded in bit 33
+ * of the register, but we encode it in bit 8 of
+ * i2c_addr_t.
+ */
+ if (addr & 0x100000000)
+ addr = (addr & 0xff) | 0x100;
} else if (cell_size == 4 && len >= sizeof(reg32)) {
if (OF_getprop(node, "reg", ®32, sizeof(reg32))
< sizeof(reg32))