summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2007-03-23 23:03:54 +0000
committerimp <imp@FreeBSD.org>2007-03-23 23:03:54 +0000
commitf4e909cecafb315d1534f359c891ed80d83693c1 (patch)
tree9f58af15d6d4c3e1aeefbdf50d1510d2633af4f4 /sys/dev
parent75d8168eb3aade1613cfc76d01cd8c638efbc02c (diff)
downloadFreeBSD-src-f4e909cecafb315d1534f359c891ed80d83693c1.zip
FreeBSD-src-f4e909cecafb315d1534f359c891ed80d83693c1.tar.gz
MFp4: Make iicbus_trasnfer_gen suitable for bridge drivers. Use it in the
bitbang bridge.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/iicbus/iicbb.c2
-rw-r--r--sys/dev/iicbus/iiconf.c16
2 files changed, 12 insertions, 6 deletions
diff --git a/sys/dev/iicbus/iicbb.c b/sys/dev/iicbus/iicbb.c
index 7fa80c1..ac10cee 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 c9124af..7401820 100644
--- a/sys/dev/iicbus/iiconf.c
+++ b/sys/dev/iicbus/iiconf.c
@@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/bus.h>
@@ -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;
-
- for (i = 0, max = 0; i < nmsgs; i++)
- if (max < msgs[i].len)
- max = msgs[i].len;
+ int i, error, lenread, lenwrote, nkid;
+ device_t *children, bus;
+
+ 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,
OpenPOWER on IntegriCloud