summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2016-01-24 18:50:37 +0000
committerian <ian@FreeBSD.org>2016-01-24 18:50:37 +0000
commit375d176b915ae25fa3119c32266e5cae55f25d99 (patch)
tree7d86915d803764a7c36d78ce43a7430124fccabb
parent543007eb9747991c19b8461954dcfad129411bda (diff)
downloadFreeBSD-src-375d176b915ae25fa3119c32266e5cae55f25d99.zip
FreeBSD-src-375d176b915ae25fa3119c32266e5cae55f25d99.tar.gz
MFC r289704:
Fix parsing of I2C addresses properties in fdt data. I2C address is represented in 7-bits format in DT files, but system expect it in 8-bit format. Also, fix two drivers that locally hack around this bug. This includes a direct-commit change to the beaglebone dts data in the 10-stable branch to adjust the i2c slave addresses directly. In -current the equivelent change happened with a switch from homegrown to standard fdt data.
-rw-r--r--sys/boot/fdt/dts/arm/beaglebone-black.dts4
-rw-r--r--sys/boot/fdt/dts/arm/beaglebone.dts2
-rw-r--r--sys/dev/ofw/ofw_iicbus.c6
3 files changed, 8 insertions, 4 deletions
diff --git a/sys/boot/fdt/dts/arm/beaglebone-black.dts b/sys/boot/fdt/dts/arm/beaglebone-black.dts
index ff25f9d..0e35a7a 100644
--- a/sys/boot/fdt/dts/arm/beaglebone-black.dts
+++ b/sys/boot/fdt/dts/arm/beaglebone-black.dts
@@ -146,9 +146,9 @@
};
i2c@44e0b000 {
- pmic@48 {
+ pmic@24 {
compatible = "ti,am335x-pmic";
- reg = <0x48>;
+ reg = <0x24>;
};
};
};
diff --git a/sys/boot/fdt/dts/arm/beaglebone.dts b/sys/boot/fdt/dts/arm/beaglebone.dts
index 83b948f..3f8e022 100644
--- a/sys/boot/fdt/dts/arm/beaglebone.dts
+++ b/sys/boot/fdt/dts/arm/beaglebone.dts
@@ -133,7 +133,7 @@
i2c@44e0b000 {
pmic@24 {
compatible = "ti,am335x-pmic";
- reg = <0x48>;
+ reg = <0x24>;
};
};
};
diff --git a/sys/dev/ofw/ofw_iicbus.c b/sys/dev/ofw/ofw_iicbus.c
index f6d1be5..98fc060 100644
--- a/sys/dev/ofw/ofw_iicbus.c
+++ b/sys/dev/ofw/ofw_iicbus.c
@@ -147,7 +147,11 @@ ofw_iicbus_attach(device_t dev)
M_NOWAIT | M_ZERO);
if (dinfo == NULL)
continue;
- dinfo->opd_dinfo.addr = paddr;
+ /*
+ * OFW uses 7-bit I2C address format (see ePAPR),
+ * but system expect 8-bit.
+ */
+ dinfo->opd_dinfo.addr = paddr << 1;
if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) !=
0) {
free(dinfo, M_DEVBUF);
OpenPOWER on IntegriCloud