diff --git a/sys/dev/iicbus/iicbb.c b/sys/dev/iicbus/iicbb.c index 7fa80c18250..ac10ceed286 100644 --- a/sys/dev/iicbus/iicbb.c +++ b/sys/dev/iicbus/iicbb.c @@ -94,6 +94,7 @@ static device_method_t iicbb_methods[] = { DEVMETHOD(iicbus_write, iicbb_write), DEVMETHOD(iicbus_read, iicbb_read), DEVMETHOD(iicbus_reset, iicbb_reset), + DEVMETHOD(iicbus_transfer, iicbus_transfer_gen), { 0, 0 } }; @@ -421,6 +422,7 @@ DRIVER_MODULE(iicbb, ixpiic, iicbb_driver, iicbb_devclass, 0, 0); DRIVER_MODULE(iicbb, lpbb, iicbb_driver, iicbb_devclass, 0, 0); DRIVER_MODULE(iicbb, viapm, iicbb_driver, iicbb_devclass, 0, 0); DRIVER_MODULE(iicbb, cxm_iic, iicbb_driver, iicbb_devclass, 0, 0); +DRIVER_MODULE(iicbb, at91_bbiic, iicbb_driver, iicbb_devclass, 0, 0); MODULE_DEPEND(iicbb, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); MODULE_VERSION(iicbb, IICBB_MODVER); diff --git a/sys/dev/iicbus/iiconf.c b/sys/dev/iicbus/iiconf.c index c9124af69e9..7401820bdfa 100644 --- a/sys/dev/iicbus/iiconf.c +++ b/sys/dev/iicbus/iiconf.c @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -356,13 +357,16 @@ iicbus_transfer(device_t bus, struct iic_msg *msgs, uint32_t nmsgs) * buffer addresses. */ int -iicbus_transfer_gen(device_t bus, struct iic_msg *msgs, uint32_t nmsgs) +iicbus_transfer_gen(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) { - int i, error, max, lenread, lenwrote; + int i, error, lenread, lenwrote, nkid; + device_t *children, bus; - for (i = 0, max = 0; i < nmsgs; i++) - if (max < msgs[i].len) - max = msgs[i].len; + device_get_children(dev, &children, &nkid); + if (nkid != 1) + return EIO; + bus = children[0]; + free(children, M_TEMP); for (i = 0, error = 0; i < nmsgs && error == 0; i++) { if (msgs[i].flags & IIC_M_RD) error = iicbus_block_read(bus, msgs[i].slave,