ref: 72239845a04f00e23487700fac27f8ba88828b6f
parent: b611e99113cdebe713475694c49bdf17b8f7ff6c
author: mia soweli <inbox@tachibana-labs.org>
date: Sun Sep 17 11:47:04 EDT 2023
i2c: bus->io now takes I2Cdev not I2Cbus
--- a/sys/src/9/omap/i2comap.c
+++ b/sys/src/9/omap/i2comap.c
@@ -129,21 +129,20 @@
}
static int
-omapi2cio(I2Cbus *bus, uchar *pkt, int olen, int ilen)
+omapi2cio(I2Cdev *dev, uchar *pkt, int olen, int ilen)
{
Ctlr *ctlr;
uint con, addr, stat;
uint o;
- ctlr = bus->ctlr;
+ ctlr = dev->bus->ctlr;
if(olen <= 0 || pkt == nil)
return -1;
- o = 0;
+ o = 1;
con = Cen | Cmst | Ctrx | Cstp | Cstt;
- if((pkt[o] & 0xf8) == 0xf0)
+ if(dev->a10)
return -1;
- addr = pkt[o++] >> 1;
/* wait for bus */
omapi2cwaitbus(ctlr);
@@ -150,7 +149,7 @@
/* first attempt to probe, will get nack here if no dev */
csr32w(ctlr, Rcnt, olen);
- csr32w(ctlr, Raddr, addr);
+ csr32w(ctlr, Raddr, dev->addr);
csr32w(ctlr, Rcon, con);
stat = omapi2cwait(ctlr);
if(stat & Inack || stat & Ial) {