diff options
author | andreast <andreast@FreeBSD.org> | 2015-11-04 22:46:30 +0000 |
---|---|---|
committer | andreast <andreast@FreeBSD.org> | 2015-11-04 22:46:30 +0000 |
commit | 92a607efabdc672ee35ce5ce5147441039929611 (patch) | |
tree | 5208562c9107c784eb4d61476587aba0133e50d7 | |
parent | b2d9de8ee8b70ad9b7bc4ab792b937cd8b629684 (diff) | |
download | FreeBSD-src-92a607efabdc672ee35ce5ce5147441039929611.zip FreeBSD-src-92a607efabdc672ee35ce5ce5147441039929611.tar.gz |
Add a compile time switch to distinguish between 7-bit and 8-bit I2C address
usage. The comment in the code should explain the situation.
Discussed with: ian@
-rw-r--r-- | sys/dev/ofw/ofw_iicbus.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/ofw/ofw_iicbus.c b/sys/dev/ofw/ofw_iicbus.c index e7613fc..badefed 100644 --- a/sys/dev/ofw/ofw_iicbus.c +++ b/sys/dev/ofw/ofw_iicbus.c @@ -148,10 +148,16 @@ ofw_iicbus_attach(device_t dev) if (dinfo == NULL) continue; /* - * OFW uses 7-bit I2C address format (see ePAPR), - * but system expect 8-bit. + * FreeBSD drivers expect I2C addresses to be expressed as + * 8-bit values. Apple OFW data contains 8-bit values, but + * Linux FDT data contains 7-bit values, so shift them up to + * 8-bit format. */ +#ifdef AIM + dinfo->opd_dinfo.addr = paddr; +#else dinfo->opd_dinfo.addr = paddr << 1; +#endif if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) != 0) { free(dinfo, M_DEVBUF); |